]> git.openfabrics.org - ~emulex/for-vlad/old/compat.git/commitdiff
compat: backport loff_t noop_llseek
authorHauke Mehrtens <hauke@hauke-m.de>
Wed, 15 Sep 2010 20:42:32 +0000 (13:42 -0700)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Wed, 15 Sep 2010 21:58:06 +0000 (14:58 -0700)
This is needed by some debug parts of mac80211.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
compat/compat-2.6.35.c
include/linux/compat-2.6.35.h

index 0d702ed39a20ce1025ad27932bc0a75384c3b406..abb08c709905bc6dd55c3c7a94a3581dd94b69db 100644 (file)
@@ -31,4 +31,21 @@ int hex_to_bin(char ch)
 }
 EXPORT_SYMBOL(hex_to_bin);
 
+/**
+ * noop_llseek - No Operation Performed llseek implementation
+ * @file:      file structure to seek on
+ * @offset:    file offset to seek to
+ * @origin:    type of seek
+ *
+ * This is an implementation of ->llseek useable for the rare special case when
+ * userspace expects the seek to succeed but the (device) file is actually not
+ * able to perform the seek. In this case you use noop_llseek() instead of
+ * falling back to the default implementation of ->llseek.
+ */
+loff_t noop_llseek(struct file *file, loff_t offset, int origin)
+{
+       return file->f_pos;
+}
+EXPORT_SYMBOL(noop_llseek);
+
 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) */
index f0562cd760068b30b55619175044b1985341a6da..32fd039184888017cb71e5b263ae00db25dafedb 100644 (file)
@@ -27,6 +27,8 @@ static inline wait_queue_head_t *sk_sleep(struct sock *sk)
 
 int hex_to_bin(char ch);
 
+extern loff_t noop_llseek(struct file *file, loff_t offset, int origin);
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)) */
 
 #endif /* LINUX_26_35_COMPAT_H */