]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] (6/25) Removing bogus arrays - ->driverfs_dev_arr[]
authorAlexander Viro <viro@math.psu.edu>
Sat, 7 Sep 2002 10:03:49 +0000 (03:03 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sat, 7 Sep 2002 10:03:49 +0000 (03:03 -0700)
disk->driverfs_dev_arr is either NULL or consists of exactly one
element.  Same change as above (struct device ** -> struct device *); old
"is the pointer to array itself NULL or not?" replaced with a flag (in
disk->flags).

drivers/scsi/sd.c
fs/partitions/check.c
include/linux/genhd.h

index b1686243dccb44ef41b8afdf4c011c19e6b9ad1d..79deae0ef3f9477b0f4b2c6dc752da688ee0453a 100644 (file)
@@ -1301,7 +1301,6 @@ static int sd_attach(Scsi_Device * sdp)
        struct {
                struct gendisk disk;
                devfs_handle_t de;
-               struct device *dev;
                char name[5];
        } *p;
        struct gendisk *gd;
@@ -1315,7 +1314,6 @@ static int sd_attach(Scsi_Device * sdp)
                return 1;
        gd = &p->disk;
        gd->de_arr = &p->de;
-       gd->driverfs_dev_arr = &p->dev;
 
        SCSI_LOG_HLQUEUE(3, printk("sd_attach: scsi device: <%d,%d,%d,%d>\n", 
                         sdp->host->host_no, sdp->channel, sdp->id, sdp->lun));
@@ -1348,7 +1346,6 @@ static int sd_attach(Scsi_Device * sdp)
 
        sd_template.nr_dev++;
         gd->de_arr[0] = sdp->de;
-        gd->driverfs_dev_arr[0] = &sdp->sdev_driverfs_dev;
        gd->major = SD_MAJOR(dsk_nr>>4);
        gd->first_minor = (dsk_nr & 15)<<4;
        gd->minor_shift = 4;
@@ -1360,6 +1357,8 @@ static int sd_attach(Scsi_Device * sdp)
                sprintf(p->name, "sd%c", 'a'+dsk_nr%26);
        gd->major_name = p->name;
         gd->flags = sdp->removable ? GENHD_FL_REMOVABLE : 0;
+        gd->driverfs_dev = &sdp->sdev_driverfs_dev;
+        gd->flags |= GENHD_FL_DRIVERFS;
        sd_disks[dsk_nr] = gd;
        sd_dskname(dsk_nr, diskname);
        printk(KERN_NOTICE "Attached scsi %sdisk %s at scsi%d, channel %d, "
index db8d2e8269a37b8cbe4380c7ea96d999cb812b56..ce9ace5e4ebeef208d9452f5d606ab1faa105761 100644 (file)
@@ -131,12 +131,12 @@ static void driverfs_create_partitions(struct gendisk *hd)
        struct device *dev, *parent;
        int part;
 
-       /* get parent driverfs device structure */
-       if (hd->driverfs_dev_arr)
-               parent = hd->driverfs_dev_arr[0];
-       else /* if driverfs not supported by subsystem, skip partitions */
+       /* if driverfs not supported by subsystem, skip partitions */
+       if (!(hd->flags & GENHD_FL_DRIVERFS))
                return;
 
+       parent = hd->driverfs_dev;
+
        if (parent)  {
                sprintf(name, "%s", parent->name);
                sprintf(bus_id, "%s:", parent->bus_id);
index aa2f694ceb1a8511a635f8ac32f6da9261c30719..5d82071b483cbd664ee0b4bb0536650bb33b09ea 100644 (file)
@@ -67,6 +67,7 @@ struct hd_struct {
 };
 
 #define GENHD_FL_REMOVABLE  1
+#define GENHD_FL_DRIVERFS  2
 
 struct gendisk {
        int major;                      /* major number of driver */
@@ -80,7 +81,7 @@ struct gendisk {
        struct block_device_operations *fops;
 
        devfs_handle_t *de_arr;         /* one per physical disc */
-       struct device **driverfs_dev_arr;/* support driverfs hierarchy */
+       struct device *driverfs_dev;
        int flags;
 };