diff options
-rw-r--r-- | fs/read_write.c | 17 | ||||
-rw-r--r-- | include/linux/fs.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/fs/read_write.c b/fs/read_write.c index 113386d6fd2d..9c0485236e68 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -97,6 +97,23 @@ loff_t generic_file_llseek(struct file *file, loff_t offset, int origin) | |||
97 | } | 97 | } |
98 | EXPORT_SYMBOL(generic_file_llseek); | 98 | EXPORT_SYMBOL(generic_file_llseek); |
99 | 99 | ||
100 | /** | ||
101 | * noop_llseek - No Operation Performed llseek implementation | ||
102 | * @file: file structure to seek on | ||
103 | * @offset: file offset to seek to | ||
104 | * @origin: type of seek | ||
105 | * | ||
106 | * This is an implementation of ->llseek useable for the rare special case when | ||
107 | * userspace expects the seek to succeed but the (device) file is actually not | ||
108 | * able to perform the seek. In this case you use noop_llseek() instead of | ||
109 | * falling back to the default implementation of ->llseek. | ||
110 | */ | ||
111 | loff_t noop_llseek(struct file *file, loff_t offset, int origin) | ||
112 | { | ||
113 | return file->f_pos; | ||
114 | } | ||
115 | EXPORT_SYMBOL(noop_llseek); | ||
116 | |||
100 | loff_t no_llseek(struct file *file, loff_t offset, int origin) | 117 | loff_t no_llseek(struct file *file, loff_t offset, int origin) |
101 | { | 118 | { |
102 | return -ESPIPE; | 119 | return -ESPIPE; |
diff --git a/include/linux/fs.h b/include/linux/fs.h index b336cb9ca9a0..9682d52d1507 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -2228,6 +2228,7 @@ extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, | |||
2228 | 2228 | ||
2229 | extern void | 2229 | extern void |
2230 | file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); | 2230 | file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); |
2231 | extern loff_t noop_llseek(struct file *file, loff_t offset, int origin); | ||
2231 | extern loff_t no_llseek(struct file *file, loff_t offset, int origin); | 2232 | extern loff_t no_llseek(struct file *file, loff_t offset, int origin); |
2232 | extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin); | 2233 | extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin); |
2233 | extern loff_t generic_file_llseek_unlocked(struct file *file, loff_t offset, | 2234 | extern loff_t generic_file_llseek_unlocked(struct file *file, loff_t offset, |