mirror of
https://github.com/torvalds/linux.git
synced 2024-11-28 07:01:32 +00:00
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: Christoph Hellwig <hch@lst.de> Reviewed-by: Nicholas Bellinger <nab@linux-iscsi.org> Acked-by: Nicholas Bellinger <nab@linux-iscsi.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
This commit is contained in:
parent
64c6be0e6d
commit
2eafd72939
@ -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 <target/target_core_base.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 + "_fabric.h\"\n\n"
|
||||
|
||||
@ -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 += " kfree(" + fabric_mod_port + ");\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 += " .module = THIS_MODULE,\n"
|
||||
@ -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_make_tpg = " + fabric_mod_name + "_make_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 += "static int __init " + fabric_mod_name + "_init(void)\n"
|
||||
|
@ -43,9 +43,7 @@
|
||||
#include <linux/atomic.h>
|
||||
#include <scsi/scsi_proto.h>
|
||||
#include <scsi/scsi_tcq.h>
|
||||
#include <target/configfs_macros.h>
|
||||
#include <target/target_core_base.h>
|
||||
#include <target/target_core_fabric_configfs.h>
|
||||
#include <target/target_core_fabric.h>
|
||||
#include "ib_srpt.h"
|
||||
|
||||
@ -3545,20 +3543,19 @@ static void srpt_cleanup_nodeacl(struct se_node_acl *se_nacl)
|
||||
spin_unlock_irq(&sport->port_acl_lock);
|
||||
}
|
||||
|
||||
static ssize_t srpt_tpg_attrib_show_srp_max_rdma_size(
|
||||
struct se_portal_group *se_tpg,
|
||||
char *page)
|
||||
static ssize_t srpt_tpg_attrib_srp_max_rdma_size_show(struct config_item *item,
|
||||
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);
|
||||
|
||||
return sprintf(page, "%u\n", sport->port_attrib.srp_max_rdma_size);
|
||||
}
|
||||
|
||||
static ssize_t srpt_tpg_attrib_store_srp_max_rdma_size(
|
||||
struct se_portal_group *se_tpg,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t srpt_tpg_attrib_srp_max_rdma_size_store(struct config_item *item,
|
||||
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);
|
||||
unsigned long val;
|
||||
int ret;
|
||||
@ -3583,22 +3580,19 @@ static ssize_t srpt_tpg_attrib_store_srp_max_rdma_size(
|
||||
return count;
|
||||
}
|
||||
|
||||
TF_TPG_ATTRIB_ATTR(srpt, srp_max_rdma_size, S_IRUGO | S_IWUSR);
|
||||
|
||||
static ssize_t srpt_tpg_attrib_show_srp_max_rsp_size(
|
||||
struct se_portal_group *se_tpg,
|
||||
char *page)
|
||||
static ssize_t srpt_tpg_attrib_srp_max_rsp_size_show(struct config_item *item,
|
||||
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);
|
||||
|
||||
return sprintf(page, "%u\n", sport->port_attrib.srp_max_rsp_size);
|
||||
}
|
||||
|
||||
static ssize_t srpt_tpg_attrib_store_srp_max_rsp_size(
|
||||
struct se_portal_group *se_tpg,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t srpt_tpg_attrib_srp_max_rsp_size_store(struct config_item *item,
|
||||
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);
|
||||
unsigned long val;
|
||||
int ret;
|
||||
@ -3623,22 +3617,19 @@ static ssize_t srpt_tpg_attrib_store_srp_max_rsp_size(
|
||||
return count;
|
||||
}
|
||||
|
||||
TF_TPG_ATTRIB_ATTR(srpt, srp_max_rsp_size, S_IRUGO | S_IWUSR);
|
||||
|
||||
static ssize_t srpt_tpg_attrib_show_srp_sq_size(
|
||||
struct se_portal_group *se_tpg,
|
||||
char *page)
|
||||
static ssize_t srpt_tpg_attrib_srp_sq_size_show(struct config_item *item,
|
||||
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);
|
||||
|
||||
return sprintf(page, "%u\n", sport->port_attrib.srp_sq_size);
|
||||
}
|
||||
|
||||
static ssize_t srpt_tpg_attrib_store_srp_sq_size(
|
||||
struct se_portal_group *se_tpg,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t srpt_tpg_attrib_srp_sq_size_store(struct config_item *item,
|
||||
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);
|
||||
unsigned long val;
|
||||
int ret;
|
||||
@ -3663,29 +3654,29 @@ static ssize_t srpt_tpg_attrib_store_srp_sq_size(
|
||||
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[] = {
|
||||
&srpt_tpg_attrib_srp_max_rdma_size.attr,
|
||||
&srpt_tpg_attrib_srp_max_rsp_size.attr,
|
||||
&srpt_tpg_attrib_srp_sq_size.attr,
|
||||
&srpt_tpg_attrib_attr_srp_max_rdma_size,
|
||||
&srpt_tpg_attrib_attr_srp_max_rsp_size,
|
||||
&srpt_tpg_attrib_attr_srp_sq_size,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static ssize_t srpt_tpg_show_enable(
|
||||
struct se_portal_group *se_tpg,
|
||||
char *page)
|
||||
static ssize_t srpt_tpg_enable_show(struct config_item *item, 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);
|
||||
|
||||
return snprintf(page, PAGE_SIZE, "%d\n", (sport->enabled) ? 1: 0);
|
||||
}
|
||||
|
||||
static ssize_t srpt_tpg_store_enable(
|
||||
struct se_portal_group *se_tpg,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t srpt_tpg_enable_store(struct config_item *item,
|
||||
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);
|
||||
unsigned long tmp;
|
||||
int ret;
|
||||
@ -3708,10 +3699,10 @@ static ssize_t srpt_tpg_store_enable(
|
||||
return count;
|
||||
}
|
||||
|
||||
TF_TPG_BASE_ATTR(srpt, enable, S_IRUGO | S_IWUSR);
|
||||
CONFIGFS_ATTR(srpt_tpg_, enable);
|
||||
|
||||
static struct configfs_attribute *srpt_tpg_attrs[] = {
|
||||
&srpt_tpg_enable.attr,
|
||||
&srpt_tpg_attr_enable,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
static ssize_t srpt_wwn_show_attr_version(struct target_fabric_configfs *tf,
|
||||
char *buf)
|
||||
static ssize_t srpt_wwn_version_show(struct config_item *item, char *buf)
|
||||
{
|
||||
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[] = {
|
||||
&srpt_wwn_version.attr,
|
||||
&srpt_wwn_attr_version,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
@ -43,8 +43,6 @@
|
||||
#include <scsi/scsi_cmnd.h>
|
||||
#include <target/target_core_base.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_target.h"
|
||||
@ -729,23 +727,23 @@ static int tcm_qla2xxx_init_nodeacl(struct se_node_acl *se_nacl,
|
||||
|
||||
#define DEF_QLA_TPG_ATTRIB(name) \
|
||||
\
|
||||
static ssize_t tcm_qla2xxx_tpg_attrib_show_##name( \
|
||||
struct se_portal_group *se_tpg, \
|
||||
char *page) \
|
||||
static ssize_t tcm_qla2xxx_tpg_attrib_##name##_show( \
|
||||
struct config_item *item, 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, se_tpg); \
|
||||
\
|
||||
return sprintf(page, "%u\n", tpg->tpg_attrib.name); \
|
||||
} \
|
||||
\
|
||||
static ssize_t tcm_qla2xxx_tpg_attrib_store_##name( \
|
||||
struct se_portal_group *se_tpg, \
|
||||
const char *page, \
|
||||
size_t count) \
|
||||
static ssize_t tcm_qla2xxx_tpg_attrib_##name##_store( \
|
||||
struct config_item *item, 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, se_tpg); \
|
||||
struct tcm_qla2xxx_tpg_attrib *a = &tpg->tpg_attrib; \
|
||||
unsigned long val; \
|
||||
int ret; \
|
||||
\
|
||||
@ -755,81 +753,39 @@ static ssize_t tcm_qla2xxx_tpg_attrib_store_##name( \
|
||||
" ret: %d\n", ret); \
|
||||
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)) { \
|
||||
pr_err("Illegal boolean value %lu\n", val); \
|
||||
return -EINVAL; \
|
||||
} \
|
||||
\
|
||||
a->_name = val; \
|
||||
return 0; \
|
||||
}
|
||||
a->name = val; \
|
||||
\
|
||||
return count; \
|
||||
} \
|
||||
CONFIGFS_ATTR(tcm_qla2xxx_tpg_attrib_, name)
|
||||
|
||||
#define QLA_TPG_ATTR(_name, _mode) \
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
QLA_TPG_ATTR(demo_mode_login_only, S_IRUGO | S_IWUSR);
|
||||
|
||||
static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = {
|
||||
&tcm_qla2xxx_tpg_attrib_generate_node_acls.attr,
|
||||
&tcm_qla2xxx_tpg_attrib_cache_dynamic_acls.attr,
|
||||
&tcm_qla2xxx_tpg_attrib_demo_mode_write_protect.attr,
|
||||
&tcm_qla2xxx_tpg_attrib_prod_mode_write_protect.attr,
|
||||
&tcm_qla2xxx_tpg_attrib_demo_mode_login_only.attr,
|
||||
&tcm_qla2xxx_tpg_attrib_attr_generate_node_acls,
|
||||
&tcm_qla2xxx_tpg_attrib_attr_cache_dynamic_acls,
|
||||
&tcm_qla2xxx_tpg_attrib_attr_demo_mode_write_protect,
|
||||
&tcm_qla2xxx_tpg_attrib_attr_prod_mode_write_protect,
|
||||
&tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only,
|
||||
NULL,
|
||||
};
|
||||
|
||||
/* End items for tcm_qla2xxx_tpg_attrib_cit */
|
||||
|
||||
static ssize_t tcm_qla2xxx_tpg_show_enable(
|
||||
struct se_portal_group *se_tpg,
|
||||
char *page)
|
||||
static ssize_t tcm_qla2xxx_tpg_enable_show(struct config_item *item,
|
||||
char *page)
|
||||
{
|
||||
struct se_portal_group *se_tpg = to_tpg(item);
|
||||
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
||||
struct tcm_qla2xxx_tpg, se_tpg);
|
||||
|
||||
@ -865,11 +821,10 @@ static void tcm_qla2xxx_undepend_tpg(struct work_struct *work)
|
||||
complete(&base_tpg->tpg_base_comp);
|
||||
}
|
||||
|
||||
static ssize_t tcm_qla2xxx_tpg_store_enable(
|
||||
struct se_portal_group *se_tpg,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t tcm_qla2xxx_tpg_enable_store(struct config_item *item,
|
||||
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, se_tpg);
|
||||
unsigned long op;
|
||||
@ -909,22 +864,16 @@ static ssize_t tcm_qla2xxx_tpg_store_enable(
|
||||
return count;
|
||||
}
|
||||
|
||||
TF_TPG_BASE_ATTR(tcm_qla2xxx, enable, S_IRUGO | S_IWUSR);
|
||||
|
||||
static ssize_t tcm_qla2xxx_tpg_show_dynamic_sessions(
|
||||
struct se_portal_group *se_tpg,
|
||||
char *page)
|
||||
static ssize_t tcm_qla2xxx_tpg_dynamic_sessions_show(struct config_item *item,
|
||||
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_store_fabric_prot_type(
|
||||
struct se_portal_group *se_tpg,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t tcm_qla2xxx_tpg_fabric_prot_type_store(struct config_item *item,
|
||||
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, se_tpg);
|
||||
unsigned long val;
|
||||
@ -943,21 +892,24 @@ static ssize_t tcm_qla2xxx_tpg_store_fabric_prot_type(
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t tcm_qla2xxx_tpg_show_fabric_prot_type(
|
||||
struct se_portal_group *se_tpg,
|
||||
char *page)
|
||||
static ssize_t tcm_qla2xxx_tpg_fabric_prot_type_show(struct config_item *item,
|
||||
char *page)
|
||||
{
|
||||
struct se_portal_group *se_tpg = to_tpg(item);
|
||||
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
||||
struct tcm_qla2xxx_tpg, se_tpg);
|
||||
|
||||
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[] = {
|
||||
&tcm_qla2xxx_tpg_enable.attr,
|
||||
&tcm_qla2xxx_tpg_dynamic_sessions.attr,
|
||||
&tcm_qla2xxx_tpg_fabric_prot_type.attr,
|
||||
&tcm_qla2xxx_tpg_attr_enable,
|
||||
&tcm_qla2xxx_tpg_attr_dynamic_sessions,
|
||||
&tcm_qla2xxx_tpg_attr_fabric_prot_type,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@ -1030,18 +982,16 @@ static void tcm_qla2xxx_drop_tpg(struct se_portal_group *se_tpg)
|
||||
kfree(tpg);
|
||||
}
|
||||
|
||||
static ssize_t tcm_qla2xxx_npiv_tpg_show_enable(
|
||||
struct se_portal_group *se_tpg,
|
||||
char *page)
|
||||
static ssize_t tcm_qla2xxx_npiv_tpg_enable_show(struct config_item *item,
|
||||
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(
|
||||
struct se_portal_group *se_tpg,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t tcm_qla2xxx_npiv_tpg_enable_store(struct config_item *item,
|
||||
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 tcm_qla2xxx_lport *lport = container_of(se_wwn,
|
||||
struct tcm_qla2xxx_lport, lport_wwn);
|
||||
@ -1077,10 +1027,10 @@ static ssize_t tcm_qla2xxx_npiv_tpg_store_enable(
|
||||
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[] = {
|
||||
&tcm_qla2xxx_npiv_tpg_enable.attr,
|
||||
&tcm_qla2xxx_npiv_tpg_attr_enable,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@ -1783,9 +1733,8 @@ static void tcm_qla2xxx_npiv_drop_lport(struct se_wwn *wwn)
|
||||
}
|
||||
|
||||
|
||||
static ssize_t tcm_qla2xxx_wwn_show_attr_version(
|
||||
struct target_fabric_configfs *tf,
|
||||
char *page)
|
||||
static ssize_t tcm_qla2xxx_wwn_version_show(struct config_item *item,
|
||||
char *page)
|
||||
{
|
||||
return sprintf(page,
|
||||
"TCM QLOGIC QLA2XXX NPIV capable fabric module %s on %s/%s on "
|
||||
@ -1793,10 +1742,10 @@ static ssize_t tcm_qla2xxx_wwn_show_attr_version(
|
||||
utsname()->machine);
|
||||
}
|
||||
|
||||
TF_WWN_ATTR_RO(tcm_qla2xxx, version);
|
||||
CONFIGFS_ATTR_RO(tcm_qla2xxx_wwn_, version);
|
||||
|
||||
static struct configfs_attribute *tcm_qla2xxx_wwn_attrs[] = {
|
||||
&tcm_qla2xxx_wwn_version.attr,
|
||||
&tcm_qla2xxx_wwn_attr_version,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -34,7 +34,6 @@
|
||||
|
||||
#include <target/target_core_base.h>
|
||||
#include <target/target_core_fabric.h>
|
||||
#include <target/target_core_fabric_configfs.h>
|
||||
|
||||
#include "tcm_loop.h"
|
||||
|
||||
@ -763,21 +762,20 @@ static void tcm_loop_port_unlink(
|
||||
|
||||
/* End items for tcm_loop_port_cit */
|
||||
|
||||
static ssize_t tcm_loop_tpg_attrib_show_fabric_prot_type(
|
||||
struct se_portal_group *se_tpg,
|
||||
char *page)
|
||||
static ssize_t tcm_loop_tpg_attrib_fabric_prot_type_show(
|
||||
struct config_item *item, 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,
|
||||
tl_se_tpg);
|
||||
|
||||
return sprintf(page, "%d\n", tl_tpg->tl_fabric_prot_type);
|
||||
}
|
||||
|
||||
static ssize_t tcm_loop_tpg_attrib_store_fabric_prot_type(
|
||||
struct se_portal_group *se_tpg,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t tcm_loop_tpg_attrib_fabric_prot_type_store(
|
||||
struct config_item *item, 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,
|
||||
tl_se_tpg);
|
||||
unsigned long val;
|
||||
@ -796,10 +794,10 @@ static ssize_t tcm_loop_tpg_attrib_store_fabric_prot_type(
|
||||
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[] = {
|
||||
&tcm_loop_tpg_attrib_fabric_prot_type.attr,
|
||||
&tcm_loop_tpg_attrib_attr_fabric_prot_type,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@ -894,10 +892,9 @@ static int tcm_loop_drop_nexus(
|
||||
|
||||
/* End items for tcm_loop_nexus_cit */
|
||||
|
||||
static ssize_t tcm_loop_tpg_show_nexus(
|
||||
struct se_portal_group *se_tpg,
|
||||
char *page)
|
||||
static ssize_t tcm_loop_tpg_nexus_show(struct config_item *item, 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_se_tpg);
|
||||
struct tcm_loop_nexus *tl_nexus;
|
||||
@ -913,11 +910,10 @@ static ssize_t tcm_loop_tpg_show_nexus(
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t tcm_loop_tpg_store_nexus(
|
||||
struct se_portal_group *se_tpg,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t tcm_loop_tpg_nexus_store(struct config_item *item,
|
||||
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_se_tpg);
|
||||
struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba;
|
||||
@ -992,12 +988,10 @@ check_newline:
|
||||
return count;
|
||||
}
|
||||
|
||||
TF_TPG_BASE_ATTR(tcm_loop, nexus, S_IRUGO | S_IWUSR);
|
||||
|
||||
static ssize_t tcm_loop_tpg_show_transport_status(
|
||||
struct se_portal_group *se_tpg,
|
||||
char *page)
|
||||
static ssize_t tcm_loop_tpg_transport_status_show(struct config_item *item,
|
||||
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_se_tpg);
|
||||
const char *status = NULL;
|
||||
@ -1020,11 +1014,10 @@ static ssize_t tcm_loop_tpg_show_transport_status(
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t tcm_loop_tpg_store_transport_status(
|
||||
struct se_portal_group *se_tpg,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t tcm_loop_tpg_transport_status_store(struct config_item *item,
|
||||
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_se_tpg);
|
||||
|
||||
@ -1044,11 +1037,12 @@ static ssize_t tcm_loop_tpg_store_transport_status(
|
||||
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[] = {
|
||||
&tcm_loop_tpg_nexus.attr,
|
||||
&tcm_loop_tpg_transport_status.attr,
|
||||
&tcm_loop_tpg_attr_nexus,
|
||||
&tcm_loop_tpg_attr_transport_status,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@ -1216,17 +1210,15 @@ static void tcm_loop_drop_scsi_hba(
|
||||
}
|
||||
|
||||
/* Start items for tcm_loop_cit */
|
||||
static ssize_t tcm_loop_wwn_show_attr_version(
|
||||
struct target_fabric_configfs *tf,
|
||||
char *page)
|
||||
static ssize_t tcm_loop_wwn_version_show(struct config_item *item, char *page)
|
||||
{
|
||||
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[] = {
|
||||
&tcm_loop_wwn_version.attr,
|
||||
&tcm_loop_wwn_attr_version,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
@ -35,8 +35,6 @@
|
||||
#include <target/target_core_base.h>
|
||||
#include <target/target_core_backend.h>
|
||||
#include <target/target_core_fabric.h>
|
||||
#include <target/target_core_fabric_configfs.h>
|
||||
#include <target/configfs_macros.h>
|
||||
#include <asm/unaligned.h>
|
||||
|
||||
#include "sbp_target.h"
|
||||
@ -2111,24 +2109,21 @@ static void sbp_drop_tport(struct se_wwn *wwn)
|
||||
kfree(tport);
|
||||
}
|
||||
|
||||
static ssize_t sbp_wwn_show_attr_version(
|
||||
struct target_fabric_configfs *tf,
|
||||
char *page)
|
||||
static ssize_t sbp_wwn_version_show(struct config_item *item, char *page)
|
||||
{
|
||||
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[] = {
|
||||
&sbp_wwn_version.attr,
|
||||
&sbp_wwn_attr_version,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static ssize_t sbp_tpg_show_directory_id(
|
||||
struct se_portal_group *se_tpg,
|
||||
char *page)
|
||||
static ssize_t sbp_tpg_directory_id_show(struct config_item *item, 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_tport *tport = tpg->tport;
|
||||
|
||||
@ -2138,11 +2133,10 @@ static ssize_t sbp_tpg_show_directory_id(
|
||||
return sprintf(page, "%06x\n", tport->directory_id);
|
||||
}
|
||||
|
||||
static ssize_t sbp_tpg_store_directory_id(
|
||||
struct se_portal_group *se_tpg,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t sbp_tpg_directory_id_store(struct config_item *item,
|
||||
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_tport *tport = tpg->tport;
|
||||
unsigned long val;
|
||||
@ -2166,20 +2160,18 @@ static ssize_t sbp_tpg_store_directory_id(
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t sbp_tpg_show_enable(
|
||||
struct se_portal_group *se_tpg,
|
||||
char *page)
|
||||
static ssize_t sbp_tpg_enable_show(struct config_item *item, 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_tport *tport = tpg->tport;
|
||||
return sprintf(page, "%d\n", tport->enable);
|
||||
}
|
||||
|
||||
static ssize_t sbp_tpg_store_enable(
|
||||
struct se_portal_group *se_tpg,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t sbp_tpg_enable_store(struct config_item *item,
|
||||
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_tport *tport = tpg->tport;
|
||||
unsigned long val;
|
||||
@ -2219,29 +2211,28 @@ static ssize_t sbp_tpg_store_enable(
|
||||
return count;
|
||||
}
|
||||
|
||||
TF_TPG_BASE_ATTR(sbp, directory_id, S_IRUGO | S_IWUSR);
|
||||
TF_TPG_BASE_ATTR(sbp, enable, S_IRUGO | S_IWUSR);
|
||||
CONFIGFS_ATTR(sbp_tpg_, directory_id);
|
||||
CONFIGFS_ATTR(sbp_tpg_, enable);
|
||||
|
||||
static struct configfs_attribute *sbp_tpg_base_attrs[] = {
|
||||
&sbp_tpg_directory_id.attr,
|
||||
&sbp_tpg_enable.attr,
|
||||
&sbp_tpg_attr_directory_id,
|
||||
&sbp_tpg_attr_enable,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static ssize_t sbp_tpg_attrib_show_mgt_orb_timeout(
|
||||
struct se_portal_group *se_tpg,
|
||||
static ssize_t sbp_tpg_attrib_mgt_orb_timeout_show(struct config_item *item,
|
||||
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_tport *tport = tpg->tport;
|
||||
return sprintf(page, "%d\n", tport->mgt_orb_timeout);
|
||||
}
|
||||
|
||||
static ssize_t sbp_tpg_attrib_store_mgt_orb_timeout(
|
||||
struct se_portal_group *se_tpg,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t sbp_tpg_attrib_mgt_orb_timeout_store(struct config_item *item,
|
||||
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_tport *tport = tpg->tport;
|
||||
unsigned long val;
|
||||
@ -2264,20 +2255,19 @@ static ssize_t sbp_tpg_attrib_store_mgt_orb_timeout(
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t sbp_tpg_attrib_show_max_reconnect_timeout(
|
||||
struct se_portal_group *se_tpg,
|
||||
static ssize_t sbp_tpg_attrib_max_reconnect_timeout_show(struct config_item *item,
|
||||
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_tport *tport = tpg->tport;
|
||||
return sprintf(page, "%d\n", tport->max_reconnect_timeout);
|
||||
}
|
||||
|
||||
static ssize_t sbp_tpg_attrib_store_max_reconnect_timeout(
|
||||
struct se_portal_group *se_tpg,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t sbp_tpg_attrib_max_reconnect_timeout_store(struct config_item *item,
|
||||
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_tport *tport = tpg->tport;
|
||||
unsigned long val;
|
||||
@ -2300,20 +2290,19 @@ static ssize_t sbp_tpg_attrib_store_max_reconnect_timeout(
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t sbp_tpg_attrib_show_max_logins_per_lun(
|
||||
struct se_portal_group *se_tpg,
|
||||
static ssize_t sbp_tpg_attrib_max_logins_per_lun_show(struct config_item *item,
|
||||
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_tport *tport = tpg->tport;
|
||||
return sprintf(page, "%d\n", tport->max_logins_per_lun);
|
||||
}
|
||||
|
||||
static ssize_t sbp_tpg_attrib_store_max_logins_per_lun(
|
||||
struct se_portal_group *se_tpg,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t sbp_tpg_attrib_max_logins_per_lun_store(struct config_item *item,
|
||||
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_tport *tport = tpg->tport;
|
||||
unsigned long val;
|
||||
@ -2330,14 +2319,14 @@ static ssize_t sbp_tpg_attrib_store_max_logins_per_lun(
|
||||
return count;
|
||||
}
|
||||
|
||||
TF_TPG_ATTRIB_ATTR(sbp, mgt_orb_timeout, S_IRUGO | S_IWUSR);
|
||||
TF_TPG_ATTRIB_ATTR(sbp, max_reconnect_timeout, S_IRUGO | S_IWUSR);
|
||||
TF_TPG_ATTRIB_ATTR(sbp, max_logins_per_lun, S_IRUGO | S_IWUSR);
|
||||
CONFIGFS_ATTR(sbp_tpg_attrib_, mgt_orb_timeout);
|
||||
CONFIGFS_ATTR(sbp_tpg_attrib_, max_reconnect_timeout);
|
||||
CONFIGFS_ATTR(sbp_tpg_attrib_, max_logins_per_lun);
|
||||
|
||||
static struct configfs_attribute *sbp_tpg_attrib_attrs[] = {
|
||||
&sbp_tpg_attrib_mgt_orb_timeout.attr,
|
||||
&sbp_tpg_attrib_max_reconnect_timeout.attr,
|
||||
&sbp_tpg_attrib_max_logins_per_lun.attr,
|
||||
&sbp_tpg_attrib_attr_mgt_orb_timeout,
|
||||
&sbp_tpg_attrib_attr_max_reconnect_timeout,
|
||||
&sbp_tpg_attrib_attr_max_logins_per_lun,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -35,8 +35,6 @@
|
||||
|
||||
#include <target/target_core_base.h>
|
||||
#include <target/target_core_fabric.h>
|
||||
#include <target/target_core_fabric_configfs.h>
|
||||
#include <target/configfs_macros.h>
|
||||
|
||||
#include "target_core_internal.h"
|
||||
#include "target_core_alua.h"
|
||||
@ -152,17 +150,16 @@ static int target_fabric_mappedlun_unlink(
|
||||
return core_dev_del_initiator_node_lun_acl(lun, lacl);
|
||||
}
|
||||
|
||||
CONFIGFS_EATTR_STRUCT(target_fabric_mappedlun, se_lun_acl);
|
||||
#define TCM_MAPPEDLUN_ATTR(_name, _mode) \
|
||||
static struct target_fabric_mappedlun_attribute target_fabric_mappedlun_##_name = \
|
||||
__CONFIGFS_EATTR(_name, _mode, \
|
||||
target_fabric_mappedlun_show_##_name, \
|
||||
target_fabric_mappedlun_store_##_name);
|
||||
|
||||
static ssize_t target_fabric_mappedlun_show_write_protect(
|
||||
struct se_lun_acl *lacl,
|
||||
char *page)
|
||||
static struct se_lun_acl *item_to_lun_acl(struct config_item *item)
|
||||
{
|
||||
return container_of(to_config_group(item), struct se_lun_acl,
|
||||
se_lun_group);
|
||||
}
|
||||
|
||||
static ssize_t target_fabric_mappedlun_write_protect_show(
|
||||
struct config_item *item, char *page)
|
||||
{
|
||||
struct se_lun_acl *lacl = item_to_lun_acl(item);
|
||||
struct se_node_acl *se_nacl = lacl->se_lun_nacl;
|
||||
struct se_dev_entry *deve;
|
||||
ssize_t len = 0;
|
||||
@ -178,11 +175,10 @@ static ssize_t target_fabric_mappedlun_show_write_protect(
|
||||
return len;
|
||||
}
|
||||
|
||||
static ssize_t target_fabric_mappedlun_store_write_protect(
|
||||
struct se_lun_acl *lacl,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t target_fabric_mappedlun_write_protect_store(
|
||||
struct config_item *item, const char *page, size_t count)
|
||||
{
|
||||
struct se_lun_acl *lacl = item_to_lun_acl(item);
|
||||
struct se_node_acl *se_nacl = lacl->se_lun_nacl;
|
||||
struct se_portal_group *se_tpg = se_nacl->se_tpg;
|
||||
unsigned long op;
|
||||
@ -209,9 +205,12 @@ static ssize_t target_fabric_mappedlun_store_write_protect(
|
||||
|
||||
}
|
||||
|
||||
TCM_MAPPEDLUN_ATTR(write_protect, S_IRUGO | S_IWUSR);
|
||||
CONFIGFS_ATTR(target_fabric_mappedlun_, write_protect);
|
||||
|
||||
CONFIGFS_EATTR_OPS(target_fabric_mappedlun, se_lun_acl, se_lun_group);
|
||||
static struct configfs_attribute *target_fabric_mappedlun_attrs[] = {
|
||||
&target_fabric_mappedlun_attr_write_protect,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static void target_fabric_mappedlun_release(struct config_item *item)
|
||||
{
|
||||
@ -222,15 +221,8 @@ static void target_fabric_mappedlun_release(struct config_item *item)
|
||||
core_dev_free_initiator_node_lun_acl(se_tpg, lacl);
|
||||
}
|
||||
|
||||
static struct configfs_attribute *target_fabric_mappedlun_attrs[] = {
|
||||
&target_fabric_mappedlun_write_protect.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static struct configfs_item_operations target_fabric_mappedlun_item_ops = {
|
||||
.release = target_fabric_mappedlun_release,
|
||||
.show_attribute = target_fabric_mappedlun_attr_show,
|
||||
.store_attribute = target_fabric_mappedlun_attr_store,
|
||||
.allow_link = target_fabric_mappedlun_link,
|
||||
.drop_link = target_fabric_mappedlun_unlink,
|
||||
};
|
||||
@ -266,49 +258,12 @@ TF_CIT_SETUP(tpg_mappedlun_stat, NULL, &target_fabric_mappedlun_stat_group_ops,
|
||||
|
||||
/* End of tfc_tpg_mappedlun_port_cit */
|
||||
|
||||
/* Start of tfc_tpg_nacl_attrib_cit */
|
||||
|
||||
CONFIGFS_EATTR_OPS(target_fabric_nacl_attrib, se_node_acl, acl_attrib_group);
|
||||
|
||||
static struct configfs_item_operations target_fabric_nacl_attrib_item_ops = {
|
||||
.show_attribute = target_fabric_nacl_attrib_attr_show,
|
||||
.store_attribute = target_fabric_nacl_attrib_attr_store,
|
||||
};
|
||||
|
||||
TF_CIT_SETUP_DRV(tpg_nacl_attrib, &target_fabric_nacl_attrib_item_ops, NULL);
|
||||
|
||||
/* End of tfc_tpg_nacl_attrib_cit */
|
||||
|
||||
/* Start of tfc_tpg_nacl_auth_cit */
|
||||
|
||||
CONFIGFS_EATTR_OPS(target_fabric_nacl_auth, se_node_acl, acl_auth_group);
|
||||
|
||||
static struct configfs_item_operations target_fabric_nacl_auth_item_ops = {
|
||||
.show_attribute = target_fabric_nacl_auth_attr_show,
|
||||
.store_attribute = target_fabric_nacl_auth_attr_store,
|
||||
};
|
||||
|
||||
TF_CIT_SETUP_DRV(tpg_nacl_auth, &target_fabric_nacl_auth_item_ops, NULL);
|
||||
|
||||
/* End of tfc_tpg_nacl_auth_cit */
|
||||
|
||||
/* Start of tfc_tpg_nacl_param_cit */
|
||||
|
||||
CONFIGFS_EATTR_OPS(target_fabric_nacl_param, se_node_acl, acl_param_group);
|
||||
|
||||
static struct configfs_item_operations target_fabric_nacl_param_item_ops = {
|
||||
.show_attribute = target_fabric_nacl_param_attr_show,
|
||||
.store_attribute = target_fabric_nacl_param_attr_store,
|
||||
};
|
||||
|
||||
TF_CIT_SETUP_DRV(tpg_nacl_param, &target_fabric_nacl_param_item_ops, NULL);
|
||||
|
||||
/* End of tfc_tpg_nacl_param_cit */
|
||||
TF_CIT_SETUP_DRV(tpg_nacl_attrib, NULL, NULL);
|
||||
TF_CIT_SETUP_DRV(tpg_nacl_auth, NULL, NULL);
|
||||
TF_CIT_SETUP_DRV(tpg_nacl_param, NULL, NULL);
|
||||
|
||||
/* Start of tfc_tpg_nacl_base_cit */
|
||||
|
||||
CONFIGFS_EATTR_OPS(target_fabric_nacl_base, se_node_acl, acl_group);
|
||||
|
||||
static struct config_group *target_fabric_make_mappedlun(
|
||||
struct config_group *group,
|
||||
const char *name)
|
||||
@ -438,8 +393,6 @@ static void target_fabric_nacl_base_release(struct config_item *item)
|
||||
|
||||
static struct configfs_item_operations target_fabric_nacl_base_item_ops = {
|
||||
.release = target_fabric_nacl_base_release,
|
||||
.show_attribute = target_fabric_nacl_base_attr_show,
|
||||
.store_attribute = target_fabric_nacl_base_attr_store,
|
||||
};
|
||||
|
||||
static struct configfs_group_operations target_fabric_nacl_base_group_ops = {
|
||||
@ -540,8 +493,6 @@ TF_CIT_SETUP(tpg_nacl, NULL, &target_fabric_nacl_group_ops, NULL);
|
||||
|
||||
/* Start of tfc_tpg_np_base_cit */
|
||||
|
||||
CONFIGFS_EATTR_OPS(target_fabric_np_base, se_tpg_np, tpg_np_group);
|
||||
|
||||
static void target_fabric_np_base_release(struct config_item *item)
|
||||
{
|
||||
struct se_tpg_np *se_tpg_np = container_of(to_config_group(item),
|
||||
@ -554,8 +505,6 @@ static void target_fabric_np_base_release(struct config_item *item)
|
||||
|
||||
static struct configfs_item_operations target_fabric_np_base_item_ops = {
|
||||
.release = target_fabric_np_base_release,
|
||||
.show_attribute = target_fabric_np_base_attr_show,
|
||||
.store_attribute = target_fabric_np_base_attr_store,
|
||||
};
|
||||
|
||||
TF_CIT_SETUP_DRV(tpg_np_base, &target_fabric_np_base_item_ops, NULL);
|
||||
@ -610,132 +559,113 @@ TF_CIT_SETUP(tpg_np, NULL, &target_fabric_np_group_ops, NULL);
|
||||
|
||||
/* Start of tfc_tpg_port_cit */
|
||||
|
||||
CONFIGFS_EATTR_STRUCT(target_fabric_port, se_lun);
|
||||
#define TCM_PORT_ATTR(_name, _mode) \
|
||||
static struct target_fabric_port_attribute target_fabric_port_##_name = \
|
||||
__CONFIGFS_EATTR(_name, _mode, \
|
||||
target_fabric_port_show_attr_##_name, \
|
||||
target_fabric_port_store_attr_##_name);
|
||||
|
||||
#define TCM_PORT_ATTOR_RO(_name) \
|
||||
__CONFIGFS_EATTR_RO(_name, \
|
||||
target_fabric_port_show_attr_##_name);
|
||||
|
||||
/*
|
||||
* alua_tg_pt_gp
|
||||
*/
|
||||
static ssize_t target_fabric_port_show_attr_alua_tg_pt_gp(
|
||||
struct se_lun *lun,
|
||||
char *page)
|
||||
static struct se_lun *item_to_lun(struct config_item *item)
|
||||
{
|
||||
return container_of(to_config_group(item), struct se_lun,
|
||||
lun_group);
|
||||
}
|
||||
|
||||
static ssize_t target_fabric_port_alua_tg_pt_gp_show(struct config_item *item,
|
||||
char *page)
|
||||
{
|
||||
struct se_lun *lun = item_to_lun(item);
|
||||
|
||||
if (!lun || !lun->lun_se_dev)
|
||||
return -ENODEV;
|
||||
|
||||
return core_alua_show_tg_pt_gp_info(lun, page);
|
||||
}
|
||||
|
||||
static ssize_t target_fabric_port_store_attr_alua_tg_pt_gp(
|
||||
struct se_lun *lun,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t target_fabric_port_alua_tg_pt_gp_store(struct config_item *item,
|
||||
const char *page, size_t count)
|
||||
{
|
||||
struct se_lun *lun = item_to_lun(item);
|
||||
|
||||
if (!lun || !lun->lun_se_dev)
|
||||
return -ENODEV;
|
||||
|
||||
return core_alua_store_tg_pt_gp_info(lun, page, count);
|
||||
}
|
||||
|
||||
TCM_PORT_ATTR(alua_tg_pt_gp, S_IRUGO | S_IWUSR);
|
||||
|
||||
/*
|
||||
* alua_tg_pt_offline
|
||||
*/
|
||||
static ssize_t target_fabric_port_show_attr_alua_tg_pt_offline(
|
||||
struct se_lun *lun,
|
||||
char *page)
|
||||
static ssize_t target_fabric_port_alua_tg_pt_offline_show(
|
||||
struct config_item *item, char *page)
|
||||
{
|
||||
struct se_lun *lun = item_to_lun(item);
|
||||
|
||||
if (!lun || !lun->lun_se_dev)
|
||||
return -ENODEV;
|
||||
|
||||
return core_alua_show_offline_bit(lun, page);
|
||||
}
|
||||
|
||||
static ssize_t target_fabric_port_store_attr_alua_tg_pt_offline(
|
||||
struct se_lun *lun,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t target_fabric_port_alua_tg_pt_offline_store(
|
||||
struct config_item *item, const char *page, size_t count)
|
||||
{
|
||||
struct se_lun *lun = item_to_lun(item);
|
||||
|
||||
if (!lun || !lun->lun_se_dev)
|
||||
return -ENODEV;
|
||||
|
||||
return core_alua_store_offline_bit(lun, page, count);
|
||||
}
|
||||
|
||||
TCM_PORT_ATTR(alua_tg_pt_offline, S_IRUGO | S_IWUSR);
|
||||
|
||||
/*
|
||||
* alua_tg_pt_status
|
||||
*/
|
||||
static ssize_t target_fabric_port_show_attr_alua_tg_pt_status(
|
||||
struct se_lun *lun,
|
||||
char *page)
|
||||
static ssize_t target_fabric_port_alua_tg_pt_status_show(
|
||||
struct config_item *item, char *page)
|
||||
{
|
||||
struct se_lun *lun = item_to_lun(item);
|
||||
|
||||
if (!lun || !lun->lun_se_dev)
|
||||
return -ENODEV;
|
||||
|
||||
return core_alua_show_secondary_status(lun, page);
|
||||
}
|
||||
|
||||
static ssize_t target_fabric_port_store_attr_alua_tg_pt_status(
|
||||
struct se_lun *lun,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t target_fabric_port_alua_tg_pt_status_store(
|
||||
struct config_item *item, const char *page, size_t count)
|
||||
{
|
||||
struct se_lun *lun = item_to_lun(item);
|
||||
|
||||
if (!lun || !lun->lun_se_dev)
|
||||
return -ENODEV;
|
||||
|
||||
return core_alua_store_secondary_status(lun, page, count);
|
||||
}
|
||||
|
||||
TCM_PORT_ATTR(alua_tg_pt_status, S_IRUGO | S_IWUSR);
|
||||
|
||||
/*
|
||||
* alua_tg_pt_write_md
|
||||
*/
|
||||
static ssize_t target_fabric_port_show_attr_alua_tg_pt_write_md(
|
||||
struct se_lun *lun,
|
||||
char *page)
|
||||
static ssize_t target_fabric_port_alua_tg_pt_write_md_show(
|
||||
struct config_item *item, char *page)
|
||||
{
|
||||
struct se_lun *lun = item_to_lun(item);
|
||||
|
||||
if (!lun || !lun->lun_se_dev)
|
||||
return -ENODEV;
|
||||
|
||||
return core_alua_show_secondary_write_metadata(lun, page);
|
||||
}
|
||||
|
||||
static ssize_t target_fabric_port_store_attr_alua_tg_pt_write_md(
|
||||
struct se_lun *lun,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t target_fabric_port_alua_tg_pt_write_md_store(
|
||||
struct config_item *item, const char *page, size_t count)
|
||||
{
|
||||
struct se_lun *lun = item_to_lun(item);
|
||||
|
||||
if (!lun || !lun->lun_se_dev)
|
||||
return -ENODEV;
|
||||
|
||||
return core_alua_store_secondary_write_metadata(lun, page, count);
|
||||
}
|
||||
|
||||
TCM_PORT_ATTR(alua_tg_pt_write_md, S_IRUGO | S_IWUSR);
|
||||
|
||||
CONFIGFS_ATTR(target_fabric_port_, alua_tg_pt_gp);
|
||||
CONFIGFS_ATTR(target_fabric_port_, alua_tg_pt_offline);
|
||||
CONFIGFS_ATTR(target_fabric_port_, alua_tg_pt_status);
|
||||
CONFIGFS_ATTR(target_fabric_port_, alua_tg_pt_write_md);
|
||||
|
||||
static struct configfs_attribute *target_fabric_port_attrs[] = {
|
||||
&target_fabric_port_alua_tg_pt_gp.attr,
|
||||
&target_fabric_port_alua_tg_pt_offline.attr,
|
||||
&target_fabric_port_alua_tg_pt_status.attr,
|
||||
&target_fabric_port_alua_tg_pt_write_md.attr,
|
||||
&target_fabric_port_attr_alua_tg_pt_gp,
|
||||
&target_fabric_port_attr_alua_tg_pt_offline,
|
||||
&target_fabric_port_attr_alua_tg_pt_status,
|
||||
&target_fabric_port_attr_alua_tg_pt_write_md,
|
||||
NULL,
|
||||
};
|
||||
|
||||
CONFIGFS_EATTR_OPS(target_fabric_port, se_lun, lun_group);
|
||||
|
||||
static int target_fabric_port_link(
|
||||
struct config_item *lun_ci,
|
||||
struct config_item *se_dev_ci)
|
||||
@ -821,8 +751,6 @@ static void target_fabric_port_release(struct config_item *item)
|
||||
}
|
||||
|
||||
static struct configfs_item_operations target_fabric_port_item_ops = {
|
||||
.show_attribute = target_fabric_port_attr_show,
|
||||
.store_attribute = target_fabric_port_attr_store,
|
||||
.release = target_fabric_port_release,
|
||||
.allow_link = target_fabric_port_link,
|
||||
.drop_link = target_fabric_port_unlink,
|
||||
@ -952,50 +880,11 @@ TF_CIT_SETUP(tpg_lun, NULL, &target_fabric_lun_group_ops, NULL);
|
||||
|
||||
/* End of tfc_tpg_lun_cit */
|
||||
|
||||
/* Start of tfc_tpg_attrib_cit */
|
||||
|
||||
CONFIGFS_EATTR_OPS(target_fabric_tpg_attrib, se_portal_group, tpg_attrib_group);
|
||||
|
||||
static struct configfs_item_operations target_fabric_tpg_attrib_item_ops = {
|
||||
.show_attribute = target_fabric_tpg_attrib_attr_show,
|
||||
.store_attribute = target_fabric_tpg_attrib_attr_store,
|
||||
};
|
||||
|
||||
TF_CIT_SETUP_DRV(tpg_attrib, &target_fabric_tpg_attrib_item_ops, NULL);
|
||||
|
||||
/* End of tfc_tpg_attrib_cit */
|
||||
|
||||
/* Start of tfc_tpg_auth_cit */
|
||||
|
||||
CONFIGFS_EATTR_OPS(target_fabric_tpg_auth, se_portal_group, tpg_auth_group);
|
||||
|
||||
static struct configfs_item_operations target_fabric_tpg_auth_item_ops = {
|
||||
.show_attribute = target_fabric_tpg_auth_attr_show,
|
||||
.store_attribute = target_fabric_tpg_auth_attr_store,
|
||||
};
|
||||
|
||||
TF_CIT_SETUP_DRV(tpg_auth, &target_fabric_tpg_auth_item_ops, NULL);
|
||||
|
||||
/* End of tfc_tpg_attrib_cit */
|
||||
|
||||
/* Start of tfc_tpg_param_cit */
|
||||
|
||||
CONFIGFS_EATTR_OPS(target_fabric_tpg_param, se_portal_group, tpg_param_group);
|
||||
|
||||
static struct configfs_item_operations target_fabric_tpg_param_item_ops = {
|
||||
.show_attribute = target_fabric_tpg_param_attr_show,
|
||||
.store_attribute = target_fabric_tpg_param_attr_store,
|
||||
};
|
||||
|
||||
TF_CIT_SETUP_DRV(tpg_param, &target_fabric_tpg_param_item_ops, NULL);
|
||||
|
||||
/* End of tfc_tpg_param_cit */
|
||||
TF_CIT_SETUP_DRV(tpg_attrib, NULL, NULL);
|
||||
TF_CIT_SETUP_DRV(tpg_auth, NULL, NULL);
|
||||
TF_CIT_SETUP_DRV(tpg_param, NULL, NULL);
|
||||
|
||||
/* Start of tfc_tpg_base_cit */
|
||||
/*
|
||||
* For use with TF_TPG_ATTR() and TF_TPG_ATTR_RO()
|
||||
*/
|
||||
CONFIGFS_EATTR_OPS(target_fabric_tpg, se_portal_group, tpg_group);
|
||||
|
||||
static void target_fabric_tpg_release(struct config_item *item)
|
||||
{
|
||||
@ -1009,8 +898,6 @@ static void target_fabric_tpg_release(struct config_item *item)
|
||||
|
||||
static struct configfs_item_operations target_fabric_tpg_base_item_ops = {
|
||||
.release = target_fabric_tpg_release,
|
||||
.show_attribute = target_fabric_tpg_attr_show,
|
||||
.store_attribute = target_fabric_tpg_attr_store,
|
||||
};
|
||||
|
||||
TF_CIT_SETUP_DRV(tpg_base, &target_fabric_tpg_base_item_ops, NULL);
|
||||
@ -1176,33 +1063,9 @@ static struct configfs_group_operations target_fabric_wwn_group_ops = {
|
||||
.make_group = target_fabric_make_wwn,
|
||||
.drop_item = target_fabric_drop_wwn,
|
||||
};
|
||||
/*
|
||||
* For use with TF_WWN_ATTR() and TF_WWN_ATTR_RO()
|
||||
*/
|
||||
CONFIGFS_EATTR_OPS(target_fabric_wwn, target_fabric_configfs, tf_group);
|
||||
|
||||
static struct configfs_item_operations target_fabric_wwn_item_ops = {
|
||||
.show_attribute = target_fabric_wwn_attr_show,
|
||||
.store_attribute = target_fabric_wwn_attr_store,
|
||||
};
|
||||
|
||||
TF_CIT_SETUP_DRV(wwn, &target_fabric_wwn_item_ops, &target_fabric_wwn_group_ops);
|
||||
|
||||
/* End of tfc_wwn_cit */
|
||||
|
||||
/* Start of tfc_discovery_cit */
|
||||
|
||||
CONFIGFS_EATTR_OPS(target_fabric_discovery, target_fabric_configfs,
|
||||
tf_disc_group);
|
||||
|
||||
static struct configfs_item_operations target_fabric_discovery_item_ops = {
|
||||
.show_attribute = target_fabric_discovery_attr_show,
|
||||
.store_attribute = target_fabric_discovery_attr_store,
|
||||
};
|
||||
|
||||
TF_CIT_SETUP_DRV(discovery, &target_fabric_discovery_item_ops, NULL);
|
||||
|
||||
/* End of tfc_discovery_cit */
|
||||
TF_CIT_SETUP_DRV(wwn, NULL, &target_fabric_wwn_group_ops);
|
||||
TF_CIT_SETUP_DRV(discovery, NULL, NULL);
|
||||
|
||||
int target_fabric_setup_cits(struct target_fabric_configfs *tf)
|
||||
{
|
||||
|
@ -87,6 +87,9 @@ void target_free_device(struct se_device *);
|
||||
/* target_core_configfs.c */
|
||||
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 */
|
||||
int target_get_pr_transport_id_len(struct se_node_acl *nacl,
|
||||
struct t10_pr_registration *pr_reg, int *format_code);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -36,7 +36,6 @@
|
||||
|
||||
#include <target/target_core_base.h>
|
||||
#include <target/target_core_fabric.h>
|
||||
#include <target/configfs_macros.h>
|
||||
|
||||
#include "tcm_fc.h"
|
||||
|
||||
|
@ -38,8 +38,6 @@
|
||||
|
||||
#include <target/target_core_base.h>
|
||||
#include <target/target_core_fabric.h>
|
||||
#include <target/target_core_fabric_configfs.h>
|
||||
#include <target/configfs_macros.h>
|
||||
|
||||
#include "tcm_fc.h"
|
||||
|
||||
@ -131,55 +129,51 @@ static ssize_t ft_wwn_store(void *arg, const char *buf, size_t len)
|
||||
* ACL auth ops.
|
||||
*/
|
||||
|
||||
static ssize_t ft_nacl_show_port_name(
|
||||
struct se_node_acl *se_nacl,
|
||||
char *page)
|
||||
static ssize_t ft_nacl_port_name_show(struct config_item *item, 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, se_node_acl);
|
||||
|
||||
return ft_wwn_show(&acl->node_auth.port_name, page);
|
||||
}
|
||||
|
||||
static ssize_t ft_nacl_store_port_name(
|
||||
struct se_node_acl *se_nacl,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t ft_nacl_port_name_store(struct config_item *item,
|
||||
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, se_node_acl);
|
||||
|
||||
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_show_node_name(
|
||||
struct se_node_acl *se_nacl,
|
||||
char *page)
|
||||
static ssize_t ft_nacl_node_name_show(struct config_item *item,
|
||||
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, se_node_acl);
|
||||
|
||||
return ft_wwn_show(&acl->node_auth.node_name, page);
|
||||
}
|
||||
|
||||
static ssize_t ft_nacl_store_node_name(
|
||||
struct se_node_acl *se_nacl,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t ft_nacl_node_name_store(struct config_item *item,
|
||||
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, se_node_acl);
|
||||
|
||||
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[] = {
|
||||
&ft_nacl_port_name.attr,
|
||||
&ft_nacl_node_name.attr,
|
||||
&ft_nacl_attr_port_name,
|
||||
&ft_nacl_attr_node_name,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@ -386,18 +380,16 @@ static void ft_del_wwn(struct se_wwn *wwn)
|
||||
kfree(ft_wwn);
|
||||
}
|
||||
|
||||
static ssize_t ft_wwn_show_attr_version(
|
||||
struct target_fabric_configfs *tf,
|
||||
char *page)
|
||||
static ssize_t ft_wwn_version_show(struct config_item *item, char *page)
|
||||
{
|
||||
return sprintf(page, "TCM FC " FT_VERSION " on %s/%s on "
|
||||
""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[] = {
|
||||
&ft_wwn_version.attr,
|
||||
&ft_wwn_attr_version,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
@ -44,7 +44,6 @@
|
||||
|
||||
#include <target/target_core_base.h>
|
||||
#include <target/target_core_fabric.h>
|
||||
#include <target/configfs_macros.h>
|
||||
|
||||
#include "tcm_fc.h"
|
||||
|
||||
|
@ -36,7 +36,6 @@
|
||||
|
||||
#include <target/target_core_base.h>
|
||||
#include <target/target_core_fabric.h>
|
||||
#include <target/configfs_macros.h>
|
||||
|
||||
#include "tcm_fc.h"
|
||||
|
||||
|
@ -19,8 +19,6 @@
|
||||
#include <scsi/scsi_tcq.h>
|
||||
#include <target/target_core_base.h>
|
||||
#include <target/target_core_fabric.h>
|
||||
#include <target/target_core_fabric_configfs.h>
|
||||
#include <target/configfs_macros.h>
|
||||
#include <asm/unaligned.h>
|
||||
|
||||
#include "tcm_usb_gadget.h"
|
||||
@ -1467,23 +1465,21 @@ static void usbg_drop_tport(struct se_wwn *wwn)
|
||||
/*
|
||||
* If somebody feels like dropping the version property, go ahead.
|
||||
*/
|
||||
static ssize_t usbg_wwn_show_attr_version(
|
||||
struct target_fabric_configfs *tf,
|
||||
char *page)
|
||||
static ssize_t usbg_wwn_version_show(struct config_item *item, char *page)
|
||||
{
|
||||
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[] = {
|
||||
&usbg_wwn_version.attr,
|
||||
&usbg_wwn_attr_version,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static ssize_t tcm_usbg_tpg_show_enable(
|
||||
struct se_portal_group *se_tpg,
|
||||
char *page)
|
||||
static ssize_t tcm_usbg_tpg_enable_show(struct config_item *item, char *page)
|
||||
{
|
||||
struct se_portal_group *se_tpg = to_tpg(item);
|
||||
struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg);
|
||||
|
||||
return snprintf(page, PAGE_SIZE, "%u\n", tpg->gadget_connect);
|
||||
@ -1492,11 +1488,10 @@ static ssize_t tcm_usbg_tpg_show_enable(
|
||||
static int usbg_attach(struct usbg_tpg *);
|
||||
static void usbg_detach(struct usbg_tpg *);
|
||||
|
||||
static ssize_t tcm_usbg_tpg_store_enable(
|
||||
struct se_portal_group *se_tpg,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t tcm_usbg_tpg_enable_store(struct config_item *item,
|
||||
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);
|
||||
unsigned long op;
|
||||
ssize_t ret;
|
||||
@ -1523,12 +1518,10 @@ static ssize_t tcm_usbg_tpg_store_enable(
|
||||
out:
|
||||
return count;
|
||||
}
|
||||
TF_TPG_BASE_ATTR(tcm_usbg, enable, S_IRUGO | S_IWUSR);
|
||||
|
||||
static ssize_t tcm_usbg_tpg_show_nexus(
|
||||
struct se_portal_group *se_tpg,
|
||||
char *page)
|
||||
static ssize_t tcm_usbg_tpg_nexus_show(struct config_item *item, 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 tcm_usbg_nexus *tv_nexus;
|
||||
ssize_t ret;
|
||||
@ -1636,11 +1629,10 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t tcm_usbg_tpg_store_nexus(
|
||||
struct se_portal_group *se_tpg,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t tcm_usbg_tpg_nexus_store(struct config_item *item,
|
||||
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);
|
||||
unsigned char i_port[USBG_NAMELEN], *ptr;
|
||||
int ret;
|
||||
@ -1670,11 +1662,13 @@ static ssize_t tcm_usbg_tpg_store_nexus(
|
||||
return ret;
|
||||
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[] = {
|
||||
&tcm_usbg_tpg_enable.attr,
|
||||
&tcm_usbg_tpg_nexus.attr,
|
||||
&tcm_usbg_tpg_attr_enable,
|
||||
&tcm_usbg_tpg_attr_nexus,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
@ -42,8 +42,6 @@
|
||||
#include <scsi/scsi_proto.h>
|
||||
#include <target/target_core_base.h>
|
||||
#include <target/target_core_fabric.h>
|
||||
#include <target/target_core_fabric_configfs.h>
|
||||
#include <target/configfs_macros.h>
|
||||
#include <linux/vhost.h>
|
||||
#include <linux/virtio_scsi.h>
|
||||
#include <linux/llist.h>
|
||||
@ -1686,11 +1684,10 @@ static void vhost_scsi_free_cmd_map_res(struct vhost_scsi_nexus *nexus,
|
||||
}
|
||||
}
|
||||
|
||||
static ssize_t vhost_scsi_tpg_attrib_store_fabric_prot_type(
|
||||
struct se_portal_group *se_tpg,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t vhost_scsi_tpg_attrib_fabric_prot_type_store(
|
||||
struct config_item *item, const char *page, size_t count)
|
||||
{
|
||||
struct se_portal_group *se_tpg = attrib_to_tpg(item);
|
||||
struct vhost_scsi_tpg *tpg = container_of(se_tpg,
|
||||
struct vhost_scsi_tpg, se_tpg);
|
||||
unsigned long val;
|
||||
@ -1709,19 +1706,20 @@ static ssize_t vhost_scsi_tpg_attrib_store_fabric_prot_type(
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t vhost_scsi_tpg_attrib_show_fabric_prot_type(
|
||||
struct se_portal_group *se_tpg,
|
||||
char *page)
|
||||
static ssize_t vhost_scsi_tpg_attrib_fabric_prot_type_show(
|
||||
struct config_item *item, char *page)
|
||||
{
|
||||
struct se_portal_group *se_tpg = attrib_to_tpg(item);
|
||||
struct vhost_scsi_tpg *tpg = container_of(se_tpg,
|
||||
struct vhost_scsi_tpg, se_tpg);
|
||||
|
||||
return sprintf(page, "%d\n", tpg->tv_fabric_prot_type);
|
||||
}
|
||||
TF_TPG_ATTRIB_ATTR(vhost_scsi, fabric_prot_type, S_IRUGO | S_IWUSR);
|
||||
|
||||
CONFIGFS_ATTR(vhost_scsi_tpg_attrib_, fabric_prot_type);
|
||||
|
||||
static struct configfs_attribute *vhost_scsi_tpg_attrib_attrs[] = {
|
||||
&vhost_scsi_tpg_attrib_fabric_prot_type.attr,
|
||||
&vhost_scsi_tpg_attrib_attr_fabric_prot_type,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@ -1869,9 +1867,9 @@ static int vhost_scsi_drop_nexus(struct vhost_scsi_tpg *tpg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t vhost_scsi_tpg_show_nexus(struct se_portal_group *se_tpg,
|
||||
char *page)
|
||||
static ssize_t vhost_scsi_tpg_nexus_show(struct config_item *item, char *page)
|
||||
{
|
||||
struct se_portal_group *se_tpg = to_tpg(item);
|
||||
struct vhost_scsi_tpg *tpg = container_of(se_tpg,
|
||||
struct vhost_scsi_tpg, se_tpg);
|
||||
struct vhost_scsi_nexus *tv_nexus;
|
||||
@ -1890,10 +1888,10 @@ static ssize_t vhost_scsi_tpg_show_nexus(struct se_portal_group *se_tpg,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t vhost_scsi_tpg_store_nexus(struct se_portal_group *se_tpg,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t vhost_scsi_tpg_nexus_store(struct config_item *item,
|
||||
const char *page, size_t count)
|
||||
{
|
||||
struct se_portal_group *se_tpg = to_tpg(item);
|
||||
struct vhost_scsi_tpg *tpg = container_of(se_tpg,
|
||||
struct vhost_scsi_tpg, se_tpg);
|
||||
struct vhost_scsi_tport *tport_wwn = tpg->tport;
|
||||
@ -1968,10 +1966,10 @@ check_newline:
|
||||
return count;
|
||||
}
|
||||
|
||||
TF_TPG_BASE_ATTR(vhost_scsi, nexus, S_IRUGO | S_IWUSR);
|
||||
CONFIGFS_ATTR(vhost_scsi_tpg_, nexus);
|
||||
|
||||
static struct configfs_attribute *vhost_scsi_tpg_attrs[] = {
|
||||
&vhost_scsi_tpg_nexus.attr,
|
||||
&vhost_scsi_tpg_attr_nexus,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@ -2107,18 +2105,17 @@ static void vhost_scsi_drop_tport(struct se_wwn *wwn)
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
vhost_scsi_wwn_show_attr_version(struct target_fabric_configfs *tf,
|
||||
char *page)
|
||||
vhost_scsi_wwn_version_show(struct config_item *item, char *page)
|
||||
{
|
||||
return sprintf(page, "TCM_VHOST fabric module %s on %s/%s"
|
||||
"on "UTS_RELEASE"\n", VHOST_SCSI_VERSION, utsname()->sysname,
|
||||
utsname()->machine);
|
||||
}
|
||||
|
||||
TF_WWN_ATTR_RO(vhost_scsi, version);
|
||||
CONFIGFS_ATTR_RO(vhost_scsi_wwn_, version);
|
||||
|
||||
static struct configfs_attribute *vhost_scsi_wwn_attrs[] = {
|
||||
&vhost_scsi_wwn_version.attr,
|
||||
&vhost_scsi_wwn_attr_version,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
@ -53,7 +53,6 @@
|
||||
|
||||
#include <target/target_core_base.h>
|
||||
#include <target/target_core_fabric.h>
|
||||
#include <target/target_core_fabric_configfs.h>
|
||||
|
||||
#include <asm/hypervisor.h>
|
||||
|
||||
@ -1438,9 +1437,10 @@ static void scsiback_aborted_task(struct se_cmd *se_cmd)
|
||||
{
|
||||
}
|
||||
|
||||
static ssize_t scsiback_tpg_param_show_alias(struct se_portal_group *se_tpg,
|
||||
static ssize_t scsiback_tpg_param_alias_show(struct config_item *item,
|
||||
char *page)
|
||||
{
|
||||
struct se_portal_group *se_tpg = param_to_tpg(item);
|
||||
struct scsiback_tpg *tpg = container_of(se_tpg, struct scsiback_tpg,
|
||||
se_tpg);
|
||||
ssize_t rb;
|
||||
@ -1452,9 +1452,10 @@ static ssize_t scsiback_tpg_param_show_alias(struct se_portal_group *se_tpg,
|
||||
return rb;
|
||||
}
|
||||
|
||||
static ssize_t scsiback_tpg_param_store_alias(struct se_portal_group *se_tpg,
|
||||
static ssize_t scsiback_tpg_param_alias_store(struct config_item *item,
|
||||
const char *page, size_t count)
|
||||
{
|
||||
struct se_portal_group *se_tpg = param_to_tpg(item);
|
||||
struct scsiback_tpg *tpg = container_of(se_tpg, struct scsiback_tpg,
|
||||
se_tpg);
|
||||
int len;
|
||||
@ -1474,10 +1475,10 @@ static ssize_t scsiback_tpg_param_store_alias(struct se_portal_group *se_tpg,
|
||||
return count;
|
||||
}
|
||||
|
||||
TF_TPG_PARAM_ATTR(scsiback, alias, S_IRUGO | S_IWUSR);
|
||||
CONFIGFS_ATTR(scsiback_tpg_param_, alias);
|
||||
|
||||
static struct configfs_attribute *scsiback_param_attrs[] = {
|
||||
&scsiback_tpg_param_alias.attr,
|
||||
&scsiback_tpg_param_attr_alias,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@ -1585,9 +1586,9 @@ static int scsiback_drop_nexus(struct scsiback_tpg *tpg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t scsiback_tpg_show_nexus(struct se_portal_group *se_tpg,
|
||||
char *page)
|
||||
static ssize_t scsiback_tpg_nexus_show(struct config_item *item, char *page)
|
||||
{
|
||||
struct se_portal_group *se_tpg = to_tpg(item);
|
||||
struct scsiback_tpg *tpg = container_of(se_tpg,
|
||||
struct scsiback_tpg, se_tpg);
|
||||
struct scsiback_nexus *tv_nexus;
|
||||
@ -1606,10 +1607,10 @@ static ssize_t scsiback_tpg_show_nexus(struct se_portal_group *se_tpg,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t scsiback_tpg_store_nexus(struct se_portal_group *se_tpg,
|
||||
const char *page,
|
||||
size_t count)
|
||||
static ssize_t scsiback_tpg_nexus_store(struct config_item *item,
|
||||
const char *page, size_t count)
|
||||
{
|
||||
struct se_portal_group *se_tpg = to_tpg(item);
|
||||
struct scsiback_tpg *tpg = container_of(se_tpg,
|
||||
struct scsiback_tpg, se_tpg);
|
||||
struct scsiback_tport *tport_wwn = tpg->tport;
|
||||
@ -1681,26 +1682,25 @@ check_newline:
|
||||
return count;
|
||||
}
|
||||
|
||||
TF_TPG_BASE_ATTR(scsiback, nexus, S_IRUGO | S_IWUSR);
|
||||
CONFIGFS_ATTR(scsiback_tpg_, nexus);
|
||||
|
||||
static struct configfs_attribute *scsiback_tpg_attrs[] = {
|
||||
&scsiback_tpg_nexus.attr,
|
||||
&scsiback_tpg_attr_nexus,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static ssize_t
|
||||
scsiback_wwn_show_attr_version(struct target_fabric_configfs *tf,
|
||||
char *page)
|
||||
scsiback_wwn_version_show(struct config_item *item, char *page)
|
||||
{
|
||||
return sprintf(page, "xen-pvscsi fabric module %s on %s/%s on "
|
||||
UTS_RELEASE"\n",
|
||||
VSCSI_VERSION, utsname()->sysname, utsname()->machine);
|
||||
}
|
||||
|
||||
TF_WWN_ATTR_RO(scsiback, version);
|
||||
CONFIGFS_ATTR_RO(scsiback_wwn_, version);
|
||||
|
||||
static struct configfs_attribute *scsiback_wwn_attrs[] = {
|
||||
&scsiback_wwn_version.attr,
|
||||
&scsiback_wwn_attr_version,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
@ -1,147 +0,0 @@
|
||||
/* -*- mode: c; c-basic-offset: 8; -*-
|
||||
* vim: noexpandtab sw=8 ts=8 sts=0:
|
||||
*
|
||||
* configfs_macros.h - extends macros for configfs
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 021110-1307, USA.
|
||||
*
|
||||
* Based on sysfs:
|
||||
* sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
|
||||
*
|
||||
* Based on kobject.h:
|
||||
* Copyright (c) 2002-2003 Patrick Mochel
|
||||
* Copyright (c) 2002-2003 Open Source Development Labs
|
||||
*
|
||||
* configfs Copyright (C) 2005 Oracle. All rights reserved.
|
||||
*
|
||||
* Added CONFIGFS_EATTR() macros from original configfs.h macros
|
||||
* Copright (C) 2008-2009 Nicholas A. Bellinger <nab@linux-iscsi.org>
|
||||
*
|
||||
* Please read Documentation/filesystems/configfs/configfs.txt before using
|
||||
* the configfs interface, ESPECIALLY the parts about reference counts and
|
||||
* item destructors.
|
||||
*/
|
||||
|
||||
#ifndef _CONFIGFS_MACROS_H_
|
||||
#define _CONFIGFS_MACROS_H_
|
||||
|
||||
#include <linux/configfs.h>
|
||||
|
||||
/*
|
||||
* Users often need to create attribute structures for their configurable
|
||||
* attributes, containing a configfs_attribute member and function pointers
|
||||
* for the show() and store() operations on that attribute. If they don't
|
||||
* need anything else on the extended attribute structure, they can use
|
||||
* this macro to define it. The argument _name isends up as
|
||||
* 'struct _name_attribute, as well as names of to CONFIGFS_ATTR_OPS() below.
|
||||
* The argument _item is the name of the structure containing the
|
||||
* struct config_item or struct config_group structure members
|
||||
*/
|
||||
#define CONFIGFS_EATTR_STRUCT(_name, _item) \
|
||||
struct _name##_attribute { \
|
||||
struct configfs_attribute attr; \
|
||||
ssize_t (*show)(struct _item *, char *); \
|
||||
ssize_t (*store)(struct _item *, const char *, size_t); \
|
||||
}
|
||||
|
||||
/*
|
||||
* With the extended attribute structure, users can use this macro
|
||||
* (similar to sysfs' __ATTR) to make defining attributes easier.
|
||||
* An example:
|
||||
* #define MYITEM_EATTR(_name, _mode, _show, _store) \
|
||||
* struct myitem_attribute childless_attr_##_name = \
|
||||
* __CONFIGFS_EATTR(_name, _mode, _show, _store)
|
||||
*/
|
||||
#define __CONFIGFS_EATTR(_name, _mode, _show, _store) \
|
||||
{ \
|
||||
.attr = { \
|
||||
.ca_name = __stringify(_name), \
|
||||
.ca_mode = _mode, \
|
||||
.ca_owner = THIS_MODULE, \
|
||||
}, \
|
||||
.show = _show, \
|
||||
.store = _store, \
|
||||
}
|
||||
/* Here is a readonly version, only requiring a show() operation */
|
||||
#define __CONFIGFS_EATTR_RO(_name, _show) \
|
||||
{ \
|
||||
.attr = { \
|
||||
.ca_name = __stringify(_name), \
|
||||
.ca_mode = 0444, \
|
||||
.ca_owner = THIS_MODULE, \
|
||||
}, \
|
||||
.show = _show, \
|
||||
}
|
||||
|
||||
/*
|
||||
* With these extended attributes, the simple show_attribute() and
|
||||
* store_attribute() operations need to call the show() and store() of the
|
||||
* attributes. This is a common pattern, so we provide a macro to define
|
||||
* them. The argument _name is the name of the attribute defined by
|
||||
* CONFIGFS_ATTR_STRUCT(). The argument _item is the name of the structure
|
||||
* containing the struct config_item or struct config_group structure member.
|
||||
* The argument _item_member is the actual name of the struct config_* struct
|
||||
* in your _item structure. Meaning my_structure->some_config_group.
|
||||
* ^^_item^^^^^ ^^_item_member^^^
|
||||
* This macro expects the attributes to be named "struct <name>_attribute".
|
||||
*/
|
||||
#define CONFIGFS_EATTR_OPS_TO_FUNC(_name, _item, _item_member) \
|
||||
static struct _item *to_##_name(struct config_item *ci) \
|
||||
{ \
|
||||
return (ci) ? container_of(to_config_group(ci), struct _item, \
|
||||
_item_member) : NULL; \
|
||||
}
|
||||
|
||||
#define CONFIGFS_EATTR_OPS_SHOW(_name, _item) \
|
||||
static ssize_t _name##_attr_show(struct config_item *item, \
|
||||
struct configfs_attribute *attr, \
|
||||
char *page) \
|
||||
{ \
|
||||
struct _item *_item = to_##_name(item); \
|
||||
struct _name##_attribute * _name##_attr = \
|
||||
container_of(attr, struct _name##_attribute, attr); \
|
||||
ssize_t ret = 0; \
|
||||
\
|
||||
if (_name##_attr->show) \
|
||||
ret = _name##_attr->show(_item, page); \
|
||||
return ret; \
|
||||
}
|
||||
|
||||
#define CONFIGFS_EATTR_OPS_STORE(_name, _item) \
|
||||
static ssize_t _name##_attr_store(struct config_item *item, \
|
||||
struct configfs_attribute *attr, \
|
||||
const char *page, size_t count) \
|
||||
{ \
|
||||
struct _item *_item = to_##_name(item); \
|
||||
struct _name##_attribute * _name##_attr = \
|
||||
container_of(attr, struct _name##_attribute, attr); \
|
||||
ssize_t ret = -EINVAL; \
|
||||
\
|
||||
if (_name##_attr->store) \
|
||||
ret = _name##_attr->store(_item, page, count); \
|
||||
return ret; \
|
||||
}
|
||||
|
||||
#define CONFIGFS_EATTR_OPS(_name, _item, _item_member) \
|
||||
CONFIGFS_EATTR_OPS_TO_FUNC(_name, _item, _item_member); \
|
||||
CONFIGFS_EATTR_OPS_SHOW(_name, _item); \
|
||||
CONFIGFS_EATTR_OPS_STORE(_name, _item);
|
||||
|
||||
#define CONFIGFS_EATTR_OPS_RO(_name, _item, _item_member) \
|
||||
CONFIGFS_EATTR_OPS_TO_FUNC(_name, _item, _item_member); \
|
||||
CONFIGFS_EATTR_OPS_SHOW(_name, _item);
|
||||
|
||||
#endif /* _CONFIGFS_MACROS_H_ */
|
@ -563,6 +563,36 @@ struct se_node_acl {
|
||||
struct kref acl_kref;
|
||||
};
|
||||
|
||||
static inline struct se_node_acl *acl_to_nacl(struct config_item *item)
|
||||
{
|
||||
return container_of(to_config_group(item), struct se_node_acl,
|
||||
acl_group);
|
||||
}
|
||||
|
||||
static inline struct se_node_acl *attrib_to_nacl(struct config_item *item)
|
||||
{
|
||||
return container_of(to_config_group(item), struct se_node_acl,
|
||||
acl_attrib_group);
|
||||
}
|
||||
|
||||
static inline struct se_node_acl *auth_to_nacl(struct config_item *item)
|
||||
{
|
||||
return container_of(to_config_group(item), struct se_node_acl,
|
||||
acl_auth_group);
|
||||
}
|
||||
|
||||
static inline struct se_node_acl *param_to_nacl(struct config_item *item)
|
||||
{
|
||||
return container_of(to_config_group(item), struct se_node_acl,
|
||||
acl_param_group);
|
||||
}
|
||||
|
||||
static inline struct se_node_acl *fabric_stat_to_nacl(struct config_item *item)
|
||||
{
|
||||
return container_of(to_config_group(item), struct se_node_acl,
|
||||
acl_fabric_stat_group);
|
||||
}
|
||||
|
||||
struct se_session {
|
||||
unsigned sess_tearing_down:1;
|
||||
u64 sess_bin_isid;
|
||||
@ -820,6 +850,12 @@ struct se_tpg_np {
|
||||
struct config_group tpg_np_group;
|
||||
};
|
||||
|
||||
static inline struct se_tpg_np *to_tpg_np(struct config_item *item)
|
||||
{
|
||||
return container_of(to_config_group(item), struct se_tpg_np,
|
||||
tpg_np_group);
|
||||
}
|
||||
|
||||
struct se_portal_group {
|
||||
/*
|
||||
* PROTOCOL IDENTIFIER value per SPC4, 7.5.1.
|
||||
@ -856,6 +892,30 @@ struct se_portal_group {
|
||||
struct config_group tpg_param_group;
|
||||
};
|
||||
|
||||
static inline struct se_portal_group *to_tpg(struct config_item *item)
|
||||
{
|
||||
return container_of(to_config_group(item), struct se_portal_group,
|
||||
tpg_group);
|
||||
}
|
||||
|
||||
static inline struct se_portal_group *attrib_to_tpg(struct config_item *item)
|
||||
{
|
||||
return container_of(to_config_group(item), struct se_portal_group,
|
||||
tpg_attrib_group);
|
||||
}
|
||||
|
||||
static inline struct se_portal_group *auth_to_tpg(struct config_item *item)
|
||||
{
|
||||
return container_of(to_config_group(item), struct se_portal_group,
|
||||
tpg_auth_group);
|
||||
}
|
||||
|
||||
static inline struct se_portal_group *param_to_tpg(struct config_item *item)
|
||||
{
|
||||
return container_of(to_config_group(item), struct se_portal_group,
|
||||
tpg_param_group);
|
||||
}
|
||||
|
||||
struct se_wwn {
|
||||
struct target_fabric_configfs *wwn_tf;
|
||||
struct config_group wwn_group;
|
||||
|
@ -1,122 +0,0 @@
|
||||
/*
|
||||
* Used for tfc_wwn_cit attributes
|
||||
*/
|
||||
|
||||
#include <target/configfs_macros.h>
|
||||
|
||||
CONFIGFS_EATTR_STRUCT(target_fabric_nacl_attrib, se_node_acl);
|
||||
#define TF_NACL_ATTRIB_ATTR(_fabric, _name, _mode) \
|
||||
static struct target_fabric_nacl_attrib_attribute _fabric##_nacl_attrib_##_name = \
|
||||
__CONFIGFS_EATTR(_name, _mode, \
|
||||
_fabric##_nacl_attrib_show_##_name, \
|
||||
_fabric##_nacl_attrib_store_##_name);
|
||||
|
||||
CONFIGFS_EATTR_STRUCT(target_fabric_nacl_auth, se_node_acl);
|
||||
#define TF_NACL_AUTH_ATTR(_fabric, _name, _mode) \
|
||||
static struct target_fabric_nacl_auth_attribute _fabric##_nacl_auth_##_name = \
|
||||
__CONFIGFS_EATTR(_name, _mode, \
|
||||
_fabric##_nacl_auth_show_##_name, \
|
||||
_fabric##_nacl_auth_store_##_name);
|
||||
|
||||
#define TF_NACL_AUTH_ATTR_RO(_fabric, _name) \
|
||||
static struct target_fabric_nacl_auth_attribute _fabric##_nacl_auth_##_name = \
|
||||
__CONFIGFS_EATTR_RO(_name, \
|
||||
_fabric##_nacl_auth_show_##_name);
|
||||
|
||||
CONFIGFS_EATTR_STRUCT(target_fabric_nacl_param, se_node_acl);
|
||||
#define TF_NACL_PARAM_ATTR(_fabric, _name, _mode) \
|
||||
static struct target_fabric_nacl_param_attribute _fabric##_nacl_param_##_name = \
|
||||
__CONFIGFS_EATTR(_name, _mode, \
|
||||
_fabric##_nacl_param_show_##_name, \
|
||||
_fabric##_nacl_param_store_##_name);
|
||||
|
||||
#define TF_NACL_PARAM_ATTR_RO(_fabric, _name) \
|
||||
static struct target_fabric_nacl_param_attribute _fabric##_nacl_param_##_name = \
|
||||
__CONFIGFS_EATTR_RO(_name, \
|
||||
_fabric##_nacl_param_show_##_name);
|
||||
|
||||
|
||||
CONFIGFS_EATTR_STRUCT(target_fabric_nacl_base, se_node_acl);
|
||||
#define TF_NACL_BASE_ATTR(_fabric, _name, _mode) \
|
||||
static struct target_fabric_nacl_base_attribute _fabric##_nacl_##_name = \
|
||||
__CONFIGFS_EATTR(_name, _mode, \
|
||||
_fabric##_nacl_show_##_name, \
|
||||
_fabric##_nacl_store_##_name);
|
||||
|
||||
#define TF_NACL_BASE_ATTR_RO(_fabric, _name) \
|
||||
static struct target_fabric_nacl_base_attribute _fabric##_nacl_##_name = \
|
||||
__CONFIGFS_EATTR_RO(_name, \
|
||||
_fabric##_nacl_show_##_name);
|
||||
|
||||
CONFIGFS_EATTR_STRUCT(target_fabric_np_base, se_tpg_np);
|
||||
#define TF_NP_BASE_ATTR(_fabric, _name, _mode) \
|
||||
static struct target_fabric_np_base_attribute _fabric##_np_##_name = \
|
||||
__CONFIGFS_EATTR(_name, _mode, \
|
||||
_fabric##_np_show_##_name, \
|
||||
_fabric##_np_store_##_name);
|
||||
|
||||
CONFIGFS_EATTR_STRUCT(target_fabric_tpg_attrib, se_portal_group);
|
||||
#define TF_TPG_ATTRIB_ATTR(_fabric, _name, _mode) \
|
||||
static struct target_fabric_tpg_attrib_attribute _fabric##_tpg_attrib_##_name = \
|
||||
__CONFIGFS_EATTR(_name, _mode, \
|
||||
_fabric##_tpg_attrib_show_##_name, \
|
||||
_fabric##_tpg_attrib_store_##_name);
|
||||
|
||||
CONFIGFS_EATTR_STRUCT(target_fabric_tpg_auth, se_portal_group);
|
||||
#define TF_TPG_AUTH_ATTR(_fabric, _name, _mode) \
|
||||
static struct target_fabric_tpg_auth_attribute _fabric##_tpg_auth_##_name = \
|
||||
__CONFIGFS_EATTR(_name, _mode, \
|
||||
_fabric##_tpg_auth_show_##_name, \
|
||||
_fabric##_tpg_auth_store_##_name);
|
||||
|
||||
#define TF_TPG_AUTH_ATTR_RO(_fabric, _name) \
|
||||
static struct target_fabric_tpg_auth_attribute _fabric##_tpg_auth_##_name = \
|
||||
__CONFIGFS_EATTR_RO(_name, \
|
||||
_fabric##_tpg_auth_show_##_name);
|
||||
|
||||
CONFIGFS_EATTR_STRUCT(target_fabric_tpg_param, se_portal_group);
|
||||
#define TF_TPG_PARAM_ATTR(_fabric, _name, _mode) \
|
||||
static struct target_fabric_tpg_param_attribute _fabric##_tpg_param_##_name = \
|
||||
__CONFIGFS_EATTR(_name, _mode, \
|
||||
_fabric##_tpg_param_show_##_name, \
|
||||
_fabric##_tpg_param_store_##_name);
|
||||
|
||||
|
||||
CONFIGFS_EATTR_STRUCT(target_fabric_tpg, se_portal_group);
|
||||
#define TF_TPG_BASE_ATTR(_fabric, _name, _mode) \
|
||||
static struct target_fabric_tpg_attribute _fabric##_tpg_##_name = \
|
||||
__CONFIGFS_EATTR(_name, _mode, \
|
||||
_fabric##_tpg_show_##_name, \
|
||||
_fabric##_tpg_store_##_name);
|
||||
|
||||
|
||||
#define TF_TPG_BASE_ATTR_RO(_fabric, _name) \
|
||||
static struct target_fabric_tpg_attribute _fabric##_tpg_##_name = \
|
||||
__CONFIGFS_EATTR_RO(_name, \
|
||||
_fabric##_tpg_show_##_name);
|
||||
|
||||
CONFIGFS_EATTR_STRUCT(target_fabric_wwn, target_fabric_configfs);
|
||||
#define TF_WWN_ATTR(_fabric, _name, _mode) \
|
||||
static struct target_fabric_wwn_attribute _fabric##_wwn_##_name = \
|
||||
__CONFIGFS_EATTR(_name, _mode, \
|
||||
_fabric##_wwn_show_attr_##_name, \
|
||||
_fabric##_wwn_store_attr_##_name);
|
||||
|
||||
#define TF_WWN_ATTR_RO(_fabric, _name) \
|
||||
static struct target_fabric_wwn_attribute _fabric##_wwn_##_name = \
|
||||
__CONFIGFS_EATTR_RO(_name, \
|
||||
_fabric##_wwn_show_attr_##_name);
|
||||
|
||||
CONFIGFS_EATTR_STRUCT(target_fabric_discovery, target_fabric_configfs);
|
||||
#define TF_DISC_ATTR(_fabric, _name, _mode) \
|
||||
static struct target_fabric_discovery_attribute _fabric##_disc_##_name = \
|
||||
__CONFIGFS_EATTR(_name, _mode, \
|
||||
_fabric##_disc_show_##_name, \
|
||||
_fabric##_disc_store_##_name);
|
||||
|
||||
#define TF_DISC_ATTR_RO(_fabric, _name) \
|
||||
static struct target_fabric_discovery_attribute _fabric##_disc_##_name = \
|
||||
__CONFIGFS_EATTR_RO(_name, \
|
||||
_fabric##_disc_show_##_name);
|
||||
|
||||
extern int target_fabric_setup_cits(struct target_fabric_configfs *);
|
Loading…
Reference in New Issue
Block a user