diff options
-rw-r--r-- | drivers/infiniband/ulp/srpt/ib_srpt.c | 1 | ||||
-rw-r--r-- | drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 1 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/tcm_qla2xxx.c | 2 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_configfs.c | 2 | ||||
-rw-r--r-- | drivers/target/loopback/tcm_loop.c | 1 | ||||
-rw-r--r-- | drivers/target/sbp/sbp_target.c | 1 | ||||
-rw-r--r-- | drivers/target/target_core_configfs.c | 30 | ||||
-rw-r--r-- | drivers/target/tcm_fc/tfc_conf.c | 1 | ||||
-rw-r--r-- | drivers/usb/gadget/function/f_tcm.c | 1 | ||||
-rw-r--r-- | drivers/vhost/scsi.c | 1 | ||||
-rw-r--r-- | drivers/xen/xen-scsiback.c | 1 | ||||
-rw-r--r-- | include/target/target_core_fabric.h | 12 |
12 files changed, 28 insertions, 26 deletions
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 657d728da40c..41ee1f263bd6 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
@@ -3673,7 +3673,6 @@ static struct configfs_attribute *srpt_wwn_attrs[] = { | |||
3673 | 3673 | ||
3674 | static const struct target_core_fabric_ops srpt_template = { | 3674 | static const struct target_core_fabric_ops srpt_template = { |
3675 | .module = THIS_MODULE, | 3675 | .module = THIS_MODULE, |
3676 | .name = "srpt", | ||
3677 | .fabric_name = "srpt", | 3676 | .fabric_name = "srpt", |
3678 | .tpg_get_wwn = srpt_get_fabric_wwn, | 3677 | .tpg_get_wwn = srpt_get_fabric_wwn, |
3679 | .tpg_get_tag = srpt_get_tag, | 3678 | .tpg_get_tag = srpt_get_tag, |
diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c index 6e1c3e65f37b..cc9cae469c4b 100644 --- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | |||
@@ -4039,7 +4039,6 @@ static struct configfs_attribute *ibmvscsis_tpg_attrs[] = { | |||
4039 | 4039 | ||
4040 | static const struct target_core_fabric_ops ibmvscsis_ops = { | 4040 | static const struct target_core_fabric_ops ibmvscsis_ops = { |
4041 | .module = THIS_MODULE, | 4041 | .module = THIS_MODULE, |
4042 | .name = "ibmvscsis", | ||
4043 | .fabric_name = "ibmvscsis", | 4042 | .fabric_name = "ibmvscsis", |
4044 | .max_data_sg_nents = MAX_TXU / PAGE_SIZE, | 4043 | .max_data_sg_nents = MAX_TXU / PAGE_SIZE, |
4045 | .tpg_get_wwn = ibmvscsis_get_fabric_wwn, | 4044 | .tpg_get_wwn = ibmvscsis_get_fabric_wwn, |
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index ff8735effe28..fc312a5eab75 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c | |||
@@ -1910,7 +1910,6 @@ static struct configfs_attribute *tcm_qla2xxx_wwn_attrs[] = { | |||
1910 | 1910 | ||
1911 | static const struct target_core_fabric_ops tcm_qla2xxx_ops = { | 1911 | static const struct target_core_fabric_ops tcm_qla2xxx_ops = { |
1912 | .module = THIS_MODULE, | 1912 | .module = THIS_MODULE, |
1913 | .name = "qla2xxx", | ||
1914 | .fabric_name = "qla2xxx", | 1913 | .fabric_name = "qla2xxx", |
1915 | .node_acl_size = sizeof(struct tcm_qla2xxx_nacl), | 1914 | .node_acl_size = sizeof(struct tcm_qla2xxx_nacl), |
1916 | /* | 1915 | /* |
@@ -1959,7 +1958,6 @@ static const struct target_core_fabric_ops tcm_qla2xxx_ops = { | |||
1959 | 1958 | ||
1960 | static const struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = { | 1959 | static const struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = { |
1961 | .module = THIS_MODULE, | 1960 | .module = THIS_MODULE, |
1962 | .name = "qla2xxx_npiv", | ||
1963 | .fabric_name = "qla2xxx_npiv", | 1961 | .fabric_name = "qla2xxx_npiv", |
1964 | .node_acl_size = sizeof(struct tcm_qla2xxx_nacl), | 1962 | .node_acl_size = sizeof(struct tcm_qla2xxx_nacl), |
1965 | .tpg_get_wwn = tcm_qla2xxx_get_fabric_wwn, | 1963 | .tpg_get_wwn = tcm_qla2xxx_get_fabric_wwn, |
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c index 5c9e98ee42de..39a700a41f6e 100644 --- a/drivers/target/iscsi/iscsi_target_configfs.c +++ b/drivers/target/iscsi/iscsi_target_configfs.c | |||
@@ -1544,7 +1544,7 @@ static void lio_release_cmd(struct se_cmd *se_cmd) | |||
1544 | 1544 | ||
1545 | const struct target_core_fabric_ops iscsi_ops = { | 1545 | const struct target_core_fabric_ops iscsi_ops = { |
1546 | .module = THIS_MODULE, | 1546 | .module = THIS_MODULE, |
1547 | .name = "iscsi", | 1547 | .fabric_alias = "iscsi", |
1548 | .fabric_name = "iSCSI", | 1548 | .fabric_name = "iSCSI", |
1549 | .node_acl_size = sizeof(struct iscsi_node_acl), | 1549 | .node_acl_size = sizeof(struct iscsi_node_acl), |
1550 | .tpg_get_wwn = lio_tpg_get_endpoint_wwn, | 1550 | .tpg_get_wwn = lio_tpg_get_endpoint_wwn, |
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 962845224c19..b0991e86587f 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c | |||
@@ -1144,7 +1144,6 @@ static struct configfs_attribute *tcm_loop_wwn_attrs[] = { | |||
1144 | 1144 | ||
1145 | static const struct target_core_fabric_ops loop_ops = { | 1145 | static const struct target_core_fabric_ops loop_ops = { |
1146 | .module = THIS_MODULE, | 1146 | .module = THIS_MODULE, |
1147 | .name = "loopback", | ||
1148 | .fabric_name = "loopback", | 1147 | .fabric_name = "loopback", |
1149 | .tpg_get_wwn = tcm_loop_get_endpoint_wwn, | 1148 | .tpg_get_wwn = tcm_loop_get_endpoint_wwn, |
1150 | .tpg_get_tag = tcm_loop_get_tag, | 1149 | .tpg_get_tag = tcm_loop_get_tag, |
diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c index f5830bb4ef5a..08cee13dfb9a 100644 --- a/drivers/target/sbp/sbp_target.c +++ b/drivers/target/sbp/sbp_target.c | |||
@@ -2318,7 +2318,6 @@ static struct configfs_attribute *sbp_tpg_attrib_attrs[] = { | |||
2318 | 2318 | ||
2319 | static const struct target_core_fabric_ops sbp_ops = { | 2319 | static const struct target_core_fabric_ops sbp_ops = { |
2320 | .module = THIS_MODULE, | 2320 | .module = THIS_MODULE, |
2321 | .name = "sbp", | ||
2322 | .fabric_name = "sbp", | 2321 | .fabric_name = "sbp", |
2323 | .tpg_get_wwn = sbp_get_fabric_wwn, | 2322 | .tpg_get_wwn = sbp_get_fabric_wwn, |
2324 | .tpg_get_tag = sbp_get_tag, | 2323 | .tpg_get_tag = sbp_get_tag, |
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index ae6c44c48f75..0e8449be5115 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -172,7 +172,10 @@ static struct target_fabric_configfs *target_core_get_fabric( | |||
172 | 172 | ||
173 | mutex_lock(&g_tf_lock); | 173 | mutex_lock(&g_tf_lock); |
174 | list_for_each_entry(tf, &g_tf_list, tf_list) { | 174 | list_for_each_entry(tf, &g_tf_list, tf_list) { |
175 | if (!strcmp(tf->tf_ops->name, name)) { | 175 | const char *cmp_name = tf->tf_ops->fabric_alias; |
176 | if (!cmp_name) | ||
177 | cmp_name = tf->tf_ops->fabric_name; | ||
178 | if (!strcmp(cmp_name, name)) { | ||
176 | atomic_inc(&tf->tf_access_cnt); | 179 | atomic_inc(&tf->tf_access_cnt); |
177 | mutex_unlock(&g_tf_lock); | 180 | mutex_unlock(&g_tf_lock); |
178 | return tf; | 181 | return tf; |
@@ -249,7 +252,7 @@ static struct config_group *target_core_register_fabric( | |||
249 | return ERR_PTR(-EINVAL); | 252 | return ERR_PTR(-EINVAL); |
250 | } | 253 | } |
251 | pr_debug("Target_Core_ConfigFS: REGISTER -> Located fabric:" | 254 | pr_debug("Target_Core_ConfigFS: REGISTER -> Located fabric:" |
252 | " %s\n", tf->tf_ops->name); | 255 | " %s\n", tf->tf_ops->fabric_name); |
253 | /* | 256 | /* |
254 | * On a successful target_core_get_fabric() look, the returned | 257 | * On a successful target_core_get_fabric() look, the returned |
255 | * struct target_fabric_configfs *tf will contain a usage reference. | 258 | * struct target_fabric_configfs *tf will contain a usage reference. |
@@ -282,7 +285,7 @@ static void target_core_deregister_fabric( | |||
282 | " tf list\n", config_item_name(item)); | 285 | " tf list\n", config_item_name(item)); |
283 | 286 | ||
284 | pr_debug("Target_Core_ConfigFS: DEREGISTER -> located fabric:" | 287 | pr_debug("Target_Core_ConfigFS: DEREGISTER -> located fabric:" |
285 | " %s\n", tf->tf_ops->name); | 288 | " %s\n", tf->tf_ops->fabric_name); |
286 | atomic_dec(&tf->tf_access_cnt); | 289 | atomic_dec(&tf->tf_access_cnt); |
287 | 290 | ||
288 | pr_debug("Target_Core_ConfigFS: DEREGISTER -> Releasing ci" | 291 | pr_debug("Target_Core_ConfigFS: DEREGISTER -> Releasing ci" |
@@ -342,19 +345,22 @@ EXPORT_SYMBOL(target_undepend_item); | |||
342 | 345 | ||
343 | static int target_fabric_tf_ops_check(const struct target_core_fabric_ops *tfo) | 346 | static int target_fabric_tf_ops_check(const struct target_core_fabric_ops *tfo) |
344 | { | 347 | { |
345 | if (!tfo->name) { | 348 | if (tfo->fabric_alias) { |
346 | pr_err("Missing tfo->name\n"); | 349 | if (strlen(tfo->fabric_alias) >= TARGET_FABRIC_NAME_SIZE) { |
347 | return -EINVAL; | 350 | pr_err("Passed alias: %s exceeds " |
348 | } | 351 | "TARGET_FABRIC_NAME_SIZE\n", tfo->fabric_alias); |
349 | if (strlen(tfo->name) >= TARGET_FABRIC_NAME_SIZE) { | 352 | return -EINVAL; |
350 | pr_err("Passed name: %s exceeds TARGET_FABRIC" | 353 | } |
351 | "_NAME_SIZE\n", tfo->name); | ||
352 | return -EINVAL; | ||
353 | } | 354 | } |
354 | if (!tfo->fabric_name) { | 355 | if (!tfo->fabric_name) { |
355 | pr_err("Missing tfo->fabric_name\n"); | 356 | pr_err("Missing tfo->fabric_name\n"); |
356 | return -EINVAL; | 357 | return -EINVAL; |
357 | } | 358 | } |
359 | if (strlen(tfo->fabric_name) >= TARGET_FABRIC_NAME_SIZE) { | ||
360 | pr_err("Passed name: %s exceeds " | ||
361 | "TARGET_FABRIC_NAME_SIZE\n", tfo->fabric_name); | ||
362 | return -EINVAL; | ||
363 | } | ||
358 | if (!tfo->tpg_get_wwn) { | 364 | if (!tfo->tpg_get_wwn) { |
359 | pr_err("Missing tfo->tpg_get_wwn()\n"); | 365 | pr_err("Missing tfo->tpg_get_wwn()\n"); |
360 | return -EINVAL; | 366 | return -EINVAL; |
@@ -486,7 +492,7 @@ void target_unregister_template(const struct target_core_fabric_ops *fo) | |||
486 | 492 | ||
487 | mutex_lock(&g_tf_lock); | 493 | mutex_lock(&g_tf_lock); |
488 | list_for_each_entry(t, &g_tf_list, tf_list) { | 494 | list_for_each_entry(t, &g_tf_list, tf_list) { |
489 | if (!strcmp(t->tf_ops->name, fo->name)) { | 495 | if (!strcmp(t->tf_ops->fabric_name, fo->fabric_name)) { |
490 | BUG_ON(atomic_read(&t->tf_access_cnt)); | 496 | BUG_ON(atomic_read(&t->tf_access_cnt)); |
491 | list_del(&t->tf_list); | 497 | list_del(&t->tf_list); |
492 | mutex_unlock(&g_tf_lock); | 498 | mutex_unlock(&g_tf_lock); |
diff --git a/drivers/target/tcm_fc/tfc_conf.c b/drivers/target/tcm_fc/tfc_conf.c index 8b884246a9be..1ce49518d440 100644 --- a/drivers/target/tcm_fc/tfc_conf.c +++ b/drivers/target/tcm_fc/tfc_conf.c | |||
@@ -422,7 +422,6 @@ static u32 ft_tpg_get_inst_index(struct se_portal_group *se_tpg) | |||
422 | 422 | ||
423 | static const struct target_core_fabric_ops ft_fabric_ops = { | 423 | static const struct target_core_fabric_ops ft_fabric_ops = { |
424 | .module = THIS_MODULE, | 424 | .module = THIS_MODULE, |
425 | .name = "fc", | ||
426 | .fabric_name = "fc", | 425 | .fabric_name = "fc", |
427 | .node_acl_size = sizeof(struct ft_node_acl), | 426 | .node_acl_size = sizeof(struct ft_node_acl), |
428 | .tpg_get_wwn = ft_get_fabric_wwn, | 427 | .tpg_get_wwn = ft_get_fabric_wwn, |
diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index 1a03f4975dab..34f5982cab78 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c | |||
@@ -1713,7 +1713,6 @@ static int usbg_check_stop_free(struct se_cmd *se_cmd) | |||
1713 | 1713 | ||
1714 | static const struct target_core_fabric_ops usbg_ops = { | 1714 | static const struct target_core_fabric_ops usbg_ops = { |
1715 | .module = THIS_MODULE, | 1715 | .module = THIS_MODULE, |
1716 | .name = "usb_gadget", | ||
1717 | .fabric_name = "usb_gadget", | 1716 | .fabric_name = "usb_gadget", |
1718 | .tpg_get_wwn = usbg_get_fabric_wwn, | 1717 | .tpg_get_wwn = usbg_get_fabric_wwn, |
1719 | .tpg_get_tag = usbg_get_tag, | 1718 | .tpg_get_tag = usbg_get_tag, |
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 37e003649ba1..a08472ae5b1b 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
@@ -2284,7 +2284,6 @@ static struct configfs_attribute *vhost_scsi_wwn_attrs[] = { | |||
2284 | 2284 | ||
2285 | static const struct target_core_fabric_ops vhost_scsi_ops = { | 2285 | static const struct target_core_fabric_ops vhost_scsi_ops = { |
2286 | .module = THIS_MODULE, | 2286 | .module = THIS_MODULE, |
2287 | .name = "vhost", | ||
2288 | .fabric_name = "vhost", | 2287 | .fabric_name = "vhost", |
2289 | .tpg_get_wwn = vhost_scsi_get_fabric_wwn, | 2288 | .tpg_get_wwn = vhost_scsi_get_fabric_wwn, |
2290 | .tpg_get_tag = vhost_scsi_get_tpgt, | 2289 | .tpg_get_tag = vhost_scsi_get_tpgt, |
diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c index ffde280c3ecd..c9e23a126218 100644 --- a/drivers/xen/xen-scsiback.c +++ b/drivers/xen/xen-scsiback.c | |||
@@ -1805,7 +1805,6 @@ static int scsiback_check_false(struct se_portal_group *se_tpg) | |||
1805 | 1805 | ||
1806 | static const struct target_core_fabric_ops scsiback_ops = { | 1806 | static const struct target_core_fabric_ops scsiback_ops = { |
1807 | .module = THIS_MODULE, | 1807 | .module = THIS_MODULE, |
1808 | .name = "xen-pvscsi", | ||
1809 | .fabric_name = "xen-pvscsi", | 1808 | .fabric_name = "xen-pvscsi", |
1810 | .tpg_get_wwn = scsiback_get_fabric_wwn, | 1809 | .tpg_get_wwn = scsiback_get_fabric_wwn, |
1811 | .tpg_get_tag = scsiback_get_tag, | 1810 | .tpg_get_tag = scsiback_get_tag, |
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index a0b41110d266..0a1595f3c5a1 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h | |||
@@ -8,10 +8,16 @@ | |||
8 | 8 | ||
9 | struct target_core_fabric_ops { | 9 | struct target_core_fabric_ops { |
10 | struct module *module; | 10 | struct module *module; |
11 | const char *name; | ||
12 | /* | 11 | /* |
13 | * fabric_name is used for the ALUA state path and is stored on disk | 12 | * XXX: Special case for iscsi/iSCSI... |
14 | * with PR state. | 13 | * If non-null, fabric_alias is used for matching target/$fabric |
14 | * ConfigFS paths. If null, fabric_name is used for this (see below). | ||
15 | */ | ||
16 | const char *fabric_alias; | ||
17 | /* | ||
18 | * fabric_name is used for matching target/$fabric ConfigFS paths | ||
19 | * without a fabric_alias (see above). It's also used for the ALUA state | ||
20 | * path and is stored on disk with PR state. | ||
15 | */ | 21 | */ |
16 | const char *fabric_name; | 22 | const char *fabric_name; |
17 | size_t node_acl_size; | 23 | size_t node_acl_size; |