diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-11-28 00:11:24 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-12-02 00:36:03 -0500 |
commit | e9f720d63b476c9dc2a936c186878f1795b8b4c5 (patch) | |
tree | 24acc76cf082f15bdc7bd34aac80cecdcdeab9cf /drivers | |
parent | 03a627457e8440fe09e173dcc7d59a7c0a202d03 (diff) |
target/user: Convert to external tcmu_backend_dev_attrs
This patch converts TCM-USER to use an external set of device attributes,
and utilizes target_core_backend_configfs.h macros to generate a default
set of configfs extended-attr handlers.
It calls target_core_setup_sub_cits() to setup the initial config_item_type
based on existing target_core_configfs.c defaults, and using configfs_attribute
generated by DEF_TB_DEFAULT_ATTRIBS(tcmu) populates tcmu_backend_dev_attrs[]
It introduces no function change for existing TCMU device attributes.
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/target/target_core_user.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index 9a1b314f6482..8bfa61c9693d 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <target/target_core_base.h> | 28 | #include <target/target_core_base.h> |
29 | #include <target/target_core_fabric.h> | 29 | #include <target/target_core_fabric.h> |
30 | #include <target/target_core_backend.h> | 30 | #include <target/target_core_backend.h> |
31 | #include <target/target_core_backend_configfs.h> | ||
32 | |||
31 | #include <linux/target_core_user.h> | 33 | #include <linux/target_core_user.h> |
32 | 34 | ||
33 | /* | 35 | /* |
@@ -1092,6 +1094,42 @@ tcmu_parse_cdb(struct se_cmd *cmd) | |||
1092 | return ret; | 1094 | return ret; |
1093 | } | 1095 | } |
1094 | 1096 | ||
1097 | DEF_TB_DEFAULT_ATTRIBS(tcmu); | ||
1098 | |||
1099 | static struct configfs_attribute *tcmu_backend_dev_attrs[] = { | ||
1100 | &tcmu_dev_attrib_emulate_model_alias.attr, | ||
1101 | &tcmu_dev_attrib_emulate_dpo.attr, | ||
1102 | &tcmu_dev_attrib_emulate_fua_write.attr, | ||
1103 | &tcmu_dev_attrib_emulate_fua_read.attr, | ||
1104 | &tcmu_dev_attrib_emulate_write_cache.attr, | ||
1105 | &tcmu_dev_attrib_emulate_ua_intlck_ctrl.attr, | ||
1106 | &tcmu_dev_attrib_emulate_tas.attr, | ||
1107 | &tcmu_dev_attrib_emulate_tpu.attr, | ||
1108 | &tcmu_dev_attrib_emulate_tpws.attr, | ||
1109 | &tcmu_dev_attrib_emulate_caw.attr, | ||
1110 | &tcmu_dev_attrib_emulate_3pc.attr, | ||
1111 | &tcmu_dev_attrib_pi_prot_type.attr, | ||
1112 | &tcmu_dev_attrib_hw_pi_prot_type.attr, | ||
1113 | &tcmu_dev_attrib_pi_prot_format.attr, | ||
1114 | &tcmu_dev_attrib_enforce_pr_isids.attr, | ||
1115 | &tcmu_dev_attrib_is_nonrot.attr, | ||
1116 | &tcmu_dev_attrib_emulate_rest_reord.attr, | ||
1117 | &tcmu_dev_attrib_force_pr_aptpl.attr, | ||
1118 | &tcmu_dev_attrib_hw_block_size.attr, | ||
1119 | &tcmu_dev_attrib_block_size.attr, | ||
1120 | &tcmu_dev_attrib_hw_max_sectors.attr, | ||
1121 | &tcmu_dev_attrib_fabric_max_sectors.attr, | ||
1122 | &tcmu_dev_attrib_optimal_sectors.attr, | ||
1123 | &tcmu_dev_attrib_hw_queue_depth.attr, | ||
1124 | &tcmu_dev_attrib_queue_depth.attr, | ||
1125 | &tcmu_dev_attrib_max_unmap_lba_count.attr, | ||
1126 | &tcmu_dev_attrib_max_unmap_block_desc_count.attr, | ||
1127 | &tcmu_dev_attrib_unmap_granularity.attr, | ||
1128 | &tcmu_dev_attrib_unmap_granularity_alignment.attr, | ||
1129 | &tcmu_dev_attrib_max_write_same_len.attr, | ||
1130 | NULL, | ||
1131 | }; | ||
1132 | |||
1095 | static struct se_subsystem_api tcmu_template = { | 1133 | static struct se_subsystem_api tcmu_template = { |
1096 | .name = "user", | 1134 | .name = "user", |
1097 | .inquiry_prod = "USER", | 1135 | .inquiry_prod = "USER", |
@@ -1112,6 +1150,7 @@ static struct se_subsystem_api tcmu_template = { | |||
1112 | 1150 | ||
1113 | static int __init tcmu_module_init(void) | 1151 | static int __init tcmu_module_init(void) |
1114 | { | 1152 | { |
1153 | struct target_backend_cits *tbc = &tcmu_template.tb_cits; | ||
1115 | int ret; | 1154 | int ret; |
1116 | 1155 | ||
1117 | BUILD_BUG_ON((sizeof(struct tcmu_cmd_entry) % TCMU_OP_ALIGN_SIZE) != 0); | 1156 | BUILD_BUG_ON((sizeof(struct tcmu_cmd_entry) % TCMU_OP_ALIGN_SIZE) != 0); |
@@ -1134,6 +1173,9 @@ static int __init tcmu_module_init(void) | |||
1134 | goto out_unreg_device; | 1173 | goto out_unreg_device; |
1135 | } | 1174 | } |
1136 | 1175 | ||
1176 | target_core_setup_sub_cits(&tcmu_template); | ||
1177 | tbc->tb_dev_attrib_cit.ct_attrs = tcmu_backend_dev_attrs; | ||
1178 | |||
1137 | ret = transport_subsystem_register(&tcmu_template); | 1179 | ret = transport_subsystem_register(&tcmu_template); |
1138 | if (ret) | 1180 | if (ret) |
1139 | goto out_unreg_genl; | 1181 | goto out_unreg_genl; |