aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/block/dasd_devmap.c
diff options
context:
space:
mode:
authorHorst Hummel <horst.hummel@de.ibm.com>2007-04-27 10:01:47 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2007-04-27 10:01:44 -0400
commit4dfd5c4593e69e9d399dd9e01d184dc534408f7e (patch)
tree3f148b0c30de75b8ec3a43b247da9d06b24573bc /drivers/s390/block/dasd_devmap.c
parentbe7962856d299a0f231ac36f89f4a89cbecfe0ff (diff)
[S390] dasd: Add sysfs attribute status and generate uevents.
This patch adds a sysfs-attribute 'status' to make the DASD device-status accessible from user-space. In addition, the DASD driver generates an uevent(CHANGE) for the ccw-device on each device-status change. This enables user-space applications (e.g. udev) to do related processing. Signed-off-by: Horst Hummel <horst.hummel@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/block/dasd_devmap.c')
-rw-r--r--drivers/s390/block/dasd_devmap.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c
index ed70852cc915..66958b8d7c45 100644
--- a/drivers/s390/block/dasd_devmap.c
+++ b/drivers/s390/block/dasd_devmap.c
@@ -829,6 +829,46 @@ dasd_discipline_show(struct device *dev, struct device_attribute *attr,
829static DEVICE_ATTR(discipline, 0444, dasd_discipline_show, NULL); 829static DEVICE_ATTR(discipline, 0444, dasd_discipline_show, NULL);
830 830
831static ssize_t 831static ssize_t
832dasd_device_status_show(struct device *dev, struct device_attribute *attr,
833 char *buf)
834{
835 struct dasd_device *device;
836 ssize_t len;
837
838 device = dasd_device_from_cdev(to_ccwdev(dev));
839 if (!IS_ERR(device)) {
840 switch (device->state) {
841 case DASD_STATE_NEW:
842 len = snprintf(buf, PAGE_SIZE, "new\n");
843 break;
844 case DASD_STATE_KNOWN:
845 len = snprintf(buf, PAGE_SIZE, "detected\n");
846 break;
847 case DASD_STATE_BASIC:
848 len = snprintf(buf, PAGE_SIZE, "basic\n");
849 break;
850 case DASD_STATE_UNFMT:
851 len = snprintf(buf, PAGE_SIZE, "unformatted\n");
852 break;
853 case DASD_STATE_READY:
854 len = snprintf(buf, PAGE_SIZE, "ready\n");
855 break;
856 case DASD_STATE_ONLINE:
857 len = snprintf(buf, PAGE_SIZE, "online\n");
858 break;
859 default:
860 len = snprintf(buf, PAGE_SIZE, "no stat\n");
861 break;
862 }
863 dasd_put_device(device);
864 } else
865 len = snprintf(buf, PAGE_SIZE, "unknown\n");
866 return len;
867}
868
869static DEVICE_ATTR(status, 0444, dasd_device_status_show, NULL);
870
871static ssize_t
832dasd_alias_show(struct device *dev, struct device_attribute *attr, char *buf) 872dasd_alias_show(struct device *dev, struct device_attribute *attr, char *buf)
833{ 873{
834 struct dasd_devmap *devmap; 874 struct dasd_devmap *devmap;
@@ -939,6 +979,7 @@ static DEVICE_ATTR(eer_enabled, 0644, dasd_eer_show, dasd_eer_store);
939static struct attribute * dasd_attrs[] = { 979static struct attribute * dasd_attrs[] = {
940 &dev_attr_readonly.attr, 980 &dev_attr_readonly.attr,
941 &dev_attr_discipline.attr, 981 &dev_attr_discipline.attr,
982 &dev_attr_status.attr,
942 &dev_attr_alias.attr, 983 &dev_attr_alias.attr,
943 &dev_attr_vendor.attr, 984 &dev_attr_vendor.attr,
944 &dev_attr_uid.attr, 985 &dev_attr_uid.attr,