From dtor_core@ameritech.net Fri Apr 29 07:06:43 2005 From: Dmitry Torokhov Subject: sysfs: (driver/block) if show/store is missing return -EIO Date: Fri, 29 Apr 2005 01:26:06 -0500 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 Signed-off-by: Greg Kroah-Hartman --- drivers/block/as-iosched.c | 4 ++-- drivers/block/cfq-iosched.c | 4 ++-- drivers/block/deadline-iosched.c | 4 ++-- drivers/block/genhd.c | 2 +- drivers/block/ll_rw_blk.c | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) --- gregkh-2.6.orig/drivers/block/as-iosched.c 2005-04-06 11:47:46.000000000 -0700 +++ gregkh-2.6/drivers/block/as-iosched.c 2005-05-03 22:05:18.000000000 -0700 @@ -2044,7 +2044,7 @@ 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 @@ struct as_fs_entry *entry = to_as(attr); if (!entry->store) - return -EINVAL; + return -EIO; return entry->store(e->elevator_data, page, length); } --- gregkh-2.6.orig/drivers/block/cfq-iosched.c 2005-04-06 11:47:46.000000000 -0700 +++ gregkh-2.6/drivers/block/cfq-iosched.c 2005-05-03 22:05:18.000000000 -0700 @@ -1772,7 +1772,7 @@ struct cfq_fs_entry *entry = to_cfq(attr); if (!entry->show) - return 0; + return -EIO; return entry->show(e->elevator_data, page); } @@ -1785,7 +1785,7 @@ struct cfq_fs_entry *entry = to_cfq(attr); if (!entry->store) - return -EINVAL; + return -EIO; return entry->store(e->elevator_data, page, length); } --- gregkh-2.6.orig/drivers/block/genhd.c 2005-04-06 11:47:46.000000000 -0700 +++ gregkh-2.6/drivers/block/genhd.c 2005-05-03 22:05:18.000000000 -0700 @@ -321,7 +321,7 @@ 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); --- gregkh-2.6.orig/drivers/block/ll_rw_blk.c 2005-04-20 21:25:10.000000000 -0700 +++ gregkh-2.6/drivers/block/ll_rw_blk.c 2005-05-03 22:05:18.000000000 -0700 @@ -3582,7 +3582,7 @@ q = container_of(kobj, struct request_queue, kobj); if (!entry->show) - return 0; + return -EIO; return entry->show(q, page); } @@ -3596,7 +3596,7 @@ q = container_of(kobj, struct request_queue, kobj); if (!entry->store) - return -EINVAL; + return -EIO; return entry->store(q, page, length); } --- gregkh-2.6.orig/drivers/block/deadline-iosched.c 2005-04-06 11:47:46.000000000 -0700 +++ gregkh-2.6/drivers/block/deadline-iosched.c 2005-05-03 22:05:18.000000000 -0700 @@ -886,7 +886,7 @@ 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 @@ struct deadline_fs_entry *entry = to_deadline(attr); if (!entry->store) - return -EINVAL; + return -EIO; return entry->store(e->elevator_data, page, length); }