aboutsummaryrefslogtreecommitdiffstats
path: root/security/tomoyo/gc.c
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2010-06-17 03:52:29 -0400
committerJames Morris <jmorris@namei.org>2010-08-02 01:34:40 -0400
commita98aa4debe2728abb3353e35fc5d110dcc0d7f0d (patch)
tree0334194761e26961339dd126e997c23e4060ce72 /security/tomoyo/gc.c
parent5fb49870e6d48d81d8ca0e1ef979073dc9a820f7 (diff)
TOMOYO: Merge tomoyo_path_group and tomoyo_number_group
"struct tomoyo_path_group" and "struct tomoyo_number_group" are identical. Rename tomoyo_path_group/tomoyo_number_group to tomoyo_group and tomoyo_path_group_member to tomoyo_path_group and tomoyo_number_group_member to tomoyo_unmber_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.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/security/tomoyo/gc.c b/security/tomoyo/gc.c
index a54bd823fcd5..446d59f8ae25 100644
--- a/security/tomoyo/gc.c
+++ b/security/tomoyo/gc.c
@@ -12,10 +12,9 @@
12#include <linux/slab.h> 12#include <linux/slab.h>
13 13
14enum tomoyo_policy_id { 14enum tomoyo_policy_id {
15 TOMOYO_ID_GROUP,
15 TOMOYO_ID_PATH_GROUP, 16 TOMOYO_ID_PATH_GROUP,
16 TOMOYO_ID_PATH_GROUP_MEMBER,
17 TOMOYO_ID_NUMBER_GROUP, 17 TOMOYO_ID_NUMBER_GROUP,
18 TOMOYO_ID_NUMBER_GROUP_MEMBER,
19 TOMOYO_ID_DOMAIN_INITIALIZER, 18 TOMOYO_ID_DOMAIN_INITIALIZER,
20 TOMOYO_ID_DOMAIN_KEEPER, 19 TOMOYO_ID_DOMAIN_KEEPER,
21 TOMOYO_ID_AGGREGATOR, 20 TOMOYO_ID_AGGREGATOR,
@@ -207,31 +206,24 @@ static void tomoyo_del_name(struct list_head *element)
207 container_of(element, typeof(*ptr), list); 206 container_of(element, typeof(*ptr), list);
208} 207}
209 208
210static void tomoyo_del_path_group_member(struct list_head *element) 209static void tomoyo_del_path_group(struct list_head *element)
211{ 210{
212 struct tomoyo_path_group_member *member = 211 struct tomoyo_path_group *member =
213 container_of(element, typeof(*member), head.list); 212 container_of(element, typeof(*member), head.list);
214 tomoyo_put_name(member->member_name); 213 tomoyo_put_name(member->member_name);
215} 214}
216 215
217static void tomoyo_del_path_group(struct list_head *element) 216static void tomoyo_del_group(struct list_head *element)
218{ 217{
219 struct tomoyo_path_group *group = 218 struct tomoyo_group *group =
220 container_of(element, typeof(*group), list); 219 container_of(element, typeof(*group), list);
221 tomoyo_put_name(group->group_name); 220 tomoyo_put_name(group->group_name);
222} 221}
223 222
224static void tomoyo_del_number_group_member(struct list_head *element)
225{
226 struct tomoyo_number_group_member *member =
227 container_of(element, typeof(*member), head.list);
228}
229
230static void tomoyo_del_number_group(struct list_head *element) 223static void tomoyo_del_number_group(struct list_head *element)
231{ 224{
232 struct tomoyo_number_group *group = 225 struct tomoyo_number_group *member =
233 container_of(element, typeof(*group), list); 226 container_of(element, typeof(*member), head.list);
234 tomoyo_put_name(group->group_name);
235} 227}
236 228
237static struct list_head *tomoyo_policy_list[TOMOYO_MAX_POLICY] = { 229static struct list_head *tomoyo_policy_list[TOMOYO_MAX_POLICY] = {
@@ -305,28 +297,28 @@ static void tomoyo_collect_entry(void)
305 } 297 }
306 } 298 }
307 { 299 {
308 struct tomoyo_path_group *group; 300 struct tomoyo_group *group;
309 list_for_each_entry_rcu(group, &tomoyo_path_group_list, list) { 301 list_for_each_entry_rcu(group, &tomoyo_path_group_list, list) {
310 tomoyo_collect_member(&group->member_list, 302 tomoyo_collect_member(&group->member_list,
311 TOMOYO_ID_PATH_GROUP_MEMBER); 303 TOMOYO_ID_PATH_GROUP);
312 if (!list_empty(&group->member_list) || 304 if (!list_empty(&group->member_list) ||
313 atomic_read(&group->users)) 305 atomic_read(&group->users))
314 continue; 306 continue;
315 if (!tomoyo_add_to_gc(TOMOYO_ID_PATH_GROUP, 307 if (!tomoyo_add_to_gc(TOMOYO_ID_GROUP,
316 &group->list)) 308 &group->list))
317 goto unlock; 309 goto unlock;
318 } 310 }
319 } 311 }
320 { 312 {
321 struct tomoyo_number_group *group; 313 struct tomoyo_group *group;
322 list_for_each_entry_rcu(group, &tomoyo_number_group_list, 314 list_for_each_entry_rcu(group, &tomoyo_number_group_list,
323 list) { 315 list) {
324 tomoyo_collect_member(&group->member_list, 316 tomoyo_collect_member(&group->member_list,
325 TOMOYO_ID_NUMBER_GROUP_MEMBER); 317 TOMOYO_ID_NUMBER_GROUP);
326 if (!list_empty(&group->member_list) || 318 if (!list_empty(&group->member_list) ||
327 atomic_read(&group->users)) 319 atomic_read(&group->users))
328 continue; 320 continue;
329 if (!tomoyo_add_to_gc(TOMOYO_ID_NUMBER_GROUP, 321 if (!tomoyo_add_to_gc(TOMOYO_ID_GROUP,
330 &group->list)) 322 &group->list))
331 goto unlock; 323 goto unlock;
332 } 324 }
@@ -377,14 +369,11 @@ static void tomoyo_kfree_entry(void)
377 if (!tomoyo_del_domain(element)) 369 if (!tomoyo_del_domain(element))
378 continue; 370 continue;
379 break; 371 break;
380 case TOMOYO_ID_PATH_GROUP_MEMBER:
381 tomoyo_del_path_group_member(element);
382 break;
383 case TOMOYO_ID_PATH_GROUP: 372 case TOMOYO_ID_PATH_GROUP:
384 tomoyo_del_path_group(element); 373 tomoyo_del_path_group(element);
385 break; 374 break;
386 case TOMOYO_ID_NUMBER_GROUP_MEMBER: 375 case TOMOYO_ID_GROUP:
387 tomoyo_del_number_group_member(element); 376 tomoyo_del_group(element);
388 break; 377 break;
389 case TOMOYO_ID_NUMBER_GROUP: 378 case TOMOYO_ID_NUMBER_GROUP:
390 tomoyo_del_number_group(element); 379 tomoyo_del_number_group(element);