diff options
author | Mark Haverkamp <markh@osdl.org> | 2005-06-01 13:24:38 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-06-03 13:44:12 -0400 |
commit | 0bb14afe10dddbc05c3244bd224b6858de0ee319 (patch) | |
tree | 08abf734eaedc75801f43dfac3e0474de770741d /drivers/scsi/aacraid/linit.c | |
parent | 9a8bc9b84b783fd92315e56ce4d4ee78a2c6819c (diff) |
[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>
Diffstat (limited to 'drivers/scsi/aacraid/linit.c')
-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 6f05d86c7bb3..c2be8380dad5 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 | |||
533 | } | 533 | } |
534 | #endif | 534 | #endif |
535 | 535 | ||
536 | static ssize_t aac_show_model(struct class_device *class_dev, | ||
537 | char *buf) | ||
538 | { | ||
539 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | ||
540 | int len; | ||
541 | |||
542 | len = snprintf(buf, PAGE_SIZE, "%s\n", | ||
543 | aac_drivers[dev->cardtype].model); | ||
544 | return len; | ||
545 | } | ||
546 | |||
547 | static ssize_t aac_show_vendor(struct class_device *class_dev, | ||
548 | char *buf) | ||
549 | { | ||
550 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | ||
551 | int len; | ||
552 | |||
553 | len = snprintf(buf, PAGE_SIZE, "%s\n", | ||
554 | aac_drivers[dev->cardtype].vname); | ||
555 | return len; | ||
556 | } | ||
557 | |||
558 | static ssize_t aac_show_kernel_version(struct class_device *class_dev, | ||
559 | char *buf) | ||
560 | { | ||
561 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | ||
562 | int len, tmp; | ||
563 | |||
564 | tmp = le32_to_cpu(dev->adapter_info.kernelrev); | ||
565 | len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", | ||
566 | tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, | ||
567 | le32_to_cpu(dev->adapter_info.kernelbuild)); | ||
568 | return len; | ||
569 | } | ||
570 | |||
571 | static ssize_t aac_show_monitor_version(struct class_device *class_dev, | ||
572 | char *buf) | ||
573 | { | ||
574 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | ||
575 | int len, tmp; | ||
576 | |||
577 | tmp = le32_to_cpu(dev->adapter_info.monitorrev); | ||
578 | len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", | ||
579 | tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, | ||
580 | le32_to_cpu(dev->adapter_info.monitorbuild)); | ||
581 | return len; | ||
582 | } | ||
583 | |||
584 | static ssize_t aac_show_bios_version(struct class_device *class_dev, | ||
585 | char *buf) | ||
586 | { | ||
587 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | ||
588 | int len, tmp; | ||
589 | |||
590 | tmp = le32_to_cpu(dev->adapter_info.biosrev); | ||
591 | len = snprintf(buf, PAGE_SIZE, "%d.%d-%d[%d]\n", | ||
592 | tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, | ||
593 | le32_to_cpu(dev->adapter_info.biosbuild)); | ||
594 | return len; | ||
595 | } | ||
596 | |||
597 | static ssize_t aac_show_serial_number(struct class_device *class_dev, | ||
598 | char *buf) | ||
599 | { | ||
600 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | ||
601 | int len = 0; | ||
602 | |||
603 | if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0) | ||
604 | len = snprintf(buf, PAGE_SIZE, "%x\n", | ||
605 | le32_to_cpu(dev->adapter_info.serial[0])); | ||
606 | return len; | ||
607 | } | ||
608 | |||
609 | |||
610 | static struct class_device_attribute aac_model = { | ||
611 | .attr = { | ||
612 | .name = "model", | ||
613 | .mode = S_IRUGO, | ||
614 | }, | ||
615 | .show = aac_show_model, | ||
616 | }; | ||
617 | static struct class_device_attribute aac_vendor = { | ||
618 | .attr = { | ||
619 | .name = "vendor", | ||
620 | .mode = S_IRUGO, | ||
621 | }, | ||
622 | .show = aac_show_vendor, | ||
623 | }; | ||
624 | static struct class_device_attribute aac_kernel_version = { | ||
625 | .attr = { | ||
626 | .name = "hba_kernel_version", | ||
627 | .mode = S_IRUGO, | ||
628 | }, | ||
629 | .show = aac_show_kernel_version, | ||
630 | }; | ||
631 | static struct class_device_attribute aac_monitor_version = { | ||
632 | .attr = { | ||
633 | .name = "hba_monitor_version", | ||
634 | .mode = S_IRUGO, | ||
635 | }, | ||
636 | .show = aac_show_monitor_version, | ||
637 | }; | ||
638 | static struct class_device_attribute aac_bios_version = { | ||
639 | .attr = { | ||
640 | .name = "hba_bios_version", | ||
641 | .mode = S_IRUGO, | ||
642 | }, | ||
643 | .show = aac_show_bios_version, | ||
644 | }; | ||
645 | static struct class_device_attribute aac_serial_number = { | ||
646 | .attr = { | ||
647 | .name = "serial_number", | ||
648 | .mode = S_IRUGO, | ||
649 | }, | ||
650 | .show = aac_show_serial_number, | ||
651 | }; | ||
652 | |||
653 | static struct class_device_attribute *aac_attrs[] = { | ||
654 | &aac_model, | ||
655 | &aac_vendor, | ||
656 | &aac_kernel_version, | ||
657 | &aac_monitor_version, | ||
658 | &aac_bios_version, | ||
659 | &aac_serial_number, | ||
660 | NULL | ||
661 | }; | ||
662 | |||
663 | |||
536 | static struct file_operations aac_cfg_fops = { | 664 | static struct file_operations aac_cfg_fops = { |
537 | .owner = THIS_MODULE, | 665 | .owner = THIS_MODULE, |
538 | .ioctl = aac_cfg_ioctl, | 666 | .ioctl = aac_cfg_ioctl, |
@@ -553,6 +681,7 @@ static struct scsi_host_template aac_driver_template = { | |||
553 | #endif | 681 | #endif |
554 | .queuecommand = aac_queuecommand, | 682 | .queuecommand = aac_queuecommand, |
555 | .bios_param = aac_biosparm, | 683 | .bios_param = aac_biosparm, |
684 | .shost_attrs = aac_attrs, | ||
556 | .slave_configure = aac_slave_configure, | 685 | .slave_configure = aac_slave_configure, |
557 | .eh_abort_handler = aac_eh_abort, | 686 | .eh_abort_handler = aac_eh_abort, |
558 | .eh_host_reset_handler = aac_eh_reset, | 687 | .eh_host_reset_handler = aac_eh_reset, |