Lines Matching refs:fabric_mod_name

38 def tcm_mod_build_FC_include(fabric_mod_dir_var, fabric_mod_name):  argument
43 f = fabric_mod_dir_var + "/" + fabric_mod_name + "_base.h"
50 buf = "#define " + fabric_mod_name.upper() + "_VERSION \"v0.1\"\n"
51 buf += "#define " + fabric_mod_name.upper() + "_NAMELEN 32\n"
53 buf += "struct " + fabric_mod_name + "_tpg {\n"
56 buf += " /* Pointer back to " + fabric_mod_name + "_lport */\n"
57 buf += " struct " + fabric_mod_name + "_lport *lport;\n"
58 buf += " /* Returned by " + fabric_mod_name + "_make_tpg() */\n"
62 buf += "struct " + fabric_mod_name + "_lport {\n"
66 buf += " char lport_name[" + fabric_mod_name.upper() + "_NAMELEN];\n"
67 buf += " /* Returned by " + fabric_mod_name + "_make_lport() */\n"
82 def tcm_mod_build_SAS_include(fabric_mod_dir_var, fabric_mod_name): argument
87 f = fabric_mod_dir_var + "/" + fabric_mod_name + "_base.h"
94 buf = "#define " + fabric_mod_name.upper() + "_VERSION \"v0.1\"\n"
95 buf += "#define " + fabric_mod_name.upper() + "_NAMELEN 32\n"
97 buf += "struct " + fabric_mod_name + "_tpg {\n"
100 buf += " /* Pointer back to " + fabric_mod_name + "_tport */\n"
101 buf += " struct " + fabric_mod_name + "_tport *tport;\n"
102 buf += " /* Returned by " + fabric_mod_name + "_make_tpg() */\n"
105 buf += "struct " + fabric_mod_name + "_tport {\n"
109 buf += " char tport_name[" + fabric_mod_name.upper() + "_NAMELEN];\n"
110 buf += " /* Returned by " + fabric_mod_name + "_make_tport() */\n"
125 def tcm_mod_build_iSCSI_include(fabric_mod_dir_var, fabric_mod_name): argument
130 f = fabric_mod_dir_var + "/" + fabric_mod_name + "_base.h"
137 buf = "#define " + fabric_mod_name.upper() + "_VERSION \"v0.1\"\n"
138 buf += "#define " + fabric_mod_name.upper() + "_NAMELEN 32\n"
140 buf += "struct " + fabric_mod_name + "_tpg {\n"
143 buf += " /* Pointer back to " + fabric_mod_name + "_tport */\n"
144 buf += " struct " + fabric_mod_name + "_tport *tport;\n"
145 buf += " /* Returned by " + fabric_mod_name + "_make_tpg() */\n"
148 buf += "struct " + fabric_mod_name + "_tport {\n"
150 buf += " char tport_name[" + fabric_mod_name.upper() + "_NAMELEN];\n"
151 buf += " /* Returned by " + fabric_mod_name + "_make_tport() */\n"
166 def tcm_mod_build_base_includes(proto_ident, fabric_mod_dir_val, fabric_mod_name): argument
169 tcm_mod_build_FC_include(fabric_mod_dir_val, fabric_mod_name)
171 tcm_mod_build_SAS_include(fabric_mod_dir_val, fabric_mod_name)
173 tcm_mod_build_iSCSI_include(fabric_mod_dir_val, fabric_mod_name)
180 def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): argument
183 f = fabric_mod_dir_var + "/" + fabric_mod_name + "_configfs.c"
206 buf += "#include \"" + fabric_mod_name + "_base.h\"\n"
207 buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n"
209 buf += "static const struct target_core_fabric_ops " + fabric_mod_name + "_ops;\n\n"
211 buf += "static struct se_portal_group *" + fabric_mod_name + "_make_tpg(\n"
216 …buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + "*" + fabric_mod_port + " = containe…
217 …buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + ", " + fabric_mod_port + "_wwn);\n…
218 buf += " struct " + fabric_mod_name + "_tpg *tpg;\n"
225 buf += " tpg = kzalloc(sizeof(struct " + fabric_mod_name + "_tpg), GFP_KERNEL);\n"
227 buf += " printk(KERN_ERR \"Unable to allocate struct " + fabric_mod_name + "_tpg\");\n"
246 buf += "static void " + fabric_mod_name + "_drop_tpg(struct se_portal_group *se_tpg)\n"
248 buf += " struct " + fabric_mod_name + "_tpg *tpg = container_of(se_tpg,\n"
249 buf += " struct " + fabric_mod_name + "_tpg, se_tpg);\n\n"
254 buf += "static struct se_wwn *" + fabric_mod_name + "_make_" + fabric_mod_port + "(\n"
259 buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + " *" + fabric_mod_port + ";\n"
264 buf += " /* if (" + fabric_mod_name + "_parse_wwn(name, &wwpn, 1) < 0)\n"
266 …buf += " " + fabric_mod_port + " = kzalloc(sizeof(struct " + fabric_mod_name + "_" + fabric_mod_po…
268 …buf += " printk(KERN_ERR \"Unable to allocate struct " + fabric_mod_name + "_" + fabric_mod_port …
275 …buf += " /* " + fabric_mod_name + "_format_wwn(&" + fabric_mod_port + "->" + fabric_mod_port + "_n…
278 buf += "static void " + fabric_mod_name + "_drop_" + fabric_mod_port + "(struct se_wwn *wwn)\n"
280 …buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + " *" + fabric_mod_port + " = contain…
281 …buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + ", " + fabric_mod_port + "_wwn);\…
285 buf += "static const struct target_core_fabric_ops " + fabric_mod_name + "_ops = {\n"
287 buf += " .name = \"" + fabric_mod_name + "\",\n"
288 buf += " .get_fabric_name = " + fabric_mod_name + "_get_fabric_name,\n"
289 buf += " .tpg_get_wwn = " + fabric_mod_name + "_get_fabric_wwn,\n"
290 buf += " .tpg_get_tag = " + fabric_mod_name + "_get_tag,\n"
291 buf += " .tpg_check_demo_mode = " + fabric_mod_name + "_check_false,\n"
292 buf += " .tpg_check_demo_mode_cache = " + fabric_mod_name + "_check_true,\n"
293 buf += " .tpg_check_demo_mode_write_protect = " + fabric_mod_name + "_check_true,\n"
294 buf += " .tpg_check_prod_mode_write_protect = " + fabric_mod_name + "_check_false,\n"
295 buf += " .tpg_get_inst_index = " + fabric_mod_name + "_tpg_get_inst_index,\n"
296 buf += " .release_cmd = " + fabric_mod_name + "_release_cmd,\n"
297 buf += " .sess_get_index = " + fabric_mod_name + "_sess_get_index,\n"
299 buf += " .write_pending = " + fabric_mod_name + "_write_pending,\n"
300 buf += " .write_pending_status = " + fabric_mod_name + "_write_pending_status,\n"
301 buf += " .set_default_node_attributes = " + fabric_mod_name + "_set_default_node_attrs,\n"
302 buf += " .get_cmd_state = " + fabric_mod_name + "_get_cmd_state,\n"
303 buf += " .queue_data_in = " + fabric_mod_name + "_queue_data_in,\n"
304 buf += " .queue_status = " + fabric_mod_name + "_queue_status,\n"
305 buf += " .queue_tm_rsp = " + fabric_mod_name + "_queue_tm_rsp,\n"
306 buf += " .aborted_task = " + fabric_mod_name + "_aborted_task,\n"
310 buf += " .fabric_make_wwn = " + fabric_mod_name + "_make_" + fabric_mod_port + ",\n"
311 buf += " .fabric_drop_wwn = " + fabric_mod_name + "_drop_" + fabric_mod_port + ",\n"
312 buf += " .fabric_make_tpg = " + fabric_mod_name + "_make_tpg,\n"
313 buf += " .fabric_drop_tpg = " + fabric_mod_name + "_drop_tpg,\n"
316 buf += "static int __init " + fabric_mod_name + "_init(void)\n"
318 buf += " return target_register_template(&" + fabric_mod_name + "_ops);\n"
321 buf += "static void __exit " + fabric_mod_name + "_exit(void)\n"
323 buf += " target_unregister_template(&" + fabric_mod_name + "_ops);\n"
326 buf += "MODULE_DESCRIPTION(\"" + fabric_mod_name.upper() + " series fabric driver\");\n"
328 buf += "module_init(" + fabric_mod_name + "_init);\n"
329 buf += "module_exit(" + fabric_mod_name + "_exit);\n"
374 def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name): argument
378 f = fabric_mod_dir_var + "/" + fabric_mod_name + "_fabric.c"
385 fi = fabric_mod_dir_var + "/" + fabric_mod_name + "_fabric.h"
404 buf += "#include \"" + fabric_mod_name + "_base.h\"\n"
405 buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n"
407 buf += "int " + fabric_mod_name + "_check_true(struct se_portal_group *se_tpg)\n"
411 bufi += "int " + fabric_mod_name + "_check_true(struct se_portal_group *);\n"
413 buf += "int " + fabric_mod_name + "_check_false(struct se_portal_group *se_tpg)\n"
417 bufi += "int " + fabric_mod_name + "_check_false(struct se_portal_group *);\n"
428 buf += "char *" + fabric_mod_name + "_get_fabric_name(void)\n"
430 buf += " return \"" + fabric_mod_name + "\";\n"
432 bufi += "char *" + fabric_mod_name + "_get_fabric_name(void);\n"
436 buf += "char *" + fabric_mod_name + "_get_fabric_wwn(struct se_portal_group *se_tpg)\n"
438 buf += " struct " + fabric_mod_name + "_tpg *tpg = container_of(se_tpg,\n"
439 buf += " struct " + fabric_mod_name + "_tpg, se_tpg);\n"
440 …buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + " *" + fabric_mod_port + " = tpg->" …
443 bufi += "char *" + fabric_mod_name + "_get_fabric_wwn(struct se_portal_group *);\n"
446 buf += "u16 " + fabric_mod_name + "_get_tag(struct se_portal_group *se_tpg)\n"
448 buf += " struct " + fabric_mod_name + "_tpg *tpg = container_of(se_tpg,\n"
449 buf += " struct " + fabric_mod_name + "_tpg, se_tpg);\n"
452 bufi += "u16 " + fabric_mod_name + "_get_tag(struct se_portal_group *);\n"
455 buf += "u32 " + fabric_mod_name + "_tpg_get_inst_index(struct se_portal_group *se_tpg)\n"
459 bufi += "u32 " + fabric_mod_name + "_tpg_get_inst_index(struct se_portal_group *);\n"
462 buf += "void " + fabric_mod_name + "_release_cmd(struct se_cmd *se_cmd)\n"
466 bufi += "void " + fabric_mod_name + "_release_cmd(struct se_cmd *);\n"
469 buf += "u32 " + fabric_mod_name + "_sess_get_index(struct se_session *se_sess)\n"
473 bufi += "u32 " + fabric_mod_name + "_sess_get_index(struct se_session *);\n"
476 buf += "int " + fabric_mod_name + "_write_pending(struct se_cmd *se_cmd)\n"
480 bufi += "int " + fabric_mod_name + "_write_pending(struct se_cmd *);\n"
483 buf += "int " + fabric_mod_name + "_write_pending_status(struct se_cmd *se_cmd)\n"
487 bufi += "int " + fabric_mod_name + "_write_pending_status(struct se_cmd *);\n"
490 buf += "void " + fabric_mod_name + "_set_default_node_attrs(struct se_node_acl *nacl)\n"
494 bufi += "void " + fabric_mod_name + "_set_default_node_attrs(struct se_node_acl *);\n"
497 buf += "int " + fabric_mod_name + "_get_cmd_state(struct se_cmd *se_cmd)\n"
501 bufi += "int " + fabric_mod_name + "_get_cmd_state(struct se_cmd *);\n"
504 buf += "int " + fabric_mod_name + "_queue_data_in(struct se_cmd *se_cmd)\n"
508 bufi += "int " + fabric_mod_name + "_queue_data_in(struct se_cmd *);\n"
511 buf += "int " + fabric_mod_name + "_queue_status(struct se_cmd *se_cmd)\n"
515 bufi += "int " + fabric_mod_name + "_queue_status(struct se_cmd *);\n"
518 buf += "void " + fabric_mod_name + "_queue_tm_rsp(struct se_cmd *se_cmd)\n"
522 bufi += "void " + fabric_mod_name + "_queue_tm_rsp(struct se_cmd *);\n"
525 buf += "void " + fabric_mod_name + "_aborted_task(struct se_cmd *se_cmd)\n"
529 bufi += "void " + fabric_mod_name + "_aborted_task(struct se_cmd *);\n"
544 def tcm_mod_build_kbuild(fabric_mod_dir_var, fabric_mod_name): argument
554 buf += fabric_mod_name + "-objs := " + fabric_mod_name + "_fabric.o \\\n"
555 buf += " " + fabric_mod_name + "_configfs.o\n"
556 buf += "obj-$(CONFIG_" + fabric_mod_name.upper() + ") += " + fabric_mod_name + ".o\n"
565 def tcm_mod_build_kconfig(fabric_mod_dir_var, fabric_mod_name): argument
575 buf = "config " + fabric_mod_name.upper() + "\n"
576 buf += " tristate \"" + fabric_mod_name.upper() + " fabric module\"\n"
580 buf += " Say Y here to enable the " + fabric_mod_name.upper() + " fabric module\n"
589 def tcm_mod_add_kbuild(tcm_dir, fabric_mod_name): argument
590 buf = "obj-$(CONFIG_" + fabric_mod_name.upper() + ") += " + fabric_mod_name.lower() + "/\n"
598 def tcm_mod_add_kconfig(tcm_dir, fabric_mod_name): argument
599 buf = "source \"drivers/target/" + fabric_mod_name.lower() + "/Kconfig\"\n"
615 fabric_mod_name = modname
616 fabric_mod_dir = tcm_dir + "drivers/target/" + fabric_mod_name
617 print "Set fabric_mod_name: " + fabric_mod_name
630 tcm_mod_build_base_includes(proto_ident, fabric_mod_dir, fabric_mod_name)
632 tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir, fabric_mod_name)
633 tcm_mod_build_configfs(proto_ident, fabric_mod_dir, fabric_mod_name)
634 tcm_mod_build_kbuild(fabric_mod_dir, fabric_mod_name)
635 tcm_mod_build_kconfig(fabric_mod_dir, fabric_mod_name)
637 …input = raw_input("Would you like to add " + fabric_mod_name + " to drivers/target/Makefile..? [ye…
639 tcm_mod_add_kbuild(tcm_dir, fabric_mod_name)
641 …input = raw_input("Would you like to add " + fabric_mod_name + " to drivers/target/Kconfig..? [yes…
643 tcm_mod_add_kconfig(tcm_dir, fabric_mod_name)