Commit 2eafd729 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Nicholas Bellinger

target: use per-attribute show and store methods

This also allows to remove the target-specific old configfs macros, and
gets rid of the target_core_fabric_configfs.h header which only had one
function declaration left that could be moved to a better place.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
Acked-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 64c6be0e
...@@ -203,8 +203,6 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): ...@@ -203,8 +203,6 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
buf += "#include <scsi/scsi_proto.h>\n\n" buf += "#include <scsi/scsi_proto.h>\n\n"
buf += "#include <target/target_core_base.h>\n" buf += "#include <target/target_core_base.h>\n"
buf += "#include <target/target_core_fabric.h>\n" buf += "#include <target/target_core_fabric.h>\n"
buf += "#include <target/target_core_fabric_configfs.h>\n"
buf += "#include <target/configfs_macros.h>\n\n"
buf += "#include \"" + fabric_mod_name + "_base.h\"\n" buf += "#include \"" + fabric_mod_name + "_base.h\"\n"
buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n" buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n"
...@@ -283,19 +281,6 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): ...@@ -283,19 +281,6 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + ", " + fabric_mod_port + "_wwn);\n" buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + ", " + fabric_mod_port + "_wwn);\n"
buf += " kfree(" + fabric_mod_port + ");\n" buf += " kfree(" + fabric_mod_port + ");\n"
buf += "}\n\n" buf += "}\n\n"
buf += "static ssize_t " + fabric_mod_name + "_wwn_show_attr_version(\n"
buf += " struct target_fabric_configfs *tf,\n"
buf += " char *page)\n"
buf += "{\n"
buf += " return sprintf(page, \"" + fabric_mod_name.upper() + " fabric module %s on %s/%s\"\n"
buf += " \"on \"UTS_RELEASE\"\\n\", " + fabric_mod_name.upper() + "_VERSION, utsname()->sysname,\n"
buf += " utsname()->machine);\n"
buf += "}\n\n"
buf += "TF_WWN_ATTR_RO(" + fabric_mod_name + ", version);\n\n"
buf += "static struct configfs_attribute *" + fabric_mod_name + "_wwn_attrs[] = {\n"
buf += " &" + fabric_mod_name + "_wwn_version.attr,\n"
buf += " NULL,\n"
buf += "};\n\n"
buf += "static const struct target_core_fabric_ops " + fabric_mod_name + "_ops = {\n" buf += "static const struct target_core_fabric_ops " + fabric_mod_name + "_ops = {\n"
buf += " .module = THIS_MODULE,\n" buf += " .module = THIS_MODULE,\n"
...@@ -328,8 +313,6 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): ...@@ -328,8 +313,6 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
buf += " .fabric_drop_wwn = " + fabric_mod_name + "_drop_" + fabric_mod_port + ",\n" buf += " .fabric_drop_wwn = " + fabric_mod_name + "_drop_" + fabric_mod_port + ",\n"
buf += " .fabric_make_tpg = " + fabric_mod_name + "_make_tpg,\n" buf += " .fabric_make_tpg = " + fabric_mod_name + "_make_tpg,\n"
buf += " .fabric_drop_tpg = " + fabric_mod_name + "_drop_tpg,\n" buf += " .fabric_drop_tpg = " + fabric_mod_name + "_drop_tpg,\n"
buf += "\n"
buf += " .tfc_wwn_attrs = " + fabric_mod_name + "_wwn_attrs,\n"
buf += "};\n\n" buf += "};\n\n"
buf += "static int __init " + fabric_mod_name + "_init(void)\n" buf += "static int __init " + fabric_mod_name + "_init(void)\n"
......
...@@ -43,9 +43,7 @@ ...@@ -43,9 +43,7 @@
#include <linux/atomic.h> #include <linux/atomic.h>
#include <scsi/scsi_proto.h> #include <scsi/scsi_proto.h>
#include <scsi/scsi_tcq.h> #include <scsi/scsi_tcq.h>
#include <target/configfs_macros.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_fabric_configfs.h>
#include <target/target_core_fabric.h> #include <target/target_core_fabric.h>
#include "ib_srpt.h" #include "ib_srpt.h"
...@@ -3545,20 +3543,19 @@ static void srpt_cleanup_nodeacl(struct se_node_acl *se_nacl) ...@@ -3545,20 +3543,19 @@ static void srpt_cleanup_nodeacl(struct se_node_acl *se_nacl)
spin_unlock_irq(&sport->port_acl_lock); spin_unlock_irq(&sport->port_acl_lock);
} }
static ssize_t srpt_tpg_attrib_show_srp_max_rdma_size( static ssize_t srpt_tpg_attrib_srp_max_rdma_size_show(struct config_item *item,
struct se_portal_group *se_tpg,
char *page) char *page)
{ {
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1);
return sprintf(page, "%u\n", sport->port_attrib.srp_max_rdma_size); return sprintf(page, "%u\n", sport->port_attrib.srp_max_rdma_size);
} }
static ssize_t srpt_tpg_attrib_store_srp_max_rdma_size( static ssize_t srpt_tpg_attrib_srp_max_rdma_size_store(struct config_item *item,
struct se_portal_group *se_tpg, const char *page, size_t count)
const char *page,
size_t count)
{ {
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1);
unsigned long val; unsigned long val;
int ret; int ret;
...@@ -3583,22 +3580,19 @@ static ssize_t srpt_tpg_attrib_store_srp_max_rdma_size( ...@@ -3583,22 +3580,19 @@ static ssize_t srpt_tpg_attrib_store_srp_max_rdma_size(
return count; return count;
} }
TF_TPG_ATTRIB_ATTR(srpt, srp_max_rdma_size, S_IRUGO | S_IWUSR); static ssize_t srpt_tpg_attrib_srp_max_rsp_size_show(struct config_item *item,
static ssize_t srpt_tpg_attrib_show_srp_max_rsp_size(
struct se_portal_group *se_tpg,
char *page) char *page)
{ {
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1);
return sprintf(page, "%u\n", sport->port_attrib.srp_max_rsp_size); return sprintf(page, "%u\n", sport->port_attrib.srp_max_rsp_size);
} }
static ssize_t srpt_tpg_attrib_store_srp_max_rsp_size( static ssize_t srpt_tpg_attrib_srp_max_rsp_size_store(struct config_item *item,
struct se_portal_group *se_tpg, const char *page, size_t count)
const char *page,
size_t count)
{ {
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1);
unsigned long val; unsigned long val;
int ret; int ret;
...@@ -3623,22 +3617,19 @@ static ssize_t srpt_tpg_attrib_store_srp_max_rsp_size( ...@@ -3623,22 +3617,19 @@ static ssize_t srpt_tpg_attrib_store_srp_max_rsp_size(
return count; return count;
} }
TF_TPG_ATTRIB_ATTR(srpt, srp_max_rsp_size, S_IRUGO | S_IWUSR); static ssize_t srpt_tpg_attrib_srp_sq_size_show(struct config_item *item,
static ssize_t srpt_tpg_attrib_show_srp_sq_size(
struct se_portal_group *se_tpg,
char *page) char *page)
{ {
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1);
return sprintf(page, "%u\n", sport->port_attrib.srp_sq_size); return sprintf(page, "%u\n", sport->port_attrib.srp_sq_size);
} }
static ssize_t srpt_tpg_attrib_store_srp_sq_size( static ssize_t srpt_tpg_attrib_srp_sq_size_store(struct config_item *item,
struct se_portal_group *se_tpg, const char *page, size_t count)
const char *page,
size_t count)
{ {
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1);
unsigned long val; unsigned long val;
int ret; int ret;
...@@ -3663,29 +3654,29 @@ static ssize_t srpt_tpg_attrib_store_srp_sq_size( ...@@ -3663,29 +3654,29 @@ static ssize_t srpt_tpg_attrib_store_srp_sq_size(
return count; return count;
} }
TF_TPG_ATTRIB_ATTR(srpt, srp_sq_size, S_IRUGO | S_IWUSR); CONFIGFS_ATTR(srpt_tpg_attrib_, srp_max_rdma_size);
CONFIGFS_ATTR(srpt_tpg_attrib_, srp_max_rsp_size);
CONFIGFS_ATTR(srpt_tpg_attrib_, srp_sq_size);
static struct configfs_attribute *srpt_tpg_attrib_attrs[] = { static struct configfs_attribute *srpt_tpg_attrib_attrs[] = {
&srpt_tpg_attrib_srp_max_rdma_size.attr, &srpt_tpg_attrib_attr_srp_max_rdma_size,
&srpt_tpg_attrib_srp_max_rsp_size.attr, &srpt_tpg_attrib_attr_srp_max_rsp_size,
&srpt_tpg_attrib_srp_sq_size.attr, &srpt_tpg_attrib_attr_srp_sq_size,
NULL, NULL,
}; };
static ssize_t srpt_tpg_show_enable( static ssize_t srpt_tpg_enable_show(struct config_item *item, char *page)
struct se_portal_group *se_tpg,
char *page)
{ {
struct se_portal_group *se_tpg = to_tpg(item);
struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1);
return snprintf(page, PAGE_SIZE, "%d\n", (sport->enabled) ? 1: 0); return snprintf(page, PAGE_SIZE, "%d\n", (sport->enabled) ? 1: 0);
} }
static ssize_t srpt_tpg_store_enable( static ssize_t srpt_tpg_enable_store(struct config_item *item,
struct se_portal_group *se_tpg, const char *page, size_t count)
const char *page,
size_t count)
{ {
struct se_portal_group *se_tpg = to_tpg(item);
struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1);
unsigned long tmp; unsigned long tmp;
int ret; int ret;
...@@ -3708,10 +3699,10 @@ static ssize_t srpt_tpg_store_enable( ...@@ -3708,10 +3699,10 @@ static ssize_t srpt_tpg_store_enable(
return count; return count;
} }
TF_TPG_BASE_ATTR(srpt, enable, S_IRUGO | S_IWUSR); CONFIGFS_ATTR(srpt_tpg_, enable);
static struct configfs_attribute *srpt_tpg_attrs[] = { static struct configfs_attribute *srpt_tpg_attrs[] = {
&srpt_tpg_enable.attr, &srpt_tpg_attr_enable,
NULL, NULL,
}; };
...@@ -3781,16 +3772,15 @@ static void srpt_drop_tport(struct se_wwn *wwn) ...@@ -3781,16 +3772,15 @@ static void srpt_drop_tport(struct se_wwn *wwn)
pr_debug("drop_tport(%s\n", config_item_name(&sport->port_wwn.wwn_group.cg_item)); pr_debug("drop_tport(%s\n", config_item_name(&sport->port_wwn.wwn_group.cg_item));
} }
static ssize_t srpt_wwn_show_attr_version(struct target_fabric_configfs *tf, static ssize_t srpt_wwn_version_show(struct config_item *item, char *buf)
char *buf)
{ {
return scnprintf(buf, PAGE_SIZE, "%s\n", DRV_VERSION); return scnprintf(buf, PAGE_SIZE, "%s\n", DRV_VERSION);
} }
TF_WWN_ATTR_RO(srpt, version); CONFIGFS_ATTR_RO(srpt_wwn_, version);
static struct configfs_attribute *srpt_wwn_attrs[] = { static struct configfs_attribute *srpt_wwn_attrs[] = {
&srpt_wwn_version.attr, &srpt_wwn_attr_version,
NULL, NULL,
}; };
......
...@@ -43,8 +43,6 @@ ...@@ -43,8 +43,6 @@
#include <scsi/scsi_cmnd.h> #include <scsi/scsi_cmnd.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_fabric.h> #include <target/target_core_fabric.h>
#include <target/target_core_fabric_configfs.h>
#include <target/configfs_macros.h>
#include "qla_def.h" #include "qla_def.h"
#include "qla_target.h" #include "qla_target.h"
...@@ -729,23 +727,23 @@ static int tcm_qla2xxx_init_nodeacl(struct se_node_acl *se_nacl, ...@@ -729,23 +727,23 @@ static int tcm_qla2xxx_init_nodeacl(struct se_node_acl *se_nacl,
#define DEF_QLA_TPG_ATTRIB(name) \ #define DEF_QLA_TPG_ATTRIB(name) \
\ \
static ssize_t tcm_qla2xxx_tpg_attrib_show_##name( \ static ssize_t tcm_qla2xxx_tpg_attrib_##name##_show( \
struct se_portal_group *se_tpg, \ struct config_item *item, char *page) \
char *page) \
{ \ { \
struct se_portal_group *se_tpg = attrib_to_tpg(item); \
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, \ struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, \
struct tcm_qla2xxx_tpg, se_tpg); \ struct tcm_qla2xxx_tpg, se_tpg); \
\ \
return sprintf(page, "%u\n", tpg->tpg_attrib.name); \ return sprintf(page, "%u\n", tpg->tpg_attrib.name); \
} \ } \
\ \
static ssize_t tcm_qla2xxx_tpg_attrib_store_##name( \ static ssize_t tcm_qla2xxx_tpg_attrib_##name##_store( \
struct se_portal_group *se_tpg, \ struct config_item *item, const char *page, size_t count) \
const char *page, \
size_t count) \
{ \ { \
struct se_portal_group *se_tpg = attrib_to_tpg(item); \
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, \ struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, \
struct tcm_qla2xxx_tpg, se_tpg); \ struct tcm_qla2xxx_tpg, se_tpg); \
struct tcm_qla2xxx_tpg_attrib *a = &tpg->tpg_attrib; \
unsigned long val; \ unsigned long val; \
int ret; \ int ret; \
\ \
...@@ -755,81 +753,39 @@ static ssize_t tcm_qla2xxx_tpg_attrib_store_##name( \ ...@@ -755,81 +753,39 @@ static ssize_t tcm_qla2xxx_tpg_attrib_store_##name( \
" ret: %d\n", ret); \ " ret: %d\n", ret); \
return -EINVAL; \ return -EINVAL; \
} \ } \
ret = tcm_qla2xxx_set_attrib_##name(tpg, val); \
\
return (!ret) ? count : -EINVAL; \
}
#define DEF_QLA_TPG_ATTR_BOOL(_name) \
\
static int tcm_qla2xxx_set_attrib_##_name( \
struct tcm_qla2xxx_tpg *tpg, \
unsigned long val) \
{ \
struct tcm_qla2xxx_tpg_attrib *a = &tpg->tpg_attrib; \
\ \
if ((val != 0) && (val != 1)) { \ if ((val != 0) && (val != 1)) { \
pr_err("Illegal boolean value %lu\n", val); \ pr_err("Illegal boolean value %lu\n", val); \
return -EINVAL; \ return -EINVAL; \
} \ } \
\ \
a->_name = val; \ a->name = val; \
return 0; \ \
} return count; \
} \
#define QLA_TPG_ATTR(_name, _mode) \ CONFIGFS_ATTR(tcm_qla2xxx_tpg_attrib_, name)
TF_TPG_ATTRIB_ATTR(tcm_qla2xxx, _name, _mode);
/*
* Define tcm_qla2xxx_tpg_attrib_s_generate_node_acls
*/
DEF_QLA_TPG_ATTR_BOOL(generate_node_acls);
DEF_QLA_TPG_ATTRIB(generate_node_acls); DEF_QLA_TPG_ATTRIB(generate_node_acls);
QLA_TPG_ATTR(generate_node_acls, S_IRUGO | S_IWUSR);
/*
Define tcm_qla2xxx_attrib_s_cache_dynamic_acls
*/
DEF_QLA_TPG_ATTR_BOOL(cache_dynamic_acls);
DEF_QLA_TPG_ATTRIB(cache_dynamic_acls); DEF_QLA_TPG_ATTRIB(cache_dynamic_acls);
QLA_TPG_ATTR(cache_dynamic_acls, S_IRUGO | S_IWUSR);
/*
* Define tcm_qla2xxx_tpg_attrib_s_demo_mode_write_protect
*/
DEF_QLA_TPG_ATTR_BOOL(demo_mode_write_protect);
DEF_QLA_TPG_ATTRIB(demo_mode_write_protect); DEF_QLA_TPG_ATTRIB(demo_mode_write_protect);
QLA_TPG_ATTR(demo_mode_write_protect, S_IRUGO | S_IWUSR);
/*
* Define tcm_qla2xxx_tpg_attrib_s_prod_mode_write_protect
*/
DEF_QLA_TPG_ATTR_BOOL(prod_mode_write_protect);
DEF_QLA_TPG_ATTRIB(prod_mode_write_protect); DEF_QLA_TPG_ATTRIB(prod_mode_write_protect);
QLA_TPG_ATTR(prod_mode_write_protect, S_IRUGO | S_IWUSR);
/*
* Define tcm_qla2xxx_tpg_attrib_s_demo_mode_login_only
*/
DEF_QLA_TPG_ATTR_BOOL(demo_mode_login_only);
DEF_QLA_TPG_ATTRIB(demo_mode_login_only); DEF_QLA_TPG_ATTRIB(demo_mode_login_only);
QLA_TPG_ATTR(demo_mode_login_only, S_IRUGO | S_IWUSR);
static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = {
&tcm_qla2xxx_tpg_attrib_generate_node_acls.attr, &tcm_qla2xxx_tpg_attrib_attr_generate_node_acls,
&tcm_qla2xxx_tpg_attrib_cache_dynamic_acls.attr, &tcm_qla2xxx_tpg_attrib_attr_cache_dynamic_acls,
&tcm_qla2xxx_tpg_attrib_demo_mode_write_protect.attr, &tcm_qla2xxx_tpg_attrib_attr_demo_mode_write_protect,
&tcm_qla2xxx_tpg_attrib_prod_mode_write_protect.attr, &tcm_qla2xxx_tpg_attrib_attr_prod_mode_write_protect,
&tcm_qla2xxx_tpg_attrib_demo_mode_login_only.attr, &tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only,
NULL, NULL,
}; };
/* End items for tcm_qla2xxx_tpg_attrib_cit */ /* End items for tcm_qla2xxx_tpg_attrib_cit */
static ssize_t tcm_qla2xxx_tpg_show_enable( static ssize_t tcm_qla2xxx_tpg_enable_show(struct config_item *item,
struct se_portal_group *se_tpg,
char *page) char *page)
{ {
struct se_portal_group *se_tpg = to_tpg(item);
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
struct tcm_qla2xxx_tpg, se_tpg); struct tcm_qla2xxx_tpg, se_tpg);
...@@ -865,11 +821,10 @@ static void tcm_qla2xxx_undepend_tpg(struct work_struct *work) ...@@ -865,11 +821,10 @@ static void tcm_qla2xxx_undepend_tpg(struct work_struct *work)
complete(&base_tpg->tpg_base_comp); complete(&base_tpg->tpg_base_comp);
} }
static ssize_t tcm_qla2xxx_tpg_store_enable( static ssize_t tcm_qla2xxx_tpg_enable_store(struct config_item *item,
struct se_portal_group *se_tpg, const char *page, size_t count)
const char *page,
size_t count)
{ {
struct se_portal_group *se_tpg = to_tpg(item);
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
struct tcm_qla2xxx_tpg, se_tpg); struct tcm_qla2xxx_tpg, se_tpg);
unsigned long op; unsigned long op;
...@@ -909,22 +864,16 @@ static ssize_t tcm_qla2xxx_tpg_store_enable( ...@@ -909,22 +864,16 @@ static ssize_t tcm_qla2xxx_tpg_store_enable(
return count; return count;
} }
TF_TPG_BASE_ATTR(tcm_qla2xxx, enable, S_IRUGO | S_IWUSR); static ssize_t tcm_qla2xxx_tpg_dynamic_sessions_show(struct config_item *item,
static ssize_t tcm_qla2xxx_tpg_show_dynamic_sessions(
struct se_portal_group *se_tpg,
char *page) char *page)
{ {
return target_show_dynamic_sessions(se_tpg, page); return target_show_dynamic_sessions(to_tpg(item), page);
} }
TF_TPG_BASE_ATTR_RO(tcm_qla2xxx, dynamic_sessions); static ssize_t tcm_qla2xxx_tpg_fabric_prot_type_store(struct config_item *item,
const char *page, size_t count)
static ssize_t tcm_qla2xxx_tpg_store_fabric_prot_type(
struct se_portal_group *se_tpg,
const char *page,
size_t count)
{ {
struct se_portal_group *se_tpg = to_tpg(item);
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
struct tcm_qla2xxx_tpg, se_tpg); struct tcm_qla2xxx_tpg, se_tpg);
unsigned long val; unsigned long val;
...@@ -943,21 +892,24 @@ static ssize_t tcm_qla2xxx_tpg_store_fabric_prot_type( ...@@ -943,21 +892,24 @@ static ssize_t tcm_qla2xxx_tpg_store_fabric_prot_type(
return count; return count;
} }
static ssize_t tcm_qla2xxx_tpg_show_fabric_prot_type( static ssize_t tcm_qla2xxx_tpg_fabric_prot_type_show(struct config_item *item,
struct se_portal_group *se_tpg,
char *page) char *page)
{ {
struct se_portal_group *se_tpg = to_tpg(item);
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
struct tcm_qla2xxx_tpg, se_tpg); struct tcm_qla2xxx_tpg, se_tpg);
return sprintf(page, "%d\n", tpg->tpg_attrib.fabric_prot_type); return sprintf(page, "%d\n", tpg->tpg_attrib.fabric_prot_type);
} }
TF_TPG_BASE_ATTR(tcm_qla2xxx, fabric_prot_type, S_IRUGO | S_IWUSR);
CONFIGFS_ATTR_WO(tcm_qla2xxx_tpg_, enable);
CONFIGFS_ATTR_RO(tcm_qla2xxx_tpg_, dynamic_sessions);
CONFIGFS_ATTR(tcm_qla2xxx_tpg_, fabric_prot_type);
static struct configfs_attribute *tcm_qla2xxx_tpg_attrs[] = { static struct configfs_attribute *tcm_qla2xxx_tpg_attrs[] = {
&tcm_qla2xxx_tpg_enable.attr, &tcm_qla2xxx_tpg_attr_enable,
&tcm_qla2xxx_tpg_dynamic_sessions.attr, &tcm_qla2xxx_tpg_attr_dynamic_sessions,
&tcm_qla2xxx_tpg_fabric_prot_type.attr, &tcm_qla2xxx_tpg_attr_fabric_prot_type,
NULL, NULL,
}; };
...@@ -1030,18 +982,16 @@ static void tcm_qla2xxx_drop_tpg(struct se_portal_group *se_tpg) ...@@ -1030,18 +982,16 @@ static void tcm_qla2xxx_drop_tpg(struct se_portal_group *se_tpg)
kfree(tpg); kfree(tpg);
} }
static ssize_t tcm_qla2xxx_npiv_tpg_show_enable( static ssize_t tcm_qla2xxx_npiv_tpg_enable_show(struct config_item *item,
struct se_portal_group *se_tpg,
char *page) char *page)
{ {
return tcm_qla2xxx_tpg_show_enable(se_tpg, page); return tcm_qla2xxx_tpg_enable_show(item, page);
} }
static ssize_t tcm_qla2xxx_npiv_tpg_store_enable( static ssize_t tcm_qla2xxx_npiv_tpg_enable_store(struct config_item *item,
struct se_portal_group *se_tpg, const char *page, size_t count)
const char *page,
size_t count)
{ {
struct se_portal_group *se_tpg = to_tpg(item);
struct se_wwn *se_wwn = se_tpg->se_tpg_wwn; struct se_wwn *se_wwn = se_tpg->se_tpg_wwn;
struct tcm_qla2xxx_lport *lport = container_of(se_wwn, struct tcm_qla2xxx_lport *lport = container_of(se_wwn,
struct tcm_qla2xxx_lport, lport_wwn); struct tcm_qla2xxx_lport, lport_wwn);
...@@ -1077,10 +1027,10 @@ static ssize_t tcm_qla2xxx_npiv_tpg_store_enable( ...@@ -1077,10 +1027,10 @@ static ssize_t tcm_qla2xxx_npiv_tpg_store_enable(
return count; return count;
} }
TF_TPG_BASE_ATTR(tcm_qla2xxx_npiv, enable, S_IRUGO | S_IWUSR); CONFIGFS_ATTR(tcm_qla2xxx_npiv_tpg_, enable);
static struct configfs_attribute *tcm_qla2xxx_npiv_tpg_attrs[] = { static struct configfs_attribute *tcm_qla2xxx_npiv_tpg_attrs[] = {
&tcm_qla2xxx_npiv_tpg_enable.attr, &tcm_qla2xxx_npiv_tpg_attr_enable,
NULL, NULL,
}; };
...@@ -1783,8 +1733,7 @@ static void tcm_qla2xxx_npiv_drop_lport(struct se_wwn *wwn) ...@@ -1783,8 +1733,7 @@ static void tcm_qla2xxx_npiv_drop_lport(struct se_wwn *wwn)
} }
static ssize_t tcm_qla2xxx_wwn_show_attr_version( static ssize_t tcm_qla2xxx_wwn_version_show(struct config_item *item,
struct target_fabric_configfs *tf,
char *page) char *page)
{ {
return sprintf(page, return sprintf(page,
...@@ -1793,10 +1742,10 @@ static ssize_t tcm_qla2xxx_wwn_show_attr_version( ...@@ -1793,10 +1742,10 @@ static ssize_t tcm_qla2xxx_wwn_show_attr_version(
utsname()->machine); utsname()->machine);
} }
TF_WWN_ATTR_RO(tcm_qla2xxx, version); CONFIGFS_ATTR_RO(tcm_qla2xxx_wwn_, version);
static struct configfs_attribute *tcm_qla2xxx_wwn_attrs[] = { static struct configfs_attribute *tcm_qla2xxx_wwn_attrs[] = {
&tcm_qla2xxx_wwn_version.attr, &tcm_qla2xxx_wwn_attr_version,
NULL, NULL,
}; };
......
This diff is collapsed.
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_fabric.h> #include <target/target_core_fabric.h>
#include <target/target_core_fabric_configfs.h>
#include "tcm_loop.h" #include "tcm_loop.h"
...@@ -763,21 +762,20 @@ static void tcm_loop_port_unlink( ...@@ -763,21 +762,20 @@ static void tcm_loop_port_unlink(
/* End items for tcm_loop_port_cit */ /* End items for tcm_loop_port_cit */
static ssize_t tcm_loop_tpg_attrib_show_fabric_prot_type( static ssize_t tcm_loop_tpg_attrib_fabric_prot_type_show(
struct se_portal_group *se_tpg, struct config_item *item, char *page)
char *page)
{ {
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, struct tcm_loop_tpg, struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, struct tcm_loop_tpg,
tl_se_tpg); tl_se_tpg);
return sprintf(page, "%d\n", tl_tpg->tl_fabric_prot_type); return sprintf(page, "%d\n", tl_tpg->tl_fabric_prot_type);
} }
static ssize_t tcm_loop_tpg_attrib_store_fabric_prot_type( static ssize_t tcm_loop_tpg_attrib_fabric_prot_type_store(
struct se_portal_group *se_tpg, struct config_item *item, const char *page, size_t count)
const char *page,
size_t count)
{ {
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, struct tcm_loop_tpg, struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, struct tcm_loop_tpg,
tl_se_tpg); tl_se_tpg);
unsigned long val; unsigned long val;
...@@ -796,10 +794,10 @@ static ssize_t tcm_loop_tpg_attrib_store_fabric_prot_type( ...@@ -796,10 +794,10 @@ static ssize_t tcm_loop_tpg_attrib_store_fabric_prot_type(
return count; return count;
} }
TF_TPG_ATTRIB_ATTR(tcm_loop, fabric_prot_type, S_IRUGO | S_IWUSR); CONFIGFS_ATTR(tcm_loop_tpg_attrib_, fabric_prot_type);
static struct configfs_attribute *tcm_loop_tpg_attrib_attrs[] = { static struct configfs_attribute *tcm_loop_tpg_attrib_attrs[] = {
&tcm_loop_tpg_attrib_fabric_prot_type.attr, &tcm_loop_tpg_attrib_attr_fabric_prot_type,
NULL, NULL,
}; };
...@@ -894,10 +892,9 @@ static int tcm_loop_drop_nexus( ...@@ -894,10 +892,9 @@ static int tcm_loop_drop_nexus(
/* End items for tcm_loop_nexus_cit */ /* End items for tcm_loop_nexus_cit */
static ssize_t tcm_loop_tpg_show_nexus( static ssize_t tcm_loop_tpg_nexus_show(struct config_item *item, char *page)
struct se_portal_group *se_tpg,
char *page)
{ {
struct se_portal_group *se_tpg = to_tpg(item);
struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, struct tcm_loop_tpg *tl_tpg = container_of(se_tpg,
struct tcm_loop_tpg, tl_se_tpg); struct tcm_loop_tpg, tl_se_tpg);
struct tcm_loop_nexus *tl_nexus; struct tcm_loop_nexus *tl_nexus;
...@@ -913,11 +910,10 @@ static ssize_t tcm_loop_tpg_show_nexus( ...@@ -913,11 +910,10 @@ static ssize_t tcm_loop_tpg_show_nexus(
return ret; return ret;
} }
static ssize_t tcm_loop_tpg_store_nexus( static ssize_t tcm_loop_tpg_nexus_store(struct config_item *item,
struct se_portal_group *se_tpg, const char *page, size_t count)
const char *page,
size_t count)
{ {
struct se_portal_group *se_tpg = to_tpg(item);
struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, struct tcm_loop_tpg *tl_tpg = container_of(se_tpg,
struct tcm_loop_tpg, tl_se_tpg); struct tcm_loop_tpg, tl_se_tpg);
struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba;
...@@ -992,12 +988,10 @@ static ssize_t tcm_loop_tpg_store_nexus( ...@@ -992,12 +988,10 @@ static ssize_t tcm_loop_tpg_store_nexus(
return count; return count;
} }
TF_TPG_BASE_ATTR(tcm_loop, nexus, S_IRUGO | S_IWUSR); static ssize_t tcm_loop_tpg_transport_status_show(struct config_item *item,
static ssize_t tcm_loop_tpg_show_transport_status(
struct se_portal_group *se_tpg,
char *page) char *page)
{ {
struct se_portal_group *se_tpg = to_tpg(item);
struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, struct tcm_loop_tpg *tl_tpg = container_of(se_tpg,
struct tcm_loop_tpg, tl_se_tpg); struct tcm_loop_tpg, tl_se_tpg);
const char *status = NULL; const char *status = NULL;
...@@ -1020,11 +1014,10 @@ static ssize_t tcm_loop_tpg_show_transport_status( ...@@ -1020,11 +1014,10 @@ static ssize_t tcm_loop_tpg_show_transport_status(
return ret; return ret;
} }
static ssize_t tcm_loop_tpg_store_transport_status( static ssize_t tcm_loop_tpg_transport_status_store(struct config_item *item,
struct se_portal_group *se_tpg, const char *page, size_t count)
const char *page,
size_t count)
{ {
struct se_portal_group *se_tpg = to_tpg(item);
struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, struct tcm_loop_tpg *tl_tpg = container_of(se_tpg,
struct tcm_loop_tpg, tl_se_tpg); struct tcm_loop_tpg, tl_se_tpg);
...@@ -1044,11 +1037,12 @@ static ssize_t tcm_loop_tpg_store_transport_status( ...@@ -1044,11 +1037,12 @@ static ssize_t tcm_loop_tpg_store_transport_status(
return -EINVAL; return -EINVAL;
} }
TF_TPG_BASE_ATTR(tcm_loop, transport_status, S_IRUGO | S_IWUSR); CONFIGFS_ATTR(tcm_loop_tpg_, nexus);
CONFIGFS_ATTR(tcm_loop_tpg_, transport_status);
static struct configfs_attribute *tcm_loop_tpg_attrs[] = { static struct configfs_attribute *tcm_loop_tpg_attrs[] = {
&tcm_loop_tpg_nexus.attr, &tcm_loop_tpg_attr_nexus,
&tcm_loop_tpg_transport_status.attr, &tcm_loop_tpg_attr_transport_status,
NULL, NULL,
}; };
...@@ -1216,17 +1210,15 @@ static void tcm_loop_drop_scsi_hba( ...@@ -1216,17 +1210,15 @@ static void tcm_loop_drop_scsi_hba(
} }
/* Start items for tcm_loop_cit */ /* Start items for tcm_loop_cit */
static ssize_t tcm_loop_wwn_show_attr_version( static ssize_t tcm_loop_wwn_version_show(struct config_item *item, char *page)
struct target_fabric_configfs *tf,
char *page)
{ {
return sprintf(page, "TCM Loopback Fabric module %s\n", TCM_LOOP_VERSION); return sprintf(page, "TCM Loopback Fabric module %s\n", TCM_LOOP_VERSION);
} }
TF_WWN_ATTR_RO(tcm_loop, version); CONFIGFS_ATTR_RO(tcm_loop_wwn_, version);
static struct configfs_attribute *tcm_loop_wwn_attrs[] = { static struct configfs_attribute *tcm_loop_wwn_attrs[] = {
&tcm_loop_wwn_version.attr, &tcm_loop_wwn_attr_version,
NULL, NULL,
}; };
......
...@@ -35,8 +35,6 @@ ...@@ -35,8 +35,6 @@
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_backend.h> #include <target/target_core_backend.h>
#include <target/target_core_fabric.h> #include <target/target_core_fabric.h>
#include <target/target_core_fabric_configfs.h>
#include <target/configfs_macros.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include "sbp_target.h" #include "sbp_target.h"
...@@ -2111,24 +2109,21 @@ static void sbp_drop_tport(struct se_wwn *wwn) ...@@ -2111,24 +2109,21 @@ static void sbp_drop_tport(struct se_wwn *wwn)
kfree(tport); kfree(tport);
} }
static ssize_t sbp_wwn_show_attr_version( static ssize_t sbp_wwn_version_show(struct config_item *item, char *page)
struct target_fabric_configfs *tf,
char *page)
{ {
return sprintf(page, "FireWire SBP fabric module %s\n", SBP_VERSION); return sprintf(page, "FireWire SBP fabric module %s\n", SBP_VERSION);
} }
TF_WWN_ATTR_RO(sbp, version); CONFIGFS_ATTR_RO(sbp_wwn_, version);
static struct configfs_attribute *sbp_wwn_attrs[] = { static struct configfs_attribute *sbp_wwn_attrs[] = {
&sbp_wwn_version.attr, &sbp_wwn_attr_version,
NULL, NULL,
}; };
static ssize_t sbp_tpg_show_directory_id( static ssize_t sbp_tpg_directory_id_show(struct config_item *item, char *page)
struct se_portal_group *se_tpg,
char *page)
{ {
struct se_portal_group *se_tpg = to_tpg(item);
struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg);
struct sbp_tport *tport = tpg->tport; struct sbp_tport *tport = tpg->tport;
...@@ -2138,11 +2133,10 @@ static ssize_t sbp_tpg_show_directory_id( ...@@ -2138,11 +2133,10 @@ static ssize_t sbp_tpg_show_directory_id(
return sprintf(page, "%06x\n", tport->directory_id); return sprintf(page, "%06x\n", tport->directory_id);
} }
static ssize_t sbp_tpg_store_directory_id( static ssize_t sbp_tpg_directory_id_store(struct config_item *item,
struct se_portal_group *se_tpg, const char *page, size_t count)
const char *page,
size_t count)
{ {
struct se_portal_group *se_tpg = to_tpg(item);
struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg);
struct sbp_tport *tport = tpg->tport; struct sbp_tport *tport = tpg->tport;
unsigned long val; unsigned long val;
...@@ -2166,20 +2160,18 @@ static ssize_t sbp_tpg_store_directory_id( ...@@ -2166,20 +2160,18 @@ static ssize_t sbp_tpg_store_directory_id(
return count; return count;
} }
static ssize_t sbp_tpg_show_enable( static ssize_t sbp_tpg_enable_show(struct config_item *item, char *page)
struct se_portal_group *se_tpg,
char *page)
{ {
struct se_portal_group *se_tpg = to_tpg(item);
struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg);
struct sbp_tport *tport = tpg->tport; struct sbp_tport *tport = tpg->tport;
return sprintf(page, "%d\n", tport->enable); return sprintf(page, "%d\n", tport->enable);
} }
static ssize_t sbp_tpg_store_enable( static ssize_t sbp_tpg_enable_store(struct config_item *item,
struct se_portal_group *se_tpg, const char *page, size_t count)
const char *page,
size_t count)
{ {
struct se_portal_group *se_tpg = to_tpg(item);
struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg);
struct sbp_tport *tport = tpg->tport; struct sbp_tport *tport = tpg->tport;
unsigned long val; unsigned long val;
...@@ -2219,29 +2211,28 @@ static ssize_t sbp_tpg_store_enable( ...@@ -2219,29 +2211,28 @@ static ssize_t sbp_tpg_store_enable(
return count; return count;
} }
TF_TPG_BASE_ATTR(sbp, directory_id, S_IRUGO | S_IWUSR); CONFIGFS_ATTR(sbp_tpg_, directory_id);
TF_TPG_BASE_ATTR(sbp, enable, S_IRUGO | S_IWUSR); CONFIGFS_ATTR(sbp_tpg_, enable);
static struct configfs_attribute *sbp_tpg_base_attrs[] = { static struct configfs_attribute *sbp_tpg_base_attrs[] = {
&sbp_tpg_directory_id.attr, &sbp_tpg_attr_directory_id,
&sbp_tpg_enable.attr, &sbp_tpg_attr_enable,
NULL, NULL,
}; };
static ssize_t sbp_tpg_attrib_show_mgt_orb_timeout( static ssize_t sbp_tpg_attrib_mgt_orb_timeout_show(struct config_item *item,
struct se_portal_group *se_tpg,
char *page) char *page)
{ {
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg);
struct sbp_tport *tport = tpg->tport; struct sbp_tport *tport = tpg->tport;
return sprintf(page, "%d\n", tport->mgt_orb_timeout); return sprintf(page, "%d\n", tport->mgt_orb_timeout);
} }
static ssize_t sbp_tpg_attrib_store_mgt_orb_timeout( static ssize_t sbp_tpg_attrib_mgt_orb_timeout_store(struct config_item *item,
struct se_portal_group *se_tpg, const char *page, size_t count)
const char *page,
size_t count)
{ {
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg);
struct sbp_tport *tport = tpg->tport; struct sbp_tport *tport = tpg->tport;
unsigned long val; unsigned long val;
...@@ -2264,20 +2255,19 @@ static ssize_t sbp_tpg_attrib_store_mgt_orb_timeout( ...@@ -2264,20 +2255,19 @@ static ssize_t sbp_tpg_attrib_store_mgt_orb_timeout(
return count; return count;
} }
static ssize_t sbp_tpg_attrib_show_max_reconnect_timeout( static ssize_t sbp_tpg_attrib_max_reconnect_timeout_show(struct config_item *item,
struct se_portal_group *se_tpg,
char *page) char *page)
{ {
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg);
struct sbp_tport *tport = tpg->tport; struct sbp_tport *tport = tpg->tport;
return sprintf(page, "%d\n", tport->max_reconnect_timeout); return sprintf(page, "%d\n", tport->max_reconnect_timeout);
} }
static ssize_t sbp_tpg_attrib_store_max_reconnect_timeout( static ssize_t sbp_tpg_attrib_max_reconnect_timeout_store(struct config_item *item,
struct se_portal_group *se_tpg, const char *page, size_t count)
const char *page,
size_t count)
{ {
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg);
struct sbp_tport *tport = tpg->tport; struct sbp_tport *tport = tpg->tport;
unsigned long val; unsigned long val;
...@@ -2300,20 +2290,19 @@ static ssize_t sbp_tpg_attrib_store_max_reconnect_timeout( ...@@ -2300,20 +2290,19 @@ static ssize_t sbp_tpg_attrib_store_max_reconnect_timeout(
return count; return count;
} }
static ssize_t sbp_tpg_attrib_show_max_logins_per_lun( static ssize_t sbp_tpg_attrib_max_logins_per_lun_show(struct config_item *item,
struct se_portal_group *se_tpg,
char *page) char *page)
{ {
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg);
struct sbp_tport *tport = tpg->tport; struct sbp_tport *tport = tpg->tport;
return sprintf(page, "%d\n", tport->max_logins_per_lun); return sprintf(page, "%d\n", tport->max_logins_per_lun);
} }
static ssize_t sbp_tpg_attrib_store_max_logins_per_lun( static ssize_t sbp_tpg_attrib_max_logins_per_lun_store(struct config_item *item,
struct se_portal_group *se_tpg, const char *page, size_t count)
const char *page,
size_t count)
{ {
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg);
struct sbp_tport *tport = tpg->tport; struct sbp_tport *tport = tpg->tport;
unsigned long val; unsigned long val;
...@@ -2330,14 +2319,14 @@ static ssize_t sbp_tpg_attrib_store_max_logins_per_lun( ...@@ -2330,14 +2319,14 @@ static ssize_t sbp_tpg_attrib_store_max_logins_per_lun(
return count; return count;
} }
TF_TPG_ATTRIB_ATTR(sbp, mgt_orb_timeout, S_IRUGO | S_IWUSR); CONFIGFS_ATTR(sbp_tpg_attrib_, mgt_orb_timeout);
TF_TPG_ATTRIB_ATTR(sbp, max_reconnect_timeout, S_IRUGO | S_IWUSR); CONFIGFS_ATTR(sbp_tpg_attrib_, max_reconnect_timeout);
TF_TPG_ATTRIB_ATTR(sbp, max_logins_per_lun, S_IRUGO | S_IWUSR); CONFIGFS_ATTR(sbp_tpg_attrib_, max_logins_per_lun);
static struct configfs_attribute *sbp_tpg_attrib_attrs[] = { static struct configfs_attribute *sbp_tpg_attrib_attrs[] = {
&sbp_tpg_attrib_mgt_orb_timeout.attr, &sbp_tpg_attrib_attr_mgt_orb_timeout,
&sbp_tpg_attrib_max_reconnect_timeout.attr, &sbp_tpg_attrib_attr_max_reconnect_timeout,
&sbp_tpg_attrib_max_logins_per_lun.attr, &sbp_tpg_attrib_attr_max_logins_per_lun,
NULL, NULL,
}; };
......
This diff is collapsed.
...@@ -87,6 +87,9 @@ void target_free_device(struct se_device *); ...@@ -87,6 +87,9 @@ void target_free_device(struct se_device *);
/* target_core_configfs.c */ /* target_core_configfs.c */
void target_setup_backend_cits(struct target_backend *); void target_setup_backend_cits(struct target_backend *);
/* target_core_fabric_configfs.c */
int target_fabric_setup_cits(struct target_fabric_configfs *);
/* target_core_fabric_lib.c */ /* target_core_fabric_lib.c */
int target_get_pr_transport_id_len(struct se_node_acl *nacl, int target_get_pr_transport_id_len(struct se_node_acl *nacl,
struct t10_pr_registration *pr_reg, int *format_code); struct t10_pr_registration *pr_reg, int *format_code);
......
This diff is collapsed.
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_fabric.h> #include <target/target_core_fabric.h>
#include <target/configfs_macros.h>
#include "tcm_fc.h" #include "tcm_fc.h"
......
...@@ -38,8 +38,6 @@ ...@@ -38,8 +38,6 @@
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_fabric.h> #include <target/target_core_fabric.h>
#include <target/target_core_fabric_configfs.h>
#include <target/configfs_macros.h>
#include "tcm_fc.h" #include "tcm_fc.h"
...@@ -131,55 +129,51 @@ static ssize_t ft_wwn_store(void *arg, const char *buf, size_t len) ...@@ -131,55 +129,51 @@ static ssize_t ft_wwn_store(void *arg, const char *buf, size_t len)
* ACL auth ops. * ACL auth ops.
*/ */
static ssize_t ft_nacl_show_port_name( static ssize_t ft_nacl_port_name_show(struct config_item *item, char *page)
struct se_node_acl *se_nacl,
char *page)
{ {
struct se_node_acl *se_nacl = acl_to_nacl(item);
struct ft_node_acl *acl = container_of(se_nacl, struct ft_node_acl *acl = container_of(se_nacl,
struct ft_node_acl, se_node_acl); struct ft_node_acl, se_node_acl);
return ft_wwn_show(&acl->node_auth.port_name, page); return ft_wwn_show(&acl->node_auth.port_name, page);
} }
static ssize_t ft_nacl_store_port_name( static ssize_t ft_nacl_port_name_store(struct config_item *item,
struct se_node_acl *se_nacl, const char *page, size_t count)
const char *page,
size_t count)
{ {
struct se_node_acl *se_nacl = acl_to_nacl(item);
struct ft_node_acl *acl = container_of(se_nacl, struct ft_node_acl *acl = container_of(se_nacl,
struct ft_node_acl, se_node_acl); struct ft_node_acl, se_node_acl);
return ft_wwn_store(&acl->node_auth.port_name, page, count); return ft_wwn_store(&acl->node_auth.port_name, page, count);
} }
TF_NACL_BASE_ATTR(ft, port_name, S_IRUGO | S_IWUSR); static ssize_t ft_nacl_node_name_show(struct config_item *item,
static ssize_t ft_nacl_show_node_name(
struct se_node_acl *se_nacl,
char *page) char *page)
{ {
struct se_node_acl *se_nacl = acl_to_nacl(item);
struct ft_node_acl *acl = container_of(se_nacl, struct ft_node_acl *acl = container_of(se_nacl,
struct ft_node_acl, se_node_acl); struct ft_node_acl, se_node_acl);
return ft_wwn_show(&acl->node_auth.node_name, page); return ft_wwn_show(&acl->node_auth.node_name, page);
} }
static ssize_t ft_nacl_store_node_name( static ssize_t ft_nacl_node_name_store(struct config_item *item,
struct se_node_acl *se_nacl, const char *page, size_t count)
const char *page,
size_t count)
{ {
struct se_node_acl *se_nacl = acl_to_nacl(item);
struct ft_node_acl *acl = container_of(se_nacl, struct ft_node_acl *acl = container_of(se_nacl,
struct ft_node_acl, se_node_acl); struct ft_node_acl, se_node_acl);
return ft_wwn_store(&acl->node_auth.node_name, page, count); return ft_wwn_store(&acl->node_auth.node_name, page, count);
} }
TF_NACL_BASE_ATTR(ft, node_name, S_IRUGO | S_IWUSR); CONFIGFS_ATTR(ft_nacl_, node_name);
CONFIGFS_ATTR(ft_nacl_, port_name);
static struct configfs_attribute *ft_nacl_base_attrs[] = { static struct configfs_attribute *ft_nacl_base_attrs[] = {
&ft_nacl_port_name.attr, &ft_nacl_attr_port_name,
&ft_nacl_node_name.attr, &ft_nacl_attr_node_name,
NULL, NULL,
}; };
...@@ -386,18 +380,16 @@ static void ft_del_wwn(struct se_wwn *wwn) ...@@ -386,18 +380,16 @@ static void ft_del_wwn(struct se_wwn *wwn)
kfree(ft_wwn); kfree(ft_wwn);
} }
static ssize_t ft_wwn_show_attr_version( static ssize_t ft_wwn_version_show(struct config_item *item, char *page)
struct target_fabric_configfs *tf,
char *page)
{ {
return sprintf(page, "TCM FC " FT_VERSION " on %s/%s on " return sprintf(page, "TCM FC " FT_VERSION " on %s/%s on "
""UTS_RELEASE"\n", utsname()->sysname, utsname()->machine); ""UTS_RELEASE"\n", utsname()->sysname, utsname()->machine);
} }
TF_WWN_ATTR_RO(ft, version); CONFIGFS_ATTR_RO(ft_wwn_, version);
static struct configfs_attribute *ft_wwn_attrs[] = { static struct configfs_attribute *ft_wwn_attrs[] = {
&ft_wwn_version.attr, &ft_wwn_attr_version,
NULL, NULL,
}; };
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_fabric.h> #include <target/target_core_fabric.h>
#include <target/configfs_macros.h>
#include "tcm_fc.h" #include "tcm_fc.h"
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_fabric.h> #include <target/target_core_fabric.h>
#include <target/configfs_macros.h>
#include "tcm_fc.h" #include "tcm_fc.h"
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#include <scsi/scsi_tcq.h> #include <scsi/scsi_tcq.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_fabric.h> #include <target/target_core_fabric.h>
#include <target/target_core_fabric_configfs.h>
#include <target/configfs_macros.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include "tcm_usb_gadget.h" #include "tcm_usb_gadget.h"
...@@ -1467,23 +1465,21 @@ static void usbg_drop_tport(struct se_wwn *wwn) ...@@ -1467,23 +1465,21 @@ static void usbg_drop_tport(struct se_wwn *wwn)
/* /*
* If somebody feels like dropping the version property, go ahead. * If somebody feels like dropping the version property, go ahead.
*/ */
static ssize_t usbg_wwn_show_attr_version( static ssize_t usbg_wwn_version_show(struct config_item *item, char *page)
struct target_fabric_configfs *tf,
char *page)
{ {
return sprintf(page, "usb-gadget fabric module\n"); return sprintf(page, "usb-gadget fabric module\n");
} }
TF_WWN_ATTR_RO(usbg, version);
CONFIGFS_ATTR_RO(usbg_wwn_, version);
static struct configfs_attribute *usbg_wwn_attrs[] = { static struct configfs_attribute *usbg_wwn_attrs[] = {
&usbg_wwn_version.attr, &usbg_wwn_attr_version,
NULL, NULL,
}; };
static ssize_t tcm_usbg_tpg_show_enable( static ssize_t tcm_usbg_tpg_enable_show(struct config_item *item, char *page)
struct se_portal_group *se_tpg,
char *page)
{ {
struct se_portal_group *se_tpg = to_tpg(item);
struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg);
return snprintf(page, PAGE_SIZE, "%u\n", tpg->gadget_connect); return snprintf(page, PAGE_SIZE, "%u\n", tpg->gadget_connect);
...@@ -1492,11 +1488,10 @@ static ssize_t tcm_usbg_tpg_show_enable( ...@@ -1492,11 +1488,10 @@ static ssize_t tcm_usbg_tpg_show_enable(
static int usbg_attach(struct usbg_tpg *); static int usbg_attach(struct usbg_tpg *);
static void usbg_detach(struct usbg_tpg *); static void usbg_detach(struct usbg_tpg *);
static ssize_t tcm_usbg_tpg_store_enable( static ssize_t tcm_usbg_tpg_enable_store(struct config_item *item,
struct se_portal_group *se_tpg, const char *page, size_t count)
const char *page,
size_t count)
{ {
struct se_portal_group *se_tpg = to_tpg(item);
struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg);
unsigned long op; unsigned long op;
ssize_t ret; ssize_t ret;
...@@ -1523,12 +1518,10 @@ static ssize_t tcm_usbg_tpg_store_enable( ...@@ -1523,12 +1518,10 @@ static ssize_t tcm_usbg_tpg_store_enable(
out: out:
return count; return count;
} }
TF_TPG_BASE_ATTR(tcm_usbg, enable, S_IRUGO | S_IWUSR);
static ssize_t tcm_usbg_tpg_show_nexus( static ssize_t tcm_usbg_tpg_nexus_show(struct config_item *item, char *page)
struct se_portal_group *se_tpg,
char *page)
{ {
struct se_portal_group *se_tpg = to_tpg(item);
struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg);
struct tcm_usbg_nexus *tv_nexus; struct tcm_usbg_nexus *tv_nexus;
ssize_t ret; ssize_t ret;
...@@ -1636,11 +1629,10 @@ static int tcm_usbg_drop_nexus(struct usbg_tpg *tpg) ...@@ -1636,11 +1629,10 @@ static int tcm_usbg_drop_nexus(struct usbg_tpg *tpg)
return ret; return ret;
} }
static ssize_t tcm_usbg_tpg_store_nexus( static ssize_t tcm_usbg_tpg_nexus_store(struct config_item *item,
struct se_portal_group *se_tpg, const char *page, size_t count)
const char *page,
size_t count)
{ {
struct se_portal_group *se_tpg = to_tpg(item);
struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg);
unsigned char i_port[USBG_NAMELEN], *ptr; unsigned char i_port[USBG_NAMELEN], *ptr;
int ret; int ret;
...@@ -1670,11 +1662,13 @@ static ssize_t tcm_usbg_tpg_store_nexus( ...@@ -1670,11 +1662,13 @@ static ssize_t tcm_usbg_tpg_store_nexus(
return ret; return ret;
return count; return count;
} }
TF_TPG_BASE_ATTR(tcm_usbg, nexus, S_IRUGO | S_IWUSR);
CONFIGFS_ATTR(tcm_usbg_tpg_, enable);
CONFIGFS_ATTR(tcm_usbg_tpg_, nexus);
static struct configfs_attribute *usbg_base_attrs[] = { static struct configfs_attribute *usbg_base_attrs[] = {
&tcm_usbg_tpg_enable.attr, &tcm_usbg_tpg_attr_enable,
&tcm_usbg_tpg_nexus.attr, &tcm_usbg_tpg_attr_nexus,
NULL, NULL,
}; };
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment