summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2008-07-24 17:26:24 -0700
committerDan Williams <dan.j.williams@intel.com>2008-07-24 17:26:24 -0700
commit755c99faf2d51c133c49ada9700acd4b8cc961c0 (patch)
treea71dfa94044621e097091da24ad2625b4123000c
parenteb7ea4630f2df057f4df36eed7a1ec03150f0e76 (diff)
downloadmdadm-755c99faf2d51c133c49ada9700acd4b8cc961c0.tar.gz
mdadm-755c99faf2d51c133c49ada9700acd4b8cc961c0.tar.xz
mdadm-755c99faf2d51c133c49ada9700acd4b8cc961c0.zip
sysfs: deprecate sysfs_disk_to_sg
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>
-rw-r--r--mdadm.h1
-rw-r--r--super-intel.c13
-rw-r--r--sysfs.c2
3 files changed, 3 insertions, 13 deletions
diff --git a/mdadm.h b/mdadm.h
index 2c941cc..52d9435 100644
--- 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);
diff --git a/super-intel.c b/super-intel.c
index 8640cea..bdb6793 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -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 8979ec4..0ea17eb 100644
--- 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)
{