@@ -634,8 +634,7 @@ int core_tpg_register(
634634 const struct target_core_fabric_ops * tfo ,
635635 struct se_wwn * se_wwn ,
636636 struct se_portal_group * se_tpg ,
637- void * tpg_fabric_ptr ,
638- int se_tpg_type )
637+ int proto_id )
639638{
640639 struct se_lun * lun ;
641640 u32 i ;
@@ -661,8 +660,7 @@ int core_tpg_register(
661660 init_completion (& lun -> lun_ref_comp );
662661 }
663662
664- se_tpg -> se_tpg_type = se_tpg_type ;
665- se_tpg -> se_tpg_fabric_ptr = tpg_fabric_ptr ;
663+ se_tpg -> proto_id = proto_id ;
666664 se_tpg -> se_tpg_tfo = tfo ;
667665 se_tpg -> se_tpg_wwn = se_wwn ;
668666 atomic_set (& se_tpg -> tpg_pr_ref_count , 0 );
@@ -673,7 +671,7 @@ int core_tpg_register(
673671 spin_lock_init (& se_tpg -> session_lock );
674672 spin_lock_init (& se_tpg -> tpg_lun_lock );
675673
676- if (se_tpg -> se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL ) {
674+ if (se_tpg -> proto_id >= 0 ) {
677675 if (core_tpg_setup_virtual_lun0 (se_tpg ) < 0 ) {
678676 array_free (se_tpg -> tpg_lun_list ,
679677 TRANSPORT_MAX_LUNS_PER_TPG );
@@ -685,26 +683,24 @@ int core_tpg_register(
685683 list_add_tail (& se_tpg -> se_tpg_node , & tpg_list );
686684 spin_unlock_bh (& tpg_lock );
687685
688- pr_debug ("TARGET_CORE[%s]: Allocated %s struct se_portal_group for"
689- " endpoint: %s, Portal Tag: %u\n" , tfo -> get_fabric_name (),
690- (se_tpg -> se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL ) ?
691- "Normal" : "Discovery" , (tfo -> tpg_get_wwn (se_tpg ) == NULL ) ?
692- "None" : tfo -> tpg_get_wwn (se_tpg ), tfo -> tpg_get_tag (se_tpg ));
686+ pr_debug ("TARGET_CORE[%s]: Allocated portal_group for endpoint: %s, "
687+ "Proto: %d, Portal Tag: %u\n" , tfo -> get_fabric_name (),
688+ tfo -> tpg_get_wwn (se_tpg ) ? tfo -> tpg_get_wwn (se_tpg ) : NULL ,
689+ se_tpg -> proto_id , tfo -> tpg_get_tag (se_tpg ));
693690
694691 return 0 ;
695692}
696693EXPORT_SYMBOL (core_tpg_register );
697694
698695int core_tpg_deregister (struct se_portal_group * se_tpg )
699696{
697+ const struct target_core_fabric_ops * tfo = se_tpg -> se_tpg_tfo ;
700698 struct se_node_acl * nacl , * nacl_tmp ;
701699
702- pr_debug ("TARGET_CORE[%s]: Deallocating %s struct se_portal_group"
703- " for endpoint: %s Portal Tag %u\n" ,
704- (se_tpg -> se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL ) ?
705- "Normal" : "Discovery" , se_tpg -> se_tpg_tfo -> get_fabric_name (),
706- se_tpg -> se_tpg_tfo -> tpg_get_wwn (se_tpg ),
707- se_tpg -> se_tpg_tfo -> tpg_get_tag (se_tpg ));
700+ pr_debug ("TARGET_CORE[%s]: Deallocating portal_group for endpoint: %s, "
701+ "Proto: %d, Portal Tag: %u\n" , tfo -> get_fabric_name (),
702+ tfo -> tpg_get_wwn (se_tpg ) ? tfo -> tpg_get_wwn (se_tpg ) : NULL ,
703+ se_tpg -> proto_id , tfo -> tpg_get_tag (se_tpg ));
708704
709705 spin_lock_bh (& tpg_lock );
710706 list_del (& se_tpg -> se_tpg_node );
@@ -732,10 +728,9 @@ int core_tpg_deregister(struct se_portal_group *se_tpg)
732728 }
733729 spin_unlock_irq (& se_tpg -> acl_node_lock );
734730
735- if (se_tpg -> se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL )
731+ if (se_tpg -> proto_id >= 0 )
736732 core_tpg_remove_lun (se_tpg , & se_tpg -> tpg_virt_lun0 );
737733
738- se_tpg -> se_tpg_fabric_ptr = NULL ;
739734 array_free (se_tpg -> tpg_lun_list , TRANSPORT_MAX_LUNS_PER_TPG );
740735 return 0 ;
741736}
0 commit comments