aboutsummaryrefslogtreecommitdiffstats
path: root/security/tomoyo/common.c
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2009-06-02 07:42:24 -0400
committerJames Morris <jmorris@namei.org>2009-06-02 17:51:51 -0400
commit7d2948b1248109dbc7f4aaf9867c54b1912d494c (patch)
tree24edc8fa319598bc32b7d53c7b61fb3ec9ae9e92 /security/tomoyo/common.c
parentab588ccadc80f6ef5495e83e176e88c5c0fc2d0e (diff)
TOMOYO: Simplify policy reader.
We can directly assign the result of tomoyo_io_printf() to done flag. Signed-off-by: Kentaro Takeda <takedakn@nttdata.co.jp> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: Toshiharu Harada <haradats@nttdata.co.jp> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/tomoyo/common.c')
-rw-r--r--security/tomoyo/common.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index a42fe02c6144..6d2561276a7b 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -1113,10 +1113,9 @@ static int tomoyo_read_manager_policy(struct tomoyo_io_buffer *head)
1113 list); 1113 list);
1114 if (ptr->is_deleted) 1114 if (ptr->is_deleted)
1115 continue; 1115 continue;
1116 if (!tomoyo_io_printf(head, "%s\n", ptr->manager->name)) { 1116 done = tomoyo_io_printf(head, "%s\n", ptr->manager->name);
1117 done = false; 1117 if (!done)
1118 break; 1118 break;
1119 }
1120 } 1119 }
1121 up_read(&tomoyo_policy_manager_list_lock); 1120 up_read(&tomoyo_policy_manager_list_lock);
1122 head->read_eof = done; 1121 head->read_eof = done;
@@ -1441,15 +1440,14 @@ static int tomoyo_read_domain_policy(struct tomoyo_io_buffer *head)
1441 TOMOYO_DOMAIN_FLAGS_IGNORE_GLOBAL_ALLOW_READ) 1440 TOMOYO_DOMAIN_FLAGS_IGNORE_GLOBAL_ALLOW_READ)
1442 ignore_global_allow_read 1441 ignore_global_allow_read
1443 = TOMOYO_KEYWORD_IGNORE_GLOBAL_ALLOW_READ "\n"; 1442 = TOMOYO_KEYWORD_IGNORE_GLOBAL_ALLOW_READ "\n";
1444 if (!tomoyo_io_printf(head, 1443 done = tomoyo_io_printf(head, "%s\n" TOMOYO_KEYWORD_USE_PROFILE
1445 "%s\n" TOMOYO_KEYWORD_USE_PROFILE "%u\n" 1444 "%u\n%s%s%s\n",
1446 "%s%s%s\n", domain->domainname->name, 1445 domain->domainname->name,
1447 domain->profile, quota_exceeded, 1446 domain->profile, quota_exceeded,
1448 transition_failed, 1447 transition_failed,
1449 ignore_global_allow_read)) { 1448 ignore_global_allow_read);
1450 done = false; 1449 if (!done)
1451 break; 1450 break;
1452 }
1453 head->read_step = 2; 1451 head->read_step = 2;
1454acl_loop: 1452acl_loop:
1455 if (head->read_step == 3) 1453 if (head->read_step == 3)
@@ -1457,24 +1455,22 @@ acl_loop:
1457 /* Print ACL entries in the domain. */ 1455 /* Print ACL entries in the domain. */
1458 down_read(&tomoyo_domain_acl_info_list_lock); 1456 down_read(&tomoyo_domain_acl_info_list_lock);
1459 list_for_each_cookie(apos, head->read_var2, 1457 list_for_each_cookie(apos, head->read_var2,
1460 &domain->acl_info_list) { 1458 &domain->acl_info_list) {
1461 struct tomoyo_acl_info *ptr 1459 struct tomoyo_acl_info *ptr
1462 = list_entry(apos, struct tomoyo_acl_info, 1460 = list_entry(apos, struct tomoyo_acl_info,
1463 list); 1461 list);
1464 if (!tomoyo_print_entry(head, ptr)) { 1462 done = tomoyo_print_entry(head, ptr);
1465 done = false; 1463 if (!done)
1466 break; 1464 break;
1467 }
1468 } 1465 }
1469 up_read(&tomoyo_domain_acl_info_list_lock); 1466 up_read(&tomoyo_domain_acl_info_list_lock);
1470 if (!done) 1467 if (!done)
1471 break; 1468 break;
1472 head->read_step = 3; 1469 head->read_step = 3;
1473tail_mark: 1470tail_mark:
1474 if (!tomoyo_io_printf(head, "\n")) { 1471 done = tomoyo_io_printf(head, "\n");
1475 done = false; 1472 if (!done)
1476 break; 1473 break;
1477 }
1478 head->read_step = 1; 1474 head->read_step = 1;
1479 if (head->read_single_domain) 1475 if (head->read_single_domain)
1480 break; 1476 break;
@@ -1544,11 +1540,10 @@ static int tomoyo_read_domain_profile(struct tomoyo_io_buffer *head)
1544 domain = list_entry(pos, struct tomoyo_domain_info, list); 1540 domain = list_entry(pos, struct tomoyo_domain_info, list);
1545 if (domain->is_deleted) 1541 if (domain->is_deleted)
1546 continue; 1542 continue;
1547 if (!tomoyo_io_printf(head, "%u %s\n", domain->profile, 1543 done = tomoyo_io_printf(head, "%u %s\n", domain->profile,
1548 domain->domainname->name)) { 1544 domain->domainname->name);
1549 done = false; 1545 if (!done)
1550 break; 1546 break;
1551 }
1552 } 1547 }
1553 up_read(&tomoyo_domain_list_lock); 1548 up_read(&tomoyo_domain_list_lock);
1554 head->read_eof = done; 1549 head->read_eof = done;