From: Hauke Mehrtens Date: Wed, 15 Sep 2010 20:42:32 +0000 (-0700) Subject: compat: backport loff_t noop_llseek X-Git-Tag: v2.6.37-rc1-1~19 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=764a6496348bc04e03434d5c6d8761e5f5e2b280;p=~emulex%2Ffor-vlad%2Fold%2Fcompat.git compat: backport loff_t noop_llseek This is needed by some debug parts of mac80211. Signed-off-by: Hauke Mehrtens --- diff --git a/compat/compat-2.6.35.c b/compat/compat-2.6.35.c index 0d702ed..abb08c7 100644 --- a/compat/compat-2.6.35.c +++ b/compat/compat-2.6.35.c @@ -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) */ diff --git a/include/linux/compat-2.6.35.h b/include/linux/compat-2.6.35.h index f0562cd..32fd039 100644 --- a/include/linux/compat-2.6.35.h +++ b/include/linux/compat-2.6.35.h @@ -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 */