vserver 2.0 rc7
[linux-2.6.git] / drivers / s390 / block / dasd_genhd.c
index 44b6e73..96c4934 100644 (file)
@@ -9,7 +9,7 @@
  *
  * gendisk related functions for the dasd driver.
  *
- * $Revision: 1.46 $
+ * $Revision: 1.50 $
  */
 
 #include <linux/config.h>
@@ -31,12 +31,16 @@ int
 dasd_gendisk_alloc(struct dasd_device *device)
 {
        struct gendisk *gdp;
-       int len;
+       int len, feature_ro;
 
        /* Make sure the minor for this device exists. */
        if (device->devindex >= DASD_PER_MAJOR)
                return -EBUSY;
 
+       feature_ro = dasd_get_feature(device->cdev, DASD_FEATURE_READONLY);
+       if (feature_ro < 0)
+               return feature_ro;
+
        gdp = alloc_disk(1 << DASD_PARTN_BITS);
        if (!gdp)
                return -ENOMEM;
@@ -71,7 +75,7 @@ dasd_gendisk_alloc(struct dasd_device *device)
 
        sprintf(gdp->devfs_name, "dasd/%s", device->cdev->dev.bus_id);
 
-       if (test_bit(DASD_FLAG_RO, &device->flags))
+       if (feature_ro)
                set_disk_ro(gdp, 1);
        gdp->private_data = device;
        gdp->queue = device->request_queue;
@@ -149,11 +153,12 @@ dasd_destroy_partitions(struct dasd_device * device)
         * Can't call delete_partitions directly. Use ioctl.
         * The ioctl also does locking and invalidation.
         */
-       memset(&bpart, sizeof(struct blkpg_partition), 0);
-       memset(&barg, sizeof(struct blkpg_ioctl_arg), 0);
+       memset(&bpart, 0, sizeof(struct blkpg_partition));
+       memset(&barg, 0, sizeof(struct blkpg_ioctl_arg));
        barg.data = &bpart;
+       barg.op = BLKPG_DEL_PARTITION;
        for (bpart.pno = device->gdp->minors - 1; bpart.pno > 0; bpart.pno--)
-               ioctl_by_bdev(bdev, BLKPG_DEL_PARTITION, (unsigned long) &barg);
+               ioctl_by_bdev(bdev, BLKPG, (unsigned long) &barg);
 
        invalidate_partition(device->gdp, 0);
        /* Matching blkdev_put to the blkdev_get in dasd_scan_partitions. */