target: remove struct target_fabric_configfs_template

It's only embedded into struct target_fabric_configfs these days, so we
might as well remove this layer of abstraction.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
This commit is contained in:
Christoph Hellwig 2015-05-03 08:50:55 +02:00 committed by Nicholas Bellinger
parent 0dc2e8d143
commit 968ebe7520
3 changed files with 46 additions and 55 deletions

View File

@ -199,16 +199,15 @@ 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->tf_cit_tmpl.tfc_wwn_cit);
&tf->tf_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->tf_cit_tmpl.tfc_wwn_cit);
config_group_init_type_name(&tf->tf_group, name, &tf->tf_wwn_cit);
config_group_init_type_name(&tf->tf_disc_group, "discovery_auth",
&tf->tf_cit_tmpl.tfc_discovery_cit);
&tf->tf_discovery_cit);
pr_debug("Target_Core_ConfigFS: REGISTER -> Allocated Fabric:"
" %s\n", tf->tf_group.cg_item.ci_name);

View File

@ -46,8 +46,7 @@
#define TF_CIT_SETUP(_name, _item_ops, _group_ops, _attrs) \
static void target_fabric_setup_##_name##_cit(struct target_fabric_configfs *tf) \
{ \
struct target_fabric_configfs_template *tfc = &tf->tf_cit_tmpl; \
struct config_item_type *cit = &tfc->tfc_##_name##_cit; \
struct config_item_type *cit = &tf->tf_##_name##_cit; \
\
cit->ct_item_ops = _item_ops; \
cit->ct_group_ops = _group_ops; \
@ -59,8 +58,7 @@ static void target_fabric_setup_##_name##_cit(struct target_fabric_configfs *tf)
#define TF_CIT_SETUP_DRV(_name, _item_ops, _group_ops) \
static void target_fabric_setup_##_name##_cit(struct target_fabric_configfs *tf) \
{ \
struct target_fabric_configfs_template *tfc = &tf->tf_cit_tmpl; \
struct config_item_type *cit = &tfc->tfc_##_name##_cit; \
struct config_item_type *cit = &tf->tf_##_name##_cit; \
struct configfs_attribute **attrs = tf->tf_ops->tfc_##_name##_attrs; \
\
cit->ct_item_ops = _item_ops; \
@ -399,9 +397,9 @@ static struct config_group *target_fabric_make_mappedlun(
}
config_group_init_type_name(&lacl->se_lun_group, name,
&tf->tf_cit_tmpl.tfc_tpg_mappedlun_cit);
&tf->tf_tpg_mappedlun_cit);
config_group_init_type_name(&lacl->ml_stat_grps.stat_group,
"statistics", &tf->tf_cit_tmpl.tfc_tpg_mappedlun_stat_cit);
"statistics", &tf->tf_tpg_mappedlun_stat_cit);
lacl_cg->default_groups[0] = &lacl->ml_stat_grps.stat_group;
lacl_cg->default_groups[1] = NULL;
@ -523,16 +521,15 @@ 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->tf_cit_tmpl.tfc_tpg_nacl_base_cit);
&tf->tf_tpg_nacl_base_cit);
config_group_init_type_name(&se_nacl->acl_attrib_group, "attrib",
&tf->tf_cit_tmpl.tfc_tpg_nacl_attrib_cit);
&tf->tf_tpg_nacl_attrib_cit);
config_group_init_type_name(&se_nacl->acl_auth_group, "auth",
&tf->tf_cit_tmpl.tfc_tpg_nacl_auth_cit);
&tf->tf_tpg_nacl_auth_cit);
config_group_init_type_name(&se_nacl->acl_param_group, "param",
&tf->tf_cit_tmpl.tfc_tpg_nacl_param_cit);
&tf->tf_tpg_nacl_param_cit);
config_group_init_type_name(&se_nacl->acl_fabric_stat_group,
"fabric_statistics",
&tf->tf_cit_tmpl.tfc_tpg_nacl_stat_cit);
"fabric_statistics", &tf->tf_tpg_nacl_stat_cit);
return &se_nacl->acl_group;
}
@ -614,7 +611,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->tf_cit_tmpl.tfc_tpg_np_base_cit);
&tf->tf_tpg_np_base_cit);
return &se_tpg_np->tpg_np_group;
}
@ -918,9 +915,9 @@ static struct config_group *target_fabric_make_lun(
}
config_group_init_type_name(&lun->lun_group, name,
&tf->tf_cit_tmpl.tfc_tpg_port_cit);
&tf->tf_tpg_port_cit);
config_group_init_type_name(&lun->port_stat_grps.stat_group,
"statistics", &tf->tf_cit_tmpl.tfc_tpg_port_stat_cit);
"statistics", &tf->tf_tpg_port_stat_cit);
lun_cg->default_groups[0] = &lun->port_stat_grps.stat_group;
lun_cg->default_groups[1] = NULL;
@ -1071,19 +1068,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->tf_cit_tmpl.tfc_tpg_base_cit);
&tf->tf_tpg_base_cit);
config_group_init_type_name(&se_tpg->tpg_lun_group, "lun",
&tf->tf_cit_tmpl.tfc_tpg_lun_cit);
&tf->tf_tpg_lun_cit);
config_group_init_type_name(&se_tpg->tpg_np_group, "np",
&tf->tf_cit_tmpl.tfc_tpg_np_cit);
&tf->tf_tpg_np_cit);
config_group_init_type_name(&se_tpg->tpg_acl_group, "acls",
&tf->tf_cit_tmpl.tfc_tpg_nacl_cit);
&tf->tf_tpg_nacl_cit);
config_group_init_type_name(&se_tpg->tpg_attrib_group, "attrib",
&tf->tf_cit_tmpl.tfc_tpg_attrib_cit);
&tf->tf_tpg_attrib_cit);
config_group_init_type_name(&se_tpg->tpg_auth_group, "auth",
&tf->tf_cit_tmpl.tfc_tpg_auth_cit);
&tf->tf_tpg_auth_cit);
config_group_init_type_name(&se_tpg->tpg_param_group, "param",
&tf->tf_cit_tmpl.tfc_tpg_param_cit);
&tf->tf_tpg_param_cit);
return &se_tpg->tpg_group;
}
@ -1169,10 +1166,9 @@ static struct config_group *target_fabric_make_wwn(
wwn->wwn_group.default_groups[0] = &wwn->fabric_stat_group;
wwn->wwn_group.default_groups[1] = NULL;
config_group_init_type_name(&wwn->wwn_group, name,
&tf->tf_cit_tmpl.tfc_tpg_cit);
config_group_init_type_name(&wwn->wwn_group, name, &tf->tf_tpg_cit);
config_group_init_type_name(&wwn->fabric_stat_group, "fabric_statistics",
&tf->tf_cit_tmpl.tfc_wwn_fabric_stats_cit);
&tf->tf_wwn_fabric_stats_cit);
return &wwn->wwn_group;
}

View File

@ -5,30 +5,6 @@
#define TARGET_CORE_NAME_MAX_LEN 64
#define TARGET_FABRIC_NAME_SIZE 32
struct target_fabric_configfs_template {
struct config_item_type tfc_discovery_cit;
struct config_item_type tfc_wwn_cit;
struct config_item_type tfc_wwn_fabric_stats_cit;
struct config_item_type tfc_tpg_cit;
struct config_item_type tfc_tpg_base_cit;
struct config_item_type tfc_tpg_lun_cit;
struct config_item_type tfc_tpg_port_cit;
struct config_item_type tfc_tpg_port_stat_cit;
struct config_item_type tfc_tpg_np_cit;
struct config_item_type tfc_tpg_np_base_cit;
struct config_item_type tfc_tpg_attrib_cit;
struct config_item_type tfc_tpg_auth_cit;
struct config_item_type tfc_tpg_param_cit;
struct config_item_type tfc_tpg_nacl_cit;
struct config_item_type tfc_tpg_nacl_base_cit;
struct config_item_type tfc_tpg_nacl_attrib_cit;
struct config_item_type tfc_tpg_nacl_auth_cit;
struct config_item_type tfc_tpg_nacl_param_cit;
struct config_item_type tfc_tpg_nacl_stat_cit;
struct config_item_type tfc_tpg_mappedlun_cit;
struct config_item_type tfc_tpg_mappedlun_stat_cit;
};
struct target_fabric_configfs {
atomic_t tf_access_cnt;
struct list_head tf_list;
@ -36,6 +12,26 @@ struct target_fabric_configfs {
struct config_group tf_disc_group;
struct config_group *tf_default_groups[2];
const struct target_core_fabric_ops *tf_ops;
struct target_fabric_configfs_template tf_cit_tmpl;
};
struct config_item_type tf_discovery_cit;
struct config_item_type tf_wwn_cit;
struct config_item_type tf_wwn_fabric_stats_cit;
struct config_item_type tf_tpg_cit;
struct config_item_type tf_tpg_base_cit;
struct config_item_type tf_tpg_lun_cit;
struct config_item_type tf_tpg_port_cit;
struct config_item_type tf_tpg_port_stat_cit;
struct config_item_type tf_tpg_np_cit;
struct config_item_type tf_tpg_np_base_cit;
struct config_item_type tf_tpg_attrib_cit;
struct config_item_type tf_tpg_auth_cit;
struct config_item_type tf_tpg_param_cit;
struct config_item_type tf_tpg_nacl_cit;
struct config_item_type tf_tpg_nacl_base_cit;
struct config_item_type tf_tpg_nacl_attrib_cit;
struct config_item_type tf_tpg_nacl_auth_cit;
struct config_item_type tf_tpg_nacl_param_cit;
struct config_item_type tf_tpg_nacl_stat_cit;
struct config_item_type tf_tpg_mappedlun_cit;
struct config_item_type tf_tpg_mappedlun_stat_cit;
};