Macro and qla npiv cleanups
Subsystems (8)
PATCH 4/5 target/qla2xxx: Define NPIV ops in terms of normal ops
In reply to Andy GroverInstead of defining a second target_core_fabric_ops struct, use the same one as normal (tcm_qla2xxx_ops) and then fixup the changed methods.
This should make it a little easier to pick out the npiv differences, and also save a little space.
--- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 62 +++++++---------------------------- 1 files changed, 13 insertions(+), 49 deletions(-)
drivers/scsi/qla2xxx/tcm_qla2xxx.c +13 -49
@@ -1792,53 +1792,6 @@ static struct target_core_fabric_ops tcm_qla2xxx_ops = { .fabric_drop_nodeacl = tcm_qla2xxx_drop_nodeacl, }; -static struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = { - .get_fabric_name = tcm_qla2xxx_npiv_get_fabric_name, - .get_fabric_proto_ident = tcm_qla2xxx_get_fabric_proto_ident, - .tpg_get_wwn = tcm_qla2xxx_npiv_get_fabric_wwn, - .tpg_get_tag = tcm_qla2xxx_get_tag, - .tpg_get_default_depth = tcm_qla2xxx_get_default_depth, - .tpg_get_pr_transport_id = tcm_qla2xxx_get_pr_transport_id, - .tpg_get_pr_transport_id_len = tcm_qla2xxx_get_pr_transport_id_len, - .tpg_parse_pr_out_transport_id = tcm_qla2xxx_parse_pr_out_transport_id, - .tpg_check_demo_mode = tcm_qla2xxx_check_false, - .tpg_check_demo_mode_cache = tcm_qla2xxx_check_true, - .tpg_check_demo_mode_write_protect = tcm_qla2xxx_check_true, - .tpg_check_prod_mode_write_protect = tcm_qla2xxx_check_false, - .tpg_check_demo_mode_login_only = tcm_qla2xxx_check_demo_mode_login_only, - .tpg_alloc_fabric_acl = tcm_qla2xxx_alloc_fabric_acl, - .tpg_release_fabric_acl = tcm_qla2xxx_release_fabric_acl, - .tpg_get_inst_index = tcm_qla2xxx_tpg_get_inst_index, - .release_cmd = tcm_qla2xxx_release_cmd, - .put_session = tcm_qla2xxx_put_session, - .shutdown_session = tcm_qla2xxx_shutdown_session, - .close_session = tcm_qla2xxx_close_session, - .sess_get_index = tcm_qla2xxx_sess_get_index, - .sess_get_initiator_sid =NULL , - .write_pending = tcm_qla2xxx_write_pending, - .write_pending_status = tcm_qla2xxx_write_pending_status, - .set_default_node_attributes = tcm_qla2xxx_set_default_node_attrs, - .get_task_tag = tcm_qla2xxx_get_task_tag, - .get_cmd_state = tcm_qla2xxx_get_cmd_state, - .queue_data_in = tcm_qla2xxx_queue_data_in, - .queue_status = tcm_qla2xxx_queue_status, - .queue_tm_rsp = tcm_qla2xxx_queue_tm_rsp, -/* -* Setup function pointers for generic logic in -* target_core_fabric_configfs.c -*/ - .fabric_make_wwn = tcm_qla2xxx_npiv_make_lport, - .fabric_drop_wwn = tcm_qla2xxx_npiv_drop_lport, - .fabric_make_tpg = tcm_qla2xxx_npiv_make_tpg, - .fabric_drop_tpg = tcm_qla2xxx_drop_tpg, - .fabric_post_link =NULL , - .fabric_pre_unlink =NULL , - .fabric_make_np =NULL , - .fabric_drop_np =NULL , - .fabric_make_nodeacl = tcm_qla2xxx_make_nodeacl, - .fabric_drop_nodeacl = tcm_qla2xxx_drop_nodeacl, -}; -static int tcm_qla2xxx_register_configfs (void ) {struct target_fabric_configfs *fabric, *npiv_fabric;
@@ -1895,10 +1848,21 @@ static int tcm_qla2xxx_register_configfs(void) ret =PTR_ERR (npiv_fabric); goto out_fabric; } +/* -* Setup fabric->tf_ops from our local tcm_qla2xxx_npiv_ops +* NPIV is the same as regular, except for a few functions. */ - npiv_fabric->tf_ops = tcm_qla2xxx_npiv_ops; + npiv_fabric->tf_ops = tcm_qla2xxx_ops; + npiv_fabric->tf_ops.get_fabric_name = tcm_qla2xxx_npiv_get_fabric_name; + npiv_fabric->tf_ops.tpg_get_wwn = tcm_qla2xxx_npiv_get_fabric_wwn; + npiv_fabric->tf_ops.tpg_check_demo_mode = tcm_qla2xxx_check_false; + npiv_fabric->tf_ops.tpg_check_demo_mode_cache = tcm_qla2xxx_check_true; + npiv_fabric->tf_ops.tpg_check_demo_mode_write_protect = tcm_qla2xxx_check_true; + npiv_fabric->tf_ops.tpg_check_prod_mode_write_protect = tcm_qla2xxx_check_false; + npiv_fabric->tf_ops.fabric_make_wwn = tcm_qla2xxx_npiv_make_lport; + npiv_fabric->tf_ops.fabric_drop_wwn = tcm_qla2xxx_npiv_drop_lport; + npiv_fabric->tf_ops.fabric_make_tpg = tcm_qla2xxx_npiv_make_tpg; +/* * Setup default attribute lists for various npiv_fabric->tf_cit_tmpl */
Signature · 1 line
1.7.1
PATCH 5/5 target/qla2xxx: Remove QLA_TPG_ATTRIB macro
In reply to Andy GroverJust a dereference, don't need a macro.
--- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 20 ++++++++++---------- drivers/scsi/qla2xxx/tcm_qla2xxx.h | 2 -- 2 files changed, 10 insertions(+), 12 deletions(-)
drivers/scsi/qla2xxx/tcm_qla2xxx.c +10 -10
@@ -333,7 +333,7 @@ static int tcm_qla2xxx_check_demo_mode(struct se_portal_group *se_tpg)struct tcm_qla2xxx_tpg *tpg =container_of (se_tpg, struct tcm_qla2xxx_tpg, se_tpg); -return QLA_TPG_ATTRIB (tpg)->generate_node_acls; +return tpg->tpg_attrib.generate_node_acls; }static int tcm_qla2xxx_check_demo_mode_cache (struct se_portal_group *se_tpg)
@@ -341,7 +341,7 @@ static int tcm_qla2xxx_check_demo_mode_cache(struct se_portal_group *se_tpg)struct tcm_qla2xxx_tpg *tpg =container_of (se_tpg, struct tcm_qla2xxx_tpg, se_tpg); -return QLA_TPG_ATTRIB (tpg)->cache_dynamic_acls; +return tpg->tpg_attrib.cache_dynamic_acls; }static int tcm_qla2xxx_check_demo_write_protect (struct se_portal_group *se_tpg)
@@ -349,7 +349,7 @@ static int tcm_qla2xxx_check_demo_write_protect(struct se_portal_group *se_tpg)struct tcm_qla2xxx_tpg *tpg =container_of (se_tpg, struct tcm_qla2xxx_tpg, se_tpg); -return QLA_TPG_ATTRIB (tpg)->demo_mode_write_protect; +return tpg->tpg_attrib.demo_mode_write_protect; }static int tcm_qla2xxx_check_prod_write_protect (struct se_portal_group *se_tpg)
@@ -357,7 +357,7 @@ static int tcm_qla2xxx_check_prod_write_protect(struct se_portal_group *se_tpg)struct tcm_qla2xxx_tpg *tpg =container_of (se_tpg, struct tcm_qla2xxx_tpg, se_tpg); -return QLA_TPG_ATTRIB (tpg)->prod_mode_write_protect; +return tpg->tpg_attrib.prod_mode_write_protect; }static int tcm_qla2xxx_check_demo_mode_login_only (struct se_portal_group *se_tpg)
@@ -365,7 +365,7 @@ static int tcm_qla2xxx_check_demo_mode_login_only(struct se_portal_group *se_tpgstruct tcm_qla2xxx_tpg *tpg =container_of (se_tpg, struct tcm_qla2xxx_tpg, se_tpg); -return QLA_TPG_ATTRIB (tpg)->demo_mode_login_only; +return tpg->tpg_attrib.demo_mode_login_only; } static struct se_node_acl *tcm_qla2xxx_alloc_fabric_acl(
@@ -875,7 +875,7 @@ static ssize_t tcm_qla2xxx_tpg_attrib_show_##name( \struct tcm_qla2xxx_tpg *tpg =container_of (se_tpg, \ struct tcm_qla2xxx_tpg, se_tpg); \ \ -return sprintf (page,"%u\n" ,QLA_TPG_ATTRIB (tpg)->name); \ +return sprintf (page,"%u\n" , tpg->tpg_attrib.name); \ } \ \ static ssize_t tcm_qla2xxx_tpg_attrib_store_##name( \
@@ -1055,10 +1055,10 @@ static struct se_portal_group *tcm_qla2xxx_make_tpg(* By default allow READ-ONLY TPG demo-mode access w/ cached dynamic * NodeACLs */ -QLA_TPG_ATTRIB (tpg)->generate_node_acls =1 ; -QLA_TPG_ATTRIB (tpg)->demo_mode_write_protect =1 ; -QLA_TPG_ATTRIB (tpg)->cache_dynamic_acls =1 ; -QLA_TPG_ATTRIB (tpg)->demo_mode_login_only =1 ; + tpg->tpg_attrib.generate_node_acls =1 ; + tpg->tpg_attrib.demo_mode_write_protect =1 ; + tpg->tpg_attrib.cache_dynamic_acls =1 ; + tpg->tpg_attrib.demo_mode_login_only =1 ; ret =core_tpg_register (&tcm_qla2xxx_fabric_configfs->tf_ops, wwn, &tpg->se_tpg, tpg,TRANSPORT_TPG_TYPE_NORMAL );
drivers/scsi/qla2xxx/tcm_qla2xxx.h +0 -2
@@ -45,8 +45,6 @@ struct tcm_qla2xxx_tpg {struct se_portal_group se_tpg; }; -#define QLA_TPG_ATTRIB (tpg) (&(tpg)->tpg_attrib) -struct tcm_qla2xxx_fc_loopid {struct se_node_acl *se_nacl; };
Signature · 1 line
1.7.1
cover Macro and qla npiv cleanups
Rebased against target for-next. Compile-tested.
Regards -- Andy
PATCH 1/5 target: Remove TF_CIT_TMPL macro
Remove a lingering macro that just hid a dereference.
--- Documentation/target/tcm_mod_builder.py | 18 ++++++------ drivers/scsi/qla2xxx/tcm_qla2xxx.c | 36 ++++++++++++------------ drivers/target/iscsi/iscsi_target_configfs.c | 22 +++++++------- drivers/target/loopback/tcm_loop.c | 10 +++--- drivers/target/sbp/sbp_target.c | 18 ++++++------ drivers/target/target_core_configfs.c | 6 ++-- drivers/target/target_core_fabric_configfs.c | 38 +++++++++++++------------- drivers/target/tcm_fc/tfc_conf.c | 18 ++++++------ drivers/usb/gadget/tcm_usb_gadget.c | 18 ++++++------ drivers/vhost/scsi.c | 18 ++++++------ include/target/target_core_configfs.h | 1 - 11 files changed, 101 insertions(+), 102 deletions(-)
Documentation/target/tcm_mod_builder.py +9 -9
@@ -440,15 +440,15 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): buf += " /*\n" buf += " * Setup default attribute lists for various fabric->tf_cit_tmpl\n" buf += " */\n" - buf += " TF_CIT_TMPL(fabric)->tfc_wwn_cit.ct_attrs = " + fabric_mod_name + "_wwn_attrs;\n" - buf += " TF_CIT_TMPL(fabric)->tfc_tpg_base_cit.ct_attrs = NULL;\n" - buf += " TF_CIT_TMPL(fabric)->tfc_tpg_attrib_cit.ct_attrs = NULL;\n" - buf += " TF_CIT_TMPL(fabric)->tfc_tpg_param_cit.ct_attrs = NULL;\n" - buf += " TF_CIT_TMPL(fabric)->tfc_tpg_np_base_cit.ct_attrs = NULL;\n" - buf += " TF_CIT_TMPL(fabric)->tfc_tpg_nacl_base_cit.ct_attrs = NULL;\n" - buf += " TF_CIT_TMPL(fabric)->tfc_tpg_nacl_attrib_cit.ct_attrs = NULL;\n" - buf += " TF_CIT_TMPL(fabric)->tfc_tpg_nacl_auth_cit.ct_attrs = NULL;\n" - buf += " TF_CIT_TMPL(fabric)->tfc_tpg_nacl_param_cit.ct_attrs = NULL;\n" + buf += " fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = " + fabric_mod_name + "_wwn_attrs;\n" + buf += " fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = NULL;\n" + buf += " fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs = NULL;\n" + buf += " fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs = NULL;\n" + buf += " fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs = NULL;\n" + buf += " fabric->tf_cit_tmpl.tfc_tpg_nacl_base_cit.ct_attrs = NULL;\n" + buf += " fabric->tf_cit_tmpl.tfc_tpg_nacl_attrib_cit.ct_attrs = NULL;\n" + buf += " fabric->tf_cit_tmpl.tfc_tpg_nacl_auth_cit.ct_attrs = NULL;\n" + buf += " fabric->tf_cit_tmpl.tfc_tpg_nacl_param_cit.ct_attrs = NULL;\n" buf += " /*\n" buf += " * Register the fabric for use within TCM\n" buf += " */\n"
drivers/scsi/qla2xxx/tcm_qla2xxx.c +18 -18
@@ -1862,16 +1862,16 @@ static int tcm_qla2xxx_register_configfs(void)/* * Setup default attribute lists for various fabric->tf_cit_tmpl */ -TF_CIT_TMPL (fabric)->tfc_wwn_cit.ct_attrs = tcm_qla2xxx_wwn_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_base_cit.ct_attrs = tcm_qla2xxx_tpg_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_attrib_cit.ct_attrs = + fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = tcm_qla2xxx_wwn_attrs; + fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = tcm_qla2xxx_tpg_attrs; + fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs = tcm_qla2xxx_tpg_attrib_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_param_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_np_base_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_base_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_attrib_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_auth_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_param_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_nacl_base_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_nacl_attrib_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_nacl_auth_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_nacl_param_cit.ct_attrs =NULL ;/* * Register the fabric for use within TCM */
@@ -1902,15 +1902,15 @@ static int tcm_qla2xxx_register_configfs(void)/* * Setup default attribute lists for various npiv_fabric->tf_cit_tmpl */ -TF_CIT_TMPL (npiv_fabric)->tfc_wwn_cit.ct_attrs = tcm_qla2xxx_wwn_attrs; -TF_CIT_TMPL (npiv_fabric)->tfc_tpg_base_cit.ct_attrs =NULL ; -TF_CIT_TMPL (npiv_fabric)->tfc_tpg_attrib_cit.ct_attrs =NULL ; -TF_CIT_TMPL (npiv_fabric)->tfc_tpg_param_cit.ct_attrs =NULL ; -TF_CIT_TMPL (npiv_fabric)->tfc_tpg_np_base_cit.ct_attrs =NULL ; -TF_CIT_TMPL (npiv_fabric)->tfc_tpg_nacl_base_cit.ct_attrs =NULL ; -TF_CIT_TMPL (npiv_fabric)->tfc_tpg_nacl_attrib_cit.ct_attrs =NULL ; -TF_CIT_TMPL (npiv_fabric)->tfc_tpg_nacl_auth_cit.ct_attrs =NULL ; -TF_CIT_TMPL (npiv_fabric)->tfc_tpg_nacl_param_cit.ct_attrs =NULL ; + npiv_fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = tcm_qla2xxx_wwn_attrs; + npiv_fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs =NULL ; + npiv_fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs =NULL ; + npiv_fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs =NULL ; + npiv_fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs =NULL ; + npiv_fabric->tf_cit_tmpl.tfc_tpg_nacl_base_cit.ct_attrs =NULL ; + npiv_fabric->tf_cit_tmpl.tfc_tpg_nacl_attrib_cit.ct_attrs =NULL ; + npiv_fabric->tf_cit_tmpl.tfc_tpg_nacl_auth_cit.ct_attrs =NULL ; + npiv_fabric->tf_cit_tmpl.tfc_tpg_nacl_param_cit.ct_attrs =NULL ;/* * Register the npiv_fabric for use within TCM */
drivers/target/iscsi/iscsi_target_configfs.c +11 -11
@@ -1997,17 +1997,17 @@ int iscsi_target_register_configfs(void)* Setup default attribute lists for various fabric->tf_cit_tmpl * sturct config_item_type's */ -TF_CIT_TMPL (fabric)->tfc_discovery_cit.ct_attrs = lio_target_discovery_auth_attrs; -TF_CIT_TMPL (fabric)->tfc_wwn_cit.ct_attrs = lio_target_wwn_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_base_cit.ct_attrs = lio_target_tpg_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_attrib_cit.ct_attrs = lio_target_tpg_attrib_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_auth_cit.ct_attrs = lio_target_tpg_auth_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_param_cit.ct_attrs = lio_target_tpg_param_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_np_base_cit.ct_attrs = lio_target_portal_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_base_cit.ct_attrs = lio_target_initiator_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_attrib_cit.ct_attrs = lio_target_nacl_attrib_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_auth_cit.ct_attrs = lio_target_nacl_auth_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_param_cit.ct_attrs = lio_target_nacl_param_attrs; + fabric->tf_cit_tmpl.tfc_discovery_cit.ct_attrs = lio_target_discovery_auth_attrs; + fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = lio_target_wwn_attrs; + fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = lio_target_tpg_attrs; + fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs = lio_target_tpg_attrib_attrs; + fabric->tf_cit_tmpl.tfc_tpg_auth_cit.ct_attrs = lio_target_tpg_auth_attrs; + fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs = lio_target_tpg_param_attrs; + fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs = lio_target_portal_attrs; + fabric->tf_cit_tmpl.tfc_tpg_nacl_base_cit.ct_attrs = lio_target_initiator_attrs; + fabric->tf_cit_tmpl.tfc_tpg_nacl_attrib_cit.ct_attrs = lio_target_nacl_attrib_attrs; + fabric->tf_cit_tmpl.tfc_tpg_nacl_auth_cit.ct_attrs = lio_target_nacl_auth_attrs; + fabric->tf_cit_tmpl.tfc_tpg_nacl_param_cit.ct_attrs = lio_target_nacl_param_attrs; ret =target_fabric_configfs_register (fabric);if (ret <0 ) {
drivers/target/loopback/tcm_loop.c +5 -5
@@ -1334,11 +1334,11 @@ static int tcm_loop_register_configfs(void)/* * Setup default attribute lists for various fabric->tf_cit_tmpl */ -TF_CIT_TMPL (fabric)->tfc_wwn_cit.ct_attrs = tcm_loop_wwn_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_base_cit.ct_attrs = tcm_loop_tpg_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_attrib_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_param_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_np_base_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = tcm_loop_wwn_attrs; + fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = tcm_loop_tpg_attrs; + fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs =NULL ;/* * Once fabric->tf_ops has been setup, now register the fabric for * use within TCM
drivers/target/sbp/sbp_target.c +9 -9
@@ -2556,15 +2556,15 @@ static int sbp_register_configfs(void)/* * Setup default attribute lists for various fabric->tf_cit_tmpl */ -TF_CIT_TMPL (fabric)->tfc_wwn_cit.ct_attrs = sbp_wwn_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_base_cit.ct_attrs = sbp_tpg_base_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_attrib_cit.ct_attrs = sbp_tpg_attrib_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_param_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_np_base_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_base_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_attrib_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_auth_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_param_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = sbp_wwn_attrs; + fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = sbp_tpg_base_attrs; + fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs = sbp_tpg_attrib_attrs; + fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_nacl_base_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_nacl_attrib_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_nacl_auth_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_nacl_param_cit.ct_attrs =NULL ; ret =target_fabric_configfs_register (fabric);if (ret <0 ) {
drivers/target/target_core_configfs.c +3 -3
@@ -176,16 +176,16 @@ static struct config_group *target_core_register_fabric(* struct target_fabric_configfs *tf will contain a usage reference. */ pr_debug ("Target_Core_ConfigFS: REGISTER tfc_wwn_cit -> %p\n" , - &TF_CIT_TMPL (tf)->tfc_wwn_cit); + &tf->tf_cit_tmpl.tfc_wwn_cit); tf->tf_group.default_groups = tf->tf_default_groups; tf->tf_group.default_groups[0 ] = &tf->tf_disc_group; tf->tf_group.default_groups[1 ] =NULL ;config_group_init_type_name (&tf->tf_group, name, - &TF_CIT_TMPL (tf)->tfc_wwn_cit); + &tf->tf_cit_tmpl.tfc_wwn_cit);config_group_init_type_name (&tf->tf_disc_group,"discovery_auth" , - &TF_CIT_TMPL (tf)->tfc_discovery_cit); + &tf->tf_cit_tmpl.tfc_discovery_cit);pr_debug ("Target_Core_ConfigFS: REGISTER -> Allocated Fabric:" " %s\n" , tf->tf_group.cg_item.ci_name);
drivers/target/target_core_fabric_configfs.c +19 -19
@@ -385,9 +385,9 @@ static struct config_group *target_fabric_make_mappedlun( }config_group_init_type_name (&lacl->se_lun_group, name, - &TF_CIT_TMPL (tf)->tfc_tpg_mappedlun_cit); + &tf->tf_cit_tmpl.tfc_tpg_mappedlun_cit);config_group_init_type_name (&lacl->ml_stat_grps.stat_group, -"statistics" , &TF_CIT_TMPL (tf)->tfc_tpg_mappedlun_stat_cit); +"statistics" , &tf->tf_cit_tmpl.tfc_tpg_mappedlun_stat_cit); lacl_cg->default_groups[0 ] = &lacl->ml_stat_grps.stat_group; lacl_cg->default_groups[1 ] =NULL ;
@@ -504,16 +504,16 @@ static struct config_group *target_fabric_make_nodeacl( nacl_cg->default_groups[4 ] =NULL ;config_group_init_type_name (&se_nacl->acl_group, name, - &TF_CIT_TMPL (tf)->tfc_tpg_nacl_base_cit); + &tf->tf_cit_tmpl.tfc_tpg_nacl_base_cit);config_group_init_type_name (&se_nacl->acl_attrib_group,"attrib" , - &TF_CIT_TMPL (tf)->tfc_tpg_nacl_attrib_cit); + &tf->tf_cit_tmpl.tfc_tpg_nacl_attrib_cit);config_group_init_type_name (&se_nacl->acl_auth_group,"auth" , - &TF_CIT_TMPL (tf)->tfc_tpg_nacl_auth_cit); + &tf->tf_cit_tmpl.tfc_tpg_nacl_auth_cit);config_group_init_type_name (&se_nacl->acl_param_group,"param" , - &TF_CIT_TMPL (tf)->tfc_tpg_nacl_param_cit); + &tf->tf_cit_tmpl.tfc_tpg_nacl_param_cit);config_group_init_type_name (&se_nacl->acl_fabric_stat_group,"fabric_statistics" , - &TF_CIT_TMPL (tf)->tfc_tpg_nacl_stat_cit); + &tf->tf_cit_tmpl.tfc_tpg_nacl_stat_cit);return &se_nacl->acl_group; }
@@ -595,7 +595,7 @@ static struct config_group *target_fabric_make_np( se_tpg_np->tpg_np_parent = se_tpg;config_group_init_type_name (&se_tpg_np->tpg_np_group, name, - &TF_CIT_TMPL (tf)->tfc_tpg_np_base_cit); + &tf->tf_cit_tmpl.tfc_tpg_np_base_cit);return &se_tpg_np->tpg_np_group; }
@@ -899,9 +899,9 @@ static struct config_group *target_fabric_make_lun( }config_group_init_type_name (&lun->lun_group, name, - &TF_CIT_TMPL (tf)->tfc_tpg_port_cit); + &tf->tf_cit_tmpl.tfc_tpg_port_cit);config_group_init_type_name (&lun->port_stat_grps.stat_group, -"statistics" , &TF_CIT_TMPL (tf)->tfc_tpg_port_stat_cit); +"statistics" , &tf->tf_cit_tmpl.tfc_tpg_port_stat_cit); lun_cg->default_groups[0 ] = &lun->port_stat_grps.stat_group; lun_cg->default_groups[1 ] =NULL ;
@@ -1056,19 +1056,19 @@ static struct config_group *target_fabric_make_tpg( se_tpg->tpg_group.default_groups[6 ] =NULL ;config_group_init_type_name (&se_tpg->tpg_group, name, - &TF_CIT_TMPL (tf)->tfc_tpg_base_cit); + &tf->tf_cit_tmpl.tfc_tpg_base_cit);config_group_init_type_name (&se_tpg->tpg_lun_group,"lun" , - &TF_CIT_TMPL (tf)->tfc_tpg_lun_cit); + &tf->tf_cit_tmpl.tfc_tpg_lun_cit);config_group_init_type_name (&se_tpg->tpg_np_group,"np" , - &TF_CIT_TMPL (tf)->tfc_tpg_np_cit); + &tf->tf_cit_tmpl.tfc_tpg_np_cit);config_group_init_type_name (&se_tpg->tpg_acl_group,"acls" , - &TF_CIT_TMPL (tf)->tfc_tpg_nacl_cit); + &tf->tf_cit_tmpl.tfc_tpg_nacl_cit);config_group_init_type_name (&se_tpg->tpg_attrib_group,"attrib" , - &TF_CIT_TMPL (tf)->tfc_tpg_attrib_cit); + &tf->tf_cit_tmpl.tfc_tpg_attrib_cit);config_group_init_type_name (&se_tpg->tpg_auth_group,"auth" , - &TF_CIT_TMPL (tf)->tfc_tpg_auth_cit); + &tf->tf_cit_tmpl.tfc_tpg_auth_cit);config_group_init_type_name (&se_tpg->tpg_param_group,"param" , - &TF_CIT_TMPL (tf)->tfc_tpg_param_cit); + &tf->tf_cit_tmpl.tfc_tpg_param_cit);return &se_tpg->tpg_group; }
@@ -1155,9 +1155,9 @@ static struct config_group *target_fabric_make_wwn( wwn->wwn_group.default_groups[1 ] =NULL ;config_group_init_type_name (&wwn->wwn_group, name, - &TF_CIT_TMPL (tf)->tfc_tpg_cit); + &tf->tf_cit_tmpl.tfc_tpg_cit);config_group_init_type_name (&wwn->fabric_stat_group,"fabric_statistics" , - &TF_CIT_TMPL (tf)->tfc_wwn_fabric_stats_cit); + &tf->tf_cit_tmpl.tfc_wwn_fabric_stats_cit);return &wwn->wwn_group; }
drivers/target/tcm_fc/tfc_conf.c +9 -9
@@ -571,16 +571,16 @@ int ft_register_configfs(void)/* * Setup default attribute lists for various fabric->tf_cit_tmpl */ -TF_CIT_TMPL (fabric)->tfc_wwn_cit.ct_attrs = ft_wwn_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_base_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_attrib_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_param_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_np_base_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_base_cit.ct_attrs = + fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = ft_wwn_attrs; + fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_nacl_base_cit.ct_attrs = ft_nacl_base_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_attrib_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_auth_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_param_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_nacl_attrib_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_nacl_auth_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_nacl_param_cit.ct_attrs =NULL ;/* * register the fabric for use within TCM */
drivers/usb/gadget/tcm_usb_gadget.c +9 -9
@@ -1923,15 +1923,15 @@ static int usbg_register_configfs(void) } fabric->tf_ops = usbg_ops; -TF_CIT_TMPL (fabric)->tfc_wwn_cit.ct_attrs = usbg_wwn_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_base_cit.ct_attrs = usbg_base_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_attrib_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_param_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_np_base_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_base_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_attrib_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_auth_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_param_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = usbg_wwn_attrs; + fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = usbg_base_attrs; + fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_nacl_base_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_nacl_attrib_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_nacl_auth_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_nacl_param_cit.ct_attrs =NULL ; ret =target_fabric_configfs_register (fabric);if (ret <0 ) { printk(KERN_ERR "target_fabric_configfs_register() failed"
drivers/vhost/scsi.c +9 -9
@@ -2150,15 +2150,15 @@ static int tcm_vhost_register_configfs(void)/* * Setup default attribute lists for various fabric->tf_cit_tmpl */ -TF_CIT_TMPL (fabric)->tfc_wwn_cit.ct_attrs = tcm_vhost_wwn_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_base_cit.ct_attrs = tcm_vhost_tpg_attrs; -TF_CIT_TMPL (fabric)->tfc_tpg_attrib_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_param_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_np_base_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_base_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_attrib_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_auth_cit.ct_attrs =NULL ; -TF_CIT_TMPL (fabric)->tfc_tpg_nacl_param_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = tcm_vhost_wwn_attrs; + fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = tcm_vhost_tpg_attrs; + fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_nacl_base_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_nacl_attrib_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_nacl_auth_cit.ct_attrs =NULL ; + fabric->tf_cit_tmpl.tfc_tpg_nacl_param_cit.ct_attrs =NULL ;/* * Register the fabric for use within TCM */
include/target/target_core_configfs.h +0 -1
@@ -54,4 +54,3 @@ struct target_fabric_configfs {struct target_fabric_configfs_template tf_cit_tmpl; }; -#define TF_CIT_TMPL (tf) (&(tf)->tf_cit_tmpl)
Signature · 1 line
1.7.1
PATCH 2/5 target/iscsi: Remove iscsi dereferencing macros
In reply to Andy GroverThese are all straightforward.
--- drivers/target/iscsi/iscsi_target_configfs.c | 42 +++++++++++++------------- drivers/target/iscsi/iscsi_target_core.h | 9 ----- drivers/target/iscsi/iscsi_target_nego.c | 8 ++-- drivers/target/iscsi/iscsi_target_tpg.c | 4 +- 4 files changed, 27 insertions(+), 36 deletions(-)
drivers/target/iscsi/iscsi_target_configfs.c +21 -21
@@ -374,7 +374,7 @@ static ssize_t iscsi_nacl_attrib_show_##name( \ struct iscsi_node_acl *nacl = container_of(se_nacl, struct iscsi_node_acl, \ se_node_acl); \ \ -return sprintf (page,"%u\n" ,ISCSI_NODE_ATTRIB (nacl)->name); \ +return sprintf (page,"%u\n" , nacl->node_attrib.name); \ } \ \ static ssize_t iscsi_nacl_attrib_store_##name( \
@@ -899,7 +899,7 @@ static struct se_node_acl *lio_target_make_nodeacl(if (!se_nacl_new)return ERR_PTR (-ENOMEM ); - cmdsn_depth =ISCSI_TPG_ATTRIB (tpg)->default_cmdsn_depth; + cmdsn_depth = tpg->tpg_attrib.default_cmdsn_depth;/* * se_nacl_new may be released by core_tpg_add_initiator_node_acl() * when converting a NdoeACL from demo mode -> explict
@@ -922,9 +922,9 @@ static struct se_node_acl *lio_target_make_nodeacl(return ERR_PTR (-ENOMEM ); } - stats_cg->default_groups[0 ] = &NODE_STAT_GRPS (acl)->iscsi_sess_stats_group; + stats_cg->default_groups[0 ] = &acl->node_stat_grps.iscsi_sess_stats_group; stats_cg->default_groups[1 ] =NULL ; -config_group_init_type_name (&NODE_STAT_GRPS (acl)->iscsi_sess_stats_group, +config_group_init_type_name (&acl->node_stat_grps.iscsi_sess_stats_group,"iscsi_sess_stats" , &iscsi_stat_sess_cit);return se_nacl;
@@ -969,7 +969,7 @@ static ssize_t iscsi_tpg_attrib_show_##name( \if (iscsit_get_tpg (tpg) <0 ) \return -EINVAL ; \ \ - rb =sprintf (page,"%u\n" ,ISCSI_TPG_ATTRIB (tpg)->name); \ + rb =sprintf (page,"%u\n" , tpg->tpg_attrib.name); \iscsit_put_tpg (tpg); \return rb; \ } \
@@ -1516,21 +1516,21 @@ static struct se_wwn *lio_target_call_coreaddtiqn(return ERR_PTR (-ENOMEM ); } - stats_cg->default_groups[0 ] = &WWN_STAT_GRPS (tiqn)->iscsi_instance_group; - stats_cg->default_groups[1 ] = &WWN_STAT_GRPS (tiqn)->iscsi_sess_err_group; - stats_cg->default_groups[2 ] = &WWN_STAT_GRPS (tiqn)->iscsi_tgt_attr_group; - stats_cg->default_groups[3 ] = &WWN_STAT_GRPS (tiqn)->iscsi_login_stats_group; - stats_cg->default_groups[4 ] = &WWN_STAT_GRPS (tiqn)->iscsi_logout_stats_group; + stats_cg->default_groups[0 ] = &tiqn->tiqn_stat_grps.iscsi_instance_group; + stats_cg->default_groups[1 ] = &tiqn->tiqn_stat_grps.iscsi_sess_err_group; + stats_cg->default_groups[2 ] = &tiqn->tiqn_stat_grps.iscsi_tgt_attr_group; + stats_cg->default_groups[3 ] = &tiqn->tiqn_stat_grps.iscsi_login_stats_group; + stats_cg->default_groups[4 ] = &tiqn->tiqn_stat_grps.iscsi_logout_stats_group; stats_cg->default_groups[5 ] =NULL ; -config_group_init_type_name (&WWN_STAT_GRPS (tiqn)->iscsi_instance_group, +config_group_init_type_name (&tiqn->tiqn_stat_grps.iscsi_instance_group,"iscsi_instance" , &iscsi_stat_instance_cit); -config_group_init_type_name (&WWN_STAT_GRPS (tiqn)->iscsi_sess_err_group, +config_group_init_type_name (&tiqn->tiqn_stat_grps.iscsi_sess_err_group,"iscsi_sess_err" , &iscsi_stat_sess_err_cit); -config_group_init_type_name (&WWN_STAT_GRPS (tiqn)->iscsi_tgt_attr_group, +config_group_init_type_name (&tiqn->tiqn_stat_grps.iscsi_tgt_attr_group,"iscsi_tgt_attr" , &iscsi_stat_tgt_attr_cit); -config_group_init_type_name (&WWN_STAT_GRPS (tiqn)->iscsi_login_stats_group, +config_group_init_type_name (&tiqn->tiqn_stat_grps.iscsi_login_stats_group,"iscsi_login_stats" , &iscsi_stat_login_cit); -config_group_init_type_name (&WWN_STAT_GRPS (tiqn)->iscsi_logout_stats_group, +config_group_init_type_name (&tiqn->tiqn_stat_grps.iscsi_logout_stats_group,"iscsi_logout_stats" , &iscsi_stat_logout_cit);pr_debug ("LIO_Target_ConfigFS: REGISTER -> %s\n" , tiqn->tiqn);
@@ -1817,21 +1817,21 @@ static u32 lio_tpg_get_default_depth(struct se_portal_group *se_tpg) {struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr; -return ISCSI_TPG_ATTRIB (tpg)->default_cmdsn_depth; +return tpg->tpg_attrib.default_cmdsn_depth; }static int lio_tpg_check_demo_mode (struct se_portal_group *se_tpg) {struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr; -return ISCSI_TPG_ATTRIB (tpg)->generate_node_acls; +return tpg->tpg_attrib.generate_node_acls; }static int lio_tpg_check_demo_mode_cache (struct se_portal_group *se_tpg) {struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr; -return ISCSI_TPG_ATTRIB (tpg)->cache_dynamic_acls; +return tpg->tpg_attrib.cache_dynamic_acls; } static int lio_tpg_check_demo_mode_write_protect(
@@ -1839,7 +1839,7 @@ static int lio_tpg_check_demo_mode_write_protect( {struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr; -return ISCSI_TPG_ATTRIB (tpg)->demo_mode_write_protect; +return tpg->tpg_attrib.demo_mode_write_protect; } static int lio_tpg_check_prod_mode_write_protect(
@@ -1847,7 +1847,7 @@ static int lio_tpg_check_prod_mode_write_protect( {struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr; -return ISCSI_TPG_ATTRIB (tpg)->prod_mode_write_protect; +return tpg->tpg_attrib.prod_mode_write_protect; } static void lio_tpg_release_fabric_acl(
@@ -1911,7 +1911,7 @@ static void lio_set_default_node_attributes(struct se_node_acl *se_acl) struct iscsi_node_acl *acl = container_of(se_acl, struct iscsi_node_acl, se_node_acl); -ISCSI_NODE_ATTRIB (acl)->nacl = acl; + acl->node_attrib.nacl = acl;iscsit_set_default_node_attribues (acl); }
drivers/target/iscsi/iscsi_target_core.h +0 -9
@@ -750,11 +750,6 @@ struct iscsi_node_acl {struct se_node_acl se_node_acl; }; -#define NODE_STAT_GRPS (nacl) (&(nacl)->node_stat_grps) - -#define ISCSI_NODE_ATTRIB (t) (&(t)->node_attrib) -#define ISCSI_NODE_AUTH (t) (&(t)->node_auth) -struct iscsi_tpg_attrib {u32 authentication;u32 login_timeout;
@@ -833,8 +828,6 @@ struct iscsi_portal_group {#define ISCSI_TPG_C (c) ((struct iscsi_portal_group *)(c)->tpg)#define ISCSI_TPG_LUN (c, l) ((iscsi_tpg_list_t *)(c)->tpg->tpg_lun_list_t[l])#define ISCSI_TPG_S (s) ((struct iscsi_portal_group *)(s)->tpg) -#define ISCSI_TPG_ATTRIB (t) (&(t)->tpg_attrib) -#define SE_TPG (tpg) (&(tpg)->tpg_se_tpg)struct iscsi_wwn_stat_grps {struct config_group iscsi_stat_group;
@@ -866,8 +859,6 @@ struct iscsi_tiqn {struct iscsi_logout_stats logout_stats; }____cacheline_aligned ; -#define WWN_STAT_GRPS (tiqn) (&(tiqn)->tiqn_stat_grps) -struct iscsit_global {/* In core shutdown */ u32 in_shutdown;
drivers/target/iscsi/iscsi_target_nego.c +4 -4
@@ -142,7 +142,7 @@ static u32 iscsi_handle_authentication( iscsi_nacl = container_of(se_nacl, struct iscsi_node_acl, se_node_acl); - auth =ISCSI_NODE_AUTH (iscsi_nacl); + auth = &iscsi_nacl->node_auth; } }else {/*
@@ -699,7 +699,7 @@ static int iscsi_target_handle_csg_zero(return -1 ;if (!iscsi_check_negotiated_keys (conn->param_list)) { -if (ISCSI_TPG_ATTRIB (ISCSI_TPG_C (conn))->authentication && +if (ISCSI_TPG_C (conn)->tpg_attrib.authentication && !strncmp (param->value,NONE ,4 )) {pr_err ("Initiator sent AuthMethod=None but" " Target is enforcing iSCSI Authentication,"
@@ -709,7 +709,7 @@ static int iscsi_target_handle_csg_zero(return -1 ; } -if (ISCSI_TPG_ATTRIB (ISCSI_TPG_C (conn))->authentication && +if (ISCSI_TPG_C (conn)->tpg_attrib.authentication && !login->auth_complete)return 0 ;
@@ -772,7 +772,7 @@ static int iscsi_target_handle_csg_one(struct iscsi_conn *conn, struct iscsi_log }if (!login->auth_complete && -ISCSI_TPG_ATTRIB (ISCSI_TPG_C (conn))->authentication) { +ISCSI_TPG_C (conn)->tpg_attrib.authentication) {pr_err ("Initiator is requesting CSG: 1, has not been" " successfully authenticated, and the Target is" " enforcing iSCSI Authentication, login failed.\n" );
drivers/target/iscsi/iscsi_target_tpg.c +2 -2
@@ -239,7 +239,7 @@ int iscsit_tpg_add_portal_group(struct iscsi_tiqn *tiqn, struct iscsi_portal_groif (iscsi_create_default_params (&tpg->param_list) <0 ) goto err_out; -ISCSI_TPG_ATTRIB (tpg)->tpg = tpg; + tpg->tpg_attrib.tpg = tpg;spin_lock (&tpg->tpg_state_lock); tpg->tpg_state =TPG_STATE_INACTIVE ;
@@ -332,7 +332,7 @@ int iscsit_tpg_enable_portal_group(struct iscsi_portal_group *tpg)return -EINVAL ; } -if (ISCSI_TPG_ATTRIB (tpg)->authentication) { +if (tpg->tpg_attrib.authentication) {if (!strcmp (param->value,NONE )) { ret =iscsi_update_param_value (param,CHAP );if (ret)
Signature · 1 line
1.7.1
PATCH 3/5 target/iscsi: Remove macros that contain typecasts
In reply to Andy GroverThese just want to return a pointer instead of a value, but are otherwise the same.
ISCSI_TPG_LUN macro was unused.
--- drivers/target/iscsi/iscsi_target.c | 2 +- drivers/target/iscsi/iscsi_target_auth.c | 2 +- drivers/target/iscsi/iscsi_target_core.h | 4 ---- drivers/target/iscsi/iscsi_target_erl0.c | 10 +++++----- drivers/target/iscsi/iscsi_target_login.c | 16 ++++++++-------- drivers/target/iscsi/iscsi_target_nego.c | 6 +++--- 6 files changed, 18 insertions(+), 22 deletions(-)
drivers/target/iscsi/iscsi_target.c +1 -1
@@ -4375,7 +4375,7 @@ int iscsit_close_connection(int iscsit_close_session (struct iscsi_session *sess) { -struct iscsi_portal_group *tpg =ISCSI_TPG_S (sess); +struct iscsi_portal_group *tpg = sess->tpg;struct se_portal_group *se_tpg = &tpg->tpg_se_tpg;if (atomic_read (&sess->nconn)) {
drivers/target/iscsi/iscsi_target_auth.c +1 -1
@@ -113,7 +113,7 @@ static struct iscsi_chap *chap_server_open(/* * Set Identifier. */ - chap->id =ISCSI_TPG_C (conn)->tpg_chap_id++; + chap->id = conn->tpg->tpg_chap_id++; *aic_len +=sprintf (aic_str + *aic_len,"CHAP_I=%d" , chap->id); *aic_len +=1 ;pr_debug ("[server] Sending CHAP_I=%d\n" , chap->id);
drivers/target/iscsi/iscsi_target_core.h +0 -4
@@ -825,10 +825,6 @@ struct iscsi_portal_group {struct list_head tpg_list; }____cacheline_aligned ; -#define ISCSI_TPG_C (c) ((struct iscsi_portal_group *)(c)->tpg) -#define ISCSI_TPG_LUN (c, l) ((iscsi_tpg_list_t *)(c)->tpg->tpg_lun_list_t[l]) -#define ISCSI_TPG_S (s) ((struct iscsi_portal_group *)(s)->tpg) -struct iscsi_wwn_stat_grps {struct config_group iscsi_stat_group;struct config_group iscsi_instance_group;
drivers/target/iscsi/iscsi_target_erl0.c +5 -5
@@ -759,7 +759,7 @@ int iscsit_check_post_dataout(static void iscsit_handle_time2retain_timeout (unsigned long data) {struct iscsi_session *sess = (struct iscsi_session *) data; -struct iscsi_portal_group *tpg =ISCSI_TPG_S (sess); +struct iscsi_portal_group *tpg = sess->tpg;struct se_portal_group *se_tpg = &tpg->tpg_se_tpg;spin_lock_bh (&se_tpg->session_lock);
@@ -803,9 +803,9 @@ void iscsit_start_time2retain_handler(struct iscsi_session *sess)* Only start Time2Retain timer when the associated TPG is still in * an ACTIVE (eg: not disabled or shutdown) state. */ -spin_lock (&ISCSI_TPG_S (sess)->tpg_state_lock); - tpg_active = (ISCSI_TPG_S (sess)->tpg_state ==TPG_STATE_ACTIVE ); -spin_unlock (&ISCSI_TPG_S (sess)->tpg_state_lock); +spin_lock (&sess->tpg->tpg_state_lock); + tpg_active = (sess->tpg->tpg_state ==TPG_STATE_ACTIVE ); +spin_unlock (&sess->tpg->tpg_state_lock);if (!tpg_active)return ;
@@ -831,7 +831,7 @@ void iscsit_start_time2retain_handler(struct iscsi_session *sess)*/ int iscsit_stop_time2retain_timer (struct iscsi_session *sess) { -struct iscsi_portal_group *tpg =ISCSI_TPG_S (sess); +struct iscsi_portal_group *tpg = sess->tpg;struct se_portal_group *se_tpg = &tpg->tpg_se_tpg;if (sess->time2retain_timer_flags &ISCSI_TF_EXPIRED )
drivers/target/iscsi/iscsi_target_login.c +8 -8
@@ -349,15 +349,15 @@ static int iscsi_login_zero_tsih_s2(* Assign a new TPG Session Handle. Note this is protected with * struct iscsi_portal_group->np_login_sem from iscsit_access_np(). */ - sess->tsih = ++ISCSI_TPG_S (sess)->ntsih; + sess->tsih = ++sess->tpg->ntsih;if (!sess->tsih) - sess->tsih = ++ISCSI_TPG_S (sess)->ntsih; + sess->tsih = ++sess->tpg->ntsih;/* * Create the default params from user defined values.. */ if (iscsi_copy_param_list (&conn->param_list, -ISCSI_TPG_C (conn)->param_list,1 ) <0 ) { + conn->tpg->param_list,1 ) <0 ) {iscsit_tx_login_rsp (conn,ISCSI_STATUS_CLS_TARGET_ERR ,ISCSI_LOGIN_STATUS_NO_RESOURCES );return -1 ;
@@ -382,7 +382,7 @@ static int iscsi_login_zero_tsih_s2(* In our case, we have already located the struct iscsi_tiqn at this point. */ memset (buf,0 ,32 ); -sprintf (buf,"TargetPortalGroupTag=%hu" ,ISCSI_TPG_S (sess)->tpgt); +sprintf (buf,"TargetPortalGroupTag=%hu" , sess->tpg->tpgt);if (iscsi_change_param_value (buf, conn->param_list,0 ) <0 ) {iscsit_tx_login_rsp (conn,ISCSI_STATUS_CLS_TARGET_ERR ,ISCSI_LOGIN_STATUS_NO_RESOURCES );
@@ -577,7 +577,7 @@ static int iscsi_login_non_zero_tsih_s2(iscsi_login_set_conn_values (sess, conn, pdu->cid);if (iscsi_copy_param_list (&conn->param_list, -ISCSI_TPG_C (conn)->param_list,0 ) <0 ) { + conn->tpg->param_list,0 ) <0 ) {iscsit_tx_login_rsp (conn,ISCSI_STATUS_CLS_TARGET_ERR ,ISCSI_LOGIN_STATUS_NO_RESOURCES );return -1 ;
@@ -595,7 +595,7 @@ static int iscsi_login_non_zero_tsih_s2(* In our case, we have already located the struct iscsi_tiqn at this point. */ memset (buf,0 ,32 ); -sprintf (buf,"TargetPortalGroupTag=%hu" ,ISCSI_TPG_S (sess)->tpgt); +sprintf (buf,"TargetPortalGroupTag=%hu" , sess->tpg->tpgt);if (iscsi_change_param_value (buf, conn->param_list,0 ) <0 ) {iscsit_tx_login_rsp (conn,ISCSI_STATUS_CLS_TARGET_ERR ,ISCSI_LOGIN_STATUS_NO_RESOURCES );
@@ -693,7 +693,7 @@ int iscsi_post_login_handler(int stop_timer =0 ;struct iscsi_session *sess = conn->sess;struct se_session *se_sess = sess->se_sess; -struct iscsi_portal_group *tpg =ISCSI_TPG_S (sess); +struct iscsi_portal_group *tpg = sess->tpg;struct se_portal_group *se_tpg = &tpg->tpg_se_tpg;struct iscsi_thread_set *ts;
@@ -1156,7 +1156,7 @@ old_sess_out:spin_lock_bh (&conn->sess->conn_lock);if (conn->sess->session_state ==TARG_SESS_STATE_FAILED ) {struct se_portal_group *se_tpg = - &ISCSI_TPG_C (conn)->tpg_se_tpg; + &conn->tpg->tpg_se_tpg;atomic_set (&conn->sess->session_continuation,0 );spin_unlock_bh (&conn->sess->conn_lock);
drivers/target/iscsi/iscsi_target_nego.c +3 -3
@@ -699,7 +699,7 @@ static int iscsi_target_handle_csg_zero(return -1 ;if (!iscsi_check_negotiated_keys (conn->param_list)) { -if (ISCSI_TPG_C (conn)->tpg_attrib.authentication && +if (conn->tpg->tpg_attrib.authentication && !strncmp (param->value,NONE ,4 )) {pr_err ("Initiator sent AuthMethod=None but" " Target is enforcing iSCSI Authentication,"
@@ -709,7 +709,7 @@ static int iscsi_target_handle_csg_zero(return -1 ; } -if (ISCSI_TPG_C (conn)->tpg_attrib.authentication && +if (conn->tpg->tpg_attrib.authentication && !login->auth_complete)return 0 ;
@@ -772,7 +772,7 @@ static int iscsi_target_handle_csg_one(struct iscsi_conn *conn, struct iscsi_log }if (!login->auth_complete && -ISCSI_TPG_C (conn)->tpg_attrib.authentication) { + conn->tpg->tpg_attrib.authentication) {pr_err ("Initiator is requesting CSG: 1, has not been" " successfully authenticated, and the Target is" " enforcing iSCSI Authentication, login failed.\n" );
Signature · 1 line
1.7.1
Re: [PATCH 1/5] target: Remove TF_CIT_TMPL macro
In reply to Andy GroverQuoted 3 lines · Andy Grover
Remove a lingering macro that just hid a dereference.
Signed-off-by Andy Grover <[email protected]>
Looks good,
Re: [PATCH 2/5] target/iscsi: Remove iscsi dereferencing macros
In reply to Andy GroverQuoted 3 lines · Andy Grover
These are all straightforward.
Signed-off-by Andy Grover <[email protected]>
Looks good,
Re: [PATCH 3/5] target/iscsi: Remove macros that contain typecasts
In reply to Andy GroverQuoted 6 lines · Andy Grover
These just want to return a pointer instead of a value, but are otherwise the same.
ISCSI_TPG_LUNmacro was unused.Signed-off-by Andy Grover <[email protected]>
Looks good,
Re: [PATCH 4/5] target/qla2xxx: Define NPIV ops in terms of normal ops
In reply to Andy GroverQuoted 7 lines · Andy Grover
Instead of defining a second
target_core_fabric_opsstruct, use the same one as normal (tcm_qla2xxx_ops) and then fixup the changed methods.This should make it a little easier to pick out the npiv differences, and also save a little space.
Signed-off-by Andy Grover <[email protected]>
Can't say I'm a huge fan of either the old or new way, I'd rather have the methods contain both the NPIV and non-NPIV code inline. If that's what you're preparing for I'm supportive of this, otherwise I don't really care too much about it. Looks correct at least..
Re: [PATCH 5/5] target/qla2xxx: Remove QLA_TPG_ATTRIB macro
In reply to Andy GroverQuoted 3 lines · Andy Grover
Just a dereference, don't need a macro.
Signed-off-by Andy Grover <[email protected]>
Looks good,
Re: [PATCH 4/5] target/qla2xxx: Define NPIV ops in terms of normal ops
In reply to Christoph HellwigQuoted 7 lines · Christoph Hellwig
Quoted 6 lines · Andy Grover
Instead of defining a second
target_core_fabric_opsstruct, use the same one as normal (tcm_qla2xxx_ops) and then fixup the changed methods.This should make it a little easier to pick out the npiv differences, and also save a little space.
Quoted 6 lines
Quoted 1 line
Signed-off-by Andy Grover <[email protected]>Can't say I'm a huge fan of either the old or new way, I'd rather have the methods contain both the NPIV and non-NPIV code inline. If that's what you're preparing for I'm supportive of this, otherwise I don't really care too much about it. Looks correct at least..
It reduces the binary size and makes it easier to spot the differences between the two cases, which was the goal. So I think it's a small improvement but if others disagree then I'm fine with the code as-is.
Regards -- Andy