Messages in this thread | | | Date | Thu, 28 May 2015 14:10:10 -0700 | From | josh@joshtrip ... | Subject | Re: [PATCH 1/2] rcu: introduce list_last_or_null_rcu |
| |
On Thu, May 28, 2015 at 04:44:59PM -0400, Dan Streetman wrote: > On Thu, May 28, 2015 at 4:42 PM, Dan Streetman <ddstreet@ieee.org> wrote: > > On Thu, May 28, 2015 at 4:39 PM, <josh@joshtriplett.org> wrote: > >> On Thu, May 28, 2015 at 04:35:27PM -0400, Dan Streetman wrote: > >>> Add list_last_or_null_rcu(), to simplify getting the last entry from a > >>> rcu-protected list. The standard list_last_entry() can't be used as it > >>> is not rcu-protected; the list may be modified concurrently. And the > >>> ->prev pointer can't be used, as only the ->next pointers are protected > >>> by rcu. > >>> > >>> This simply iterates forward through the entire list, to get to the last > >>> entry. If the list is empty, it returns NULL. > >>> > >>> Signed-off-by: Dan Streetman <ddstreet@ieee.org> > >> > >> The list iteration functions are macros because they introduce a loop > >> with attached loop block. For this, is there any reason not to make it > >> an inline function instead of a macro? > > > > true, there's no reason i can see not to make it inline, let me send > > an updated patch. > > ha, as soon as i sent that email, i realized it can't be an inline > function, because the return value is (type *), not a predefined > value. Of course it could return void*, but unless there's a benefit > of making it an inline function, it seems to me like it would be > better as a #define.
Fair enough. Sigh, C.
- Josh Triplett
| |