diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2010-06-17 03:53:24 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2010-08-02 01:34:40 -0400 |
commit | a230f9e7121cbcbfe23bd5a630abf6b53cece555 (patch) | |
tree | a81820f41d57ffd8704aaef4331f696030d7ba77 /security/tomoyo/gc.c | |
parent | a98aa4debe2728abb3353e35fc5d110dcc0d7f0d (diff) |
TOMOYO: Use array of "struct list_head".
Assign list id and make the lists as array of "struct list_head".
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.c | 41 |
1 files changed, 7 insertions, 34 deletions
diff --git a/security/tomoyo/gc.c b/security/tomoyo/gc.c index 446d59f8ae25..414e18bd93c7 100644 --- a/security/tomoyo/gc.c +++ b/security/tomoyo/gc.c | |||
@@ -11,24 +11,6 @@ | |||
11 | #include <linux/kthread.h> | 11 | #include <linux/kthread.h> |
12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
13 | 13 | ||
14 | enum tomoyo_policy_id { | ||
15 | TOMOYO_ID_GROUP, | ||
16 | TOMOYO_ID_PATH_GROUP, | ||
17 | TOMOYO_ID_NUMBER_GROUP, | ||
18 | TOMOYO_ID_DOMAIN_INITIALIZER, | ||
19 | TOMOYO_ID_DOMAIN_KEEPER, | ||
20 | TOMOYO_ID_AGGREGATOR, | ||
21 | TOMOYO_ID_ALIAS, | ||
22 | TOMOYO_ID_GLOBALLY_READABLE, | ||
23 | TOMOYO_ID_PATTERN, | ||
24 | TOMOYO_ID_NO_REWRITE, | ||
25 | TOMOYO_ID_MANAGER, | ||
26 | TOMOYO_ID_NAME, | ||
27 | TOMOYO_ID_ACL, | ||
28 | TOMOYO_ID_DOMAIN, | ||
29 | TOMOYO_MAX_POLICY | ||
30 | }; | ||
31 | |||
32 | struct tomoyo_gc_entry { | 14 | struct tomoyo_gc_entry { |
33 | struct list_head list; | 15 | struct list_head list; |
34 | int type; | 16 | int type; |
@@ -226,17 +208,6 @@ static void tomoyo_del_number_group(struct list_head *element) | |||
226 | container_of(element, typeof(*member), head.list); | 208 | container_of(element, typeof(*member), head.list); |
227 | } | 209 | } |
228 | 210 | ||
229 | static struct list_head *tomoyo_policy_list[TOMOYO_MAX_POLICY] = { | ||
230 | [TOMOYO_ID_GLOBALLY_READABLE] = &tomoyo_globally_readable_list, | ||
231 | [TOMOYO_ID_PATTERN] = &tomoyo_pattern_list, | ||
232 | [TOMOYO_ID_NO_REWRITE] = &tomoyo_no_rewrite_list, | ||
233 | [TOMOYO_ID_DOMAIN_INITIALIZER] = &tomoyo_domain_initializer_list, | ||
234 | [TOMOYO_ID_DOMAIN_KEEPER] = &tomoyo_domain_keeper_list, | ||
235 | [TOMOYO_ID_AGGREGATOR] = &tomoyo_aggregator_list, | ||
236 | [TOMOYO_ID_ALIAS] = &tomoyo_alias_list, | ||
237 | [TOMOYO_ID_MANAGER] = &tomoyo_policy_manager_list, | ||
238 | }; | ||
239 | |||
240 | static bool tomoyo_collect_member(struct list_head *member_list, int id) | 211 | static bool tomoyo_collect_member(struct list_head *member_list, int id) |
241 | { | 212 | { |
242 | struct tomoyo_acl_head *member; | 213 | struct tomoyo_acl_head *member; |
@@ -267,9 +238,8 @@ static void tomoyo_collect_entry(void) | |||
267 | if (mutex_lock_interruptible(&tomoyo_policy_lock)) | 238 | if (mutex_lock_interruptible(&tomoyo_policy_lock)) |
268 | return; | 239 | return; |
269 | for (i = 0; i < TOMOYO_MAX_POLICY; i++) { | 240 | for (i = 0; i < TOMOYO_MAX_POLICY; i++) { |
270 | if (tomoyo_policy_list[i]) | 241 | if (!tomoyo_collect_member(&tomoyo_policy_list[i], i)) |
271 | if (!tomoyo_collect_member(tomoyo_policy_list[i], i)) | 242 | goto unlock; |
272 | goto unlock; | ||
273 | } | 243 | } |
274 | { | 244 | { |
275 | struct tomoyo_domain_info *domain; | 245 | struct tomoyo_domain_info *domain; |
@@ -298,7 +268,9 @@ static void tomoyo_collect_entry(void) | |||
298 | } | 268 | } |
299 | { | 269 | { |
300 | struct tomoyo_group *group; | 270 | struct tomoyo_group *group; |
301 | list_for_each_entry_rcu(group, &tomoyo_path_group_list, list) { | 271 | list_for_each_entry_rcu(group, |
272 | &tomoyo_group_list[TOMOYO_PATH_GROUP], | ||
273 | list) { | ||
302 | tomoyo_collect_member(&group->member_list, | 274 | tomoyo_collect_member(&group->member_list, |
303 | TOMOYO_ID_PATH_GROUP); | 275 | TOMOYO_ID_PATH_GROUP); |
304 | if (!list_empty(&group->member_list) || | 276 | if (!list_empty(&group->member_list) || |
@@ -311,7 +283,8 @@ static void tomoyo_collect_entry(void) | |||
311 | } | 283 | } |
312 | { | 284 | { |
313 | struct tomoyo_group *group; | 285 | struct tomoyo_group *group; |
314 | list_for_each_entry_rcu(group, &tomoyo_number_group_list, | 286 | list_for_each_entry_rcu(group, |
287 | &tomoyo_group_list[TOMOYO_NUMBER_GROUP], | ||
315 | list) { | 288 | list) { |
316 | tomoyo_collect_member(&group->member_list, | 289 | tomoyo_collect_member(&group->member_list, |
317 | TOMOYO_ID_NUMBER_GROUP); | 290 | TOMOYO_ID_NUMBER_GROUP); |