diff options
Diffstat (limited to 'fs/configfs')
-rw-r--r-- | fs/configfs/file.c | 33 |
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 | */ | ||
93 | static 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); | ||
143 | out: | 114 | out: |
144 | up(&buffer->sem); | 115 | up(&buffer->sem); |
145 | return retval; | 116 | return retval; |