lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090820151904.22833.91381.stgit@beardog.cce.hp.com>
Date:	Thu, 20 Aug 2009 10:19:04 -0500
From:	"Stephen M. Cameron" <scameron@...rdog.cce.hp.com>
To:	linux-kernel@...r.kernel.org
Cc:	linux-scsi@...r.kernel.org, akpm@...ux-foundation.org,
	axboe@...nel.dk, andrew.patterson@...com,
	mikem@...-ss-1-lb.cnet.com, scameron@...rdog.cce.hp.com
Subject: [cciss: PATCH 16/17] Add a "raid_level" attribute to each logical
	drive in /sys

Add raid_level attribute to each logical drive at
/sys/devices/<dev>/ccissX/cXdY/raid_level for controller X,
logical drive Y


Signed-off-by: Stephen M. Cameron <scameron@...rdog.cce.hp.com>
---

 .../ABI/testing/sysfs-bus-pci-devices-cciss        |    7 ++++++
 drivers/block/cciss.c                              |   24 ++++++++++++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss b/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss
index 5a6c8d3..8d02602 100644
--- a/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss
+++ b/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss
@@ -45,3 +45,10 @@ Kernel Version: 2.6.31
 Contact:	iss_storagedev@...com
 Description:	Displays the 8-byte LUN ID used to address logical
 		drive Y of controller X.
+
+Where:		/sys/bus/pci/devices/<dev>/ccissX/cXdY/raid_level
+Date:		August 2009
+Kernel Version: 2.6.31
+Contact:	iss_storagedev@...com
+Description:	Displays the RAID level of logical drive Y of
+		controller X.
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 373ef43..2ad089e 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -603,6 +603,29 @@ static ssize_t cciss_show_lunid(struct device *dev,
 }
 DEVICE_ATTR(lunid, S_IRUGO, cciss_show_lunid, NULL);
 
+static ssize_t cciss_show_raid_level(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);
+	int raid;
+	unsigned long flags;
+
+	spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags);
+	if (h->busy_configuring) {
+		spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
+		return -EBUSY;
+	}
+	raid = drv->raid_level;
+	spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
+	if (raid < 0 || raid > 5)
+		raid = RAID_UNKNOWN;
+
+	return snprintf(buf, strlen(raid_label[raid]) + 7, "RAID %s\n",
+			raid_label[raid]);
+}
+DEVICE_ATTR(raid_level, S_IRUGO, cciss_show_raid_level, NULL);
+
 static struct attribute *cciss_host_attrs[] = {
 	&dev_attr_rescan.attr,
 	NULL
@@ -629,6 +652,7 @@ static struct attribute *cciss_dev_attrs[] = {
 	&dev_attr_vendor.attr,
 	&dev_attr_rev.attr,
 	&dev_attr_lunid.attr,
+	&dev_attr_raid_level.attr,
 	NULL
 };
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ