diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2011-06-26 10:16:36 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2011-06-28 19:31:19 -0400 |
commit | 0df7e8b8f1c25c10820bdc679555f2fbfb897ca0 (patch) | |
tree | 626a0304fceec0bbee93e43a24bc0f813fe230b7 /security/tomoyo/memory.c | |
parent | b5bc60b4ce313b6dbb42e7d32915dcf0a07c2a68 (diff) |
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.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/security/tomoyo/memory.c b/security/tomoyo/memory.c index 42a7b1ba8cbf..dfef0cb268dc 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) | |||
110 | return NULL; | 110 | return NULL; |
111 | if (mutex_lock_interruptible(&tomoyo_policy_lock)) | 111 | if (mutex_lock_interruptible(&tomoyo_policy_lock)) |
112 | goto out; | 112 | goto out; |
113 | list_for_each_entry(group, &tomoyo_group_list[idx], list) { | 113 | list_for_each_entry(group, &tomoyo_group_list[idx], head.list) { |
114 | if (e.group_name != group->group_name) | 114 | if (e.group_name != group->group_name) |
115 | continue; | 115 | continue; |
116 | atomic_inc(&group->users); | 116 | atomic_inc(&group->head.users); |
117 | found = true; | 117 | found = true; |
118 | break; | 118 | break; |
119 | } | 119 | } |
@@ -121,8 +121,8 @@ struct tomoyo_group *tomoyo_get_group(const char *group_name, const u8 idx) | |||
121 | struct tomoyo_group *entry = tomoyo_commit_ok(&e, sizeof(e)); | 121 | struct tomoyo_group *entry = tomoyo_commit_ok(&e, sizeof(e)); |
122 | if (entry) { | 122 | if (entry) { |
123 | INIT_LIST_HEAD(&entry->member_list); | 123 | INIT_LIST_HEAD(&entry->member_list); |
124 | atomic_set(&entry->users, 1); | 124 | atomic_set(&entry->head.users, 1); |
125 | list_add_tail_rcu(&entry->list, | 125 | list_add_tail_rcu(&entry->head.list, |
126 | &tomoyo_group_list[idx]); | 126 | &tomoyo_group_list[idx]); |
127 | group = entry; | 127 | group = entry; |
128 | found = true; | 128 | found = true; |
@@ -164,10 +164,10 @@ const struct tomoyo_path_info *tomoyo_get_name(const char *name) | |||
164 | head = &tomoyo_name_list[hash_long(hash, TOMOYO_HASH_BITS)]; | 164 | head = &tomoyo_name_list[hash_long(hash, TOMOYO_HASH_BITS)]; |
165 | if (mutex_lock_interruptible(&tomoyo_policy_lock)) | 165 | if (mutex_lock_interruptible(&tomoyo_policy_lock)) |
166 | return NULL; | 166 | return NULL; |
167 | list_for_each_entry(ptr, head, list) { | 167 | list_for_each_entry(ptr, head, head.list) { |
168 | if (hash != ptr->entry.hash || strcmp(name, ptr->entry.name)) | 168 | if (hash != ptr->entry.hash || strcmp(name, ptr->entry.name)) |
169 | continue; | 169 | continue; |
170 | atomic_inc(&ptr->users); | 170 | atomic_inc(&ptr->head.users); |
171 | goto out; | 171 | goto out; |
172 | } | 172 | } |
173 | ptr = kzalloc(sizeof(*ptr) + len, GFP_NOFS); | 173 | ptr = kzalloc(sizeof(*ptr) + len, GFP_NOFS); |
@@ -183,9 +183,9 @@ const struct tomoyo_path_info *tomoyo_get_name(const char *name) | |||
183 | atomic_add(allocated_len, &tomoyo_policy_memory_size); | 183 | atomic_add(allocated_len, &tomoyo_policy_memory_size); |
184 | ptr->entry.name = ((char *) ptr) + sizeof(*ptr); | 184 | ptr->entry.name = ((char *) ptr) + sizeof(*ptr); |
185 | memmove((char *) ptr->entry.name, name, len); | 185 | memmove((char *) ptr->entry.name, name, len); |
186 | atomic_set(&ptr->users, 1); | 186 | atomic_set(&ptr->head.users, 1); |
187 | tomoyo_fill_path_info(&ptr->entry); | 187 | tomoyo_fill_path_info(&ptr->entry); |
188 | list_add_tail(&ptr->list, head); | 188 | list_add_tail(&ptr->head.list, head); |
189 | out: | 189 | out: |
190 | mutex_unlock(&tomoyo_policy_lock); | 190 | mutex_unlock(&tomoyo_policy_lock); |
191 | return ptr ? &ptr->entry : NULL; | 191 | return ptr ? &ptr->entry : NULL; |