Re: [Containers] [PATCH 2/7] pid: Add do_each_pid_task

From: Eric W. Biederman
Date: Wed Aug 16 2006 - 02:32:46 EST


"Serge E. Hallyn" <serue@xxxxxxxxxx> writes:

> Quoting Eric W. Biederman (ebiederm@xxxxxxxxxxxx):
>> To avoid pid rollover confusion the kernel needs to work with
>> struct pid * instead of pid_t. Currently there is not an iterator
>> that walks through all of the tasks of a given pid type starting
>> with a struct pid. This prevents us replacing some pid_t instances
>> with struct pid. So this patch adds do_each_pid_task which walks
>> through the set of task for a given pid type starting with a struct pid.
>>
>> Signed-off-by: Eric W. Biederman <ebiederm@xxxxxxxxxxxx>
>> ---
>> include/linux/pid.h | 13 +++++++++++++
>> 1 files changed, 13 insertions(+), 0 deletions(-)
>>
>> diff --git a/include/linux/pid.h b/include/linux/pid.h
>> index 93da7e2..4007114 100644
>> --- a/include/linux/pid.h
>> +++ b/include/linux/pid.h
>> @@ -118,4 +118,17 @@ #define while_each_task_pid(who, type, t
>> 1; }) ); \
>> }
>>
>> +#define do_each_pid_task(pid, type, task) \
>
> Hmm, defining do_each_pid_task right after do_each_task_pid could result
> in some frustration :)
>
> Though not sure of a better name - do_each_task_structpid?

A couple of things.
- I think do_each_pid_task is probably the most descriptive name
I can come up with. As these are tasks of a pid. I don't quite understand
where the old name came from.

- Whatever we pick for the new function is the name we are going to use
for a long time so I don't want it to be clumsy. The existing function
will go away after everything is updated.

- If you pick the wrong one you will get a compile error, as integers and
pointers are not very interchangeable.

I hate the temporary confusion but I don't see a better alternative.

Eric

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