aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/target
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /Documentation/target
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'Documentation/target')
-rwxr-xr-xDocumentation/target/tcm_mod_builder.py78
1 files changed, 62 insertions, 16 deletions
diff --git a/Documentation/target/tcm_mod_builder.py b/Documentation/target/tcm_mod_builder.py
index 3fe0d812dce..7ef9b843d52 100755
--- a/Documentation/target/tcm_mod_builder.py
+++ b/Documentation/target/tcm_mod_builder.py
@@ -230,9 +230,14 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
230 buf += "#include <linux/ctype.h>\n" 230 buf += "#include <linux/ctype.h>\n"
231 buf += "#include <asm/unaligned.h>\n\n" 231 buf += "#include <asm/unaligned.h>\n\n"
232 buf += "#include <target/target_core_base.h>\n" 232 buf += "#include <target/target_core_base.h>\n"
233 buf += "#include <target/target_core_fabric.h>\n" 233 buf += "#include <target/target_core_transport.h>\n"
234 buf += "#include <target/target_core_fabric_ops.h>\n"
234 buf += "#include <target/target_core_fabric_configfs.h>\n" 235 buf += "#include <target/target_core_fabric_configfs.h>\n"
236 buf += "#include <target/target_core_fabric_lib.h>\n"
237 buf += "#include <target/target_core_device.h>\n"
238 buf += "#include <target/target_core_tpg.h>\n"
235 buf += "#include <target/target_core_configfs.h>\n" 239 buf += "#include <target/target_core_configfs.h>\n"
240 buf += "#include <target/target_core_base.h>\n"
236 buf += "#include <target/configfs_macros.h>\n\n" 241 buf += "#include <target/configfs_macros.h>\n\n"
237 buf += "#include \"" + fabric_mod_name + "_base.h\"\n" 242 buf += "#include \"" + fabric_mod_name + "_base.h\"\n"
238 buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n" 243 buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n"
@@ -255,7 +260,7 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
255 buf += " /* " + fabric_mod_name + "_parse_wwn(name, &wwpn, 1) < 0)\n" 260 buf += " /* " + fabric_mod_name + "_parse_wwn(name, &wwpn, 1) < 0)\n"
256 buf += " return ERR_PTR(-EINVAL); */\n" 261 buf += " return ERR_PTR(-EINVAL); */\n"
257 buf += " se_nacl_new = " + fabric_mod_name + "_alloc_fabric_acl(se_tpg);\n" 262 buf += " se_nacl_new = " + fabric_mod_name + "_alloc_fabric_acl(se_tpg);\n"
258 buf += " if (!se_nacl_new)\n" 263 buf += " if (!(se_nacl_new))\n"
259 buf += " return ERR_PTR(-ENOMEM);\n" 264 buf += " return ERR_PTR(-ENOMEM);\n"
260 buf += "//#warning FIXME: Hardcoded nexus depth in " + fabric_mod_name + "_make_nodeacl()\n" 265 buf += "//#warning FIXME: Hardcoded nexus depth in " + fabric_mod_name + "_make_nodeacl()\n"
261 buf += " nexus_depth = 1;\n" 266 buf += " nexus_depth = 1;\n"
@@ -303,7 +308,7 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
303 buf += " if (strict_strtoul(name + 5, 10, &tpgt) || tpgt > UINT_MAX)\n" 308 buf += " if (strict_strtoul(name + 5, 10, &tpgt) || tpgt > UINT_MAX)\n"
304 buf += " return ERR_PTR(-EINVAL);\n\n" 309 buf += " return ERR_PTR(-EINVAL);\n\n"
305 buf += " tpg = kzalloc(sizeof(struct " + fabric_mod_name + "_tpg), GFP_KERNEL);\n" 310 buf += " tpg = kzalloc(sizeof(struct " + fabric_mod_name + "_tpg), GFP_KERNEL);\n"
306 buf += " if (!tpg) {\n" 311 buf += " if (!(tpg)) {\n"
307 buf += " printk(KERN_ERR \"Unable to allocate struct " + fabric_mod_name + "_tpg\");\n" 312 buf += " printk(KERN_ERR \"Unable to allocate struct " + fabric_mod_name + "_tpg\");\n"
308 buf += " return ERR_PTR(-ENOMEM);\n" 313 buf += " return ERR_PTR(-ENOMEM);\n"
309 buf += " }\n" 314 buf += " }\n"
@@ -339,7 +344,7 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
339 buf += " /* if (" + fabric_mod_name + "_parse_wwn(name, &wwpn, 1) < 0)\n" 344 buf += " /* if (" + fabric_mod_name + "_parse_wwn(name, &wwpn, 1) < 0)\n"
340 buf += " return ERR_PTR(-EINVAL); */\n\n" 345 buf += " return ERR_PTR(-EINVAL); */\n\n"
341 buf += " " + fabric_mod_port + " = kzalloc(sizeof(struct " + fabric_mod_name + "_" + fabric_mod_port + "), GFP_KERNEL);\n" 346 buf += " " + fabric_mod_port + " = kzalloc(sizeof(struct " + fabric_mod_name + "_" + fabric_mod_port + "), GFP_KERNEL);\n"
342 buf += " if (!" + fabric_mod_port + ") {\n" 347 buf += " if (!(" + fabric_mod_port + ")) {\n"
343 buf += " printk(KERN_ERR \"Unable to allocate struct " + fabric_mod_name + "_" + fabric_mod_port + "\");\n" 348 buf += " printk(KERN_ERR \"Unable to allocate struct " + fabric_mod_name + "_" + fabric_mod_port + "\");\n"
344 buf += " return ERR_PTR(-ENOMEM);\n" 349 buf += " return ERR_PTR(-ENOMEM);\n"
345 buf += " }\n" 350 buf += " }\n"
@@ -347,7 +352,7 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
347 if proto_ident == "FC" or proto_ident == "SAS": 352 if proto_ident == "FC" or proto_ident == "SAS":
348 buf += " " + fabric_mod_port + "->" + fabric_mod_port + "_wwpn = wwpn;\n" 353 buf += " " + fabric_mod_port + "->" + fabric_mod_port + "_wwpn = wwpn;\n"
349 354
350 buf += " /* " + fabric_mod_name + "_format_wwn(&" + fabric_mod_port + "->" + fabric_mod_port + "_name[0], " + fabric_mod_name.upper() + "_NAMELEN, wwpn); */\n\n" 355 buf += " /* " + fabric_mod_name + "_format_wwn(&" + fabric_mod_port + "->" + fabric_mod_port + "_name[0], " + fabric_mod_name.upper() + "__NAMELEN, wwpn); */\n\n"
351 buf += " return &" + fabric_mod_port + "->" + fabric_mod_port + "_wwn;\n" 356 buf += " return &" + fabric_mod_port + "->" + fabric_mod_port + "_wwn;\n"
352 buf += "}\n\n" 357 buf += "}\n\n"
353 buf += "static void " + fabric_mod_name + "_drop_" + fabric_mod_port + "(struct se_wwn *wwn)\n" 358 buf += "static void " + fabric_mod_name + "_drop_" + fabric_mod_port + "(struct se_wwn *wwn)\n"
@@ -386,7 +391,8 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
386 buf += " .tpg_alloc_fabric_acl = " + fabric_mod_name + "_alloc_fabric_acl,\n" 391 buf += " .tpg_alloc_fabric_acl = " + fabric_mod_name + "_alloc_fabric_acl,\n"
387 buf += " .tpg_release_fabric_acl = " + fabric_mod_name + "_release_fabric_acl,\n" 392 buf += " .tpg_release_fabric_acl = " + fabric_mod_name + "_release_fabric_acl,\n"
388 buf += " .tpg_get_inst_index = " + fabric_mod_name + "_tpg_get_inst_index,\n" 393 buf += " .tpg_get_inst_index = " + fabric_mod_name + "_tpg_get_inst_index,\n"
389 buf += " .release_cmd = " + fabric_mod_name + "_release_cmd,\n" 394 buf += " .release_cmd_to_pool = " + fabric_mod_name + "_release_cmd,\n"
395 buf += " .release_cmd_direct = " + fabric_mod_name + "_release_cmd,\n"
390 buf += " .shutdown_session = " + fabric_mod_name + "_shutdown_session,\n" 396 buf += " .shutdown_session = " + fabric_mod_name + "_shutdown_session,\n"
391 buf += " .close_session = " + fabric_mod_name + "_close_session,\n" 397 buf += " .close_session = " + fabric_mod_name + "_close_session,\n"
392 buf += " .stop_session = " + fabric_mod_name + "_stop_session,\n" 398 buf += " .stop_session = " + fabric_mod_name + "_stop_session,\n"
@@ -399,10 +405,14 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
399 buf += " .set_default_node_attributes = " + fabric_mod_name + "_set_default_node_attrs,\n" 405 buf += " .set_default_node_attributes = " + fabric_mod_name + "_set_default_node_attrs,\n"
400 buf += " .get_task_tag = " + fabric_mod_name + "_get_task_tag,\n" 406 buf += " .get_task_tag = " + fabric_mod_name + "_get_task_tag,\n"
401 buf += " .get_cmd_state = " + fabric_mod_name + "_get_cmd_state,\n" 407 buf += " .get_cmd_state = " + fabric_mod_name + "_get_cmd_state,\n"
408 buf += " .new_cmd_failure = " + fabric_mod_name + "_new_cmd_failure,\n"
402 buf += " .queue_data_in = " + fabric_mod_name + "_queue_data_in,\n" 409 buf += " .queue_data_in = " + fabric_mod_name + "_queue_data_in,\n"
403 buf += " .queue_status = " + fabric_mod_name + "_queue_status,\n" 410 buf += " .queue_status = " + fabric_mod_name + "_queue_status,\n"
404 buf += " .queue_tm_rsp = " + fabric_mod_name + "_queue_tm_rsp,\n" 411 buf += " .queue_tm_rsp = " + fabric_mod_name + "_queue_tm_rsp,\n"
412 buf += " .get_fabric_sense_len = " + fabric_mod_name + "_get_fabric_sense_len,\n"
413 buf += " .set_fabric_sense_len = " + fabric_mod_name + "_set_fabric_sense_len,\n"
405 buf += " .is_state_remove = " + fabric_mod_name + "_is_state_remove,\n" 414 buf += " .is_state_remove = " + fabric_mod_name + "_is_state_remove,\n"
415 buf += " .pack_lun = " + fabric_mod_name + "_pack_lun,\n"
406 buf += " /*\n" 416 buf += " /*\n"
407 buf += " * Setup function pointers for generic logic in target_core_fabric_configfs.c\n" 417 buf += " * Setup function pointers for generic logic in target_core_fabric_configfs.c\n"
408 buf += " */\n" 418 buf += " */\n"
@@ -429,9 +439,9 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
429 buf += " * Register the top level struct config_item_type with TCM core\n" 439 buf += " * Register the top level struct config_item_type with TCM core\n"
430 buf += " */\n" 440 buf += " */\n"
431 buf += " fabric = target_fabric_configfs_init(THIS_MODULE, \"" + fabric_mod_name[4:] + "\");\n" 441 buf += " fabric = target_fabric_configfs_init(THIS_MODULE, \"" + fabric_mod_name[4:] + "\");\n"
432 buf += " if (IS_ERR(fabric)) {\n" 442 buf += " if (!(fabric)) {\n"
433 buf += " printk(KERN_ERR \"target_fabric_configfs_init() failed\\n\");\n" 443 buf += " printk(KERN_ERR \"target_fabric_configfs_init() failed\\n\");\n"
434 buf += " return PTR_ERR(fabric);\n" 444 buf += " return -ENOMEM;\n"
435 buf += " }\n" 445 buf += " }\n"
436 buf += " /*\n" 446 buf += " /*\n"
437 buf += " * Setup fabric->tf_ops from our local " + fabric_mod_name + "_ops\n" 447 buf += " * Setup fabric->tf_ops from our local " + fabric_mod_name + "_ops\n"
@@ -465,9 +475,9 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
465 buf += " printk(KERN_INFO \"" + fabric_mod_name.upper() + "[0] - Set fabric -> " + fabric_mod_name + "_fabric_configfs\\n\");\n" 475 buf += " printk(KERN_INFO \"" + fabric_mod_name.upper() + "[0] - Set fabric -> " + fabric_mod_name + "_fabric_configfs\\n\");\n"
466 buf += " return 0;\n" 476 buf += " return 0;\n"
467 buf += "};\n\n" 477 buf += "};\n\n"
468 buf += "static void __exit " + fabric_mod_name + "_deregister_configfs(void)\n" 478 buf += "static void " + fabric_mod_name + "_deregister_configfs(void)\n"
469 buf += "{\n" 479 buf += "{\n"
470 buf += " if (!" + fabric_mod_name + "_fabric_configfs)\n" 480 buf += " if (!(" + fabric_mod_name + "_fabric_configfs))\n"
471 buf += " return;\n\n" 481 buf += " return;\n\n"
472 buf += " target_fabric_configfs_deregister(" + fabric_mod_name + "_fabric_configfs);\n" 482 buf += " target_fabric_configfs_deregister(" + fabric_mod_name + "_fabric_configfs);\n"
473 buf += " " + fabric_mod_name + "_fabric_configfs = NULL;\n" 483 buf += " " + fabric_mod_name + "_fabric_configfs = NULL;\n"
@@ -482,15 +492,17 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
482 buf += " return ret;\n\n" 492 buf += " return ret;\n\n"
483 buf += " return 0;\n" 493 buf += " return 0;\n"
484 buf += "};\n\n" 494 buf += "};\n\n"
485 buf += "static void __exit " + fabric_mod_name + "_exit(void)\n" 495 buf += "static void " + fabric_mod_name + "_exit(void)\n"
486 buf += "{\n" 496 buf += "{\n"
487 buf += " " + fabric_mod_name + "_deregister_configfs();\n" 497 buf += " " + fabric_mod_name + "_deregister_configfs();\n"
488 buf += "};\n\n" 498 buf += "};\n\n"
489 499
500 buf += "#ifdef MODULE\n"
490 buf += "MODULE_DESCRIPTION(\"" + fabric_mod_name.upper() + " series fabric driver\");\n" 501 buf += "MODULE_DESCRIPTION(\"" + fabric_mod_name.upper() + " series fabric driver\");\n"
491 buf += "MODULE_LICENSE(\"GPL\");\n" 502 buf += "MODULE_LICENSE(\"GPL\");\n"
492 buf += "module_init(" + fabric_mod_name + "_init);\n" 503 buf += "module_init(" + fabric_mod_name + "_init);\n"
493 buf += "module_exit(" + fabric_mod_name + "_exit);\n" 504 buf += "module_exit(" + fabric_mod_name + "_exit);\n"
505 buf += "#endif\n"
494 506
495 ret = p.write(buf) 507 ret = p.write(buf)
496 if ret: 508 if ret:
@@ -502,7 +514,7 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
502 514
503def tcm_mod_scan_fabric_ops(tcm_dir): 515def tcm_mod_scan_fabric_ops(tcm_dir):
504 516
505 fabric_ops_api = tcm_dir + "include/target/target_core_fabric.h" 517 fabric_ops_api = tcm_dir + "include/target/target_core_fabric_ops.h"
506 518
507 print "Using tcm_mod_scan_fabric_ops: " + fabric_ops_api 519 print "Using tcm_mod_scan_fabric_ops: " + fabric_ops_api
508 process_fo = 0; 520 process_fo = 0;
@@ -567,7 +579,11 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
567 buf += "#include <scsi/scsi_cmnd.h>\n" 579 buf += "#include <scsi/scsi_cmnd.h>\n"
568 buf += "#include <scsi/libfc.h>\n\n" 580 buf += "#include <scsi/libfc.h>\n\n"
569 buf += "#include <target/target_core_base.h>\n" 581 buf += "#include <target/target_core_base.h>\n"
570 buf += "#include <target/target_core_fabric.h>\n" 582 buf += "#include <target/target_core_transport.h>\n"
583 buf += "#include <target/target_core_fabric_ops.h>\n"
584 buf += "#include <target/target_core_fabric_lib.h>\n"
585 buf += "#include <target/target_core_device.h>\n"
586 buf += "#include <target/target_core_tpg.h>\n"
571 buf += "#include <target/target_core_configfs.h>\n\n" 587 buf += "#include <target/target_core_configfs.h>\n\n"
572 buf += "#include \"" + fabric_mod_name + "_base.h\"\n" 588 buf += "#include \"" + fabric_mod_name + "_base.h\"\n"
573 buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n" 589 buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n"
@@ -772,8 +788,8 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
772 buf += "{\n" 788 buf += "{\n"
773 buf += " struct " + fabric_mod_name + "_nacl *nacl;\n\n" 789 buf += " struct " + fabric_mod_name + "_nacl *nacl;\n\n"
774 buf += " nacl = kzalloc(sizeof(struct " + fabric_mod_name + "_nacl), GFP_KERNEL);\n" 790 buf += " nacl = kzalloc(sizeof(struct " + fabric_mod_name + "_nacl), GFP_KERNEL);\n"
775 buf += " if (!nacl) {\n" 791 buf += " if (!(nacl)) {\n"
776 buf += " printk(KERN_ERR \"Unable to allocate struct " + fabric_mod_name + "_nacl\\n\");\n" 792 buf += " printk(KERN_ERR \"Unable to alocate struct " + fabric_mod_name + "_nacl\\n\");\n"
777 buf += " return NULL;\n" 793 buf += " return NULL;\n"
778 buf += " }\n\n" 794 buf += " }\n\n"
779 buf += " return &nacl->se_node_acl;\n" 795 buf += " return &nacl->se_node_acl;\n"
@@ -799,7 +815,7 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
799 buf += "}\n\n" 815 buf += "}\n\n"
800 bufi += "u32 " + fabric_mod_name + "_tpg_get_inst_index(struct se_portal_group *);\n" 816 bufi += "u32 " + fabric_mod_name + "_tpg_get_inst_index(struct se_portal_group *);\n"
801 817
802 if re.search('\*release_cmd\)\(', fo): 818 if re.search('release_cmd_to_pool', fo):
803 buf += "void " + fabric_mod_name + "_release_cmd(struct se_cmd *se_cmd)\n" 819 buf += "void " + fabric_mod_name + "_release_cmd(struct se_cmd *se_cmd)\n"
804 buf += "{\n" 820 buf += "{\n"
805 buf += " return;\n" 821 buf += " return;\n"
@@ -883,6 +899,13 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
883 buf += "}\n\n" 899 buf += "}\n\n"
884 bufi += "int " + fabric_mod_name + "_get_cmd_state(struct se_cmd *);\n" 900 bufi += "int " + fabric_mod_name + "_get_cmd_state(struct se_cmd *);\n"
885 901
902 if re.search('new_cmd_failure\)\(', fo):
903 buf += "void " + fabric_mod_name + "_new_cmd_failure(struct se_cmd *se_cmd)\n"
904 buf += "{\n"
905 buf += " return;\n"
906 buf += "}\n\n"
907 bufi += "void " + fabric_mod_name + "_new_cmd_failure(struct se_cmd *);\n"
908
886 if re.search('queue_data_in\)\(', fo): 909 if re.search('queue_data_in\)\(', fo):
887 buf += "int " + fabric_mod_name + "_queue_data_in(struct se_cmd *se_cmd)\n" 910 buf += "int " + fabric_mod_name + "_queue_data_in(struct se_cmd *se_cmd)\n"
888 buf += "{\n" 911 buf += "{\n"
@@ -904,6 +927,20 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
904 buf += "}\n\n" 927 buf += "}\n\n"
905 bufi += "int " + fabric_mod_name + "_queue_tm_rsp(struct se_cmd *);\n" 928 bufi += "int " + fabric_mod_name + "_queue_tm_rsp(struct se_cmd *);\n"
906 929
930 if re.search('get_fabric_sense_len\)\(', fo):
931 buf += "u16 " + fabric_mod_name + "_get_fabric_sense_len(void)\n"
932 buf += "{\n"
933 buf += " return 0;\n"
934 buf += "}\n\n"
935 bufi += "u16 " + fabric_mod_name + "_get_fabric_sense_len(void);\n"
936
937 if re.search('set_fabric_sense_len\)\(', fo):
938 buf += "u16 " + fabric_mod_name + "_set_fabric_sense_len(struct se_cmd *se_cmd, u32 sense_length)\n"
939 buf += "{\n"
940 buf += " return 0;\n"
941 buf += "}\n\n"
942 bufi += "u16 " + fabric_mod_name + "_set_fabric_sense_len(struct se_cmd *, u32);\n"
943
907 if re.search('is_state_remove\)\(', fo): 944 if re.search('is_state_remove\)\(', fo):
908 buf += "int " + fabric_mod_name + "_is_state_remove(struct se_cmd *se_cmd)\n" 945 buf += "int " + fabric_mod_name + "_is_state_remove(struct se_cmd *se_cmd)\n"
909 buf += "{\n" 946 buf += "{\n"
@@ -911,6 +948,15 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
911 buf += "}\n\n" 948 buf += "}\n\n"
912 bufi += "int " + fabric_mod_name + "_is_state_remove(struct se_cmd *);\n" 949 bufi += "int " + fabric_mod_name + "_is_state_remove(struct se_cmd *);\n"
913 950
951 if re.search('pack_lun\)\(', fo):
952 buf += "u64 " + fabric_mod_name + "_pack_lun(unsigned int lun)\n"
953 buf += "{\n"
954 buf += " WARN_ON(lun >= 256);\n"
955 buf += " /* Caller wants this byte-swapped */\n"
956 buf += " return cpu_to_le64((lun & 0xff) << 8);\n"
957 buf += "}\n\n"
958 bufi += "u64 " + fabric_mod_name + "_pack_lun(unsigned int);\n"
959
914 960
915 ret = p.write(buf) 961 ret = p.write(buf)
916 if ret: 962 if ret: