* [PATCH 1/2] compat: backport loff_t noop_llseek @ 2010-09-15 20:42 Hauke Mehrtens 2010-09-15 20:42 ` [PATCH 2/2] compat: backport list_for_each_entry_continue_rcu Hauke Mehrtens 0 siblings, 1 reply; 3+ messages in thread From: Hauke Mehrtens @ 2010-09-15 20:42 UTC (permalink / raw) To: lrodriguez; +Cc: linux-wireless, mcgrof, Hauke Mehrtens This is needed by some debug parts of mac80211. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> --- compat/compat-2.6.35.c | 17 +++++++++++++++++ include/linux/compat-2.6.35.h | 2 ++ 2 files changed, 19 insertions(+), 0 deletions(-) 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 */ -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] compat: backport list_for_each_entry_continue_rcu 2010-09-15 20:42 [PATCH 1/2] compat: backport loff_t noop_llseek Hauke Mehrtens @ 2010-09-15 20:42 ` Hauke Mehrtens 2010-09-15 21:58 ` Luis R. Rodriguez 0 siblings, 1 reply; 3+ messages in thread From: Hauke Mehrtens @ 2010-09-15 20:42 UTC (permalink / raw) To: lrodriguez; +Cc: linux-wireless, mcgrof, Hauke Mehrtens This is needed for new driver carl9170. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> --- include/linux/compat-2.6.31.h | 11 +++++++++++ include/linux/compat-2.6.33.h | 14 ++++++++++++++ 2 files changed, 25 insertions(+), 0 deletions(-) diff --git a/include/linux/compat-2.6.31.h b/include/linux/compat-2.6.31.h index 54ddefd..6c454cb 100644 --- a/include/linux/compat-2.6.31.h +++ b/include/linux/compat-2.6.31.h @@ -191,6 +191,17 @@ void compat_synchronize_threaded_irq(struct compat_threaded_irq *comp) cancel_work_sync(&comp->work); } +/** + * list_entry_rcu - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + * + * This primitive may safely run concurrently with the _rcu list-mutation + * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). + */ +#define list_entry_rcu(ptr, type, member) \ + container_of(rcu_dereference(ptr), type, member) #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) */ diff --git a/include/linux/compat-2.6.33.h b/include/linux/compat-2.6.33.h index e4dff72..e7e20d9 100644 --- a/include/linux/compat-2.6.33.h +++ b/include/linux/compat-2.6.33.h @@ -98,6 +98,20 @@ int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function, #define kfifo_out(a, b, c) __kfifo_get(*a, b, c) #define kfifo_len(a) __kfifo_len(*a) +/** + * list_for_each_entry_continue_rcu - continue iteration over list of given type + * @pos: the type * to use as a loop cursor. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + * + * Continue to iterate over list of given type, continuing after + * the current position. + */ +#define list_for_each_entry_continue_rcu(pos, head, member) \ + for (pos = list_entry_rcu(pos->member.next, typeof(*pos), member); \ + prefetch(pos->member.next), &pos->member != (head); \ + pos = list_entry_rcu(pos->member.next, typeof(*pos), member)) + #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) */ #endif /* LINUX_26_33_COMPAT_H */ -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] compat: backport list_for_each_entry_continue_rcu 2010-09-15 20:42 ` [PATCH 2/2] compat: backport list_for_each_entry_continue_rcu Hauke Mehrtens @ 2010-09-15 21:58 ` Luis R. Rodriguez 0 siblings, 0 replies; 3+ messages in thread From: Luis R. Rodriguez @ 2010-09-15 21:58 UTC (permalink / raw) To: Hauke Mehrtens Cc: Luis Rodriguez, linux-wireless@vger.kernel.org, mcgrof@infradead.org On Wed, Sep 15, 2010 at 01:42:33PM -0700, Hauke Mehrtens wrote: > This is needed for new driver carl9170. > > Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Thanks, applied and pushed out! Luis ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-09-15 21:58 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-09-15 20:42 [PATCH 1/2] compat: backport loff_t noop_llseek Hauke Mehrtens 2010-09-15 20:42 ` [PATCH 2/2] compat: backport list_for_each_entry_continue_rcu Hauke Mehrtens 2010-09-15 21:58 ` Luis R. Rodriguez
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).