diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-06-16 18:27:42 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-06-29 10:57:26 +0200 |
commit | 1bf9d14dff4a2c4de6152c6f751bdaf6896b68bb (patch) | |
tree | 9f4f52547bc8cbdc934126344edeb96d441c0383 | |
parent | ecryptfs: switch ecryptfs_decode_and_decrypt_filename() from dentry to sb (diff) | |
download | linux-1bf9d14dff4a2c4de6152c6f751bdaf6896b68bb.tar.xz linux-1bf9d14dff4a2c4de6152c6f751bdaf6896b68bb.zip |
new helper: fixed_size_llseek()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/read_write.c | 20 | ||||
-rw-r--r-- | include/linux/fs.h | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/fs/read_write.c b/fs/read_write.c index f646c8b565b9..782dfc3acebc 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -145,6 +145,26 @@ loff_t generic_file_llseek(struct file *file, loff_t offset, int whence) EXPORT_SYMBOL(generic_file_llseek); /** + * fixed_size_llseek - llseek implementation for fixed-sized devices + * @file: file structure to seek on + * @offset: file offset to seek to + * @whence: type of seek + * @size: size of the file + * + */ +loff_t fixed_size_llseek(struct file *file, loff_t offset, int whence, loff_t size) +{ + switch (whence) { + case SEEK_SET: case SEEK_CUR: case SEEK_END: + return generic_file_llseek_size(file, offset, whence, + size, size); + default: + return -EINVAL; + } +} +EXPORT_SYMBOL(fixed_size_llseek); + +/** * noop_llseek - No Operation Performed llseek implementation * @file: file structure to seek on * @offset: file offset to seek to diff --git a/include/linux/fs.h b/include/linux/fs.h index 1db01c13ddce..803b7fa2520a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2428,6 +2428,8 @@ extern loff_t no_llseek(struct file *file, loff_t offset, int whence); extern loff_t generic_file_llseek(struct file *file, loff_t offset, int whence); extern loff_t generic_file_llseek_size(struct file *file, loff_t offset, int whence, loff_t maxsize, loff_t eof); +extern loff_t fixed_size_llseek(struct file *file, loff_t offset, + int whence, loff_t size); extern int generic_file_open(struct inode * inode, struct file * filp); extern int nonseekable_open(struct inode * inode, struct file * filp); |