summaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorStephen M. Cameron <scameron@beardog.cce.hp.com>2009-09-17 13:48:10 -0500
committerJens Axboe <jens.axboe@oracle.com>2009-10-01 21:15:44 +0200
commitce84a8aeac4a4a2cc421b3145dd2fb7cae860e4d (patch)
tree350987acff39fbeefa9500d6dcc977973d1bc42e /drivers/block
parent2e043986d584cf95656d4ee0c40fb2051e8a8460 (diff)
downloadlinux-ce84a8aeac4a4a2cc421b3145dd2fb7cae860e4d.tar.bz2
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>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/cciss.c26
1 files changed, 26 insertions, 0 deletions
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,
}
DEVICE_ATTR(rev, S_IRUGO, dev_show_rev, NULL);
+static ssize_t cciss_show_lunid(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ drive_info_struct *drv = dev_get_drvdata(dev);
+ struct ctlr_info *h = to_hba(drv->dev->parent);
+ unsigned long flags;
+ unsigned char lunid[8];
+
+ spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags);
+ if (h->busy_configuring) {
+ spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
+ return -EBUSY;
+ }
+ if (!drv->heads) {
+ spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
+ return -ENOTTY;
+ }
+ memcpy(lunid, drv->LunID, sizeof(lunid));
+ spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
+ return snprintf(buf, 20, "0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
+ lunid[0], lunid[1], lunid[2], lunid[3],
+ lunid[4], lunid[5], lunid[6], lunid[7]);
+}
+DEVICE_ATTR(lunid, S_IRUGO, cciss_show_lunid, NULL);
+
static struct attribute *cciss_host_attrs[] = {
&dev_attr_rescan.attr,
NULL
@@ -604,6 +629,7 @@ static struct attribute *cciss_dev_attrs[] = {
&dev_attr_model.attr,
&dev_attr_vendor.attr,
&dev_attr_rev.attr,
+ &dev_attr_lunid.attr,
NULL
};