diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-09-18 16:20:41 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:51:35 -0400 |
commit | 768f3591e2b1cc309fd6f10d6579b216026d7817 (patch) | |
tree | 0328abd6a6a306e648120ac2ef20332954e852e0 /include/linux/list.h | |
parent | 1a348ccc1047a00507e554826775a3d81f7f3437 (diff) |
[NETNS]: Cleanup list walking in setup_net and cleanup_net
I proposed introducing a list_for_each_entry_continue_reverse macro
to be used in setup_net() when unrolling the failed ->init callback.
Here is the macro and some more cleanup in the setup_net() itself
to remove one variable from the stack :) The same thing is for the
cleanup_net() - the existing list_for_each_entry_reverse() is used.
Minor, but the code looks nicer.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/list.h')
-rw-r--r-- | include/linux/list.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/list.h b/include/linux/list.h index f29fc9c1a964..ad9dcb9e3375 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
@@ -525,6 +525,20 @@ static inline void list_splice_init_rcu(struct list_head *list, | |||
525 | pos = list_entry(pos->member.next, typeof(*pos), member)) | 525 | pos = list_entry(pos->member.next, typeof(*pos), member)) |
526 | 526 | ||
527 | /** | 527 | /** |
528 | * list_for_each_entry_continue_reverse - iterate backwards from the given point | ||
529 | * @pos: the type * to use as a loop cursor. | ||
530 | * @head: the head for your list. | ||
531 | * @member: the name of the list_struct within the struct. | ||
532 | * | ||
533 | * Start to iterate over list of given type backwards, continuing after | ||
534 | * the current position. | ||
535 | */ | ||
536 | #define list_for_each_entry_continue_reverse(pos, head, member) \ | ||
537 | for (pos = list_entry(pos->member.prev, typeof(*pos), member); \ | ||
538 | prefetch(pos->member.prev), &pos->member != (head); \ | ||
539 | pos = list_entry(pos->member.prev, typeof(*pos), member)) | ||
540 | |||
541 | /** | ||
528 | * list_for_each_entry_from - iterate over list of given type from the current point | 542 | * list_for_each_entry_from - iterate over list of given type from the current point |
529 | * @pos: the type * to use as a loop cursor. | 543 | * @pos: the type * to use as a loop cursor. |
530 | * @head: the head for your list. | 544 | * @head: the head for your list. |