diff options
Diffstat (limited to 'Documentation/target/tcm_mod_builder.py')
| -rwxr-xr-x | Documentation/target/tcm_mod_builder.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/Documentation/target/tcm_mod_builder.py b/Documentation/target/tcm_mod_builder.py index 949de191fcdc..cda56df9b8a7 100755 --- a/Documentation/target/tcm_mod_builder.py +++ b/Documentation/target/tcm_mod_builder.py | |||
| @@ -199,7 +199,8 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): | |||
| 199 | buf += "#include <linux/string.h>\n" | 199 | buf += "#include <linux/string.h>\n" |
| 200 | buf += "#include <linux/configfs.h>\n" | 200 | buf += "#include <linux/configfs.h>\n" |
| 201 | buf += "#include <linux/ctype.h>\n" | 201 | buf += "#include <linux/ctype.h>\n" |
| 202 | buf += "#include <asm/unaligned.h>\n\n" | 202 | buf += "#include <asm/unaligned.h>\n" |
| 203 | buf += "#include <scsi/scsi_proto.h>\n\n" | ||
| 203 | buf += "#include <target/target_core_base.h>\n" | 204 | buf += "#include <target/target_core_base.h>\n" |
| 204 | buf += "#include <target/target_core_fabric.h>\n" | 205 | buf += "#include <target/target_core_fabric.h>\n" |
| 205 | buf += "#include <target/target_core_fabric_configfs.h>\n" | 206 | 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 | buf += " }\n" | 231 | buf += " }\n" |
| 231 | buf += " tpg->" + fabric_mod_port + " = " + fabric_mod_port + ";\n" | 232 | buf += " tpg->" + fabric_mod_port + " = " + fabric_mod_port + ";\n" |
| 232 | buf += " tpg->" + fabric_mod_port + "_tpgt = tpgt;\n\n" | 233 | buf += " tpg->" + fabric_mod_port + "_tpgt = tpgt;\n\n" |
| 233 | buf += " ret = core_tpg_register(&" + fabric_mod_name + "_ops, wwn,\n" | 234 | |
| 234 | buf += " &tpg->se_tpg, SCSI_PROTOCOL_SAS);\n" | 235 | if proto_ident == "FC": |
| 236 | buf += " ret = core_tpg_register(wwn, &tpg->se_tpg, SCSI_PROTOCOL_FCP);\n" | ||
| 237 | elif proto_ident == "SAS": | ||
| 238 | buf += " ret = core_tpg_register(wwn, &tpg->se_tpg, SCSI_PROTOCOL_SAS);\n" | ||
| 239 | elif proto_ident == "iSCSI": | ||
| 240 | buf += " ret = core_tpg_register(wwn, &tpg->se_tpg, SCSI_PROTOCOL_ISCSI);\n" | ||
| 241 | |||
| 235 | buf += " if (ret < 0) {\n" | 242 | buf += " if (ret < 0) {\n" |
| 236 | buf += " kfree(tpg);\n" | 243 | buf += " kfree(tpg);\n" |
| 237 | buf += " return NULL;\n" | 244 | buf += " return NULL;\n" |
| @@ -292,7 +299,7 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): | |||
| 292 | 299 | ||
| 293 | buf += "static const struct target_core_fabric_ops " + fabric_mod_name + "_ops = {\n" | 300 | buf += "static const struct target_core_fabric_ops " + fabric_mod_name + "_ops = {\n" |
| 294 | buf += " .module = THIS_MODULE,\n" | 301 | buf += " .module = THIS_MODULE,\n" |
| 295 | buf += " .name = " + fabric_mod_name + ",\n" | 302 | buf += " .name = \"" + fabric_mod_name + "\",\n" |
| 296 | buf += " .get_fabric_name = " + fabric_mod_name + "_get_fabric_name,\n" | 303 | buf += " .get_fabric_name = " + fabric_mod_name + "_get_fabric_name,\n" |
| 297 | buf += " .tpg_get_wwn = " + fabric_mod_name + "_get_fabric_wwn,\n" | 304 | buf += " .tpg_get_wwn = " + fabric_mod_name + "_get_fabric_wwn,\n" |
| 298 | buf += " .tpg_get_tag = " + fabric_mod_name + "_get_tag,\n" | 305 | 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 | buf += " .fabric_make_tpg = " + fabric_mod_name + "_make_tpg,\n" | 329 | buf += " .fabric_make_tpg = " + fabric_mod_name + "_make_tpg,\n" |
| 323 | buf += " .fabric_drop_tpg = " + fabric_mod_name + "_drop_tpg,\n" | 330 | buf += " .fabric_drop_tpg = " + fabric_mod_name + "_drop_tpg,\n" |
| 324 | buf += "\n" | 331 | buf += "\n" |
| 325 | buf += " .tfc_wwn_attrs = " + fabric_mod_name + "_wwn_attrs;\n" | 332 | buf += " .tfc_wwn_attrs = " + fabric_mod_name + "_wwn_attrs,\n" |
| 326 | buf += "};\n\n" | 333 | buf += "};\n\n" |
| 327 | 334 | ||
| 328 | buf += "static int __init " + fabric_mod_name + "_init(void)\n" | 335 | buf += "static int __init " + fabric_mod_name + "_init(void)\n" |
| 329 | buf += "{\n" | 336 | buf += "{\n" |
| 330 | buf += " return target_register_template(" + fabric_mod_name + "_ops);\n" | 337 | buf += " return target_register_template(&" + fabric_mod_name + "_ops);\n" |
| 331 | buf += "};\n\n" | 338 | buf += "};\n\n" |
| 332 | 339 | ||
| 333 | buf += "static void __exit " + fabric_mod_name + "_exit(void)\n" | 340 | buf += "static void __exit " + fabric_mod_name + "_exit(void)\n" |
| 334 | buf += "{\n" | 341 | buf += "{\n" |
| 335 | buf += " target_unregister_template(" + fabric_mod_name + "_ops);\n" | 342 | buf += " target_unregister_template(&" + fabric_mod_name + "_ops);\n" |
| 336 | buf += "};\n\n" | 343 | buf += "};\n\n" |
| 337 | 344 | ||
| 338 | buf += "MODULE_DESCRIPTION(\"" + fabric_mod_name.upper() + " series fabric driver\");\n" | 345 | buf += "MODULE_DESCRIPTION(\"" + fabric_mod_name.upper() + " series fabric driver\");\n" |
