lkml.org 
[lkml]   [2011]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 4/5] RCU: Add TASK_RCU_OFFSET
On 04/11/2011 01:12 PM, Paul E. McKenney wrote:

> -static inline struct task_struct *next_thread(const struct task_struct *p)
> -{
> - return list_entry_rcu(p->thread_group.next,
> - struct task_struct, thread_group);
> -}
> +/* Avoid #include hell for inlining rcu_read_lock(). */
> +#define next_thread(p) \
> + list_entry_rcu((p)->thread_group.next, struct task_struct, thread_group)
>


It is strange for me.
The user of the API "next_thread(p)" must has two headers included, sched.h and rculist.h

I know this is a very popular pattern of user space code, is it OK for kernel?
I think a file(even a header file) uses API(Marco), it should includes the the corresponding
headers, it reduces surprises(example, the name of "next_thread()" has no "rcu",
it is not expected that rcuxxxx.h is required).

I admit the work will become very much simpler if this pattern is allowed.



man fcntl:
#include <unistd.h>
#include <fcntl.h>

int fcntl(int fd, int cmd, ... /* arg */ );


\
 
 \ /
  Last update: 2011-04-11 10:31    [W:0.634 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site