aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen M. Cameron <scameron@beardog.cce.hp.com>2009-09-17 14:48:10 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-10-01 15:15:44 -0400
commitce84a8aeac4a4a2cc421b3145dd2fb7cae860e4d (patch)
tree350987acff39fbeefa9500d6dcc977973d1bc42e
parent2e043986d584cf95656d4ee0c40fb2051e8a8460 (diff)
cciss: Add lunid attribute to each logical drive in /sys
Add lunid attribute to each logical drive at /sys/devices/<dev>/ccissX/cXdY/lunid for controller X, logical drive Y Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--Documentation/ABI/testing/sysfs-bus-pci-devices-cciss7
-rw-r--r--drivers/block/cciss.c26
2 files changed, 33 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss b/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss
index ac3429def235..5a6c8d36afc4 100644
--- a/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss
+++ b/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss
@@ -38,3 +38,10 @@ Kernel Version: 2.6.31
38Contact: iss_storagedev@hp.com 38Contact: iss_storagedev@hp.com
39Description: Kicks of a rescan of the controller to discover logical 39Description: Kicks of a rescan of the controller to discover logical
40 drive topology changes. 40 drive topology changes.
41
42Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/lunid
43Date: August 2009
44Kernel Version: 2.6.31
45Contact: iss_storagedev@hp.com
46Description: Displays the 8-byte LUN ID used to address logical
47 drive Y of controller X.
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 79afca2e824f..ae0cb1329e92 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -579,6 +579,31 @@ static ssize_t dev_show_rev(struct device *dev,
579} 579}
580DEVICE_ATTR(rev, S_IRUGO, dev_show_rev, NULL); 580DEVICE_ATTR(rev, S_IRUGO, dev_show_rev, NULL);
581 581
582static ssize_t cciss_show_lunid(struct device *dev,
583 struct device_attribute *attr, char *buf)
584{
585 drive_info_struct *drv = dev_get_drvdata(dev);
586 struct ctlr_info *h = to_hba(drv->dev->parent);
587 unsigned long flags;
588 unsigned char lunid[8];
589
590 spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags);
591 if (h->busy_configuring) {
592 spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
593 return -EBUSY;
594 }
595 if (!drv->heads) {
596 spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
597 return -ENOTTY;
598 }
599 memcpy(lunid, drv->LunID, sizeof(lunid));
600 spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
601 return snprintf(buf, 20, "0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
602 lunid[0], lunid[1], lunid[2], lunid[3],
603 lunid[4], lunid[5], lunid[6], lunid[7]);
604}
605DEVICE_ATTR(lunid, S_IRUGO, cciss_show_lunid, NULL);
606
582static struct attribute *cciss_host_attrs[] = { 607static struct attribute *cciss_host_attrs[] = {
583 &dev_attr_rescan.attr, 608 &dev_attr_rescan.attr,
584 NULL 609 NULL
@@ -604,6 +629,7 @@ static struct attribute *cciss_dev_attrs[] = {
604 &dev_attr_model.attr, 629 &dev_attr_model.attr,
605 &dev_attr_vendor.attr, 630 &dev_attr_vendor.attr,
606 &dev_attr_rev.attr, 631 &dev_attr_rev.attr,
632 &dev_attr_lunid.attr,
607 NULL 633 NULL
608}; 634};
609 635