diff options
author | patmans@us.ibm.com <patmans@us.ibm.com> | 2005-02-25 23:51:17 -0800 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 23:39:48 -0700 |
commit | 4e05e4238b2cb63eb3f3cd51cf76f136fa684f2e (patch) | |
tree | c7743c75d9ff8cac53a3eb97c3e6f2390d5ac300 /extras/scsi_id/scsi_serial.c | |
parent | 77313cd0d13ed3682f25c745f71f648292b28215 (diff) |
[PATCH] update scsi_id to work with libsysfs changes
Update scsi_id to work with the libsysfs changes in udev: use
sysfs_get_classdev_attr and sysfs_get_device_attr in place of
sysfs_read_attribute_value.
Diffstat (limited to 'extras/scsi_id/scsi_serial.c')
-rw-r--r-- | extras/scsi_id/scsi_serial.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 8b9fbe0681..20a7928553 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -364,7 +364,7 @@ static int do_scsi_page0_inquiry(struct sysfs_device *scsi_dev, int fd, char *buffer, int len) { int retval; - char vendor[MAX_ATTR_LEN]; + struct sysfs_attribute *vendor; memset(buffer, 0, len); retval = scsi_inquiry(scsi_dev, fd, 1, 0x0, buffer, len); @@ -394,14 +394,15 @@ static int do_scsi_page0_inquiry(struct sysfs_device *scsi_dev, int fd, * If the vendor id appears in the page assume the page is * invalid. */ - if (sysfs_get_attr(scsi_dev->path, "vendor", vendor, - MAX_ATTR_LEN)) { + vendor = sysfs_get_device_attr(scsi_dev, "vendor"); + if (!vendor) { log_message(LOG_WARNING, "%s: cannot get model attribute\n", scsi_dev->name); return 1; } - if (!strncmp(&buffer[VENDOR_LENGTH], vendor, VENDOR_LENGTH)) { + if (!strncmp(&buffer[VENDOR_LENGTH], vendor->value, + VENDOR_LENGTH)) { log_message(LOG_WARNING, "%s: invalid page0 data\n", scsi_dev->name); return 1; @@ -416,15 +417,16 @@ static int do_scsi_page0_inquiry(struct sysfs_device *scsi_dev, int fd, */ static int prepend_vendor_model(struct sysfs_device *scsi_dev, char *serial) { - char attr[MAX_ATTR_LEN]; + struct sysfs_attribute *attr; int ind; - if (sysfs_get_attr(scsi_dev->path, "vendor", attr, MAX_ATTR_LEN)) { + attr = sysfs_get_device_attr(scsi_dev, "vendor"); + if (!attr) { log_message(LOG_WARNING, "%s: cannot get vendor attribute\n", scsi_dev->name); return 1; } - strncpy(serial, attr, VENDOR_LENGTH); + strncpy(serial, attr->value, VENDOR_LENGTH); ind = strlen(serial) - 1; /* * Remove sysfs added newlines. @@ -432,12 +434,13 @@ static int prepend_vendor_model(struct sysfs_device *scsi_dev, char *serial) if (serial[ind] == '\n') serial[ind] = '\0'; - if (sysfs_get_attr(scsi_dev->path, "model", attr, MAX_ATTR_LEN)) { + attr = sysfs_get_device_attr(scsi_dev, "model"); + if (!attr) { log_message(LOG_WARNING, "%s: cannot get model attribute\n", scsi_dev->name); return 1; } - strncat(serial, attr, MODEL_LENGTH); + strncat(serial, attr->value, MODEL_LENGTH); ind = strlen(serial) - 1; if (serial[ind] == '\n') serial[ind] = '\0'; |