Commit 248d4fe9 authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Martin K. Petersen
Browse files

scsi: export 'wwid' to sysfs

Use scsi_vpd_lun_id() to export the world-wide unique id (wwid) to
sysfs.  Note that this is the 'best' wwid according to the rules in
scsi_vpd_lun_id(), not every possible wwid presented by the drive.
Signed-off-by: default avatarHannes Reinecke <>
Reviewed-by: default avatarJohannes Thumshirn <>
Signed-off-by: default avatarMartin K. Petersen <>
parent 9983bed3
......@@ -905,6 +905,22 @@ sdev_show_function(queue_depth, "%d\n");
static DEVICE_ATTR(queue_depth, S_IRUGO | S_IWUSR, sdev_show_queue_depth,
static ssize_t
sdev_show_wwid(struct device *dev, struct device_attribute *attr,
char *buf)
struct scsi_device *sdev = to_scsi_device(dev);
ssize_t count;
count = scsi_vpd_lun_id(sdev, buf, PAGE_SIZE);
if (count > 0) {
buf[count] = '\n';
return count;
static DEVICE_ATTR(wwid, S_IRUGO, sdev_show_wwid, NULL);
static ssize_t
sdev_show_dh_state(struct device *dev, struct device_attribute *attr,
......@@ -1028,6 +1044,7 @@ static struct attribute *scsi_sdev_attrs[] = {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment