[PATCH] sysfs: (driver/block) if show/store is missing return -EIO
authorDmitry Torokhov <dtor_core@ameritech.net>
Fri, 29 Apr 2005 06:26:06 +0000 (01:26 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 20 Jun 2005 22:15:03 +0000 (15:15 -0700)
sysfs: fix drivers/block so if an attribute doesn't implement
       show or store method read/write will return -EIO
       instead of 0 or -EINVAL.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/block/as-iosched.c
drivers/block/cfq-iosched.c
drivers/block/deadline-iosched.c
drivers/block/genhd.c
drivers/block/ll_rw_blk.c

index a9575bb58a5e14630c507734bb35288c32da8338..638db06de2bea5414a55b0dfa8522a5db238c8bf 100644 (file)
@@ -2044,7 +2044,7 @@ as_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
        struct as_fs_entry *entry = to_as(attr);
 
        if (!entry->show)
-               return 0;
+               return -EIO;
 
        return entry->show(e->elevator_data, page);
 }
@@ -2057,7 +2057,7 @@ as_attr_store(struct kobject *kobj, struct attribute *attr,
        struct as_fs_entry *entry = to_as(attr);
 
        if (!entry->store)
-               return -EINVAL;
+               return -EIO;
 
        return entry->store(e->elevator_data, page, length);
 }
index 2210bacad56a34c4023a85036681c51657d19f8b..3ac47dde64da3be93b5e4bed65cee827f16db952 100644 (file)
@@ -1775,7 +1775,7 @@ cfq_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
        struct cfq_fs_entry *entry = to_cfq(attr);
 
        if (!entry->show)
-               return 0;
+               return -EIO;
 
        return entry->show(e->elevator_data, page);
 }
@@ -1788,7 +1788,7 @@ cfq_attr_store(struct kobject *kobj, struct attribute *attr,
        struct cfq_fs_entry *entry = to_cfq(attr);
 
        if (!entry->store)
-               return -EINVAL;
+               return -EIO;
 
        return entry->store(e->elevator_data, page, length);
 }
index d63d34c671f7a7fcbc9007ca009a04f125303cd1..7f79f3dd01655f111d88701bb48df642c72046a5 100644 (file)
@@ -886,7 +886,7 @@ deadline_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
        struct deadline_fs_entry *entry = to_deadline(attr);
 
        if (!entry->show)
-               return 0;
+               return -EIO;
 
        return entry->show(e->elevator_data, page);
 }
@@ -899,7 +899,7 @@ deadline_attr_store(struct kobject *kobj, struct attribute *attr,
        struct deadline_fs_entry *entry = to_deadline(attr);
 
        if (!entry->store)
-               return -EINVAL;
+               return -EIO;
 
        return entry->store(e->elevator_data, page, length);
 }
index 8bbe01d4b487cf5c9a03b474e8ffd2e57bbf1e8f..53f7d846b747f35692f782e0bc84f1fa8639a42e 100644 (file)
@@ -322,7 +322,7 @@ static ssize_t disk_attr_show(struct kobject *kobj, struct attribute *attr,
        struct gendisk *disk = to_disk(kobj);
        struct disk_attribute *disk_attr =
                container_of(attr,struct disk_attribute,attr);
-       ssize_t ret = 0;
+       ssize_t ret = -EIO;
 
        if (disk_attr->show)
                ret = disk_attr->show(disk,page);
index f20eba22b14b254553933848e94f3f4192552603..81fe3a0c1fe730f0cfea7661b65c44602aca5844 100644 (file)
@@ -3574,7 +3574,7 @@ queue_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
 
        q = container_of(kobj, struct request_queue, kobj);
        if (!entry->show)
-               return 0;
+               return -EIO;
 
        return entry->show(q, page);
 }
@@ -3588,7 +3588,7 @@ queue_attr_store(struct kobject *kobj, struct attribute *attr,
 
        q = container_of(kobj, struct request_queue, kobj);
        if (!entry->store)
-               return -EINVAL;
+               return -EIO;
 
        return entry->store(q, page, length);
 }