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>
This commit is contained in:
Dan Williams 2008-07-24 17:26:24 -07:00
parent eb7ea4630f
commit 755c99faf2
3 changed files with 3 additions and 13 deletions

View File

@ -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);

View 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)

View File

@ -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)
{