: Update virtual SAS NodeACL allocation handling for v4.0
Subsystems (3)
PATCH 4/4 : Update virtual SAS NodeACL allocation handling for v4.0
From: Nicholas Bellinger <[email protected]>
This patch updates tcm_loop_tpg_alloc_fabric_acl() and tcm_loop_tpg_release_fabric_acl() to follow TCM v4.0 convention for alloc/release of the demo mode se_node_acl_t used for the TCM_Loop virtual SAS Initiator Ports. This includes hanging struct se_node_acl_s off the fabric dependent struct tcm_loop_nacl so that container_of() macros can be used to access internal structures in tcm_loop from struct se_node_acl_s presented pointers.
Also, this patch removes the legacy usage of fabric->reg_default_groups_callback() in tcm_loop_register_configfs().
Signed-off-by Nicholas A. Bellinger <[email protected]>
--- drivers/target/tcm_loop/tcm_loop_configfs.c | 5 +---- drivers/target/tcm_loop/tcm_loop_core.h | 2 +- drivers/target/tcm_loop/tcm_loop_fabric.c | 10 ++++------ drivers/target/tcm_loop/tcm_loop_fabric.h | 3 ++- 4 files changed, 8 insertions(+), 12 deletions(-)
drivers/target/tcm_loop/tcm_loop_configfs.c +1 -4
@@ -545,10 +545,7 @@ int tcm_loop_register_configfs(void) fabric->tf_ops.get_fabric_sense_len = &tcm_loop_get_fabric_sense_len; fabric->tf_ops.is_state_remove = &tcm_loop_is_state_remove; fabric->tf_ops.pack_lun = &tcm_loop_pack_lun; -/* -* TCM_Loop does not currently register any default configfs group(s) -*/ - fabric->reg_default_groups_callback =NULL ; + tf_cg = &fabric->tf_group;/* * Setup function pointers for generic logic in target_core_fabric_configfs.c
drivers/target/tcm_loop/tcm_loop_core.h +1 -1
@@ -33,7 +33,7 @@ struct tcm_loop_nexus { };struct tcm_loop_nacl { -struct se_node_acl_s *se_nacl; +struct se_node_acl_s se_node_acl; };struct tcm_loop_tpg {
drivers/target/tcm_loop/tcm_loop_fabric.c +4 -6
@@ -184,8 +184,7 @@ int tcm_loop_check_demo_mode_write_protect(se_portal_group_t *se_tpg) }void *tcm_loop_tpg_alloc_fabric_acl ( -se_portal_group_t *se_tpg, -se_node_acl_t *se_nacl) +se_portal_group_t *se_tpg) {struct tcm_loop_nacl *tl_nacl;
@@ -194,17 +193,16 @@ void *tcm_loop_tpg_alloc_fabric_acl(printk (KERN_ERR "Unable to allocate struct tcm_loop_nacl\n" );return NULL ; } - tl_nacl->se_nacl = se_nacl; -return (void *)tl_nacl; +return &tl_nacl->se_node_acl; }void tcm_loop_tpg_release_fabric_acl (se_portal_group_t *se_tpg,se_node_acl_t *se_nacl) { -struct tcm_loop_nacl *tl_nacl = - (struct tcm_loop_nacl *)se_nacl->fabric_acl_ptr; +struct tcm_loop_nacl *tl_nacl =container_of (se_nacl, + struct tcm_loop_nacl, se_node_acl);kfree (tl_nacl); }
drivers/target/tcm_loop/tcm_loop_fabric.h +2 -1
@@ -11,7 +11,8 @@ extern char *tcm_loop_parse_pr_out_transport_id(const char *, u32 *, char **);extern int tcm_loop_check_demo_mode (se_portal_group_t *);extern int tcm_loop_check_demo_mode_cache (se_portal_group_t *);extern int tcm_loop_check_demo_mode_write_protect (se_portal_group_t *); -void *tcm_loop_tpg_alloc_fabric_acl (se_portal_group_t *,se_node_acl_t *); +extern struct se_node_acl_s *tcm_loop_tpg_alloc_fabric_acl ( +se_portal_group_t *);void tcm_loop_tpg_release_fabric_acl (se_portal_group_t *,se_node_acl_t *);#ifdef SNMP_SUPPORT extern u32 tcm_loop_tpg_get_inst_index (se_portal_group_t *);
Signature · 1 line
1.5.6.5