Commit c4cfdd81 authored by Sebastian Herbszt's avatar Sebastian Herbszt Committed by Nicholas Bellinger

Documentation/target: Fix tcm_mod_builder.py build breakage

Fix build breakage and set the protocol identifier based on the parameter.

Fixes: 9ac8928e ("target: simplify the target template registration API")
Fixes: e4aae5af ("target: change core_tpg_register prototype")
Signed-off-by: default avatarSebastian Herbszt <herbszt@gmx.de>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent ce9a9fc2
...@@ -199,7 +199,8 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): ...@@ -199,7 +199,8 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
buf += "#include <linux/string.h>\n" buf += "#include <linux/string.h>\n"
buf += "#include <linux/configfs.h>\n" buf += "#include <linux/configfs.h>\n"
buf += "#include <linux/ctype.h>\n" buf += "#include <linux/ctype.h>\n"
buf += "#include <asm/unaligned.h>\n\n" buf += "#include <asm/unaligned.h>\n"
buf += "#include <scsi/scsi_proto.h>\n\n"
buf += "#include <target/target_core_base.h>\n" buf += "#include <target/target_core_base.h>\n"
buf += "#include <target/target_core_fabric.h>\n" buf += "#include <target/target_core_fabric.h>\n"
buf += "#include <target/target_core_fabric_configfs.h>\n" buf += "#include <target/target_core_fabric_configfs.h>\n"
...@@ -230,8 +231,14 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): ...@@ -230,8 +231,14 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
buf += " }\n" buf += " }\n"
buf += " tpg->" + fabric_mod_port + " = " + fabric_mod_port + ";\n" buf += " tpg->" + fabric_mod_port + " = " + fabric_mod_port + ";\n"
buf += " tpg->" + fabric_mod_port + "_tpgt = tpgt;\n\n" buf += " tpg->" + fabric_mod_port + "_tpgt = tpgt;\n\n"
buf += " ret = core_tpg_register(&" + fabric_mod_name + "_ops, wwn,\n"
buf += " &tpg->se_tpg, SCSI_PROTOCOL_SAS);\n" if proto_ident == "FC":
buf += " ret = core_tpg_register(wwn, &tpg->se_tpg, SCSI_PROTOCOL_FCP);\n"
elif proto_ident == "SAS":
buf += " ret = core_tpg_register(wwn, &tpg->se_tpg, SCSI_PROTOCOL_SAS);\n"
elif proto_ident == "iSCSI":
buf += " ret = core_tpg_register(wwn, &tpg->se_tpg, SCSI_PROTOCOL_ISCSI);\n"
buf += " if (ret < 0) {\n" buf += " if (ret < 0) {\n"
buf += " kfree(tpg);\n" buf += " kfree(tpg);\n"
buf += " return NULL;\n" buf += " return NULL;\n"
...@@ -292,7 +299,7 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): ...@@ -292,7 +299,7 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
buf += "static const struct target_core_fabric_ops " + fabric_mod_name + "_ops = {\n" buf += "static const struct target_core_fabric_ops " + fabric_mod_name + "_ops = {\n"
buf += " .module = THIS_MODULE,\n" buf += " .module = THIS_MODULE,\n"
buf += " .name = " + fabric_mod_name + ",\n" buf += " .name = \"" + fabric_mod_name + "\",\n"
buf += " .get_fabric_name = " + fabric_mod_name + "_get_fabric_name,\n" buf += " .get_fabric_name = " + fabric_mod_name + "_get_fabric_name,\n"
buf += " .tpg_get_wwn = " + fabric_mod_name + "_get_fabric_wwn,\n" buf += " .tpg_get_wwn = " + fabric_mod_name + "_get_fabric_wwn,\n"
buf += " .tpg_get_tag = " + fabric_mod_name + "_get_tag,\n" buf += " .tpg_get_tag = " + fabric_mod_name + "_get_tag,\n"
...@@ -322,17 +329,17 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): ...@@ -322,17 +329,17 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
buf += " .fabric_make_tpg = " + fabric_mod_name + "_make_tpg,\n" buf += " .fabric_make_tpg = " + fabric_mod_name + "_make_tpg,\n"
buf += " .fabric_drop_tpg = " + fabric_mod_name + "_drop_tpg,\n" buf += " .fabric_drop_tpg = " + fabric_mod_name + "_drop_tpg,\n"
buf += "\n" buf += "\n"
buf += " .tfc_wwn_attrs = " + fabric_mod_name + "_wwn_attrs;\n" buf += " .tfc_wwn_attrs = " + fabric_mod_name + "_wwn_attrs,\n"
buf += "};\n\n" buf += "};\n\n"
buf += "static int __init " + fabric_mod_name + "_init(void)\n" buf += "static int __init " + fabric_mod_name + "_init(void)\n"
buf += "{\n" buf += "{\n"
buf += " return target_register_template(" + fabric_mod_name + "_ops);\n" buf += " return target_register_template(&" + fabric_mod_name + "_ops);\n"
buf += "};\n\n" buf += "};\n\n"
buf += "static void __exit " + fabric_mod_name + "_exit(void)\n" buf += "static void __exit " + fabric_mod_name + "_exit(void)\n"
buf += "{\n" buf += "{\n"
buf += " target_unregister_template(" + fabric_mod_name + "_ops);\n" buf += " target_unregister_template(&" + fabric_mod_name + "_ops);\n"
buf += "};\n\n" buf += "};\n\n"
buf += "MODULE_DESCRIPTION(\"" + fabric_mod_name.upper() + " series fabric driver\");\n" buf += "MODULE_DESCRIPTION(\"" + fabric_mod_name.upper() + " series fabric driver\");\n"
......
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