aboutsummaryrefslogtreecommitdiffstats
path: root/fs/configfs
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2007-05-09 05:33:32 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-09 15:30:49 -0400
commit92f4c701aad794de9e4cf7341d0a486aed027c46 (patch)
tree59a47427d43670a50409fc91d68a325e7cfa0ab7 /fs/configfs
parent884c3d751093446918c2f7a4b2c745f28cf91c39 (diff)
use simple_read_from_buffer() in fs/
Cleanup using simple_read_from_buffer() in binfmt_misc, configfs, and sysfs. Cc: Greg Kroah-Hartman <gregkh@suse.de> Cc: Joel Becker <joel.becker@oracle.com> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/configfs')
-rw-r--r--fs/configfs/file.c33
1 files changed, 2 insertions, 31 deletions
diff --git a/fs/configfs/file.c b/fs/configfs/file.c
index d98be5e01328..3527c7c6def8 100644
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -77,36 +77,6 @@ static int fill_read_buffer(struct dentry * dentry, struct configfs_buffer * buf
77 return ret; 77 return ret;
78} 78}
79 79
80
81/**
82 * flush_read_buffer - push buffer to userspace.
83 * @buffer: data buffer for file.
84 * @userbuf: user-passed buffer.
85 * @count: number of bytes requested.
86 * @ppos: file position.
87 *
88 * Copy the buffer we filled in fill_read_buffer() to userspace.
89 * This is done at the reader's leisure, copying and advancing
90 * the amount they specify each time.
91 * This may be called continuously until the buffer is empty.
92 */
93static int flush_read_buffer(struct configfs_buffer * buffer, char __user * buf,
94 size_t count, loff_t * ppos)
95{
96 int error;
97
98 if (*ppos > buffer->count)
99 return 0;
100
101 if (count > (buffer->count - *ppos))
102 count = buffer->count - *ppos;
103
104 error = copy_to_user(buf,buffer->page + *ppos,count);
105 if (!error)
106 *ppos += count;
107 return error ? -EFAULT : count;
108}
109
110/** 80/**
111 * configfs_read_file - read an attribute. 81 * configfs_read_file - read an attribute.
112 * @file: file pointer. 82 * @file: file pointer.
@@ -139,7 +109,8 @@ configfs_read_file(struct file *file, char __user *buf, size_t count, loff_t *pp
139 } 109 }
140 pr_debug("%s: count = %zd, ppos = %lld, buf = %s\n", 110 pr_debug("%s: count = %zd, ppos = %lld, buf = %s\n",
141 __FUNCTION__, count, *ppos, buffer->page); 111 __FUNCTION__, count, *ppos, buffer->page);
142 retval = flush_read_buffer(buffer,buf,count,ppos); 112 retval = simple_read_from_buffer(buf, count, ppos, buffer->page,
113 buffer->count);
143out: 114out:
144 up(&buffer->sem); 115 up(&buffer->sem);
145 return retval; 116 return retval;