diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-12-05 22:04:48 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-12-23 10:41:31 -0500 |
commit | b25472f9b96159cc0b9b7ed449448805973cd789 (patch) | |
tree | 7963f6d5adc2a82f6f10b4f9cf427ce931f67c76 /fs/read_write.c | |
parent | b808b1d632f6915e4d6b1badb927b2c970ad11bb (diff) |
new helpers: no_seek_end_llseek{,_size}()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/read_write.c')
-rw-r--r-- | fs/read_write.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/fs/read_write.c b/fs/read_write.c index 819ef3faf1bb..acb171331278 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -171,6 +171,45 @@ loff_t fixed_size_llseek(struct file *file, loff_t offset, int whence, loff_t si | |||
171 | EXPORT_SYMBOL(fixed_size_llseek); | 171 | EXPORT_SYMBOL(fixed_size_llseek); |
172 | 172 | ||
173 | /** | 173 | /** |
174 | * no_seek_end_llseek - llseek implementation for fixed-sized devices | ||
175 | * @file: file structure to seek on | ||
176 | * @offset: file offset to seek to | ||
177 | * @whence: type of seek | ||
178 | * | ||
179 | */ | ||
180 | loff_t no_seek_end_llseek(struct file *file, loff_t offset, int whence) | ||
181 | { | ||
182 | switch (whence) { | ||
183 | case SEEK_SET: case SEEK_CUR: | ||
184 | return generic_file_llseek_size(file, offset, whence, | ||
185 | ~0ULL, 0); | ||
186 | default: | ||
187 | return -EINVAL; | ||
188 | } | ||
189 | } | ||
190 | EXPORT_SYMBOL(no_seek_end_llseek); | ||
191 | |||
192 | /** | ||
193 | * no_seek_end_llseek_size - llseek implementation for fixed-sized devices | ||
194 | * @file: file structure to seek on | ||
195 | * @offset: file offset to seek to | ||
196 | * @whence: type of seek | ||
197 | * @size: maximal offset allowed | ||
198 | * | ||
199 | */ | ||
200 | loff_t no_seek_end_llseek_size(struct file *file, loff_t offset, int whence, loff_t size) | ||
201 | { | ||
202 | switch (whence) { | ||
203 | case SEEK_SET: case SEEK_CUR: | ||
204 | return generic_file_llseek_size(file, offset, whence, | ||
205 | size, 0); | ||
206 | default: | ||
207 | return -EINVAL; | ||
208 | } | ||
209 | } | ||
210 | EXPORT_SYMBOL(no_seek_end_llseek_size); | ||
211 | |||
212 | /** | ||
174 | * noop_llseek - No Operation Performed llseek implementation | 213 | * noop_llseek - No Operation Performed llseek implementation |
175 | * @file: file structure to seek on | 214 | * @file: file structure to seek on |
176 | * @offset: file offset to seek to | 215 | * @offset: file offset to seek to |