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 += " .set_default_node_attributes = " + fabric_mod_name + "_set_default_node_attrs,\n"
301 buf += " .get_cmd_state = " + fabric_mod_name + "_get_cmd_state,\n"
302 buf += " .queue_data_in = " + fabric_mod_name + "_queue_data_in,\n"
303 buf += " .queue_status = " + fabric_mod_name + "_queue_status,\n"
304 buf += " .queue_tm_rsp = " + fabric_mod_name + "_queue_tm_rsp,\n"
305 buf += " .aborted_task = " + fabric_mod_name + "_aborted_task,\n"
309 buf += " .fabric_make_wwn = " + fabric_mod_name + "_make_" + fabric_mod_port + ",\n"
310 buf += " .fabric_drop_wwn = " + fabric_mod_name + "_drop_" + fabric_mod_port + ",\n"
311 buf += " .fabric_make_tpg = " + fabric_mod_name + "_make_tpg,\n"
312 buf += " .fabric_drop_tpg = " + fabric_mod_name + "_drop_tpg,\n"
315 buf += "static int __init " + fabric_mod_name + "_init(void)\n"
317 buf += " return target_register_template(&" + fabric_mod_name + "_ops);\n"
320 buf += "static void __exit " + fabric_mod_name + "_exit(void)\n"
322 buf += " target_unregister_template(&" + fabric_mod_name + "_ops);\n"
325 buf += "MODULE_DESCRIPTION(\"" + fabric_mod_name.upper() + " series fabric driver\");\n"
327 buf += "module_init(" + fabric_mod_name + "_init);\n"
328 buf += "module_exit(" + fabric_mod_name + "_exit);\n"
373 def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name): argument
377 f = fabric_mod_dir_var + "/" + fabric_mod_name + "_fabric.c"
384 fi = fabric_mod_dir_var + "/" + fabric_mod_name + "_fabric.h"
403 buf += "#include \"" + fabric_mod_name + "_base.h\"\n"
404 buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n"
406 buf += "int " + fabric_mod_name + "_check_true(struct se_portal_group *se_tpg)\n"
410 bufi += "int " + fabric_mod_name + "_check_true(struct se_portal_group *);\n"
412 buf += "int " + fabric_mod_name + "_check_false(struct se_portal_group *se_tpg)\n"
416 bufi += "int " + fabric_mod_name + "_check_false(struct se_portal_group *);\n"
427 buf += "char *" + fabric_mod_name + "_get_fabric_name(void)\n"
429 buf += " return \"" + fabric_mod_name + "\";\n"
431 bufi += "char *" + fabric_mod_name + "_get_fabric_name(void);\n"
435 buf += "char *" + fabric_mod_name + "_get_fabric_wwn(struct se_portal_group *se_tpg)\n"
437 buf += " struct " + fabric_mod_name + "_tpg *tpg = container_of(se_tpg,\n"
438 buf += " struct " + fabric_mod_name + "_tpg, se_tpg);\n"
439 …buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + " *" + fabric_mod_port + " = tpg->" …
442 bufi += "char *" + fabric_mod_name + "_get_fabric_wwn(struct se_portal_group *);\n"
445 buf += "u16 " + fabric_mod_name + "_get_tag(struct se_portal_group *se_tpg)\n"
447 buf += " struct " + fabric_mod_name + "_tpg *tpg = container_of(se_tpg,\n"
448 buf += " struct " + fabric_mod_name + "_tpg, se_tpg);\n"
451 bufi += "u16 " + fabric_mod_name + "_get_tag(struct se_portal_group *);\n"
454 buf += "u32 " + fabric_mod_name + "_tpg_get_inst_index(struct se_portal_group *se_tpg)\n"
458 bufi += "u32 " + fabric_mod_name + "_tpg_get_inst_index(struct se_portal_group *);\n"
461 buf += "void " + fabric_mod_name + "_release_cmd(struct se_cmd *se_cmd)\n"
465 bufi += "void " + fabric_mod_name + "_release_cmd(struct se_cmd *);\n"
468 buf += "u32 " + fabric_mod_name + "_sess_get_index(struct se_session *se_sess)\n"
472 bufi += "u32 " + fabric_mod_name + "_sess_get_index(struct se_session *);\n"
475 buf += "int " + fabric_mod_name + "_write_pending(struct se_cmd *se_cmd)\n"
479 bufi += "int " + fabric_mod_name + "_write_pending(struct se_cmd *);\n"
482 buf += "void " + fabric_mod_name + "_set_default_node_attrs(struct se_node_acl *nacl)\n"
486 bufi += "void " + fabric_mod_name + "_set_default_node_attrs(struct se_node_acl *);\n"
489 buf += "int " + fabric_mod_name + "_get_cmd_state(struct se_cmd *se_cmd)\n"
493 bufi += "int " + fabric_mod_name + "_get_cmd_state(struct se_cmd *);\n"
496 buf += "int " + fabric_mod_name + "_queue_data_in(struct se_cmd *se_cmd)\n"
500 bufi += "int " + fabric_mod_name + "_queue_data_in(struct se_cmd *);\n"
503 buf += "int " + fabric_mod_name + "_queue_status(struct se_cmd *se_cmd)\n"
507 bufi += "int " + fabric_mod_name + "_queue_status(struct se_cmd *);\n"
510 buf += "void " + fabric_mod_name + "_queue_tm_rsp(struct se_cmd *se_cmd)\n"
514 bufi += "void " + fabric_mod_name + "_queue_tm_rsp(struct se_cmd *);\n"
517 buf += "void " + fabric_mod_name + "_aborted_task(struct se_cmd *se_cmd)\n"
521 bufi += "void " + fabric_mod_name + "_aborted_task(struct se_cmd *);\n"
536 def tcm_mod_build_kbuild(fabric_mod_dir_var, fabric_mod_name): argument
546 buf += fabric_mod_name + "-objs := " + fabric_mod_name + "_fabric.o \\\n"
547 buf += " " + fabric_mod_name + "_configfs.o\n"
548 buf += "obj-$(CONFIG_" + fabric_mod_name.upper() + ") += " + fabric_mod_name + ".o\n"
557 def tcm_mod_build_kconfig(fabric_mod_dir_var, fabric_mod_name): argument
567 buf = "config " + fabric_mod_name.upper() + "\n"
568 buf += " tristate \"" + fabric_mod_name.upper() + " fabric module\"\n"
572 buf += " Say Y here to enable the " + fabric_mod_name.upper() + " fabric module\n"
581 def tcm_mod_add_kbuild(tcm_dir, fabric_mod_name): argument
582 buf = "obj-$(CONFIG_" + fabric_mod_name.upper() + ") += " + fabric_mod_name.lower() + "/\n"
590 def tcm_mod_add_kconfig(tcm_dir, fabric_mod_name): argument
591 buf = "source \"drivers/target/" + fabric_mod_name.lower() + "/Kconfig\"\n"
607 fabric_mod_name = modname
608 fabric_mod_dir = tcm_dir + "drivers/target/" + fabric_mod_name
609 print "Set fabric_mod_name: " + fabric_mod_name
622 tcm_mod_build_base_includes(proto_ident, fabric_mod_dir, fabric_mod_name)
624 tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir, fabric_mod_name)
625 tcm_mod_build_configfs(proto_ident, fabric_mod_dir, fabric_mod_name)
626 tcm_mod_build_kbuild(fabric_mod_dir, fabric_mod_name)
627 tcm_mod_build_kconfig(fabric_mod_dir, fabric_mod_name)
629 …input = raw_input("Would you like to add " + fabric_mod_name + " to drivers/target/Makefile..? [ye…
631 tcm_mod_add_kbuild(tcm_dir, fabric_mod_name)
633 …input = raw_input("Would you like to add " + fabric_mod_name + " to drivers/target/Kconfig..? [yes…
635 tcm_mod_add_kconfig(tcm_dir, fabric_mod_name)