hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/block/partitions/ibm.c
....@@ -13,10 +13,10 @@
1313 #include <asm/ebcdic.h>
1414 #include <linux/uaccess.h>
1515 #include <asm/vtoc.h>
16
+#include <linux/module.h>
17
+#include <linux/dasd_mod.h>
1618
1719 #include "check.h"
18
-#include "ibm.h"
19
-
2020
2121 union label_t {
2222 struct vtoc_volume_label_cdl vol;
....@@ -289,7 +289,9 @@
289289 */
290290 int ibm_partition(struct parsed_partitions *state)
291291 {
292
+ int (*fn)(struct gendisk *disk, dasd_information2_t *info);
292293 struct block_device *bdev = state->bdev;
294
+ struct gendisk *disk = bdev->bd_disk;
293295 int blocksize, res;
294296 loff_t i_size, offset, size;
295297 dasd_information2_t *info;
....@@ -300,24 +302,29 @@
300302 union label_t *label;
301303
302304 res = 0;
305
+ if (!disk->fops->getgeo)
306
+ goto out_exit;
307
+ fn = symbol_get(dasd_biodasdinfo);
303308 blocksize = bdev_logical_block_size(bdev);
304309 if (blocksize <= 0)
305
- goto out_exit;
310
+ goto out_symbol;
306311 i_size = i_size_read(bdev->bd_inode);
307312 if (i_size == 0)
308
- goto out_exit;
313
+ goto out_symbol;
309314 info = kmalloc(sizeof(dasd_information2_t), GFP_KERNEL);
310315 if (info == NULL)
311
- goto out_exit;
316
+ goto out_symbol;
312317 geo = kmalloc(sizeof(struct hd_geometry), GFP_KERNEL);
313318 if (geo == NULL)
314319 goto out_nogeo;
315320 label = kmalloc(sizeof(union label_t), GFP_KERNEL);
316321 if (label == NULL)
317322 goto out_nolab;
318
- if (ioctl_by_bdev(bdev, HDIO_GETGEO, (unsigned long)geo) != 0)
323
+ /* set start if not filled by getgeo function e.g. virtblk */
324
+ geo->start = get_start_sect(bdev);
325
+ if (disk->fops->getgeo(bdev, geo))
319326 goto out_freeall;
320
- if (ioctl_by_bdev(bdev, BIODASDINFO2, (unsigned long)info) != 0) {
327
+ if (!fn || fn(disk, info)) {
321328 kfree(info);
322329 info = NULL;
323330 }
....@@ -360,6 +367,9 @@
360367 kfree(geo);
361368 out_nogeo:
362369 kfree(info);
370
+out_symbol:
371
+ if (fn)
372
+ symbol_put(dasd_biodasdinfo);
363373 out_exit:
364374 return res;
365375 }