aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/target/tcm_mod_builder.py
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-07-04 17:13:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-07-04 17:13:43 -0400
commit5c755fe142b421d295e7dd64a9833c12abbfd28e (patch)
tree768b637e9f7b72def5780c99d2368bc462fdaff4 /Documentation/target/tcm_mod_builder.py
parent6d7c8e1b3a1fae91daaf1bec4df694239c7a430b (diff)
parent2ec1e9e20701f37a06562966dbd37e7dd072fcb8 (diff)
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target updates from Nicholas Bellinger: "It's been a busy development cycle for target-core in a number of different areas. The fabric API usage for se_node_acl allocation is now within target-core code, dropping the external API callers for all fabric drivers tree-wide. There is a new conversion to RCU hlists for se_node_acl and se_portal_group LUN mappings, that turns fast-past LUN lookup into a completely lockless code-path. It also removes the original hard-coded limitation of 256 LUNs per fabric endpoint. The configfs attributes for backends can now be shared between core and driver code, allowing existing drivers to use common code while still allowing flexibility for new backend provided attributes. The highlights include: - Merge sbc_verify_dif_* into common code (sagi) - Remove iscsi-target support for obsolete IFMarker/OFMarker (Christophe Vu-Brugier) - Add bidi support in target/user backend (ilias + vangelis + agover) - Move se_node_acl allocation into target-core code (hch) - Add crc_t10dif_update common helper (akinobu + mkp) - Handle target-core odd SGL mapping for data transfer memory (akinobu) - Move transport ID handling into target-core (hch) - Move task tag into struct se_cmd + support 64-bit tags (bart) - Convert se_node_acl->device_list[] to RCU hlist (nab + hch + paulmck) - Convert se_portal_group->tpg_lun_list[] to RCU hlist (nab + hch + paulmck) - Simplify target backend driver registration (hch) - Consolidate + simplify target backend attribute implementations (hch + nab) - Subsume se_port + t10_alua_tg_pt_gp_member into se_lun (hch) - Drop lun_sep_lock for se_lun->lun_se_dev RCU usage (hch + nab) - Drop unnecessary core_tpg_register TFO parameter (nab) - Use 64-bit LUNs tree-wide (hannes) - Drop left-over TARGET_MAX_LUNS_PER_TRANSPORT limit (hannes)" * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (76 commits) target: Bump core version to v5.0 target: remove target_core_configfs.h target: remove unused TARGET_CORE_CONFIG_ROOT define target: consolidate version defines target: implement WRITE_SAME with UNMAP bit using ->execute_unmap target: simplify UNMAP handling target: replace se_cmd->execute_rw with a protocol_data field target/user: Fix inconsistent kmap_atomic/kunmap_atomic target: Send UA when changing LUN inventory target: Send UA upon LUN RESET tmr completion target: Send UA on ALUA target port group change target: Convert se_lun->lun_deve_lock to normal spinlock target: use 'se_dev_entry' when allocating UAs target: Remove 'ua_nacl' pointer from se_ua structure target_core_alua: Correct UA handling when switching states xen-scsiback: Fix compile warning for 64-bit LUN target: Remove TARGET_MAX_LUNS_PER_TRANSPORT target: use 64-bit LUNs target: Drop duplicate + unused se_dev_check_wce target: Drop unnecessary core_tpg_register TFO parameter ...
Diffstat (limited to 'Documentation/target/tcm_mod_builder.py')
-rwxr-xr-xDocumentation/target/tcm_mod_builder.py277
1 files changed, 1 insertions, 276 deletions
diff --git a/Documentation/target/tcm_mod_builder.py b/Documentation/target/tcm_mod_builder.py
index 6085e1f19c9d..949de191fcdc 100755
--- a/Documentation/target/tcm_mod_builder.py
+++ b/Documentation/target/tcm_mod_builder.py
@@ -50,15 +50,6 @@ def tcm_mod_build_FC_include(fabric_mod_dir_var, fabric_mod_name):
50 buf = "#define " + fabric_mod_name.upper() + "_VERSION \"v0.1\"\n" 50 buf = "#define " + fabric_mod_name.upper() + "_VERSION \"v0.1\"\n"
51 buf += "#define " + fabric_mod_name.upper() + "_NAMELEN 32\n" 51 buf += "#define " + fabric_mod_name.upper() + "_NAMELEN 32\n"
52 buf += "\n" 52 buf += "\n"
53 buf += "struct " + fabric_mod_name + "_nacl {\n"
54 buf += " /* Binary World Wide unique Port Name for FC Initiator Nport */\n"
55 buf += " u64 nport_wwpn;\n"
56 buf += " /* ASCII formatted WWPN for FC Initiator Nport */\n"
57 buf += " char nport_name[" + fabric_mod_name.upper() + "_NAMELEN];\n"
58 buf += " /* Returned by " + fabric_mod_name + "_make_nodeacl() */\n"
59 buf += " struct se_node_acl se_node_acl;\n"
60 buf += "};\n"
61 buf += "\n"
62 buf += "struct " + fabric_mod_name + "_tpg {\n" 53 buf += "struct " + fabric_mod_name + "_tpg {\n"
63 buf += " /* FC lport target portal group tag for TCM */\n" 54 buf += " /* FC lport target portal group tag for TCM */\n"
64 buf += " u16 lport_tpgt;\n" 55 buf += " u16 lport_tpgt;\n"
@@ -69,8 +60,6 @@ def tcm_mod_build_FC_include(fabric_mod_dir_var, fabric_mod_name):
69 buf += "};\n" 60 buf += "};\n"
70 buf += "\n" 61 buf += "\n"
71 buf += "struct " + fabric_mod_name + "_lport {\n" 62 buf += "struct " + fabric_mod_name + "_lport {\n"
72 buf += " /* SCSI protocol the lport is providing */\n"
73 buf += " u8 lport_proto_id;\n"
74 buf += " /* Binary World Wide unique Port Name for FC Target Lport */\n" 63 buf += " /* Binary World Wide unique Port Name for FC Target Lport */\n"
75 buf += " u64 lport_wwpn;\n" 64 buf += " u64 lport_wwpn;\n"
76 buf += " /* ASCII formatted WWPN for FC Target Lport */\n" 65 buf += " /* ASCII formatted WWPN for FC Target Lport */\n"
@@ -105,14 +94,6 @@ def tcm_mod_build_SAS_include(fabric_mod_dir_var, fabric_mod_name):
105 buf = "#define " + fabric_mod_name.upper() + "_VERSION \"v0.1\"\n" 94 buf = "#define " + fabric_mod_name.upper() + "_VERSION \"v0.1\"\n"
106 buf += "#define " + fabric_mod_name.upper() + "_NAMELEN 32\n" 95 buf += "#define " + fabric_mod_name.upper() + "_NAMELEN 32\n"
107 buf += "\n" 96 buf += "\n"
108 buf += "struct " + fabric_mod_name + "_nacl {\n"
109 buf += " /* Binary World Wide unique Port Name for SAS Initiator port */\n"
110 buf += " u64 iport_wwpn;\n"
111 buf += " /* ASCII formatted WWPN for Sas Initiator port */\n"
112 buf += " char iport_name[" + fabric_mod_name.upper() + "_NAMELEN];\n"
113 buf += " /* Returned by " + fabric_mod_name + "_make_nodeacl() */\n"
114 buf += " struct se_node_acl se_node_acl;\n"
115 buf += "};\n\n"
116 buf += "struct " + fabric_mod_name + "_tpg {\n" 97 buf += "struct " + fabric_mod_name + "_tpg {\n"
117 buf += " /* SAS port target portal group tag for TCM */\n" 98 buf += " /* SAS port target portal group tag for TCM */\n"
118 buf += " u16 tport_tpgt;\n" 99 buf += " u16 tport_tpgt;\n"
@@ -122,8 +103,6 @@ def tcm_mod_build_SAS_include(fabric_mod_dir_var, fabric_mod_name):
122 buf += " struct se_portal_group se_tpg;\n" 103 buf += " struct se_portal_group se_tpg;\n"
123 buf += "};\n\n" 104 buf += "};\n\n"
124 buf += "struct " + fabric_mod_name + "_tport {\n" 105 buf += "struct " + fabric_mod_name + "_tport {\n"
125 buf += " /* SCSI protocol the tport is providing */\n"
126 buf += " u8 tport_proto_id;\n"
127 buf += " /* Binary World Wide unique Port Name for SAS Target port */\n" 106 buf += " /* Binary World Wide unique Port Name for SAS Target port */\n"
128 buf += " u64 tport_wwpn;\n" 107 buf += " u64 tport_wwpn;\n"
129 buf += " /* ASCII formatted WWPN for SAS Target port */\n" 108 buf += " /* ASCII formatted WWPN for SAS Target port */\n"
@@ -158,12 +137,6 @@ def tcm_mod_build_iSCSI_include(fabric_mod_dir_var, fabric_mod_name):
158 buf = "#define " + fabric_mod_name.upper() + "_VERSION \"v0.1\"\n" 137 buf = "#define " + fabric_mod_name.upper() + "_VERSION \"v0.1\"\n"
159 buf += "#define " + fabric_mod_name.upper() + "_NAMELEN 32\n" 138 buf += "#define " + fabric_mod_name.upper() + "_NAMELEN 32\n"
160 buf += "\n" 139 buf += "\n"
161 buf += "struct " + fabric_mod_name + "_nacl {\n"
162 buf += " /* ASCII formatted InitiatorName */\n"
163 buf += " char iport_name[" + fabric_mod_name.upper() + "_NAMELEN];\n"
164 buf += " /* Returned by " + fabric_mod_name + "_make_nodeacl() */\n"
165 buf += " struct se_node_acl se_node_acl;\n"
166 buf += "};\n\n"
167 buf += "struct " + fabric_mod_name + "_tpg {\n" 140 buf += "struct " + fabric_mod_name + "_tpg {\n"
168 buf += " /* iSCSI target portal group tag for TCM */\n" 141 buf += " /* iSCSI target portal group tag for TCM */\n"
169 buf += " u16 tport_tpgt;\n" 142 buf += " u16 tport_tpgt;\n"
@@ -173,8 +146,6 @@ def tcm_mod_build_iSCSI_include(fabric_mod_dir_var, fabric_mod_name):
173 buf += " struct se_portal_group se_tpg;\n" 146 buf += " struct se_portal_group se_tpg;\n"
174 buf += "};\n\n" 147 buf += "};\n\n"
175 buf += "struct " + fabric_mod_name + "_tport {\n" 148 buf += "struct " + fabric_mod_name + "_tport {\n"
176 buf += " /* SCSI protocol the tport is providing */\n"
177 buf += " u8 tport_proto_id;\n"
178 buf += " /* ASCII formatted TargetName for IQN */\n" 149 buf += " /* ASCII formatted TargetName for IQN */\n"
179 buf += " char tport_name[" + fabric_mod_name.upper() + "_NAMELEN];\n" 150 buf += " char tport_name[" + fabric_mod_name.upper() + "_NAMELEN];\n"
180 buf += " /* Returned by " + fabric_mod_name + "_make_tport() */\n" 151 buf += " /* Returned by " + fabric_mod_name + "_make_tport() */\n"
@@ -232,61 +203,12 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
232 buf += "#include <target/target_core_base.h>\n" 203 buf += "#include <target/target_core_base.h>\n"
233 buf += "#include <target/target_core_fabric.h>\n" 204 buf += "#include <target/target_core_fabric.h>\n"
234 buf += "#include <target/target_core_fabric_configfs.h>\n" 205 buf += "#include <target/target_core_fabric_configfs.h>\n"
235 buf += "#include <target/target_core_configfs.h>\n"
236 buf += "#include <target/configfs_macros.h>\n\n" 206 buf += "#include <target/configfs_macros.h>\n\n"
237 buf += "#include \"" + fabric_mod_name + "_base.h\"\n" 207 buf += "#include \"" + fabric_mod_name + "_base.h\"\n"
238 buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n" 208 buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n"
239 209
240 buf += "static const struct target_core_fabric_ops " + fabric_mod_name + "_ops;\n\n" 210 buf += "static const struct target_core_fabric_ops " + fabric_mod_name + "_ops;\n\n"
241 211
242 buf += "static struct se_node_acl *" + fabric_mod_name + "_make_nodeacl(\n"
243 buf += " struct se_portal_group *se_tpg,\n"
244 buf += " struct config_group *group,\n"
245 buf += " const char *name)\n"
246 buf += "{\n"
247 buf += " struct se_node_acl *se_nacl, *se_nacl_new;\n"
248 buf += " struct " + fabric_mod_name + "_nacl *nacl;\n"
249
250 if proto_ident == "FC" or proto_ident == "SAS":
251 buf += " u64 wwpn = 0;\n"
252
253 buf += " u32 nexus_depth;\n\n"
254 buf += " /* " + fabric_mod_name + "_parse_wwn(name, &wwpn, 1) < 0)\n"
255 buf += " return ERR_PTR(-EINVAL); */\n"
256 buf += " se_nacl_new = " + fabric_mod_name + "_alloc_fabric_acl(se_tpg);\n"
257 buf += " if (!se_nacl_new)\n"
258 buf += " return ERR_PTR(-ENOMEM);\n"
259 buf += "//#warning FIXME: Hardcoded nexus depth in " + fabric_mod_name + "_make_nodeacl()\n"
260 buf += " nexus_depth = 1;\n"
261 buf += " /*\n"
262 buf += " * se_nacl_new may be released by core_tpg_add_initiator_node_acl()\n"
263 buf += " * when converting a NodeACL from demo mode -> explict\n"
264 buf += " */\n"
265 buf += " se_nacl = core_tpg_add_initiator_node_acl(se_tpg, se_nacl_new,\n"
266 buf += " name, nexus_depth);\n"
267 buf += " if (IS_ERR(se_nacl)) {\n"
268 buf += " " + fabric_mod_name + "_release_fabric_acl(se_tpg, se_nacl_new);\n"
269 buf += " return se_nacl;\n"
270 buf += " }\n"
271 buf += " /*\n"
272 buf += " * Locate our struct " + fabric_mod_name + "_nacl and set the FC Nport WWPN\n"
273 buf += " */\n"
274 buf += " nacl = container_of(se_nacl, struct " + fabric_mod_name + "_nacl, se_node_acl);\n"
275
276 if proto_ident == "FC" or proto_ident == "SAS":
277 buf += " nacl->" + fabric_mod_init_port + "_wwpn = wwpn;\n"
278
279 buf += " /* " + fabric_mod_name + "_format_wwn(&nacl->" + fabric_mod_init_port + "_name[0], " + fabric_mod_name.upper() + "_NAMELEN, wwpn); */\n\n"
280 buf += " return se_nacl;\n"
281 buf += "}\n\n"
282 buf += "static void " + fabric_mod_name + "_drop_nodeacl(struct se_node_acl *se_acl)\n"
283 buf += "{\n"
284 buf += " struct " + fabric_mod_name + "_nacl *nacl = container_of(se_acl,\n"
285 buf += " struct " + fabric_mod_name + "_nacl, se_node_acl);\n"
286 buf += " core_tpg_del_initiator_node_acl(se_acl->se_tpg, se_acl, 1);\n"
287 buf += " kfree(nacl);\n"
288 buf += "}\n\n"
289
290 buf += "static struct se_portal_group *" + fabric_mod_name + "_make_tpg(\n" 212 buf += "static struct se_portal_group *" + fabric_mod_name + "_make_tpg(\n"
291 buf += " struct se_wwn *wwn,\n" 213 buf += " struct se_wwn *wwn,\n"
292 buf += " struct config_group *group,\n" 214 buf += " struct config_group *group,\n"
@@ -309,8 +231,7 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
309 buf += " tpg->" + fabric_mod_port + " = " + fabric_mod_port + ";\n" 231 buf += " tpg->" + fabric_mod_port + " = " + fabric_mod_port + ";\n"
310 buf += " tpg->" + fabric_mod_port + "_tpgt = tpgt;\n\n" 232 buf += " tpg->" + fabric_mod_port + "_tpgt = tpgt;\n\n"
311 buf += " ret = core_tpg_register(&" + fabric_mod_name + "_ops, wwn,\n" 233 buf += " ret = core_tpg_register(&" + fabric_mod_name + "_ops, wwn,\n"
312 buf += " &tpg->se_tpg, tpg,\n" 234 buf += " &tpg->se_tpg, SCSI_PROTOCOL_SAS);\n"
313 buf += " TRANSPORT_TPG_TYPE_NORMAL);\n"
314 buf += " if (ret < 0) {\n" 235 buf += " if (ret < 0) {\n"
315 buf += " kfree(tpg);\n" 236 buf += " kfree(tpg);\n"
316 buf += " return NULL;\n" 237 buf += " return NULL;\n"
@@ -372,21 +293,13 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
372 buf += "static const struct target_core_fabric_ops " + fabric_mod_name + "_ops = {\n" 293 buf += "static const struct target_core_fabric_ops " + fabric_mod_name + "_ops = {\n"
373 buf += " .module = THIS_MODULE,\n" 294 buf += " .module = THIS_MODULE,\n"
374 buf += " .name = " + fabric_mod_name + ",\n" 295 buf += " .name = " + fabric_mod_name + ",\n"
375 buf += " .get_fabric_proto_ident = " + fabric_mod_name + "_get_fabric_proto_ident,\n"
376 buf += " .get_fabric_name = " + fabric_mod_name + "_get_fabric_name,\n" 296 buf += " .get_fabric_name = " + fabric_mod_name + "_get_fabric_name,\n"
377 buf += " .get_fabric_proto_ident = " + fabric_mod_name + "_get_fabric_proto_ident,\n"
378 buf += " .tpg_get_wwn = " + fabric_mod_name + "_get_fabric_wwn,\n" 297 buf += " .tpg_get_wwn = " + fabric_mod_name + "_get_fabric_wwn,\n"
379 buf += " .tpg_get_tag = " + fabric_mod_name + "_get_tag,\n" 298 buf += " .tpg_get_tag = " + fabric_mod_name + "_get_tag,\n"
380 buf += " .tpg_get_default_depth = " + fabric_mod_name + "_get_default_depth,\n"
381 buf += " .tpg_get_pr_transport_id = " + fabric_mod_name + "_get_pr_transport_id,\n"
382 buf += " .tpg_get_pr_transport_id_len = " + fabric_mod_name + "_get_pr_transport_id_len,\n"
383 buf += " .tpg_parse_pr_out_transport_id = " + fabric_mod_name + "_parse_pr_out_transport_id,\n"
384 buf += " .tpg_check_demo_mode = " + fabric_mod_name + "_check_false,\n" 299 buf += " .tpg_check_demo_mode = " + fabric_mod_name + "_check_false,\n"
385 buf += " .tpg_check_demo_mode_cache = " + fabric_mod_name + "_check_true,\n" 300 buf += " .tpg_check_demo_mode_cache = " + fabric_mod_name + "_check_true,\n"
386 buf += " .tpg_check_demo_mode_write_protect = " + fabric_mod_name + "_check_true,\n" 301 buf += " .tpg_check_demo_mode_write_protect = " + fabric_mod_name + "_check_true,\n"
387 buf += " .tpg_check_prod_mode_write_protect = " + fabric_mod_name + "_check_false,\n" 302 buf += " .tpg_check_prod_mode_write_protect = " + fabric_mod_name + "_check_false,\n"
388 buf += " .tpg_alloc_fabric_acl = " + fabric_mod_name + "_alloc_fabric_acl,\n"
389 buf += " .tpg_release_fabric_acl = " + fabric_mod_name + "_release_fabric_acl,\n"
390 buf += " .tpg_get_inst_index = " + fabric_mod_name + "_tpg_get_inst_index,\n" 303 buf += " .tpg_get_inst_index = " + fabric_mod_name + "_tpg_get_inst_index,\n"
391 buf += " .release_cmd = " + fabric_mod_name + "_release_cmd,\n" 304 buf += " .release_cmd = " + fabric_mod_name + "_release_cmd,\n"
392 buf += " .shutdown_session = " + fabric_mod_name + "_shutdown_session,\n" 305 buf += " .shutdown_session = " + fabric_mod_name + "_shutdown_session,\n"
@@ -396,7 +309,6 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
396 buf += " .write_pending = " + fabric_mod_name + "_write_pending,\n" 309 buf += " .write_pending = " + fabric_mod_name + "_write_pending,\n"
397 buf += " .write_pending_status = " + fabric_mod_name + "_write_pending_status,\n" 310 buf += " .write_pending_status = " + fabric_mod_name + "_write_pending_status,\n"
398 buf += " .set_default_node_attributes = " + fabric_mod_name + "_set_default_node_attrs,\n" 311 buf += " .set_default_node_attributes = " + fabric_mod_name + "_set_default_node_attrs,\n"
399 buf += " .get_task_tag = " + fabric_mod_name + "_get_task_tag,\n"
400 buf += " .get_cmd_state = " + fabric_mod_name + "_get_cmd_state,\n" 312 buf += " .get_cmd_state = " + fabric_mod_name + "_get_cmd_state,\n"
401 buf += " .queue_data_in = " + fabric_mod_name + "_queue_data_in,\n" 313 buf += " .queue_data_in = " + fabric_mod_name + "_queue_data_in,\n"
402 buf += " .queue_status = " + fabric_mod_name + "_queue_status,\n" 314 buf += " .queue_status = " + fabric_mod_name + "_queue_status,\n"
@@ -409,12 +321,6 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
409 buf += " .fabric_drop_wwn = " + fabric_mod_name + "_drop_" + fabric_mod_port + ",\n" 321 buf += " .fabric_drop_wwn = " + fabric_mod_name + "_drop_" + fabric_mod_port + ",\n"
410 buf += " .fabric_make_tpg = " + fabric_mod_name + "_make_tpg,\n" 322 buf += " .fabric_make_tpg = " + fabric_mod_name + "_make_tpg,\n"
411 buf += " .fabric_drop_tpg = " + fabric_mod_name + "_drop_tpg,\n" 323 buf += " .fabric_drop_tpg = " + fabric_mod_name + "_drop_tpg,\n"
412 buf += " .fabric_post_link = NULL,\n"
413 buf += " .fabric_pre_unlink = NULL,\n"
414 buf += " .fabric_make_np = NULL,\n"
415 buf += " .fabric_drop_np = NULL,\n"
416 buf += " .fabric_make_nodeacl = " + fabric_mod_name + "_make_nodeacl,\n"
417 buf += " .fabric_drop_nodeacl = " + fabric_mod_name + "_drop_nodeacl,\n"
418 buf += "\n" 324 buf += "\n"
419 buf += " .tfc_wwn_attrs = " + fabric_mod_name + "_wwn_attrs;\n" 325 buf += " .tfc_wwn_attrs = " + fabric_mod_name + "_wwn_attrs;\n"
420 buf += "};\n\n" 326 buf += "};\n\n"
@@ -507,7 +413,6 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
507 buf += "#include <scsi/scsi_proto.h>\n" 413 buf += "#include <scsi/scsi_proto.h>\n"
508 buf += "#include <target/target_core_base.h>\n" 414 buf += "#include <target/target_core_base.h>\n"
509 buf += "#include <target/target_core_fabric.h>\n" 415 buf += "#include <target/target_core_fabric.h>\n"
510 buf += "#include <target/target_core_configfs.h>\n\n"
511 buf += "#include \"" + fabric_mod_name + "_base.h\"\n" 416 buf += "#include \"" + fabric_mod_name + "_base.h\"\n"
512 buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n" 417 buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n"
513 418
@@ -539,35 +444,6 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
539 bufi += "char *" + fabric_mod_name + "_get_fabric_name(void);\n" 444 bufi += "char *" + fabric_mod_name + "_get_fabric_name(void);\n"
540 continue 445 continue
541 446
542 if re.search('get_fabric_proto_ident', fo):
543 buf += "u8 " + fabric_mod_name + "_get_fabric_proto_ident(struct se_portal_group *se_tpg)\n"
544 buf += "{\n"
545 buf += " struct " + fabric_mod_name + "_tpg *tpg = container_of(se_tpg,\n"
546 buf += " struct " + fabric_mod_name + "_tpg, se_tpg);\n"
547 buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + " *" + fabric_mod_port + " = tpg->" + fabric_mod_port + ";\n"
548 buf += " u8 proto_id;\n\n"
549 buf += " switch (" + fabric_mod_port + "->" + fabric_mod_port + "_proto_id) {\n"
550 if proto_ident == "FC":
551 buf += " case SCSI_PROTOCOL_FCP:\n"
552 buf += " default:\n"
553 buf += " proto_id = fc_get_fabric_proto_ident(se_tpg);\n"
554 buf += " break;\n"
555 elif proto_ident == "SAS":
556 buf += " case SCSI_PROTOCOL_SAS:\n"
557 buf += " default:\n"
558 buf += " proto_id = sas_get_fabric_proto_ident(se_tpg);\n"
559 buf += " break;\n"
560 elif proto_ident == "iSCSI":
561 buf += " case SCSI_PROTOCOL_ISCSI:\n"
562 buf += " default:\n"
563 buf += " proto_id = iscsi_get_fabric_proto_ident(se_tpg);\n"
564 buf += " break;\n"
565
566 buf += " }\n\n"
567 buf += " return proto_id;\n"
568 buf += "}\n\n"
569 bufi += "u8 " + fabric_mod_name + "_get_fabric_proto_ident(struct se_portal_group *);\n"
570
571 if re.search('get_wwn', fo): 447 if re.search('get_wwn', fo):
572 buf += "char *" + fabric_mod_name + "_get_fabric_wwn(struct se_portal_group *se_tpg)\n" 448 buf += "char *" + fabric_mod_name + "_get_fabric_wwn(struct se_portal_group *se_tpg)\n"
573 buf += "{\n" 449 buf += "{\n"
@@ -587,150 +463,6 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
587 buf += "}\n\n" 463 buf += "}\n\n"
588 bufi += "u16 " + fabric_mod_name + "_get_tag(struct se_portal_group *);\n" 464 bufi += "u16 " + fabric_mod_name + "_get_tag(struct se_portal_group *);\n"
589 465
590 if re.search('get_default_depth', fo):
591 buf += "u32 " + fabric_mod_name + "_get_default_depth(struct se_portal_group *se_tpg)\n"
592 buf += "{\n"
593 buf += " return 1;\n"
594 buf += "}\n\n"
595 bufi += "u32 " + fabric_mod_name + "_get_default_depth(struct se_portal_group *);\n"
596
597 if re.search('get_pr_transport_id\)\(', fo):
598 buf += "u32 " + fabric_mod_name + "_get_pr_transport_id(\n"
599 buf += " struct se_portal_group *se_tpg,\n"
600 buf += " struct se_node_acl *se_nacl,\n"
601 buf += " struct t10_pr_registration *pr_reg,\n"
602 buf += " int *format_code,\n"
603 buf += " unsigned char *buf)\n"
604 buf += "{\n"
605 buf += " struct " + fabric_mod_name + "_tpg *tpg = container_of(se_tpg,\n"
606 buf += " struct " + fabric_mod_name + "_tpg, se_tpg);\n"
607 buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + " *" + fabric_mod_port + " = tpg->" + fabric_mod_port + ";\n"
608 buf += " int ret = 0;\n\n"
609 buf += " switch (" + fabric_mod_port + "->" + fabric_mod_port + "_proto_id) {\n"
610 if proto_ident == "FC":
611 buf += " case SCSI_PROTOCOL_FCP:\n"
612 buf += " default:\n"
613 buf += " ret = fc_get_pr_transport_id(se_tpg, se_nacl, pr_reg,\n"
614 buf += " format_code, buf);\n"
615 buf += " break;\n"
616 elif proto_ident == "SAS":
617 buf += " case SCSI_PROTOCOL_SAS:\n"
618 buf += " default:\n"
619 buf += " ret = sas_get_pr_transport_id(se_tpg, se_nacl, pr_reg,\n"
620 buf += " format_code, buf);\n"
621 buf += " break;\n"
622 elif proto_ident == "iSCSI":
623 buf += " case SCSI_PROTOCOL_ISCSI:\n"
624 buf += " default:\n"
625 buf += " ret = iscsi_get_pr_transport_id(se_tpg, se_nacl, pr_reg,\n"
626 buf += " format_code, buf);\n"
627 buf += " break;\n"
628
629 buf += " }\n\n"
630 buf += " return ret;\n"
631 buf += "}\n\n"
632 bufi += "u32 " + fabric_mod_name + "_get_pr_transport_id(struct se_portal_group *,\n"
633 bufi += " struct se_node_acl *, struct t10_pr_registration *,\n"
634 bufi += " int *, unsigned char *);\n"
635
636 if re.search('get_pr_transport_id_len\)\(', fo):
637 buf += "u32 " + fabric_mod_name + "_get_pr_transport_id_len(\n"
638 buf += " struct se_portal_group *se_tpg,\n"
639 buf += " struct se_node_acl *se_nacl,\n"
640 buf += " struct t10_pr_registration *pr_reg,\n"
641 buf += " int *format_code)\n"
642 buf += "{\n"
643 buf += " struct " + fabric_mod_name + "_tpg *tpg = container_of(se_tpg,\n"
644 buf += " struct " + fabric_mod_name + "_tpg, se_tpg);\n"
645 buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + " *" + fabric_mod_port + " = tpg->" + fabric_mod_port + ";\n"
646 buf += " int ret = 0;\n\n"
647 buf += " switch (" + fabric_mod_port + "->" + fabric_mod_port + "_proto_id) {\n"
648 if proto_ident == "FC":
649 buf += " case SCSI_PROTOCOL_FCP:\n"
650 buf += " default:\n"
651 buf += " ret = fc_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg,\n"
652 buf += " format_code);\n"
653 buf += " break;\n"
654 elif proto_ident == "SAS":
655 buf += " case SCSI_PROTOCOL_SAS:\n"
656 buf += " default:\n"
657 buf += " ret = sas_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg,\n"
658 buf += " format_code);\n"
659 buf += " break;\n"
660 elif proto_ident == "iSCSI":
661 buf += " case SCSI_PROTOCOL_ISCSI:\n"
662 buf += " default:\n"
663 buf += " ret = iscsi_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg,\n"
664 buf += " format_code);\n"
665 buf += " break;\n"
666
667
668 buf += " }\n\n"
669 buf += " return ret;\n"
670 buf += "}\n\n"
671 bufi += "u32 " + fabric_mod_name + "_get_pr_transport_id_len(struct se_portal_group *,\n"
672 bufi += " struct se_node_acl *, struct t10_pr_registration *,\n"
673 bufi += " int *);\n"
674
675 if re.search('parse_pr_out_transport_id\)\(', fo):
676 buf += "char *" + fabric_mod_name + "_parse_pr_out_transport_id(\n"
677 buf += " struct se_portal_group *se_tpg,\n"
678 buf += " const char *buf,\n"
679 buf += " u32 *out_tid_len,\n"
680 buf += " char **port_nexus_ptr)\n"
681 buf += "{\n"
682 buf += " struct " + fabric_mod_name + "_tpg *tpg = container_of(se_tpg,\n"
683 buf += " struct " + fabric_mod_name + "_tpg, se_tpg);\n"
684 buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + " *" + fabric_mod_port + " = tpg->" + fabric_mod_port + ";\n"
685 buf += " char *tid = NULL;\n\n"
686 buf += " switch (" + fabric_mod_port + "->" + fabric_mod_port + "_proto_id) {\n"
687 if proto_ident == "FC":
688 buf += " case SCSI_PROTOCOL_FCP:\n"
689 buf += " default:\n"
690 buf += " tid = fc_parse_pr_out_transport_id(se_tpg, buf, out_tid_len,\n"
691 buf += " port_nexus_ptr);\n"
692 elif proto_ident == "SAS":
693 buf += " case SCSI_PROTOCOL_SAS:\n"
694 buf += " default:\n"
695 buf += " tid = sas_parse_pr_out_transport_id(se_tpg, buf, out_tid_len,\n"
696 buf += " port_nexus_ptr);\n"
697 elif proto_ident == "iSCSI":
698 buf += " case SCSI_PROTOCOL_ISCSI:\n"
699 buf += " default:\n"
700 buf += " tid = iscsi_parse_pr_out_transport_id(se_tpg, buf, out_tid_len,\n"
701 buf += " port_nexus_ptr);\n"
702
703 buf += " }\n\n"
704 buf += " return tid;\n"
705 buf += "}\n\n"
706 bufi += "char *" + fabric_mod_name + "_parse_pr_out_transport_id(struct se_portal_group *,\n"
707 bufi += " const char *, u32 *, char **);\n"
708
709 if re.search('alloc_fabric_acl\)\(', fo):
710 buf += "struct se_node_acl *" + fabric_mod_name + "_alloc_fabric_acl(struct se_portal_group *se_tpg)\n"
711 buf += "{\n"
712 buf += " struct " + fabric_mod_name + "_nacl *nacl;\n\n"
713 buf += " nacl = kzalloc(sizeof(struct " + fabric_mod_name + "_nacl), GFP_KERNEL);\n"
714 buf += " if (!nacl) {\n"
715 buf += " printk(KERN_ERR \"Unable to allocate struct " + fabric_mod_name + "_nacl\\n\");\n"
716 buf += " return NULL;\n"
717 buf += " }\n\n"
718 buf += " return &nacl->se_node_acl;\n"
719 buf += "}\n\n"
720 bufi += "struct se_node_acl *" + fabric_mod_name + "_alloc_fabric_acl(struct se_portal_group *);\n"
721
722 if re.search('release_fabric_acl\)\(', fo):
723 buf += "void " + fabric_mod_name + "_release_fabric_acl(\n"
724 buf += " struct se_portal_group *se_tpg,\n"
725 buf += " struct se_node_acl *se_nacl)\n"
726 buf += "{\n"
727 buf += " struct " + fabric_mod_name + "_nacl *nacl = container_of(se_nacl,\n"
728 buf += " struct " + fabric_mod_name + "_nacl, se_node_acl);\n"
729 buf += " kfree(nacl);\n"
730 buf += "}\n\n"
731 bufi += "void " + fabric_mod_name + "_release_fabric_acl(struct se_portal_group *,\n"
732 bufi += " struct se_node_acl *);\n"
733
734 if re.search('tpg_get_inst_index\)\(', fo): 466 if re.search('tpg_get_inst_index\)\(', fo):
735 buf += "u32 " + fabric_mod_name + "_tpg_get_inst_index(struct se_portal_group *se_tpg)\n" 467 buf += "u32 " + fabric_mod_name + "_tpg_get_inst_index(struct se_portal_group *se_tpg)\n"
736 buf += "{\n" 468 buf += "{\n"
@@ -787,13 +519,6 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
787 buf += "}\n\n" 519 buf += "}\n\n"
788 bufi += "void " + fabric_mod_name + "_set_default_node_attrs(struct se_node_acl *);\n" 520 bufi += "void " + fabric_mod_name + "_set_default_node_attrs(struct se_node_acl *);\n"
789 521
790 if re.search('get_task_tag\)\(', fo):
791 buf += "u32 " + fabric_mod_name + "_get_task_tag(struct se_cmd *se_cmd)\n"
792 buf += "{\n"
793 buf += " return 0;\n"
794 buf += "}\n\n"
795 bufi += "u32 " + fabric_mod_name + "_get_task_tag(struct se_cmd *);\n"
796
797 if re.search('get_cmd_state\)\(', fo): 522 if re.search('get_cmd_state\)\(', fo):
798 buf += "int " + fabric_mod_name + "_get_cmd_state(struct se_cmd *se_cmd)\n" 523 buf += "int " + fabric_mod_name + "_get_cmd_state(struct se_cmd *se_cmd)\n"
799 buf += "{\n" 524 buf += "{\n"