Skip to contentSkip to conversation

: Convert NodeACl and MappedLUNs to use generic configfs struct config_item_types

PATCH New Nicholas A. Bellinger 1 participant 1 message Feb 25, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 3/4 : Convert NodeACl and MappedLUNs to use generic configfs struct config_item_types

From: Nicholas Bellinger <[email protected]>

This patch converts the iSCSI target fabric module configfs code in iscsi_target_configfs.c to use new generic configfs infrastructure provided by target_core_fabric_configfs.c for the handling of NodeACL and MappedLUN config groups. This patch reproduces the existing v3.x /sys/kernel/config/target/iscsi layout using the provided TF_* macros with existing code.

This includes the conversion of iscsi_target_configfs.c code to do the following:

*) Use struct target_core_fabric_ops calls lio_target_make_nodeacl() and lio_target_drop_nodeacl() for handling allocation and release of explict NodeACLs.

*) Setup of existing iSCSI fabric dependent attributes for generic struct config_item_type->ct_attrs[] in iscsi_target_register_configfs()

*) Convert NodeACL base, param and auth attributes to use TF_NACL_*_ATTR() macros from target_core_fabric_configfs.h.

*) Setup the iSCSI fabric dependent attributes for the default tfc_discovery_cit attributes in /sys/kernel/config/target/iscsi/discovery_auth

This patch also removes the following all iSCSI fabric dependent MappedLUN group, link, and attribute code and the now unused 3.x configfs ACL add/delete functions from iscsi_target_tpg.c Also all remaining internal usage of struct config_group in iscsi_target_core.h data structures are now unused and have been removed.

---
 drivers/target/lio-target/iscsi_auth_kernel.h      |    5 +-
 drivers/target/lio-target/iscsi_target_configfs.c  |  956 ++++----------------
 drivers/target/lio-target/iscsi_target_core.h      |    6 +-
 .../target/lio-target/iscsi_target_nodeattrib.c    |    2 +-
 drivers/target/lio-target/iscsi_target_tpg.c       |   58 +-
 drivers/target/lio-target/iscsi_target_tpg.h       |    4 +-
 6 files changed, 216 insertions(+), 815 deletions(-)
drivers/target/lio-target/iscsi_auth_kernel.h +3 -2
index aa6f31e..3ac48b0 100644
@@ -100,7 +100,8 @@ u32 iscsi_handle_authentication(
 					" CHAP auth\n");
 			return -1;
 		}
-		iscsi_nacl = (iscsi_node_acl_t *)se_nacl->fabric_acl_ptr;
+		iscsi_nacl = container_of(se_nacl, iscsi_node_acl_t,
+				se_node_acl);
 		if (!(iscsi_nacl)) {
 			printk(KERN_ERR "Unable to locate iscsi_node_acl_t for"
 					" CHAP auth\n");
@@ -112,7 +113,7 @@ u32 iscsi_handle_authentication(
 		/*
 		 * For SessionType=Discovery
 		 */
-		auth = &iscsi_global->discovery_auth;	
+		auth = &iscsi_global->discovery_acl.node_auth;	
 	}
 
 #ifdef SNMP_SUPPORT
drivers/target/lio-target/iscsi_target_configfs.c +191 -765

1,183 lines not on this page · raw message

drivers/target/lio-target/iscsi_target_core.h +2 -4
index 1136c82..3bb26f7 100644
@@ -735,7 +735,6 @@ typedef struct iscsi_node_attrib_s {
 	u32			tmr_cold_reset;
 	u32			tmr_warm_reset;
 	struct iscsi_node_acl_s *nacl;
-	struct config_group	acl_attrib_group;
 } ____cacheline_aligned iscsi_node_attrib_t;
 
 struct se_dev_entry_s;
@@ -750,13 +749,12 @@ typedef struct iscsi_node_auth_s {
 	char			password[MAX_PASS_LEN];
 	char			userid_mutual[MAX_USER_LEN];
 	char			password_mutual[MAX_PASS_LEN];
-	struct config_group	auth_attrib_group;
 } ____cacheline_aligned iscsi_node_auth_t;
 
 typedef struct iscsi_node_acl_s {
 	iscsi_node_attrib_t	node_attrib;
 	iscsi_node_auth_t	node_auth;
-	struct se_node_acl_s	*se_node_acl;
+	struct se_node_acl_s	se_node_acl;
 } ____cacheline_aligned iscsi_node_acl_t;
 
 #define ISCSI_NODE_ATTRIB(t)	(&(t)->node_attrib)
@@ -933,7 +931,7 @@ typedef struct iscsi_global_s {
 	/* Semaphore used for allocate of iscsi_conn_t->auth_id */
 	struct semaphore	auth_id_sem;
 	/* Used for iSCSI discovery session authentication */
-	iscsi_node_auth_t	discovery_auth;
+	iscsi_node_acl_t	discovery_acl;
 	iscsi_portal_group_t	*discovery_tpg;
 #ifdef DEBUG_ERL
 	iscsi_debug_erl_t	*debug_erl;
drivers/target/lio-target/iscsi_target_nodeattrib.c +1 -1
index 886bd36..085f554 100644
@@ -136,7 +136,7 @@ extern int iscsi_na_nopin_timeout(
 	iscsi_node_attrib_t *a = &acl->node_attrib;
 	iscsi_session_t *sess;
 	iscsi_conn_t *conn;
-	se_node_acl_t *se_nacl = a->nacl->se_node_acl;
+	se_node_acl_t *se_nacl = &a->nacl->se_node_acl;
 	se_session_t *se_sess;
 	u32 orig_nopin_timeout = a->nopin_timeout;
 
drivers/target/lio-target/iscsi_target_tpg.c +17 -41

94 lines not on this page · raw message

drivers/target/lio-target/iscsi_target_tpg.h +2 -2
index ab44cfd..3141d7e 100644
@@ -12,8 +12,8 @@ extern char *lio_tpg_parse_pr_out_transport_id(const char *, u32 *, char **);
 extern int lio_tpg_check_demo_mode(struct se_portal_group_s *);
 extern int lio_tpg_check_demo_mode_cache(struct se_portal_group_s *);
 extern int lio_tpg_check_demo_mode_write_protect(struct se_portal_group_s *);
-extern void *lio_tpg_alloc_fabric_acl(struct se_portal_group_s *,
-			struct se_node_acl_s *);
+extern int lio_tpg_check_prod_mode_write_protect(struct se_portal_group_s *);
+extern struct se_node_acl_s *lio_tpg_alloc_fabric_acl(struct se_portal_group_s *);
 extern void lio_tpg_release_fabric_acl(struct se_portal_group_s *,
 			struct se_node_acl_s *);
 extern int lio_tpg_shutdown_session(struct se_session_s *);
Signature · 1 line
1.5.6.5