aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSalyzyn, Mark <Mark_Salyzyn@adaptec.com>2008-01-08 15:23:49 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-01-23 12:29:19 -0500
commit17eaaceef52b1ce5ca061d49a1ff9ae56ccce1e1 (patch)
tree82c8b75f0d572601865c45bd121b922ab9d471aa /drivers
parent95e852e1ef165560e85d3012127068c8f08b19a1 (diff)
[SCSI] aacraid: add sysfs report of RAID level
Report the RAID level string for the SCSI device representing the array. Report is in /sys/class/scsi_device/#:#:#:#/device/level. Signed-off-by: Mark Salyzyn <aacraid@adaptec.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/aacraid/aachba.c7
-rw-r--r--drivers/scsi/aacraid/aacraid.h1
-rw-r--r--drivers/scsi/aacraid/linit.c25
3 files changed, 32 insertions, 1 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 43d6aff460d2..eee65c145cb8 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -690,7 +690,12 @@ static char *container_types[] = {
690 "Unknown" 690 "Unknown"
691}; 691};
692 692
693 693char * get_container_type(unsigned tindex)
694{
695 if (tindex >= ARRAY_SIZE(container_types))
696 tindex = ARRAY_SIZE(container_types) - 1;
697 return container_types[tindex];
698}
694 699
695/* Function: setinqstr 700/* Function: setinqstr
696 * 701 *
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 7bb3d9fde713..6d4e24cea3dc 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1869,6 +1869,7 @@ int aac_probe_container(struct aac_dev *dev, int cid);
1869int _aac_rx_init(struct aac_dev *dev); 1869int _aac_rx_init(struct aac_dev *dev);
1870int aac_rx_select_comm(struct aac_dev *dev, int comm); 1870int aac_rx_select_comm(struct aac_dev *dev, int comm);
1871int aac_rx_deliver_producer(struct fib * fib); 1871int aac_rx_deliver_producer(struct fib * fib);
1872char * get_container_type(unsigned type);
1872extern int numacb; 1873extern int numacb;
1873extern int acbsize; 1874extern int acbsize;
1874extern char aac_driver_version[]; 1875extern char aac_driver_version[];
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index b4ad9effcf50..e6bdc930d528 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -487,6 +487,30 @@ static int aac_change_queue_depth(struct scsi_device *sdev, int depth)
487 return sdev->queue_depth; 487 return sdev->queue_depth;
488} 488}
489 489
490static ssize_t aac_show_raid_level(struct device *dev, struct device_attribute *attr, char *buf)
491{
492 struct scsi_device * sdev = to_scsi_device(dev);
493 if (sdev_channel(sdev) != CONTAINER_CHANNEL)
494 return snprintf(buf, PAGE_SIZE, sdev->no_uld_attach
495 ? "Hidden\n" : "JBOD");
496 return snprintf(buf, PAGE_SIZE, "%s\n",
497 get_container_type(((struct aac_dev *)(sdev->host->hostdata))
498 ->fsa_dev[sdev_id(sdev)].type));
499}
500
501static struct device_attribute aac_raid_level_attr = {
502 .attr = {
503 .name = "level",
504 .mode = S_IRUGO,
505 },
506 .show = aac_show_raid_level
507};
508
509static struct device_attribute *aac_dev_attrs[] = {
510 &aac_raid_level_attr,
511 NULL,
512};
513
490static int aac_ioctl(struct scsi_device *sdev, int cmd, void __user * arg) 514static int aac_ioctl(struct scsi_device *sdev, int cmd, void __user * arg)
491{ 515{
492 struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata; 516 struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata;
@@ -941,6 +965,7 @@ static struct scsi_host_template aac_driver_template = {
941 .shost_attrs = aac_attrs, 965 .shost_attrs = aac_attrs,
942 .slave_configure = aac_slave_configure, 966 .slave_configure = aac_slave_configure,
943 .change_queue_depth = aac_change_queue_depth, 967 .change_queue_depth = aac_change_queue_depth,
968 .sdev_attrs = aac_dev_attrs,
944 .eh_abort_handler = aac_eh_abort, 969 .eh_abort_handler = aac_eh_abort,
945 .eh_host_reset_handler = aac_eh_reset, 970 .eh_host_reset_handler = aac_eh_reset,
946 .can_queue = AAC_NUM_IO_FIB, 971 .can_queue = AAC_NUM_IO_FIB,