lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALZtONDQyrKS7dSsa5=cvW_U+jFw3zT_sy1txCvOTm-6GJt4PQ@mail.gmail.com>
Date:	Thu, 28 May 2015 17:33:31 -0400
From:	Dan Streetman <ddstreet@...e.org>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	Paul McKenney <paulmck@...ux.vnet.ibm.com>,
	Josh Triplett <josh@...htriplett.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Lai Jiangshan <laijs@...fujitsu.com>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] rcu: introduce list_last_or_null_rcu

On Thu, May 28, 2015 at 5:30 PM, Dan Streetman <ddstreet@...e.org> wrote:
> On Thu, May 28, 2015 at 5:28 PM, Steven Rostedt <rostedt@...dmis.org> wrote:
>> On Thu, 28 May 2015 17:19:40 -0400
>> Dan Streetman <ddstreet@...e.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.

to clarify, list_first_or_null_rcu() returns the list entry, not the
list_head; list_last_or_null_rcu() should likewise return the same
type.

git grep only shows 12 users of list_first_or_null_rcu(), so maybe
changing the name to list_first_entry_or_null_rcu() makes sense, which
would then use a new inline list_first_or_null_rcu() that returns
list_head instead of the entry type...

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ