TOMOYO: Use callback for updating entries.

Use common "struct list_head" + "bool" + "u8" structure and
use common code for elements using that structure.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: James Morris <jmorris@namei.org>
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index 811adb5..6556e5d 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -950,8 +950,6 @@
 				   struct tomoyo_mount_acl *ptr)
 {
 	const int pos = head->read_avail;
-	if (ptr->is_deleted)
-		return true;
 	if (!tomoyo_io_printf(head, TOMOYO_KEYWORD_ALLOW_MOUNT) ||
 	    !tomoyo_print_name_union(head, &ptr->dev_name) ||
 	    !tomoyo_print_name_union(head, &ptr->dir_name) ||
@@ -977,6 +975,8 @@
 {
 	const u8 acl_type = ptr->type;
 
+	if (ptr->is_deleted)
+		return true;
 	if (acl_type == TOMOYO_TYPE_PATH_ACL) {
 		struct tomoyo_path_acl *acl
 			= container_of(ptr, struct tomoyo_path_acl, head);