aboutsummaryrefslogtreecommitdiffstats
path: root/security/tomoyo/common.h
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2010-06-23 22:28:14 -0400
committerJames Morris <jmorris@namei.org>2010-08-02 01:34:44 -0400
commit475e6fa3d340e75a454ea09191a29e52e2ee6e71 (patch)
tree44e8222ec250f8573199fc3132eaeb2f8922f85e /security/tomoyo/common.h
parent5448ec4f5062ef75ce74f8d7784d4cea9c46ad00 (diff)
TOMOYO: Change list iterator.
Change list_for_each_cookie to (1) start from current position rather than next position (2) remove temporary cursor (3) check that srcu_read_lock() is held Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/tomoyo/common.h')
-rw-r--r--security/tomoyo/common.h16
1 files changed, 4 insertions, 12 deletions
diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h
index 1277724edae4..cdc9ef56fd86 100644
--- a/security/tomoyo/common.h
+++ b/security/tomoyo/common.h
@@ -1023,19 +1023,11 @@ static inline bool tomoyo_same_number_union
1023/** 1023/**
1024 * list_for_each_cookie - iterate over a list with cookie. 1024 * list_for_each_cookie - iterate over a list with cookie.
1025 * @pos: the &struct list_head to use as a loop cursor. 1025 * @pos: the &struct list_head to use as a loop cursor.
1026 * @cookie: the &struct list_head to use as a cookie.
1027 * @head: the head for your list. 1026 * @head: the head for your list.
1028 *
1029 * Same with list_for_each_rcu() except that this primitive uses @cookie
1030 * so that we can continue iteration.
1031 * @cookie must be NULL when iteration starts, and @cookie will become
1032 * NULL when iteration finishes.
1033 */ 1027 */
1034#define list_for_each_cookie(pos, cookie, head) \ 1028#define list_for_each_cookie(pos, head) \
1035 for (({ if (!cookie) \ 1029 if (!pos) \
1036 cookie = head; }), \ 1030 pos = srcu_dereference((head)->next, &tomoyo_ss); \
1037 pos = rcu_dereference((cookie)->next); \ 1031 for ( ; pos != (head); pos = srcu_dereference(pos->next, &tomoyo_ss))
1038 prefetch(pos->next), pos != (head) || ((cookie) = NULL); \
1039 (cookie) = pos, pos = rcu_dereference(pos->next))
1040 1032
1041#endif /* !defined(_SECURITY_TOMOYO_COMMON_H) */ 1033#endif /* !defined(_SECURITY_TOMOYO_COMMON_H) */