Re: [PATCH] pids: simplify do_each_task_pid/while_each_task_pid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/13, Christoph Hellwig wrote:
>
> On Thu, Apr 13, 2006 at 08:37:27PM +0400, Oleg Nesterov wrote:
> > +#define do_each_task_pid(who, type, task)					\
> > +	do {									\
> > +		struct hlist_node *pos___;					\
> > +		struct pid *pid___ = find_pid(who);				\
> > +		if (pid___ != NULL)						\
> > +			hlist_for_each_entry_rcu((task), pos___,		\
> > +				&pid___->tasks[type], pids[type].node) {
> > +
> > +#define while_each_task_pid(who, type, task)					\
> > +			}							\
> > +	} while (0)
> 
> This is prtty ugly.  Can't we just have a
> 
> #define for_each_task_pid(task, pid, type, pos) \
> 	hlist_for_each_entry_rcu((task), (pos),  \
> 		(&(pid))->tasks[type], pids[type].node) {
> 
> and move the find_pid to the caller?  That would make the code a whole lot
> more readable.

Then the caller should check find_pid() doesn't return NULL. But yes,
we can hide this check inside for_each_task_pid().

But what about current users of do_each_task_pid ? We can't just remove
these macros.

Oleg.

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux