summaryrefslogtreecommitdiffstats
path: root/security/tomoyo/gc.c
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2010-06-17 09:55:58 +0200
committerJames Morris <jmorris@namei.org>2010-08-02 07:34:42 +0200
commit7c2ea22e3c5463627ca98924cd65cb9e480dc29c (patch)
tree3a105a08cf75c77689bdfe890c64f9ae433748b9 /security/tomoyo/gc.c
parentTOMOYO: Aggregate reader functions. (diff)
downloadlinux-7c2ea22e3c5463627ca98924cd65cb9e480dc29c.tar.xz
linux-7c2ea22e3c5463627ca98924cd65cb9e480dc29c.zip
TOMOYO: Merge path_group and number_group.
Use common code for "path_group" and "number_group". 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/gc.c')
-rw-r--r--security/tomoyo/gc.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/security/tomoyo/gc.c b/security/tomoyo/gc.c
index 414e18bd93c7..cf62a4ee79c2 100644
--- a/security/tomoyo/gc.c
+++ b/security/tomoyo/gc.c
@@ -266,33 +266,25 @@ static void tomoyo_collect_entry(void)
goto unlock;
}
}
- {
+ for (i = 0; i < TOMOYO_MAX_GROUP; i++) {
+ struct list_head *list = &tomoyo_group_list[i];
+ int id;
struct tomoyo_group *group;
- list_for_each_entry_rcu(group,
- &tomoyo_group_list[TOMOYO_PATH_GROUP],
- list) {
- tomoyo_collect_member(&group->member_list,
- TOMOYO_ID_PATH_GROUP);
- if (!list_empty(&group->member_list) ||
- atomic_read(&group->users))
- continue;
- if (!tomoyo_add_to_gc(TOMOYO_ID_GROUP,
- &group->list))
- goto unlock;
+ switch (i) {
+ case 0:
+ id = TOMOYO_ID_PATH_GROUP;
+ break;
+ default:
+ id = TOMOYO_ID_NUMBER_GROUP;
+ break;
}
- }
- {
- struct tomoyo_group *group;
- list_for_each_entry_rcu(group,
- &tomoyo_group_list[TOMOYO_NUMBER_GROUP],
- list) {
- tomoyo_collect_member(&group->member_list,
- TOMOYO_ID_NUMBER_GROUP);
+ list_for_each_entry(group, list, list) {
+ if (!tomoyo_collect_member(&group->member_list, id))
+ goto unlock;
if (!list_empty(&group->member_list) ||
atomic_read(&group->users))
continue;
- if (!tomoyo_add_to_gc(TOMOYO_ID_GROUP,
- &group->list))
+ if (!tomoyo_add_to_gc(TOMOYO_ID_GROUP, &group->list))
goto unlock;
}
}