Commit ef0caf8d authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Nicholas Bellinger

target: don't copy fabric ops

Now that we don't need to set up ->tf_subsys we don't need to copy around
the ops vector anymore.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 45fb94c2
...@@ -444,7 +444,7 @@ int target_register_template(const struct target_core_fabric_ops *fo) ...@@ -444,7 +444,7 @@ int target_register_template(const struct target_core_fabric_ops *fo)
tf->tf_module = fo->module; tf->tf_module = fo->module;
snprintf(tf->tf_name, TARGET_FABRIC_NAME_SIZE, "%s", fo->name); snprintf(tf->tf_name, TARGET_FABRIC_NAME_SIZE, "%s", fo->name);
tf->tf_ops = *fo; tf->tf_ops = fo;
target_fabric_setup_cits(tf); target_fabric_setup_cits(tf);
mutex_lock(&g_tf_lock); mutex_lock(&g_tf_lock);
......
...@@ -61,7 +61,7 @@ static void target_fabric_setup_##_name##_cit(struct target_fabric_configfs *tf) ...@@ -61,7 +61,7 @@ static void target_fabric_setup_##_name##_cit(struct target_fabric_configfs *tf)
{ \ { \
struct target_fabric_configfs_template *tfc = &tf->tf_cit_tmpl; \ struct target_fabric_configfs_template *tfc = &tf->tf_cit_tmpl; \
struct config_item_type *cit = &tfc->tfc_##_name##_cit; \ struct config_item_type *cit = &tfc->tfc_##_name##_cit; \
struct configfs_attribute **attrs = tf->tf_ops.tfc_##_name##_attrs; \ struct configfs_attribute **attrs = tf->tf_ops->tfc_##_name##_attrs; \
\ \
cit->ct_item_ops = _item_ops; \ cit->ct_item_ops = _item_ops; \
cit->ct_group_ops = _group_ops; \ cit->ct_group_ops = _group_ops; \
...@@ -460,8 +460,8 @@ static void target_fabric_nacl_base_release(struct config_item *item) ...@@ -460,8 +460,8 @@ static void target_fabric_nacl_base_release(struct config_item *item)
struct se_node_acl, acl_group); struct se_node_acl, acl_group);
struct target_fabric_configfs *tf = se_nacl->se_tpg->se_tpg_wwn->wwn_tf; struct target_fabric_configfs *tf = se_nacl->se_tpg->se_tpg_wwn->wwn_tf;
if (tf->tf_ops.fabric_cleanup_nodeacl) if (tf->tf_ops->fabric_cleanup_nodeacl)
tf->tf_ops.fabric_cleanup_nodeacl(se_nacl); tf->tf_ops->fabric_cleanup_nodeacl(se_nacl);
core_tpg_del_initiator_node_acl(se_nacl); core_tpg_del_initiator_node_acl(se_nacl);
} }
...@@ -506,8 +506,8 @@ static struct config_group *target_fabric_make_nodeacl( ...@@ -506,8 +506,8 @@ static struct config_group *target_fabric_make_nodeacl(
if (IS_ERR(se_nacl)) if (IS_ERR(se_nacl))
return ERR_CAST(se_nacl); return ERR_CAST(se_nacl);
if (tf->tf_ops.fabric_init_nodeacl) { if (tf->tf_ops->fabric_init_nodeacl) {
int ret = tf->tf_ops.fabric_init_nodeacl(se_nacl, name); int ret = tf->tf_ops->fabric_init_nodeacl(se_nacl, name);
if (ret) { if (ret) {
core_tpg_del_initiator_node_acl(se_nacl); core_tpg_del_initiator_node_acl(se_nacl);
return ERR_PTR(ret); return ERR_PTR(ret);
...@@ -579,7 +579,7 @@ static void target_fabric_np_base_release(struct config_item *item) ...@@ -579,7 +579,7 @@ static void target_fabric_np_base_release(struct config_item *item)
struct se_portal_group *se_tpg = se_tpg_np->tpg_np_parent; struct se_portal_group *se_tpg = se_tpg_np->tpg_np_parent;
struct target_fabric_configfs *tf = se_tpg->se_tpg_wwn->wwn_tf; struct target_fabric_configfs *tf = se_tpg->se_tpg_wwn->wwn_tf;
tf->tf_ops.fabric_drop_np(se_tpg_np); tf->tf_ops->fabric_drop_np(se_tpg_np);
} }
static struct configfs_item_operations target_fabric_np_base_item_ops = { static struct configfs_item_operations target_fabric_np_base_item_ops = {
...@@ -603,12 +603,12 @@ static struct config_group *target_fabric_make_np( ...@@ -603,12 +603,12 @@ static struct config_group *target_fabric_make_np(
struct target_fabric_configfs *tf = se_tpg->se_tpg_wwn->wwn_tf; struct target_fabric_configfs *tf = se_tpg->se_tpg_wwn->wwn_tf;
struct se_tpg_np *se_tpg_np; struct se_tpg_np *se_tpg_np;
if (!tf->tf_ops.fabric_make_np) { if (!tf->tf_ops->fabric_make_np) {
pr_err("tf->tf_ops.fabric_make_np is NULL\n"); pr_err("tf->tf_ops.fabric_make_np is NULL\n");
return ERR_PTR(-ENOSYS); return ERR_PTR(-ENOSYS);
} }
se_tpg_np = tf->tf_ops.fabric_make_np(se_tpg, group, name); se_tpg_np = tf->tf_ops->fabric_make_np(se_tpg, group, name);
if (!se_tpg_np || IS_ERR(se_tpg_np)) if (!se_tpg_np || IS_ERR(se_tpg_np))
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
...@@ -808,13 +808,13 @@ static int target_fabric_port_link( ...@@ -808,13 +808,13 @@ static int target_fabric_port_link(
goto out; goto out;
} }
if (tf->tf_ops.fabric_post_link) { if (tf->tf_ops->fabric_post_link) {
/* /*
* Call the optional fabric_post_link() to allow a * Call the optional fabric_post_link() to allow a
* fabric module to setup any additional state once * fabric module to setup any additional state once
* core_dev_add_lun() has been called.. * core_dev_add_lun() has been called..
*/ */
tf->tf_ops.fabric_post_link(se_tpg, lun); tf->tf_ops->fabric_post_link(se_tpg, lun);
} }
return 0; return 0;
...@@ -831,13 +831,13 @@ static int target_fabric_port_unlink( ...@@ -831,13 +831,13 @@ static int target_fabric_port_unlink(
struct se_portal_group *se_tpg = lun->lun_sep->sep_tpg; struct se_portal_group *se_tpg = lun->lun_sep->sep_tpg;
struct target_fabric_configfs *tf = se_tpg->se_tpg_wwn->wwn_tf; struct target_fabric_configfs *tf = se_tpg->se_tpg_wwn->wwn_tf;
if (tf->tf_ops.fabric_pre_unlink) { if (tf->tf_ops->fabric_pre_unlink) {
/* /*
* Call the optional fabric_pre_unlink() to allow a * Call the optional fabric_pre_unlink() to allow a
* fabric module to release any additional stat before * fabric module to release any additional stat before
* core_dev_del_lun() is called. * core_dev_del_lun() is called.
*/ */
tf->tf_ops.fabric_pre_unlink(se_tpg, lun); tf->tf_ops->fabric_pre_unlink(se_tpg, lun);
} }
core_dev_del_lun(se_tpg, lun); core_dev_del_lun(se_tpg, lun);
...@@ -1027,7 +1027,7 @@ static void target_fabric_tpg_release(struct config_item *item) ...@@ -1027,7 +1027,7 @@ static void target_fabric_tpg_release(struct config_item *item)
struct se_wwn *wwn = se_tpg->se_tpg_wwn; struct se_wwn *wwn = se_tpg->se_tpg_wwn;
struct target_fabric_configfs *tf = wwn->wwn_tf; struct target_fabric_configfs *tf = wwn->wwn_tf;
tf->tf_ops.fabric_drop_tpg(se_tpg); tf->tf_ops->fabric_drop_tpg(se_tpg);
} }
static struct configfs_item_operations target_fabric_tpg_base_item_ops = { static struct configfs_item_operations target_fabric_tpg_base_item_ops = {
...@@ -1050,12 +1050,12 @@ static struct config_group *target_fabric_make_tpg( ...@@ -1050,12 +1050,12 @@ static struct config_group *target_fabric_make_tpg(
struct target_fabric_configfs *tf = wwn->wwn_tf; struct target_fabric_configfs *tf = wwn->wwn_tf;
struct se_portal_group *se_tpg; struct se_portal_group *se_tpg;
if (!tf->tf_ops.fabric_make_tpg) { if (!tf->tf_ops->fabric_make_tpg) {
pr_err("tf->tf_ops.fabric_make_tpg is NULL\n"); pr_err("tf->tf_ops->fabric_make_tpg is NULL\n");
return ERR_PTR(-ENOSYS); return ERR_PTR(-ENOSYS);
} }
se_tpg = tf->tf_ops.fabric_make_tpg(wwn, group, name); se_tpg = tf->tf_ops->fabric_make_tpg(wwn, group, name);
if (!se_tpg || IS_ERR(se_tpg)) if (!se_tpg || IS_ERR(se_tpg))
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
/* /*
...@@ -1116,7 +1116,7 @@ static void target_fabric_release_wwn(struct config_item *item) ...@@ -1116,7 +1116,7 @@ static void target_fabric_release_wwn(struct config_item *item)
struct se_wwn, wwn_group); struct se_wwn, wwn_group);
struct target_fabric_configfs *tf = wwn->wwn_tf; struct target_fabric_configfs *tf = wwn->wwn_tf;
tf->tf_ops.fabric_drop_wwn(wwn); tf->tf_ops->fabric_drop_wwn(wwn);
} }
static struct configfs_item_operations target_fabric_tpg_item_ops = { static struct configfs_item_operations target_fabric_tpg_item_ops = {
...@@ -1152,12 +1152,12 @@ static struct config_group *target_fabric_make_wwn( ...@@ -1152,12 +1152,12 @@ static struct config_group *target_fabric_make_wwn(
struct target_fabric_configfs, tf_group); struct target_fabric_configfs, tf_group);
struct se_wwn *wwn; struct se_wwn *wwn;
if (!tf->tf_ops.fabric_make_wwn) { if (!tf->tf_ops->fabric_make_wwn) {
pr_err("tf->tf_ops.fabric_make_wwn is NULL\n"); pr_err("tf->tf_ops.fabric_make_wwn is NULL\n");
return ERR_PTR(-ENOSYS); return ERR_PTR(-ENOSYS);
} }
wwn = tf->tf_ops.fabric_make_wwn(tf, group, name); wwn = tf->tf_ops->fabric_make_wwn(tf, group, name);
if (!wwn || IS_ERR(wwn)) if (!wwn || IS_ERR(wwn))
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
......
...@@ -42,7 +42,7 @@ struct target_fabric_configfs { ...@@ -42,7 +42,7 @@ struct target_fabric_configfs {
struct config_item_type *tf_fabric_cit; struct config_item_type *tf_fabric_cit;
/* Pointer to fabric's struct module */ /* Pointer to fabric's struct module */
struct module *tf_module; struct module *tf_module;
struct target_core_fabric_ops tf_ops; const struct target_core_fabric_ops *tf_ops;
struct target_fabric_configfs_template tf_cit_tmpl; struct target_fabric_configfs_template tf_cit_tmpl;
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment