]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
sysfs: deprecate sysfs_disk_to_sg
authorDan Williams <dan.j.williams@intel.com>
Fri, 25 Jul 2008 00:26:24 +0000 (17:26 -0700)
committerDan Williams <dan.j.williams@intel.com>
Fri, 25 Jul 2008 00:26:24 +0000 (17:26 -0700)
The cmd_filter patch merged for 2.6.27 broke retrieving the serial
number via an ioctl to /dev/sgN.  In debugging this I found that other
utilities like sdparm simply run the ioctl on /dev/sdX.  So just convert
to that for protection in numbers, but scream on the mailing list for
the inconvenience grr...

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
mdadm.h
super-intel.c
sysfs.c

diff --git a/mdadm.h b/mdadm.h
index 2c941cc0963cf0783072d96f2c6098de389346f2..52d94352e8ff2a3211686fcc996b5f1220e3e14e 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -346,7 +346,6 @@ extern int sysfs_get_ll(struct mdinfo *sra, struct mdinfo *dev,
 extern int sysfs_set_array(struct mdinfo *sra,
                           struct mdinfo *info);
 extern int sysfs_add_disk(struct mdinfo *sra, struct mdinfo *sd);
-extern int sysfs_disk_to_sg(int fd);
 extern int sysfs_disk_to_scsi_id(int fd, __u32 *id);
 extern int sysfs_unique_holder(int devnum, long rdev);
 
index 8640cea1142e991b6ab2047db8765193f0c3b07f..bdb6793b1c3430ab024477214134443da5179c71 100644 (file)
@@ -710,22 +710,12 @@ static int imsm_read_serial(int fd, char *devname,
                            __u8 serial[MAX_RAID_SERIAL_LEN])
 {
        unsigned char scsi_serial[255];
-       int sg_fd;
        int rv;
        int rsp_len;
        int i, cnt;
 
        memset(scsi_serial, 0, sizeof(scsi_serial));
 
-       sg_fd = sysfs_disk_to_sg(fd);
-       if (sg_fd < 0) {
-               if (devname)
-                       fprintf(stderr,
-                               Name ": Failed to open sg interface for %s: %s\n",
-                               devname, strerror(errno));
-               return 1;
-       }
-
        if (imsm_env_devname_as_serial()) {
                char name[MAX_RAID_SERIAL_LEN];
                
@@ -734,8 +724,7 @@ static int imsm_read_serial(int fd, char *devname,
                return 0;
        }
 
-       rv = scsi_get_serial(sg_fd, scsi_serial, sizeof(scsi_serial));
-       close(sg_fd);
+       rv = scsi_get_serial(fd, scsi_serial, sizeof(scsi_serial));
 
        if (rv != 0) {
                if (devname)
diff --git a/sysfs.c b/sysfs.c
index 8979ec4e23c80fd1812fe6b4f277cc4ad325d923..0ea17eb9d00b0020192930bae809eab6ad830c15 100644 (file)
--- a/sysfs.c
+++ b/sysfs.c
@@ -398,6 +398,7 @@ int sysfs_add_disk(struct mdinfo *sra, struct mdinfo *sd)
        return rv;
 }
 
+#if 0
 int sysfs_disk_to_sg(int fd)
 {
        /* from an open block device, try find and open its corresponding
@@ -461,6 +462,7 @@ int sysfs_disk_to_sg(int fd)
 
        return -1;
 }
+#endif
 
 int sysfs_disk_to_scsi_id(int fd, __u32 *id)
 {