lkml.org 
[lkml]   [2005]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 1/5 (take 2)] sysfs: if show/store is missing return -EIO
    Date
    sysfs: if attribute does not implement show or store method
    read/write should return -EIO instead of 0 or -EINVAL.

    Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
    ---

    bin.c | 4 ++--
    file.c | 4 ++--
    2 files changed, 4 insertions(+), 4 deletions(-)

    Index: dtor/fs/sysfs/file.c
    ===================================================================
    --- dtor.orig/fs/sysfs/file.c
    +++ dtor/fs/sysfs/file.c
    @@ -23,7 +23,7 @@ subsys_attr_show(struct kobject * kobj,
    {
    struct subsystem * s = to_subsys(kobj);
    struct subsys_attribute * sattr = to_sattr(attr);
    - ssize_t ret = 0;
    + ssize_t ret = -EIO;

    if (sattr->show)
    ret = sattr->show(s,page);
    @@ -36,7 +36,7 @@ subsys_attr_store(struct kobject * kobj,
    {
    struct subsystem * s = to_subsys(kobj);
    struct subsys_attribute * sattr = to_sattr(attr);
    - ssize_t ret = 0;
    + ssize_t ret = -EIO;

    if (sattr->store)
    ret = sattr->store(s,page,count);
    Index: dtor/fs/sysfs/bin.c
    ===================================================================
    --- dtor.orig/fs/sysfs/bin.c
    +++ dtor/fs/sysfs/bin.c
    @@ -25,7 +25,7 @@ fill_read(struct dentry *dentry, char *b
    struct kobject * kobj = to_kobj(dentry->d_parent);

    if (!attr->read)
    - return -EINVAL;
    + return -EIO;

    return attr->read(kobj, buffer, off, count);
    }
    @@ -71,7 +71,7 @@ flush_write(struct dentry *dentry, char
    struct kobject *kobj = to_kobj(dentry->d_parent);

    if (!attr->write)
    - return -EINVAL;
    + return -EIO;

    return attr->write(kobj, buffer, offset, count);
    }
    -
    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/
    \
     
     \ /
      Last update: 2005-04-29 08:32    [W:0.021 / U:91.004 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site