Commit 82cd7fff authored by Patrick Mochel's avatar Patrick Mochel

sysfs: remove count and off parameters from sysfs_ops methods.

The previous sysfs change implies that the show() and store() methods in 
struct sysfs_ops are called only once, during the first read() or write().
This means that off is always 0, and count should always be PAGE_SIZE, to
fill or clear the entire buffer in one shot.

Therefore, those parameters can be removed from all attribute read/write 
methods. 

This changeset removes them from the definition and fixes sysfs to deal
with that appropriately. 
parent 71074f8c
......@@ -154,27 +154,27 @@ static int sysfs_symlink(struct inode * dir, struct dentry *dentry, const char *
* These operations allow subsystems to have files that can be
* read/written.
*/
ssize_t subsys_attr_show(struct kobject * kobj, struct attribute * attr,
char * page, size_t count, loff_t off)
static ssize_t
subsys_attr_show(struct kobject * kobj, struct attribute * attr, char * page)
{
struct subsystem * s = to_subsys(kobj);
struct subsys_attribute * sattr = to_sattr(attr);
ssize_t ret = 0;
if (sattr->show)
ret = sattr->show(s,page,count,off);
ret = sattr->show(s,page,PAGE_SIZE,0);
return ret;
}
ssize_t subsys_attr_store(struct kobject * kobj, struct attribute * attr,
const char * page, size_t count, loff_t off)
static ssize_t
subsys_attr_store(struct kobject * kobj, struct attribute * attr, const char * page)
{
struct subsystem * s = to_subsys(kobj);
struct subsys_attribute * sattr = to_sattr(attr);
ssize_t ret = 0;
if (sattr->store)
ret = sattr->store(s,page,count,off);
ret = sattr->store(s,page,PAGE_SIZE,0);
return ret;
}
......@@ -215,7 +215,7 @@ static int fill_read_buffer(struct file * file, struct sysfs_buffer * buffer)
if (!buffer->page)
return -ENOMEM;
count = ops->show(kobj,attr,buffer->page,PAGE_SIZE,0);
count = ops->show(kobj,attr,buffer->page);
if (count >= 0)
buffer->count = count;
else
......@@ -328,7 +328,7 @@ static int flush_write_buffer(struct file * file, struct sysfs_buffer * buffer)
struct kobject * kobj = file->f_dentry->d_parent->d_fsdata;
struct sysfs_ops * ops = buffer->ops;
return ops->store(kobj,attr,buffer->page,PAGE_SIZE,0);
return ops->store(kobj,attr,buffer->page);
}
......
......@@ -17,8 +17,8 @@ struct attribute {
};
struct sysfs_ops {
ssize_t (*show)(struct kobject *, struct attribute *,char *, size_t, loff_t);
ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t, loff_t);
ssize_t (*show)(struct kobject *, struct attribute *,char *);
ssize_t (*store)(struct kobject *,struct attribute *,const char *);
};
extern int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment