Skip to contentSkip to conversation

cciss: add cciss driver sysfs entries

PATCH Mike Miller (OS Dev) 2 participants 4 messages May 28, 2009 – May 29, 2009 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Patch 1 of 1

cciss: add cciss driver sysfs entries

From: Andrew Patterson <[email protected]>

This patch adds sysfs entries to the cciss driver needed for the dm/multipath tools. A file for vendor, model, rev, and unique_id is added for each logical drive under directory /sys/bus/pci/devices/<dev>/ccissX/cXdY. Where X = the controller (or host) number and Y is the logical drive number. A link from /sys/bus/pci/devices/<dev>/ccissX/cXdY/block:cciss!cXdY to /sys/block/cciss!cXdY/device is also created. A bus is created in /sys/bus/cciss. A link is created from the pci ccissX entry to /sys/bus/cciss/devices/ccissX.
Please consider this for inclusion.

---

Documentation/ABI/testing/sysfs-bus-pci-devices-cciss new file +33 -0
new file mode 100644
index 0000000..0a92a7c
@@ -0,0 +1,33 @@
+Where:		/sys/bus/pci/devices/<dev>/ccissX/cXdY/model
+Date:		March 2009
+Kernel Version: 2.6.30
+Contact:	[email protected]
+Description:	Displays the SCSI INQUIRY page 0 model for logical drive
+		Y of controller X.
+
+Where:		/sys/bus/pci/devices/<dev>/ccissX/cXdY/rev
+Date:		March 2009
+Kernel Version: 2.6.30
+Contact:	[email protected]
+Description:	Displays the SCSI INQUIRY page 0 revision for logical
+		drive Y of controller X.
+
+Where:		/sys/bus/pci/devices/<dev>/ccissX/cXdY/unique_id
+Date:		March 2009
+Kernel Version: 2.6.30
+Contact:	[email protected]
+Description:	Displays the SCSI INQUIRY page 83 serial number for logical
+		drive Y of controller X.
+
+Where:		/sys/bus/pci/devices/<dev>/ccissX/cXdY/vendor
+Date:		March 2009
+Kernel Version: 2.6.30
+Contact:	[email protected]
+Description:	Displays the SCSI INQUIRY page 0 vendor for logical drive
+		Y of controller X.
+
+Where:		/sys/bus/pci/devices/<dev>/ccissX/cXdY/block:cciss!cXdY
+Date:		March 2009
+Kernel Version: 2.6.30
+Contact:	[email protected]
+Description:	A symbolic link to /sys/block/cciss!cXdY
drivers/block/cciss.c +264 -3

357 lines not on this page · raw message

drivers/block/cciss.h +17 -7
index 703e080..dd1926d 100644
@@ -12,6 +12,10 @@
 #define IO_OK		0
 #define IO_ERROR	1
 
+#define VENDOR_LEN	8
+#define MODEL_LEN	16
+#define REV_LEN		4
+
 struct ctlr_info;
 typedef struct ctlr_info ctlr_info_t;
 
@@ -34,13 +38,18 @@ typedef struct _drive_info_struct
 	int 	cylinders;
 	int	raid_level; /* set to -1 to indicate that
 			     * the drive is not in use/configured
-			    */
-	int	busy_configuring; /*This is set when the drive is being removed
-				   *to prevent it from being opened or it's queue
-				   *from being started.
-				  */
-	__u8 serial_no[16]; /* from inquiry page 0x83, */
-			    /* not necc. null terminated. */
+			     */
+	int	busy_configuring; /* This is set when a drive is being removed
+				   * to prevent it from being opened or it's
+				   * queue from being started.
+				   */
+	struct	device dev;
+	__u8 serial_no[16]; /* from inquiry page 0x83,
+			     * not necc. null terminated.
+			     */
+	char vendor[VENDOR_LEN + 1]; /* SCSI vendor string */
+	char model[MODEL_LEN + 1];   /* SCSI model string */
+	char rev[REV_LEN + 1];       /* SCSI revision string */
 } drive_info_struct;
 
 #ifdef CONFIG_CISS_SCSI_TAPE
@@ -123,6 +132,7 @@ struct ctlr_info
 	unsigned char alive;
 	struct completion *rescan_wait;
 	struct task_struct *cciss_scan_thread;
+	struct device dev;
 };
 
 /*  Defining the diffent access_menthods */
#3 lore raw
Quoted 13 lines · On Thu, 28 May 2009 15:21:24 -0500 "Mike Miller (OS Dev)"…

From: Andrew Patterson <[email protected]>

This patch adds sysfs entries to the cciss driver needed for the dm/multipath tools. A file for vendor, model, rev, and unique_id is added for each logical drive under directory /sys/bus/pci/devices/<dev>/ccissX/cXdY. Where X = the controller (or host) number and Y is the logical drive number. A link from /sys/bus/pci/devices/<dev>/ccissX/cXdY/block:cciss!cXdY to /sys/block/cciss!cXdY/device is also created. A bus is created in /sys/bus/cciss. A link is created from the pci ccissX entry to /sys/bus/cciss/devices/ccissX.
Please consider this for inclusion.

Quoted 1 line

Did Andrew's signed-off-by: get lost?

#4 lore raw
Quoted 16 lines · Andrew Morton
Quoted 13 lines · On Thu, 28 May 2009 15:21:24 -0500 "Mike Miller (OS Dev)"…

From: Andrew Patterson <[email protected]>

This patch adds sysfs entries to the cciss driver needed for the dm/multipath tools. A file for vendor, model, rev, and unique_id is added for each logical drive under directory /sys/bus/pci/devices/<dev>/ccissX/cXdY. Where X = the controller (or host) number and Y is the logical drive number. A link from /sys/bus/pci/devices/<dev>/ccissX/cXdY/block:cciss!cXdY to /sys/block/cciss!cXdY/device is also created. A bus is created in /sys/bus/cciss. A link is created from the pci ccissX entry to /sys/bus/cciss/devices/ccissX.
Please consider this for inclusion.

Quoted 3 lines
Quoted 1 line

Did Andrew's signed-off-by: get lost?

No, I converted it into the From: field. Another screw up, I guess.

mikem

#5 lore raw
In reply to a message not in the archive

On Mon, Apr 13, 2009 at 10:45:25AM -0600, Andrew Patterson wrote:
This is version six of my patch to add sysfs entries to the cciss driver.

Changelog:

Version 3
Got rid of /sys/class/cciss_* entries. Now only show vendor, model, rev, and unique_id at /sys/bus/pci/devices/ccissX/cXdY. Where X is the controller nubmer and Y is the logical drive number.
Fixed a double memcpy of the serial number.
Documented new sysfs entries in Documentation/ABI/testing/sysfs-bus-pci-devices-cciss
Fixed tabs in Documentation/ABI/testing/sysfs-bus-pci-devices-cciss Removed unneeded device_attribute release functions
Fixed pahole-reported holes.

Version 4
Moved cciss_sysfs.c into cciss.c
Added cciss_bus_type to logical drive so we get /sys/bus/cciss/device/ccissX.

Version 5
Added cciss_bus_type to hba so we get /sys/bus/cciss/device/cYdZ.

Version 6

Use "sizeof() + 1" instead of "*LEN + 2" for *_show() routines. Added back in ABI docs.
The following patch adds sysfs entries for the cciss driver. It adds vendor, model, rev, and unique_id under /sys/block/cciss!c#d#/device needed for RedHat BZ:

https://bugzilla.redhat.com/show_bug.cgi?id=484419

This patch is based off os linus's 2.6 tree (2.6.30-rc1).

 .../ABI/testing/sysfs-bus-pci-devices-cciss        |   33 ++
 drivers/block/cciss.c                              |  267 ++++++++++++++++++++
 drivers/block/cciss.h                              |   24 +-
 3 files changed, 314 insertions(+), 10 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-pci-devices-cciss
Signature · 1 line
Andrew Patterson