Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262438AbVD2G3j (ORCPT ); Fri, 29 Apr 2005 02:29:39 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262440AbVD2G2V (ORCPT ); Fri, 29 Apr 2005 02:28:21 -0400 Received: from smtp815.mail.sc5.yahoo.com ([66.163.170.1]:15711 "HELO smtp815.mail.sc5.yahoo.com") by vger.kernel.org with SMTP id S262437AbVD2G1n (ORCPT ); Fri, 29 Apr 2005 02:27:43 -0400 From: Dmitry Torokhov To: linux-kernel@vger.kernel.org Subject: [PATCH 4/5 (take 2)] sysfs: (driver/block) if show/store is missing return -EIO Date: Fri, 29 Apr 2005 01:26:06 -0500 User-Agent: KMail/1.8 Cc: Robert Love , Greg KH , Jean Delvare References: <200504280030.10214.dtor_core@ameritech.net> <1114710135.6682.60.camel@betsy> <200504290122.00679.dtor_core@ameritech.net> In-Reply-To: <200504290122.00679.dtor_core@ameritech.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200504290126.06946.dtor_core@ameritech.net> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3613 Lines: 120 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 --- as-iosched.c | 4 ++-- cfq-iosched.c | 4 ++-- deadline-iosched.c | 4 ++-- genhd.c | 2 +- ll_rw_blk.c | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) Index: dtor/drivers/block/as-iosched.c =================================================================== --- dtor.orig/drivers/block/as-iosched.c +++ dtor/drivers/block/as-iosched.c @@ -2044,7 +2044,7 @@ as_attr_show(struct kobject *kobj, struc 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, stru struct as_fs_entry *entry = to_as(attr); if (!entry->store) - return -EINVAL; + return -EIO; return entry->store(e->elevator_data, page, length); } Index: dtor/drivers/block/cfq-iosched.c =================================================================== --- dtor.orig/drivers/block/cfq-iosched.c +++ dtor/drivers/block/cfq-iosched.c @@ -1772,7 +1772,7 @@ cfq_attr_show(struct kobject *kobj, stru 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 @@ cfq_attr_store(struct kobject *kobj, str struct cfq_fs_entry *entry = to_cfq(attr); if (!entry->store) - return -EINVAL; + return -EIO; return entry->store(e->elevator_data, page, length); } Index: dtor/drivers/block/genhd.c =================================================================== --- dtor.orig/drivers/block/genhd.c +++ dtor/drivers/block/genhd.c @@ -321,7 +321,7 @@ static ssize_t disk_attr_show(struct kob 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: dtor/drivers/block/ll_rw_blk.c =================================================================== --- dtor.orig/drivers/block/ll_rw_blk.c +++ dtor/drivers/block/ll_rw_blk.c @@ -3582,7 +3582,7 @@ queue_attr_show(struct kobject *kobj, st q = container_of(kobj, struct request_queue, kobj); if (!entry->show) - return 0; + return -EIO; return entry->show(q, page); } @@ -3596,7 +3596,7 @@ queue_attr_store(struct kobject *kobj, s q = container_of(kobj, struct request_queue, kobj); if (!entry->store) - return -EINVAL; + return -EIO; return entry->store(q, page, length); } Index: dtor/drivers/block/deadline-iosched.c =================================================================== --- dtor.orig/drivers/block/deadline-iosched.c +++ dtor/drivers/block/deadline-iosched.c @@ -886,7 +886,7 @@ deadline_attr_show(struct kobject *kobj, 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 deadline_fs_entry *entry = to_deadline(attr); if (!entry->store) - return -EINVAL; + return -EIO; return entry->store(e->elevator_data, page, length); } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/