• Home
  • Raw
  • Download

Lines Matching refs:buf

41 	buf = ""
50 buf = "#define " + fabric_mod_name.upper() + "_VERSION \"v0.1\"\n"
51 buf += "#define " + fabric_mod_name.upper() + "_NAMELEN 32\n"
52 buf += "\n"
53 buf += "struct " + fabric_mod_name + "_tpg {\n"
54 buf += " /* FC lport target portal group tag for TCM */\n"
55 buf += " u16 lport_tpgt;\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"
59 buf += " struct se_portal_group se_tpg;\n"
60 buf += "};\n"
61 buf += "\n"
62 buf += "struct " + fabric_mod_name + "_lport {\n"
63 buf += " /* Binary World Wide unique Port Name for FC Target Lport */\n"
64 buf += " u64 lport_wwpn;\n"
65 buf += " /* ASCII formatted WWPN for FC Target Lport */\n"
66 buf += " char lport_name[" + fabric_mod_name.upper() + "_NAMELEN];\n"
67 buf += " /* Returned by " + fabric_mod_name + "_make_lport() */\n"
68 buf += " struct se_wwn lport_wwn;\n"
69 buf += "};\n"
71 ret = p.write(buf)
85 buf = ""
94 buf = "#define " + fabric_mod_name.upper() + "_VERSION \"v0.1\"\n"
95 buf += "#define " + fabric_mod_name.upper() + "_NAMELEN 32\n"
96 buf += "\n"
97 buf += "struct " + fabric_mod_name + "_tpg {\n"
98 buf += " /* SAS port target portal group tag for TCM */\n"
99 buf += " u16 tport_tpgt;\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"
103 buf += " struct se_portal_group se_tpg;\n"
104 buf += "};\n\n"
105 buf += "struct " + fabric_mod_name + "_tport {\n"
106 buf += " /* Binary World Wide unique Port Name for SAS Target port */\n"
107 buf += " u64 tport_wwpn;\n"
108 buf += " /* ASCII formatted WWPN for SAS Target port */\n"
109 buf += " char tport_name[" + fabric_mod_name.upper() + "_NAMELEN];\n"
110 buf += " /* Returned by " + fabric_mod_name + "_make_tport() */\n"
111 buf += " struct se_wwn tport_wwn;\n"
112 buf += "};\n"
114 ret = p.write(buf)
128 buf = ""
137 buf = "#define " + fabric_mod_name.upper() + "_VERSION \"v0.1\"\n"
138 buf += "#define " + fabric_mod_name.upper() + "_NAMELEN 32\n"
139 buf += "\n"
140 buf += "struct " + fabric_mod_name + "_tpg {\n"
141 buf += " /* iSCSI target portal group tag for TCM */\n"
142 buf += " u16 tport_tpgt;\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"
146 buf += " struct se_portal_group se_tpg;\n"
147 buf += "};\n\n"
148 buf += "struct " + fabric_mod_name + "_tport {\n"
149 buf += " /* ASCII formatted TargetName for IQN */\n"
150 buf += " char tport_name[" + fabric_mod_name.upper() + "_NAMELEN];\n"
151 buf += " /* Returned by " + fabric_mod_name + "_make_tport() */\n"
152 buf += " struct se_wwn tport_wwn;\n"
153 buf += "};\n"
155 ret = p.write(buf)
181 buf = ""
190 buf = "#include <linux/module.h>\n"
191 buf += "#include <linux/moduleparam.h>\n"
192 buf += "#include <linux/version.h>\n"
193 buf += "#include <generated/utsrelease.h>\n"
194 buf += "#include <linux/utsname.h>\n"
195 buf += "#include <linux/init.h>\n"
196 buf += "#include <linux/slab.h>\n"
197 buf += "#include <linux/kthread.h>\n"
198 buf += "#include <linux/types.h>\n"
199 buf += "#include <linux/string.h>\n"
200 buf += "#include <linux/configfs.h>\n"
201 buf += "#include <linux/ctype.h>\n"
202 buf += "#include <asm/unaligned.h>\n"
203 buf += "#include <scsi/scsi_proto.h>\n\n"
204 buf += "#include <target/target_core_base.h>\n"
205 buf += "#include <target/target_core_fabric.h>\n"
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"
212 buf += " struct se_wwn *wwn,\n"
213 buf += " struct config_group *group,\n"
214 buf += " const char *name)\n"
215 buf += "{\n"
216buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + "*" + fabric_mod_port + " = containe…
217buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + ", " + fabric_mod_port + "_wwn);\n…
218 buf += " struct " + fabric_mod_name + "_tpg *tpg;\n"
219 buf += " unsigned long tpgt;\n"
220 buf += " int ret;\n\n"
221 buf += " if (strstr(name, \"tpgt_\") != name)\n"
222 buf += " return ERR_PTR(-EINVAL);\n"
223 buf += " if (kstrtoul(name + 5, 10, &tpgt) || tpgt > UINT_MAX)\n"
224 buf += " return ERR_PTR(-EINVAL);\n\n"
225 buf += " tpg = kzalloc(sizeof(struct " + fabric_mod_name + "_tpg), GFP_KERNEL);\n"
226 buf += " if (!tpg) {\n"
227 buf += " printk(KERN_ERR \"Unable to allocate struct " + fabric_mod_name + "_tpg\");\n"
228 buf += " return ERR_PTR(-ENOMEM);\n"
229 buf += " }\n"
230 buf += " tpg->" + fabric_mod_port + " = " + fabric_mod_port + ";\n"
231 buf += " tpg->" + fabric_mod_port + "_tpgt = tpgt;\n\n"
234 buf += " ret = core_tpg_register(wwn, &tpg->se_tpg, SCSI_PROTOCOL_FCP);\n"
236 buf += " ret = core_tpg_register(wwn, &tpg->se_tpg, SCSI_PROTOCOL_SAS);\n"
238 buf += " ret = core_tpg_register(wwn, &tpg->se_tpg, SCSI_PROTOCOL_ISCSI);\n"
240 buf += " if (ret < 0) {\n"
241 buf += " kfree(tpg);\n"
242 buf += " return NULL;\n"
243 buf += " }\n"
244 buf += " return &tpg->se_tpg;\n"
245 buf += "}\n\n"
246 buf += "static void " + fabric_mod_name + "_drop_tpg(struct se_portal_group *se_tpg)\n"
247 buf += "{\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"
250 buf += " core_tpg_deregister(se_tpg);\n"
251 buf += " kfree(tpg);\n"
252 buf += "}\n\n"
254 buf += "static struct se_wwn *" + fabric_mod_name + "_make_" + fabric_mod_port + "(\n"
255 buf += " struct target_fabric_configfs *tf,\n"
256 buf += " struct config_group *group,\n"
257 buf += " const char *name)\n"
258 buf += "{\n"
259 buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + " *" + fabric_mod_port + ";\n"
262 buf += " u64 wwpn = 0;\n\n"
264 buf += " /* if (" + fabric_mod_name + "_parse_wwn(name, &wwpn, 1) < 0)\n"
265 buf += " return ERR_PTR(-EINVAL); */\n\n"
266buf += " " + fabric_mod_port + " = kzalloc(sizeof(struct " + fabric_mod_name + "_" + fabric_mod_po…
267 buf += " if (!" + fabric_mod_port + ") {\n"
268buf += " printk(KERN_ERR \"Unable to allocate struct " + fabric_mod_name + "_" + fabric_mod_port …
269 buf += " return ERR_PTR(-ENOMEM);\n"
270 buf += " }\n"
273 buf += " " + fabric_mod_port + "->" + fabric_mod_port + "_wwpn = wwpn;\n"
275buf += " /* " + fabric_mod_name + "_format_wwn(&" + fabric_mod_port + "->" + fabric_mod_port + "_n…
276 buf += " return &" + fabric_mod_port + "->" + fabric_mod_port + "_wwn;\n"
277 buf += "}\n\n"
278 buf += "static void " + fabric_mod_name + "_drop_" + fabric_mod_port + "(struct se_wwn *wwn)\n"
279 buf += "{\n"
280buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + " *" + fabric_mod_port + " = contain…
281buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + ", " + fabric_mod_port + "_wwn);\…
282 buf += " kfree(" + fabric_mod_port + ");\n"
283 buf += "}\n\n"
285 buf += "static const struct target_core_fabric_ops " + fabric_mod_name + "_ops = {\n"
286 buf += " .module = THIS_MODULE,\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"
298 buf += " .sess_get_initiator_sid = NULL,\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"
306 buf += " /*\n"
307 buf += " * Setup function pointers for generic logic in target_core_fabric_configfs.c\n"
308 buf += " */\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"
313 buf += "};\n\n"
315 buf += "static int __init " + fabric_mod_name + "_init(void)\n"
316 buf += "{\n"
317 buf += " return target_register_template(&" + fabric_mod_name + "_ops);\n"
318 buf += "};\n\n"
320 buf += "static void __exit " + fabric_mod_name + "_exit(void)\n"
321 buf += "{\n"
322 buf += " target_unregister_template(&" + fabric_mod_name + "_ops);\n"
323 buf += "};\n\n"
325 buf += "MODULE_DESCRIPTION(\"" + fabric_mod_name.upper() + " series fabric driver\");\n"
326 buf += "MODULE_LICENSE(\"GPL\");\n"
327 buf += "module_init(" + fabric_mod_name + "_init);\n"
328 buf += "module_exit(" + fabric_mod_name + "_exit);\n"
330 ret = p.write(buf)
374 buf = ""
391 buf = "#include <linux/slab.h>\n"
392 buf += "#include <linux/kthread.h>\n"
393 buf += "#include <linux/types.h>\n"
394 buf += "#include <linux/list.h>\n"
395 buf += "#include <linux/types.h>\n"
396 buf += "#include <linux/string.h>\n"
397 buf += "#include <linux/ctype.h>\n"
398 buf += "#include <asm/unaligned.h>\n"
399 buf += "#include <scsi/scsi_common.h>\n"
400 buf += "#include <scsi/scsi_proto.h>\n"
401 buf += "#include <target/target_core_base.h>\n"
402 buf += "#include <target/target_core_fabric.h>\n"
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"
407 buf += "{\n"
408 buf += " return 1;\n"
409 buf += "}\n\n"
412 buf += "int " + fabric_mod_name + "_check_false(struct se_portal_group *se_tpg)\n"
413 buf += "{\n"
414 buf += " return 0;\n"
415 buf += "}\n\n"
427 buf += "char *" + fabric_mod_name + "_get_fabric_name(void)\n"
428 buf += "{\n"
429 buf += " return \"" + fabric_mod_name + "\";\n"
430 buf += "}\n\n"
435 buf += "char *" + fabric_mod_name + "_get_fabric_wwn(struct se_portal_group *se_tpg)\n"
436 buf += "{\n"
437 buf += " struct " + fabric_mod_name + "_tpg *tpg = container_of(se_tpg,\n"
438 buf += " struct " + fabric_mod_name + "_tpg, se_tpg);\n"
439buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + " *" + fabric_mod_port + " = tpg->" …
440 buf += " return &" + fabric_mod_port + "->" + fabric_mod_port + "_name[0];\n"
441 buf += "}\n\n"
445 buf += "u16 " + fabric_mod_name + "_get_tag(struct se_portal_group *se_tpg)\n"
446 buf += "{\n"
447 buf += " struct " + fabric_mod_name + "_tpg *tpg = container_of(se_tpg,\n"
448 buf += " struct " + fabric_mod_name + "_tpg, se_tpg);\n"
449 buf += " return tpg->" + fabric_mod_port + "_tpgt;\n"
450 buf += "}\n\n"
454 buf += "u32 " + fabric_mod_name + "_tpg_get_inst_index(struct se_portal_group *se_tpg)\n"
455 buf += "{\n"
456 buf += " return 1;\n"
457 buf += "}\n\n"
461 buf += "void " + fabric_mod_name + "_release_cmd(struct se_cmd *se_cmd)\n"
462 buf += "{\n"
463 buf += " return;\n"
464 buf += "}\n\n"
468 buf += "u32 " + fabric_mod_name + "_sess_get_index(struct se_session *se_sess)\n"
469 buf += "{\n"
470 buf += " return 0;\n"
471 buf += "}\n\n"
475 buf += "int " + fabric_mod_name + "_write_pending(struct se_cmd *se_cmd)\n"
476 buf += "{\n"
477 buf += " return 0;\n"
478 buf += "}\n\n"
482 buf += "void " + fabric_mod_name + "_set_default_node_attrs(struct se_node_acl *nacl)\n"
483 buf += "{\n"
484 buf += " return;\n"
485 buf += "}\n\n"
489 buf += "int " + fabric_mod_name + "_get_cmd_state(struct se_cmd *se_cmd)\n"
490 buf += "{\n"
491 buf += " return 0;\n"
492 buf += "}\n\n"
496 buf += "int " + fabric_mod_name + "_queue_data_in(struct se_cmd *se_cmd)\n"
497 buf += "{\n"
498 buf += " return 0;\n"
499 buf += "}\n\n"
503 buf += "int " + fabric_mod_name + "_queue_status(struct se_cmd *se_cmd)\n"
504 buf += "{\n"
505 buf += " return 0;\n"
506 buf += "}\n\n"
510 buf += "void " + fabric_mod_name + "_queue_tm_rsp(struct se_cmd *se_cmd)\n"
511 buf += "{\n"
512 buf += " return;\n"
513 buf += "}\n\n"
517 buf += "void " + fabric_mod_name + "_aborted_task(struct se_cmd *se_cmd)\n"
518 buf += "{\n"
519 buf += " return;\n"
520 buf += "}\n\n"
523 ret = p.write(buf)
538 buf = ""
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"
550 ret = p.write(buf)
559 buf = ""
567 buf = "config " + fabric_mod_name.upper() + "\n"
568 buf += " tristate \"" + fabric_mod_name.upper() + " fabric module\"\n"
569 buf += " depends on TARGET_CORE && CONFIGFS_FS\n"
570 buf += " default n\n"
571 buf += " help\n"
572 buf += " Say Y here to enable the " + fabric_mod_name.upper() + " fabric module\n"
574 ret = p.write(buf)
582 buf = "obj-$(CONFIG_" + fabric_mod_name.upper() + ") += " + fabric_mod_name.lower() + "/\n"
586 f.write(buf)
591 buf = "source \"drivers/target/" + fabric_mod_name.lower() + "/Kconfig\"\n"
595 f.write(buf)