target: move transport ID handling to the core
[firefly-linux-kernel-4.4.55.git] / Documentation / target / tcm_mod_builder.py
index 29176c29537cdafc6eb9696d927798d534a8bd39..0dbd70cccde11a462ab9a7c03239069f53a3638f 100755 (executable)
@@ -60,8 +60,6 @@ def tcm_mod_build_FC_include(fabric_mod_dir_var, fabric_mod_name):
        buf += "};\n"
        buf += "\n"
        buf += "struct " + fabric_mod_name + "_lport {\n"
-       buf += "        /* SCSI protocol the lport is providing */\n"
-       buf += "        u8 lport_proto_id;\n"
        buf += "        /* Binary World Wide unique Port Name for FC Target Lport */\n"
        buf += "        u64 lport_wwpn;\n"
        buf += "        /* ASCII formatted WWPN for FC Target Lport */\n"
@@ -105,8 +103,6 @@ def tcm_mod_build_SAS_include(fabric_mod_dir_var, fabric_mod_name):
        buf += "        struct se_portal_group se_tpg;\n"
        buf += "};\n\n"
        buf += "struct " + fabric_mod_name + "_tport {\n"
-       buf += "        /* SCSI protocol the tport is providing */\n"
-       buf += "        u8 tport_proto_id;\n"
        buf += "        /* Binary World Wide unique Port Name for SAS Target port */\n"
        buf += "        u64 tport_wwpn;\n"
        buf += "        /* ASCII formatted WWPN for SAS Target port */\n"
@@ -150,8 +146,6 @@ def tcm_mod_build_iSCSI_include(fabric_mod_dir_var, fabric_mod_name):
        buf += "        struct se_portal_group se_tpg;\n"
        buf += "};\n\n"
        buf += "struct " + fabric_mod_name + "_tport {\n"
-       buf += "        /* SCSI protocol the tport is providing */\n"
-       buf += "        u8 tport_proto_id;\n"
        buf += "        /* ASCII formatted TargetName for IQN */\n"
        buf += "        char tport_name[" + fabric_mod_name.upper() + "_NAMELEN];\n"
        buf += "        /* Returned by " + fabric_mod_name + "_make_tport() */\n"
@@ -303,9 +297,6 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
        buf += "        .get_fabric_name                = " + fabric_mod_name + "_get_fabric_name,\n"
        buf += "        .tpg_get_wwn                    = " + fabric_mod_name + "_get_fabric_wwn,\n"
        buf += "        .tpg_get_tag                    = " + fabric_mod_name + "_get_tag,\n"
-       buf += "        .tpg_get_pr_transport_id        = " + fabric_mod_name + "_get_pr_transport_id,\n"
-       buf += "        .tpg_get_pr_transport_id_len    = " + fabric_mod_name + "_get_pr_transport_id_len,\n"
-       buf += "        .tpg_parse_pr_out_transport_id  = " + fabric_mod_name + "_parse_pr_out_transport_id,\n"
        buf += "        .tpg_check_demo_mode            = " + fabric_mod_name + "_check_false,\n"
        buf += "        .tpg_check_demo_mode_cache      = " + fabric_mod_name + "_check_true,\n"
        buf += "        .tpg_check_demo_mode_write_protect = " + fabric_mod_name + "_check_true,\n"
@@ -478,118 +469,6 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
                        buf += "}\n\n"
                        bufi += "u16 " + fabric_mod_name + "_get_tag(struct se_portal_group *);\n"
 
-               if re.search('get_pr_transport_id\)\(', fo):
-                       buf += "u32 " + fabric_mod_name + "_get_pr_transport_id(\n"
-                       buf += "        struct se_portal_group *se_tpg,\n"
-                       buf += "        struct se_node_acl *se_nacl,\n"
-                       buf += "        struct t10_pr_registration *pr_reg,\n"
-                       buf += "        int *format_code,\n"
-                       buf += "        unsigned char *buf)\n"
-                       buf += "{\n"
-                       buf += "        struct " + fabric_mod_name + "_tpg *tpg = container_of(se_tpg,\n"
-                       buf += "                                struct " + fabric_mod_name + "_tpg, se_tpg);\n"
-                       buf += "        struct " + fabric_mod_name + "_" + fabric_mod_port + " *" + fabric_mod_port + " = tpg->" + fabric_mod_port + ";\n"
-                       buf += "        int ret = 0;\n\n"
-                       buf += "        switch (" + fabric_mod_port + "->" + fabric_mod_port + "_proto_id) {\n"
-                       if proto_ident == "FC":
-                               buf += "        case SCSI_PROTOCOL_FCP:\n"
-                               buf += "        default:\n"
-                               buf += "                ret = fc_get_pr_transport_id(se_tpg, se_nacl, pr_reg,\n"
-                               buf += "                                        format_code, buf);\n"
-                               buf += "                break;\n"
-                       elif proto_ident == "SAS":
-                               buf += "        case SCSI_PROTOCOL_SAS:\n"
-                               buf += "        default:\n"
-                               buf += "                ret = sas_get_pr_transport_id(se_tpg, se_nacl, pr_reg,\n"
-                               buf += "                                        format_code, buf);\n"
-                               buf += "                break;\n"
-                       elif proto_ident == "iSCSI":
-                               buf += "        case SCSI_PROTOCOL_ISCSI:\n"
-                               buf += "        default:\n"
-                               buf += "                ret = iscsi_get_pr_transport_id(se_tpg, se_nacl, pr_reg,\n"
-                               buf += "                                        format_code, buf);\n"
-                               buf += "                break;\n"
-
-                       buf += "        }\n\n"
-                       buf += "        return ret;\n"
-                       buf += "}\n\n"
-                       bufi += "u32 " + fabric_mod_name + "_get_pr_transport_id(struct se_portal_group *,\n"
-                       bufi += "                       struct se_node_acl *, struct t10_pr_registration *,\n"
-                       bufi += "                       int *, unsigned char *);\n"
-
-               if re.search('get_pr_transport_id_len\)\(', fo):
-                       buf += "u32 " + fabric_mod_name + "_get_pr_transport_id_len(\n"
-                       buf += "        struct se_portal_group *se_tpg,\n"
-                       buf += "        struct se_node_acl *se_nacl,\n"
-                       buf += "        struct t10_pr_registration *pr_reg,\n"
-                       buf += "        int *format_code)\n"
-                       buf += "{\n"
-                       buf += "        struct " + fabric_mod_name + "_tpg *tpg = container_of(se_tpg,\n"
-                       buf += "                                struct " + fabric_mod_name + "_tpg, se_tpg);\n"
-                       buf += "        struct " + fabric_mod_name + "_" + fabric_mod_port + " *" + fabric_mod_port + " = tpg->" + fabric_mod_port + ";\n"
-                       buf += "        int ret = 0;\n\n"
-                       buf += "        switch (" + fabric_mod_port + "->" + fabric_mod_port + "_proto_id) {\n"
-                       if proto_ident == "FC":
-                               buf += "        case SCSI_PROTOCOL_FCP:\n"
-                               buf += "        default:\n"
-                               buf += "                ret = fc_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg,\n"
-                               buf += "                                        format_code);\n"
-                               buf += "                break;\n"
-                       elif proto_ident == "SAS":
-                               buf += "        case SCSI_PROTOCOL_SAS:\n"
-                               buf += "        default:\n"
-                               buf += "                ret = sas_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg,\n"
-                               buf += "                                        format_code);\n"
-                               buf += "                break;\n"
-                       elif proto_ident == "iSCSI":
-                               buf += "        case SCSI_PROTOCOL_ISCSI:\n"
-                               buf += "        default:\n"
-                               buf += "                ret = iscsi_get_pr_transport_id_len(se_tpg, se_nacl, pr_reg,\n"
-                               buf += "                                        format_code);\n"
-                               buf += "                break;\n"
-
-
-                       buf += "        }\n\n"
-                       buf += "        return ret;\n"
-                       buf += "}\n\n"
-                       bufi += "u32 " + fabric_mod_name + "_get_pr_transport_id_len(struct se_portal_group *,\n"
-                       bufi += "                       struct se_node_acl *, struct t10_pr_registration *,\n"
-                       bufi += "                       int *);\n"
-
-               if re.search('parse_pr_out_transport_id\)\(', fo):
-                       buf += "char *" + fabric_mod_name + "_parse_pr_out_transport_id(\n"
-                       buf += "        struct se_portal_group *se_tpg,\n"
-                       buf += "        const char *buf,\n"
-                       buf += "        u32 *out_tid_len,\n"
-                       buf += "        char **port_nexus_ptr)\n"
-                       buf += "{\n"
-                       buf += "        struct " + fabric_mod_name + "_tpg *tpg = container_of(se_tpg,\n"
-                       buf += "                                struct " + fabric_mod_name + "_tpg, se_tpg);\n"
-                       buf += "        struct " + fabric_mod_name + "_" + fabric_mod_port + " *" + fabric_mod_port + " = tpg->" + fabric_mod_port + ";\n"
-                       buf += "        char *tid = NULL;\n\n"
-                       buf += "        switch (" + fabric_mod_port + "->" + fabric_mod_port + "_proto_id) {\n"
-                       if proto_ident == "FC":
-                               buf += "        case SCSI_PROTOCOL_FCP:\n"
-                               buf += "        default:\n"
-                               buf += "                tid = fc_parse_pr_out_transport_id(se_tpg, buf, out_tid_len,\n"
-                               buf += "                                        port_nexus_ptr);\n"
-                       elif proto_ident == "SAS":
-                               buf += "        case SCSI_PROTOCOL_SAS:\n"
-                               buf += "        default:\n"
-                               buf += "                tid = sas_parse_pr_out_transport_id(se_tpg, buf, out_tid_len,\n"
-                               buf += "                                        port_nexus_ptr);\n"
-                       elif proto_ident == "iSCSI":
-                               buf += "        case SCSI_PROTOCOL_ISCSI:\n"
-                               buf += "        default:\n"
-                               buf += "                tid = iscsi_parse_pr_out_transport_id(se_tpg, buf, out_tid_len,\n"
-                               buf += "                                        port_nexus_ptr);\n"
-
-                       buf += "        }\n\n"
-                       buf += "        return tid;\n"
-                       buf += "}\n\n"
-                       bufi += "char *" + fabric_mod_name + "_parse_pr_out_transport_id(struct se_portal_group *,\n"
-                       bufi += "                       const char *, u32 *, char **);\n"
-
                if re.search('tpg_get_inst_index\)\(', fo):
                        buf += "u32 " + fabric_mod_name + "_tpg_get_inst_index(struct se_portal_group *se_tpg)\n"
                        buf += "{\n"