diff options
author | Horst Hummel <horst.hummel@de.ibm.com> | 2007-04-27 10:01:47 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2007-04-27 10:01:44 -0400 |
commit | 4dfd5c4593e69e9d399dd9e01d184dc534408f7e (patch) | |
tree | 3f148b0c30de75b8ec3a43b247da9d06b24573bc /drivers | |
parent | be7962856d299a0f231ac36f89f4a89cbecfe0ff (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')
-rw-r--r-- | drivers/s390/block/dasd.c | 3 | ||||
-rw-r--r-- | drivers/s390/block/dasd_devmap.c | 41 |
2 files changed, 44 insertions, 0 deletions
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index eb5dc62f0d9c..e71929db8b06 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -398,6 +398,9 @@ dasd_change_state(struct dasd_device *device) | |||
398 | 398 | ||
399 | if (device->state == device->target) | 399 | if (device->state == device->target) |
400 | wake_up(&dasd_init_waitq); | 400 | wake_up(&dasd_init_waitq); |
401 | |||
402 | /* let user-space know that the device status changed */ | ||
403 | kobject_uevent(&device->cdev->dev.kobj, KOBJ_CHANGE); | ||
401 | } | 404 | } |
402 | 405 | ||
403 | /* | 406 | /* |
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, | |||
829 | static DEVICE_ATTR(discipline, 0444, dasd_discipline_show, NULL); | 829 | static DEVICE_ATTR(discipline, 0444, dasd_discipline_show, NULL); |
830 | 830 | ||
831 | static ssize_t | 831 | static ssize_t |
832 | dasd_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 | |||
869 | static DEVICE_ATTR(status, 0444, dasd_device_status_show, NULL); | ||
870 | |||
871 | static ssize_t | ||
832 | dasd_alias_show(struct device *dev, struct device_attribute *attr, char *buf) | 872 | dasd_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); | |||
939 | static struct attribute * dasd_attrs[] = { | 979 | static 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, |