[PATCH 01/15] Introduce noop_llseek()

From: Jan Blunck
Date: Fri Nov 20 2009 - 11:44:43 EST


The noop_llseek() is a llseek() operation that filesystems can use that
don't want to support seeking (leave the file->f_pos untouched) but still
want to let the syscall itself to succeed.

Signed-off-by: Jan Blunck <jblunck@xxxxxxx>
---
fs/read_write.c | 6 ++++++
include/linux/fs.h | 1 +
2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/fs/read_write.c b/fs/read_write.c
index 3ac2898..7a01d11 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -97,6 +97,12 @@ loff_t generic_file_llseek(struct file *file, loff_t offset, int origin)
}
EXPORT_SYMBOL(generic_file_llseek);

+loff_t noop_llseek(struct file *file, loff_t offset, int origin)
+{
+ return file->f_pos;
+}
+EXPORT_SYMBOL(noop_llseek);
+
loff_t no_llseek(struct file *file, loff_t offset, int origin)
{
return -ESPIPE;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2620a8c..0a0c1f4 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2237,6 +2237,7 @@ extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,

extern void
file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
+extern loff_t noop_llseek(struct file *file, loff_t offset, int origin);
extern loff_t no_llseek(struct file *file, loff_t offset, int origin);
extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin);
extern loff_t generic_file_llseek_unlocked(struct file *file, loff_t offset,
--
1.6.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/