@@ -551,9 +551,7 @@ int tomoyo_write_alias_policy(char *data, const bool is_delete)
551551 return tomoyo_update_alias_entry (data , cp , is_delete );
552552}
553553
554- /* Domain create/delete/undelete handler. */
555-
556- /* #define TOMOYO_DEBUG_DOMAIN_UNDELETE */
554+ /* Domain create/delete handler. */
557555
558556/**
559557 * tomoyo_delete_domain - Delete a domain.
@@ -571,100 +569,22 @@ int tomoyo_delete_domain(char *domainname)
571569 tomoyo_fill_path_info (& name );
572570 /***** EXCLUSIVE SECTION START *****/
573571 down_write (& tomoyo_domain_list_lock );
574- #ifdef TOMOYO_DEBUG_DOMAIN_UNDELETE
575- printk (KERN_DEBUG "tomoyo_delete_domain %s\n" , domainname );
576- list_for_each_entry (domain , & tomoyo_domain_list , list ) {
577- if (tomoyo_pathcmp (domain -> domainname , & name ))
578- continue ;
579- printk (KERN_DEBUG "List: %p %u\n" , domain , domain -> is_deleted );
580- }
581- #endif
582572 /* Is there an active domain? */
583573 list_for_each_entry (domain , & tomoyo_domain_list , list ) {
584- struct tomoyo_domain_info * domain2 ;
585574 /* Never delete tomoyo_kernel_domain */
586575 if (domain == & tomoyo_kernel_domain )
587576 continue ;
588577 if (domain -> is_deleted ||
589578 tomoyo_pathcmp (domain -> domainname , & name ))
590579 continue ;
591- /* Mark already deleted domains as non undeletable. */
592- list_for_each_entry (domain2 , & tomoyo_domain_list , list ) {
593- if (!domain2 -> is_deleted ||
594- tomoyo_pathcmp (domain2 -> domainname , & name ))
595- continue ;
596- #ifdef TOMOYO_DEBUG_DOMAIN_UNDELETE
597- if (domain2 -> is_deleted != 255 )
598- printk (KERN_DEBUG
599- "Marked %p as non undeletable\n" ,
600- domain2 );
601- #endif
602- domain2 -> is_deleted = 255 ;
603- }
604- /* Delete and mark active domain as undeletable. */
605- domain -> is_deleted = 1 ;
606- #ifdef TOMOYO_DEBUG_DOMAIN_UNDELETE
607- printk (KERN_DEBUG "Marked %p as undeletable\n" , domain );
608- #endif
580+ domain -> is_deleted = true;
609581 break ;
610582 }
611583 up_write (& tomoyo_domain_list_lock );
612584 /***** EXCLUSIVE SECTION END *****/
613585 return 0 ;
614586}
615587
616- /**
617- * tomoyo_undelete_domain - Undelete a domain.
618- *
619- * @domainname: The name of domain.
620- *
621- * Returns pointer to "struct tomoyo_domain_info" on success, NULL otherwise.
622- */
623- struct tomoyo_domain_info * tomoyo_undelete_domain (const char * domainname )
624- {
625- struct tomoyo_domain_info * domain ;
626- struct tomoyo_domain_info * candidate_domain = NULL ;
627- struct tomoyo_path_info name ;
628-
629- name .name = domainname ;
630- tomoyo_fill_path_info (& name );
631- /***** EXCLUSIVE SECTION START *****/
632- down_write (& tomoyo_domain_list_lock );
633- #ifdef TOMOYO_DEBUG_DOMAIN_UNDELETE
634- printk (KERN_DEBUG "tomoyo_undelete_domain %s\n" , domainname );
635- list_for_each_entry (domain , & tomoyo_domain_list , list ) {
636- if (tomoyo_pathcmp (domain -> domainname , & name ))
637- continue ;
638- printk (KERN_DEBUG "List: %p %u\n" , domain , domain -> is_deleted );
639- }
640- #endif
641- list_for_each_entry (domain , & tomoyo_domain_list , list ) {
642- if (tomoyo_pathcmp (& name , domain -> domainname ))
643- continue ;
644- if (!domain -> is_deleted ) {
645- /* This domain is active. I can't undelete. */
646- candidate_domain = NULL ;
647- #ifdef TOMOYO_DEBUG_DOMAIN_UNDELETE
648- printk (KERN_DEBUG "%p is active. I can't undelete.\n" ,
649- domain );
650- #endif
651- break ;
652- }
653- /* Is this domain undeletable? */
654- if (domain -> is_deleted == 1 )
655- candidate_domain = domain ;
656- }
657- if (candidate_domain ) {
658- candidate_domain -> is_deleted = 0 ;
659- #ifdef TOMOYO_DEBUG_DOMAIN_UNDELETE
660- printk (KERN_DEBUG "%p was undeleted.\n" , candidate_domain );
661- #endif
662- }
663- up_write (& tomoyo_domain_list_lock );
664- /***** EXCLUSIVE SECTION END *****/
665- return candidate_domain ;
666- }
667-
668588/**
669589 * tomoyo_find_or_assign_new_domain - Create a domain.
670590 *
@@ -711,18 +631,14 @@ struct tomoyo_domain_info *tomoyo_find_or_assign_new_domain(const char *
711631 /***** CRITICAL SECTION END *****/
712632 if (flag )
713633 continue ;
714- #ifdef TOMOYO_DEBUG_DOMAIN_UNDELETE
715- printk (KERN_DEBUG "Reusing %p %s\n" , domain ,
716- domain -> domainname -> name );
717- #endif
718634 list_for_each_entry (ptr , & domain -> acl_info_list , list ) {
719635 ptr -> type |= TOMOYO_ACL_DELETED ;
720636 }
721637 tomoyo_set_domain_flag (domain , true, domain -> flags );
722638 domain -> profile = profile ;
723639 domain -> quota_warned = false;
724640 mb (); /* Avoid out-of-order execution. */
725- domain -> is_deleted = 0 ;
641+ domain -> is_deleted = false ;
726642 goto out ;
727643 }
728644 /* No memory reusable. Create using new memory. */
0 commit comments