diff options
| author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2011-12-06 05:20:31 -0500 |
|---|---|---|
| committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-12-14 06:38:25 -0500 |
| commit | ced38c8c00962c9b6c1fcd330572406162d150b9 (patch) | |
| tree | 56b4ebdfd419c2b8bfe4e30d7a41770ae39f0274 /Documentation/target | |
| parent | 77271de645631cb1dc4563d564f9dd5c214b5eed (diff) | |
target: tcm_mod_builder: small fixups
This includes:
- remove on _ in "__NAMELEN" in $fabric _make_tport
- target_fabric_configfs_init() returns an error pointer and not NULL
anymore. Consider that.
- replace (!(var_name)) with (!var_name). The extra () are not required
- remove #ifdef MODULE. If the code is builtin it needs an init function
or the code is useless
- put exit/clean functions into __exit
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'Documentation/target')
| -rwxr-xr-x | Documentation/target/tcm_mod_builder.py | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/Documentation/target/tcm_mod_builder.py b/Documentation/target/tcm_mod_builder.py index 520a923d7ac4..6e21b8b52638 100755 --- a/Documentation/target/tcm_mod_builder.py +++ b/Documentation/target/tcm_mod_builder.py | |||
| @@ -255,7 +255,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" | 255 | buf += " /* " + fabric_mod_name + "_parse_wwn(name, &wwpn, 1) < 0)\n" |
| 256 | buf += " return ERR_PTR(-EINVAL); */\n" | 256 | buf += " return ERR_PTR(-EINVAL); */\n" |
| 257 | buf += " se_nacl_new = " + fabric_mod_name + "_alloc_fabric_acl(se_tpg);\n" | 257 | buf += " se_nacl_new = " + fabric_mod_name + "_alloc_fabric_acl(se_tpg);\n" |
| 258 | buf += " if (!(se_nacl_new))\n" | 258 | buf += " if (!se_nacl_new)\n" |
| 259 | buf += " return ERR_PTR(-ENOMEM);\n" | 259 | buf += " return ERR_PTR(-ENOMEM);\n" |
| 260 | buf += "//#warning FIXME: Hardcoded nexus depth in " + fabric_mod_name + "_make_nodeacl()\n" | 260 | buf += "//#warning FIXME: Hardcoded nexus depth in " + fabric_mod_name + "_make_nodeacl()\n" |
| 261 | buf += " nexus_depth = 1;\n" | 261 | buf += " nexus_depth = 1;\n" |
| @@ -303,7 +303,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" | 303 | buf += " if (strict_strtoul(name + 5, 10, &tpgt) || tpgt > UINT_MAX)\n" |
| 304 | buf += " return ERR_PTR(-EINVAL);\n\n" | 304 | buf += " return ERR_PTR(-EINVAL);\n\n" |
| 305 | buf += " tpg = kzalloc(sizeof(struct " + fabric_mod_name + "_tpg), GFP_KERNEL);\n" | 305 | buf += " tpg = kzalloc(sizeof(struct " + fabric_mod_name + "_tpg), GFP_KERNEL);\n" |
| 306 | buf += " if (!(tpg)) {\n" | 306 | buf += " if (!tpg) {\n" |
| 307 | buf += " printk(KERN_ERR \"Unable to allocate struct " + fabric_mod_name + "_tpg\");\n" | 307 | buf += " printk(KERN_ERR \"Unable to allocate struct " + fabric_mod_name + "_tpg\");\n" |
| 308 | buf += " return ERR_PTR(-ENOMEM);\n" | 308 | buf += " return ERR_PTR(-ENOMEM);\n" |
| 309 | buf += " }\n" | 309 | buf += " }\n" |
| @@ -339,7 +339,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" | 339 | buf += " /* if (" + fabric_mod_name + "_parse_wwn(name, &wwpn, 1) < 0)\n" |
| 340 | buf += " return ERR_PTR(-EINVAL); */\n\n" | 340 | buf += " return ERR_PTR(-EINVAL); */\n\n" |
| 341 | buf += " " + fabric_mod_port + " = kzalloc(sizeof(struct " + fabric_mod_name + "_" + fabric_mod_port + "), GFP_KERNEL);\n" | 341 | buf += " " + fabric_mod_port + " = kzalloc(sizeof(struct " + fabric_mod_name + "_" + fabric_mod_port + "), GFP_KERNEL);\n" |
| 342 | buf += " if (!(" + fabric_mod_port + ")) {\n" | 342 | buf += " if (!" + fabric_mod_port + ") {\n" |
| 343 | buf += " printk(KERN_ERR \"Unable to allocate struct " + fabric_mod_name + "_" + fabric_mod_port + "\");\n" | 343 | buf += " printk(KERN_ERR \"Unable to allocate struct " + fabric_mod_name + "_" + fabric_mod_port + "\");\n" |
| 344 | buf += " return ERR_PTR(-ENOMEM);\n" | 344 | buf += " return ERR_PTR(-ENOMEM);\n" |
| 345 | buf += " }\n" | 345 | buf += " }\n" |
| @@ -347,7 +347,7 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): | |||
| 347 | if proto_ident == "FC" or proto_ident == "SAS": | 347 | if proto_ident == "FC" or proto_ident == "SAS": |
| 348 | buf += " " + fabric_mod_port + "->" + fabric_mod_port + "_wwpn = wwpn;\n" | 348 | buf += " " + fabric_mod_port + "->" + fabric_mod_port + "_wwpn = wwpn;\n" |
| 349 | 349 | ||
| 350 | buf += " /* " + fabric_mod_name + "_format_wwn(&" + fabric_mod_port + "->" + fabric_mod_port + "_name[0], " + fabric_mod_name.upper() + "__NAMELEN, wwpn); */\n\n" | 350 | 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" | 351 | buf += " return &" + fabric_mod_port + "->" + fabric_mod_port + "_wwn;\n" |
| 352 | buf += "}\n\n" | 352 | buf += "}\n\n" |
| 353 | buf += "static void " + fabric_mod_name + "_drop_" + fabric_mod_port + "(struct se_wwn *wwn)\n" | 353 | buf += "static void " + fabric_mod_name + "_drop_" + fabric_mod_port + "(struct se_wwn *wwn)\n" |
| @@ -431,9 +431,9 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): | |||
| 431 | buf += " * Register the top level struct config_item_type with TCM core\n" | 431 | buf += " * Register the top level struct config_item_type with TCM core\n" |
| 432 | buf += " */\n" | 432 | buf += " */\n" |
| 433 | buf += " fabric = target_fabric_configfs_init(THIS_MODULE, \"" + fabric_mod_name[4:] + "\");\n" | 433 | buf += " fabric = target_fabric_configfs_init(THIS_MODULE, \"" + fabric_mod_name[4:] + "\");\n" |
| 434 | buf += " if (!(fabric)) {\n" | 434 | buf += " if (IS_ERR(fabric)) {\n" |
| 435 | buf += " printk(KERN_ERR \"target_fabric_configfs_init() failed\\n\");\n" | 435 | buf += " printk(KERN_ERR \"target_fabric_configfs_init() failed\\n\");\n" |
| 436 | buf += " return -ENOMEM;\n" | 436 | buf += " return PTR_ERR(fabric);\n" |
| 437 | buf += " }\n" | 437 | buf += " }\n" |
| 438 | buf += " /*\n" | 438 | buf += " /*\n" |
| 439 | buf += " * Setup fabric->tf_ops from our local " + fabric_mod_name + "_ops\n" | 439 | buf += " * Setup fabric->tf_ops from our local " + fabric_mod_name + "_ops\n" |
| @@ -467,9 +467,9 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): | |||
| 467 | buf += " printk(KERN_INFO \"" + fabric_mod_name.upper() + "[0] - Set fabric -> " + fabric_mod_name + "_fabric_configfs\\n\");\n" | 467 | buf += " printk(KERN_INFO \"" + fabric_mod_name.upper() + "[0] - Set fabric -> " + fabric_mod_name + "_fabric_configfs\\n\");\n" |
| 468 | buf += " return 0;\n" | 468 | buf += " return 0;\n" |
| 469 | buf += "};\n\n" | 469 | buf += "};\n\n" |
| 470 | buf += "static void " + fabric_mod_name + "_deregister_configfs(void)\n" | 470 | buf += "static void __exit " + fabric_mod_name + "_deregister_configfs(void)\n" |
| 471 | buf += "{\n" | 471 | buf += "{\n" |
| 472 | buf += " if (!(" + fabric_mod_name + "_fabric_configfs))\n" | 472 | buf += " if (!" + fabric_mod_name + "_fabric_configfs)\n" |
| 473 | buf += " return;\n\n" | 473 | buf += " return;\n\n" |
| 474 | buf += " target_fabric_configfs_deregister(" + fabric_mod_name + "_fabric_configfs);\n" | 474 | buf += " target_fabric_configfs_deregister(" + fabric_mod_name + "_fabric_configfs);\n" |
| 475 | buf += " " + fabric_mod_name + "_fabric_configfs = NULL;\n" | 475 | buf += " " + fabric_mod_name + "_fabric_configfs = NULL;\n" |
| @@ -484,17 +484,15 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): | |||
| 484 | buf += " return ret;\n\n" | 484 | buf += " return ret;\n\n" |
| 485 | buf += " return 0;\n" | 485 | buf += " return 0;\n" |
| 486 | buf += "};\n\n" | 486 | buf += "};\n\n" |
| 487 | buf += "static void " + fabric_mod_name + "_exit(void)\n" | 487 | buf += "static void __exit " + fabric_mod_name + "_exit(void)\n" |
| 488 | buf += "{\n" | 488 | buf += "{\n" |
| 489 | buf += " " + fabric_mod_name + "_deregister_configfs();\n" | 489 | buf += " " + fabric_mod_name + "_deregister_configfs();\n" |
| 490 | buf += "};\n\n" | 490 | buf += "};\n\n" |
| 491 | 491 | ||
| 492 | buf += "#ifdef MODULE\n" | ||
| 493 | buf += "MODULE_DESCRIPTION(\"" + fabric_mod_name.upper() + " series fabric driver\");\n" | 492 | buf += "MODULE_DESCRIPTION(\"" + fabric_mod_name.upper() + " series fabric driver\");\n" |
| 494 | buf += "MODULE_LICENSE(\"GPL\");\n" | 493 | buf += "MODULE_LICENSE(\"GPL\");\n" |
| 495 | buf += "module_init(" + fabric_mod_name + "_init);\n" | 494 | buf += "module_init(" + fabric_mod_name + "_init);\n" |
| 496 | buf += "module_exit(" + fabric_mod_name + "_exit);\n" | 495 | buf += "module_exit(" + fabric_mod_name + "_exit);\n" |
| 497 | buf += "#endif\n" | ||
| 498 | 496 | ||
| 499 | ret = p.write(buf) | 497 | ret = p.write(buf) |
| 500 | if ret: | 498 | if ret: |
| @@ -776,7 +774,7 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name): | |||
| 776 | buf += "{\n" | 774 | buf += "{\n" |
| 777 | buf += " struct " + fabric_mod_name + "_nacl *nacl;\n\n" | 775 | buf += " struct " + fabric_mod_name + "_nacl *nacl;\n\n" |
| 778 | buf += " nacl = kzalloc(sizeof(struct " + fabric_mod_name + "_nacl), GFP_KERNEL);\n" | 776 | buf += " nacl = kzalloc(sizeof(struct " + fabric_mod_name + "_nacl), GFP_KERNEL);\n" |
| 779 | buf += " if (!(nacl)) {\n" | 777 | buf += " if (!nacl) {\n" |
| 780 | buf += " printk(KERN_ERR \"Unable to alocate struct " + fabric_mod_name + "_nacl\\n\");\n" | 778 | buf += " printk(KERN_ERR \"Unable to alocate struct " + fabric_mod_name + "_nacl\\n\");\n" |
| 781 | buf += " return NULL;\n" | 779 | buf += " return NULL;\n" |
| 782 | buf += " }\n\n" | 780 | buf += " }\n\n" |
