summaryrefslogtreecommitdiffstats
path: root/security/tomoyo/memory.c
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2011-06-26 23:16:36 +0900
committerJames Morris <jmorris@namei.org>2011-06-29 09:31:19 +1000
commit0df7e8b8f1c25c10820bdc679555f2fbfb897ca0 (patch)
tree626a0304fceec0bbee93e43a24bc0f813fe230b7 /security/tomoyo/memory.c
parentb5bc60b4ce313b6dbb42e7d32915dcf0a07c2a68 (diff)
downloadop-kernel-dev-0df7e8b8f1c25c10820bdc679555f2fbfb897ca0.zip
op-kernel-dev-0df7e8b8f1c25c10820bdc679555f2fbfb897ca0.tar.gz
TOMOYO: Cleanup part 3.
Use common structure for ACL with "struct list_head" + "atomic_t". Use array/struct where possible. Remove is_group from "struct tomoyo_name_union"/"struct tomoyo_number_union". Pass "struct file"->private_data rather than "struct file". Update some of comments. Bring tomoyo_same_acl_head() from common.h to domain.c . Bring tomoyo_invalid()/tomoyo_valid() from common.h to util.c . 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/memory.c')
-rw-r--r--security/tomoyo/memory.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/security/tomoyo/memory.c b/security/tomoyo/memory.c
index 42a7b1b..dfef0cb 100644
--- a/security/tomoyo/memory.c
+++ b/security/tomoyo/memory.c
@@ -110,10 +110,10 @@ struct tomoyo_group *tomoyo_get_group(const char *group_name, const u8 idx)
return NULL;
if (mutex_lock_interruptible(&tomoyo_policy_lock))
goto out;
- list_for_each_entry(group, &tomoyo_group_list[idx], list) {
+ list_for_each_entry(group, &tomoyo_group_list[idx], head.list) {
if (e.group_name != group->group_name)
continue;
- atomic_inc(&group->users);
+ atomic_inc(&group->head.users);
found = true;
break;
}
@@ -121,8 +121,8 @@ struct tomoyo_group *tomoyo_get_group(const char *group_name, const u8 idx)
struct tomoyo_group *entry = tomoyo_commit_ok(&e, sizeof(e));
if (entry) {
INIT_LIST_HEAD(&entry->member_list);
- atomic_set(&entry->users, 1);
- list_add_tail_rcu(&entry->list,
+ atomic_set(&entry->head.users, 1);
+ list_add_tail_rcu(&entry->head.list,
&tomoyo_group_list[idx]);
group = entry;
found = true;
@@ -164,10 +164,10 @@ const struct tomoyo_path_info *tomoyo_get_name(const char *name)
head = &tomoyo_name_list[hash_long(hash, TOMOYO_HASH_BITS)];
if (mutex_lock_interruptible(&tomoyo_policy_lock))
return NULL;
- list_for_each_entry(ptr, head, list) {
+ list_for_each_entry(ptr, head, head.list) {
if (hash != ptr->entry.hash || strcmp(name, ptr->entry.name))
continue;
- atomic_inc(&ptr->users);
+ atomic_inc(&ptr->head.users);
goto out;
}
ptr = kzalloc(sizeof(*ptr) + len, GFP_NOFS);
@@ -183,9 +183,9 @@ const struct tomoyo_path_info *tomoyo_get_name(const char *name)
atomic_add(allocated_len, &tomoyo_policy_memory_size);
ptr->entry.name = ((char *) ptr) + sizeof(*ptr);
memmove((char *) ptr->entry.name, name, len);
- atomic_set(&ptr->users, 1);
+ atomic_set(&ptr->head.users, 1);
tomoyo_fill_path_info(&ptr->entry);
- list_add_tail(&ptr->list, head);
+ list_add_tail(&ptr->head.list, head);
out:
mutex_unlock(&tomoyo_policy_lock);
return ptr ? &ptr->entry : NULL;
OpenPOWER on IntegriCloud