lkml.org 
[lkml]   [2015]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 1/2] rcu: introduce list_last_or_null_rcu
On Thu, May 28, 2015 at 5:28 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> On Thu, 28 May 2015 17:19:40 -0400
> Dan Streetman <ddstreet@ieee.org> wrote:
>
>> >> oh, ok. how do we do type-generic inline funcs? return void*?
>> >
>> > I was hoping that you would tell me. I use macros in that case.
>>
>> ha, if I ever get to the point where i think i know more than you,
>> i'll let you know ;-)
>
> static inline struct list_head *
> list_last_or_null_rcu(struct list_head *ptr)
> {
> struct list_head *entry;
> struct list_head *last;
>
> for (entry = list_next_rcu(ptr);
> entry != ptr; entry = list_next_rcu(entry))
> last = __entry;
> if (last != ptr)
> return last;
> return NULL;
> }
>
> #define list_last_or_null_entry_rcu(ptr, type, member) \
> ({ \
> struct list_head *__ptr = list_last_or_null_rcu(ptr); \
> __ptr ? list_entry_rcu(__ptr, type, member) : NULL; \
> })

well sure :-)

however, the rcu list function currently doesn't include "entry" in
the function name, but returns the list entry (not the list_head).
that could be changed, but all callers would need to change, too.

>
> -- Steve


\
 
 \ /
  Last update: 2015-05-29 00:21    [W:0.086 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site