diff options
author | Mark Haverkamp <markh@osdl.org> | 2005-06-01 17:24:38 (GMT) |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-06-03 17:44:12 (GMT) |
commit | 0bb14afe10dddbc05c3244bd224b6858de0ee319 (patch) | |
tree | 08abf734eaedc75801f43dfac3e0474de770741d | |
parent | 9a8bc9b84b783fd92315e56ce4d4ee78a2c6819c (diff) | |
download | linux-0bb14afe10dddbc05c3244bd224b6858de0ee319.tar.xz |
[SCSI] 2.6 aacraid: updated sysfs files
This patch adds some files into the /sys/class/scsi_host/hostN
directories for aacraid adapters:
model
vendor
hba_kernel_version
hba_monitor_version
hba_bios_version
serial_number
Signed-off-by: Mark Haverkamp <markh@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r-- | drivers/scsi/aacraid/linit.c | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 6f05d86..c2be838 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c @@ -533,6 +533,134 @@ static long aac_compat_cfg_ioctl(struct file *file, unsigned cmd, unsigned long } #endif +static ssize_t aac_show_model(struct class_device *class_dev, + char *buf) +{ + struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; + int len; + + len = snprintf(buf, PAGE_SIZE, "%s\n", + aac_drivers[dev->cardtype].model); + return len; +} + +static ssize_t aac_show_vendor(struct class_device *class_dev, + char *buf) +{ + struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; + int len; + + len = snprintf(buf, PAGE_SIZE, "%s\n", + aac_drivers[dev->cardtype].vname); + return len; +} + +static ssize_t aac_show_kernel_version(struct class_device *class_dev, + char *buf) +{ + struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; + int len, tmp; + + tmp = le32_to_cpu(dev->adapter_info.kernelrev); + len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", + tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, + le32_to_cpu(dev->adapter_info.kernelbuild)); + return len; +} + +static ssize_t aac_show_monitor_version(struct class_device *class_dev, + char *buf) +{ + struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; + int len, tmp; + + tmp = le32_to_cpu(dev->adapter_info.monitorrev); + len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", + tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, + le32_to_cpu(dev->adapter_info.monitorbuild)); + return len; +} + +static ssize_t aac_show_bios_version(struct class_device *class_dev, + char *buf) +{ + struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; + int len, tmp; + + tmp = le32_to_cpu(dev->adapter_info.biosrev); + len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", + tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, + le32_to_cpu(dev->adapter_info.biosbuild)); + return len; +} + +static ssize_t aac_show_serial_number(struct class_device *class_dev, + char *buf) +{ + struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; + int len = 0; + + if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0) + len = snprintf(buf, PAGE_SIZE, "%x\n", + le32_to_cpu(dev->adapter_info.serial[0])); + return len; +} + + +static struct class_device_attribute aac_model = { + .attr = { + .name = "model", + .mode = S_IRUGO, + }, + .show = aac_show_model, +}; +static struct class_device_attribute aac_vendor = { + .attr = { + .name = "vendor", + .mode = S_IRUGO, + }, + .show = aac_show_vendor, +}; +static struct class_device_attribute aac_kernel_version = { + .attr = { + .name = "hba_kernel_version", + .mode = S_IRUGO, + }, + .show = aac_show_kernel_version, +}; +static struct class_device_attribute aac_monitor_version = { + .attr = { + .name = "hba_monitor_version", + .mode = S_IRUGO, + }, + .show = aac_show_monitor_version, +}; +static struct class_device_attribute aac_bios_version = { + .attr = { + .name = "hba_bios_version", + .mode = S_IRUGO, + }, + .show = aac_show_bios_version, +}; +static struct class_device_attribute aac_serial_number = { + .attr = { + .name = "serial_number", + .mode = S_IRUGO, + }, + .show = aac_show_serial_number, +}; + +static struct class_device_attribute *aac_attrs[] = { + &aac_model, + &aac_vendor, + &aac_kernel_version, + &aac_monitor_version, + &aac_bios_version, + &aac_serial_number, + NULL +}; + + static struct file_operations aac_cfg_fops = { .owner = THIS_MODULE, .ioctl = aac_cfg_ioctl, @@ -553,6 +681,7 @@ static struct scsi_host_template aac_driver_template = { #endif .queuecommand = aac_queuecommand, .bios_param = aac_biosparm, + .shost_attrs = aac_attrs, .slave_configure = aac_slave_configure, .eh_abort_handler = aac_eh_abort, .eh_host_reset_handler = aac_eh_reset, |