X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fs390%2Fblock%2Fdasd_genhd.c;h=e99d566b69cccdbdce2b5b680a1ec46ac97d2c3a;hb=5579a782ad7ffa162b1060993e4a298dd50e7a33;hp=47ba4462708de9583cadef43f4cd0995567e7878;hpb=4935361766cc73949fe032cd157d314f288922ba;p=linux-2.6-omap-h63xx.git diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c index 47ba4462708..e99d566b69c 100644 --- a/drivers/s390/block/dasd_genhd.c +++ b/drivers/s390/block/dasd_genhd.c @@ -25,14 +25,15 @@ /* * Allocate and register gendisk structure for device. */ -int -dasd_gendisk_alloc(struct dasd_device *device) +int dasd_gendisk_alloc(struct dasd_block *block) { struct gendisk *gdp; + struct dasd_device *base; int len; /* Make sure the minor for this device exists. */ - if (device->devindex >= DASD_PER_MAJOR) + base = block->base; + if (base->devindex >= DASD_PER_MAJOR) return -EBUSY; gdp = alloc_disk(1 << DASD_PARTN_BITS); @@ -41,9 +42,9 @@ dasd_gendisk_alloc(struct dasd_device *device) /* Initialize gendisk structure. */ gdp->major = DASD_MAJOR; - gdp->first_minor = device->devindex << DASD_PARTN_BITS; + gdp->first_minor = base->devindex << DASD_PARTN_BITS; gdp->fops = &dasd_device_operations; - gdp->driverfs_dev = &device->cdev->dev; + gdp->driverfs_dev = &base->cdev->dev; /* * Set device name. @@ -53,54 +54,52 @@ dasd_gendisk_alloc(struct dasd_device *device) * dasdaaaa - dasdzzzz : 456976 devices, added up = 475252 */ len = sprintf(gdp->disk_name, "dasd"); - if (device->devindex > 25) { - if (device->devindex > 701) { - if (device->devindex > 18277) + if (base->devindex > 25) { + if (base->devindex > 701) { + if (base->devindex > 18277) len += sprintf(gdp->disk_name + len, "%c", - 'a'+(((device->devindex-18278) + 'a'+(((base->devindex-18278) /17576)%26)); len += sprintf(gdp->disk_name + len, "%c", - 'a'+(((device->devindex-702)/676)%26)); + 'a'+(((base->devindex-702)/676)%26)); } len += sprintf(gdp->disk_name + len, "%c", - 'a'+(((device->devindex-26)/26)%26)); + 'a'+(((base->devindex-26)/26)%26)); } - len += sprintf(gdp->disk_name + len, "%c", 'a'+(device->devindex%26)); + len += sprintf(gdp->disk_name + len, "%c", 'a'+(base->devindex%26)); - if (device->features & DASD_FEATURE_READONLY) + if (block->base->features & DASD_FEATURE_READONLY) set_disk_ro(gdp, 1); - gdp->private_data = device; - gdp->queue = device->request_queue; - device->gdp = gdp; - set_capacity(device->gdp, 0); - add_disk(device->gdp); + gdp->private_data = block; + gdp->queue = block->request_queue; + block->gdp = gdp; + set_capacity(block->gdp, 0); + add_disk(block->gdp); return 0; } /* * Unregister and free gendisk structure for device. */ -void -dasd_gendisk_free(struct dasd_device *device) +void dasd_gendisk_free(struct dasd_block *block) { - if (device->gdp) { - del_gendisk(device->gdp); - device->gdp->queue = NULL; - put_disk(device->gdp); - device->gdp = NULL; + if (block->gdp) { + del_gendisk(block->gdp); + block->gdp->queue = NULL; + put_disk(block->gdp); + block->gdp = NULL; } } /* * Trigger a partition detection. */ -int -dasd_scan_partitions(struct dasd_device * device) +int dasd_scan_partitions(struct dasd_block *block) { struct block_device *bdev; - bdev = bdget_disk(device->gdp, 0); - if (!bdev || blkdev_get(bdev, FMODE_READ, 1) < 0) + bdev = bdget_disk(block->gdp, 0); + if (!bdev || blkdev_get(bdev, FMODE_READ) < 0) return -ENODEV; /* * See fs/partition/check.c:register_disk,rescan_partitions @@ -117,7 +116,7 @@ dasd_scan_partitions(struct dasd_device * device) * is why the assignment to device->bdev is done AFTER * the BLKRRPART ioctl. */ - device->bdev = bdev; + block->bdev = bdev; return 0; } @@ -125,8 +124,7 @@ dasd_scan_partitions(struct dasd_device * device) * Remove all inodes in the system for a device, delete the * partitions and make device unusable by setting its size to zero. */ -void -dasd_destroy_partitions(struct dasd_device * device) +void dasd_destroy_partitions(struct dasd_block *block) { /* The two structs have 168/176 byte on 31/64 bit. */ struct blkpg_partition bpart; @@ -137,8 +135,8 @@ dasd_destroy_partitions(struct dasd_device * device) * Get the bdev pointer from the device structure and clear * device->bdev to lower the offline open_count limit again. */ - bdev = device->bdev; - device->bdev = NULL; + bdev = block->bdev; + block->bdev = NULL; /* * See fs/partition/check.c:delete_partition @@ -149,17 +147,16 @@ dasd_destroy_partitions(struct dasd_device * device) memset(&barg, 0, sizeof(struct blkpg_ioctl_arg)); barg.data = (void __force __user *) &bpart; barg.op = BLKPG_DEL_PARTITION; - for (bpart.pno = device->gdp->minors - 1; bpart.pno > 0; bpart.pno--) + for (bpart.pno = block->gdp->minors - 1; bpart.pno > 0; bpart.pno--) ioctl_by_bdev(bdev, BLKPG, (unsigned long) &barg); - invalidate_partition(device->gdp, 0); + invalidate_partition(block->gdp, 0); /* Matching blkdev_put to the blkdev_get in dasd_scan_partitions. */ - blkdev_put(bdev); - set_capacity(device->gdp, 0); + blkdev_put(bdev, FMODE_READ); + set_capacity(block->gdp, 0); } -int -dasd_gendisk_init(void) +int dasd_gendisk_init(void) { int rc; @@ -174,8 +171,7 @@ dasd_gendisk_init(void) return 0; } -void -dasd_gendisk_exit(void) +void dasd_gendisk_exit(void) { unregister_blkdev(DASD_MAJOR, "dasd"); }