Commit 9aa3d651 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending

Pull SCSI target updates from Nicholas Bellinger:
 "This series contains HCH's changes to absorb configfs attribute
  ->show() + ->store() function pointer usage from it's original
  tree-wide consumers, into common configfs code.

  It includes usb-gadget, target w/ drivers, netconsole and ocfs2
  changes to realize the improved simplicity, that now renders the
  original include/target/configfs_macros.h CPP magic for fabric drivers
  and others, unnecessary and obsolete.

  And with common code in place, new configfs attributes can be added
  easier than ever before.

  Note, there are further improvements in-flight from other folks for
  v4.5 code in configfs land, plus number of target fixes for post -rc1
  code"

In the meantime, a new user of the now-removed old configfs API came in
through the char/misc tree in commit 7bd1d409 ("stm class: Introduce
an abstraction for System Trace Module devices").

This merge resolution comes from Alexander Shishkin, who updated his stm
class tracing abstraction to account for the removal of the old
show_attribute and store_attribute methods in commit 51798222
("configfs: remove old API") from this pull.  As Alexander says about
that patch:

 "There's no need to keep an extra wrapper structure per item and the
  awkward show_attribute/store_attribute item ops are no longer needed.

  This patch converts policy code to the new api, all the while making
  the code quite a bit smaller and easier on the eyes.

  Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>"

That patch was folded into the merge so that the tree should be fully
bisectable.

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (23 commits)
  configfs: remove old API
  ocfs2/cluster: use per-attribute show and store methods
  ocfs2/cluster: move locking into attribute store methods
  netconsole: use per-attribute show and store methods
  target: use per-attribute show and store methods
  spear13xx_pcie_gadget: use per-attribute show and store methods
  dlm: use per-attribute show and store methods
  usb-gadget/f_serial: use per-attribute show and store methods
  usb-gadget/f_phonet: use per-attribute show and store methods
  usb-gadget/f_obex: use per-attribute show and store methods
  usb-gadget/f_uac2: use per-attribute show and store methods
  usb-gadget/f_uac1: use per-attribute show and store methods
  usb-gadget/f_mass_storage: use per-attribute show and store methods
  usb-gadget/f_sourcesink: use per-attribute show and store methods
  usb-gadget/f_printer: use per-attribute show and store methods
  usb-gadget/f_midi: use per-attribute show and store methods
  usb-gadget/f_loopback: use per-attribute show and store methods
  usb-gadget/ether: use per-attribute show and store methods
  usb-gadget/f_acm: use per-attribute show and store methods
  usb-gadget/f_hid: use per-attribute show and store methods
  ...
parents 5d2eb548 51798222
subdir-y := configfs
# List of programs to build # List of programs to build
hostprogs-y := dnotify_test hostprogs-y := dnotify_test
......
ifneq ($(CONFIG_CONFIGFS_FS),)
obj-m += configfs_example_explicit.o configfs_example_macros.o
endif
...@@ -160,12 +160,6 @@ among other things. For that, it needs a type. ...@@ -160,12 +160,6 @@ among other things. For that, it needs a type.
struct configfs_item_operations { struct configfs_item_operations {
void (*release)(struct config_item *); void (*release)(struct config_item *);
ssize_t (*show_attribute)(struct config_item *,
struct configfs_attribute *,
char *);
ssize_t (*store_attribute)(struct config_item *,
struct configfs_attribute *,
const char *, size_t);
int (*allow_link)(struct config_item *src, int (*allow_link)(struct config_item *src,
struct config_item *target); struct config_item *target);
int (*drop_link)(struct config_item *src, int (*drop_link)(struct config_item *src,
...@@ -183,9 +177,7 @@ The most basic function of a config_item_type is to define what ...@@ -183,9 +177,7 @@ The most basic function of a config_item_type is to define what
operations can be performed on a config_item. All items that have been operations can be performed on a config_item. All items that have been
allocated dynamically will need to provide the ct_item_ops->release() allocated dynamically will need to provide the ct_item_ops->release()
method. This method is called when the config_item's reference count method. This method is called when the config_item's reference count
reaches zero. Items that wish to display an attribute need to provide reaches zero.
the ct_item_ops->show_attribute() method. Similarly, storing a new
attribute value uses the store_attribute() method.
[struct configfs_attribute] [struct configfs_attribute]
...@@ -193,6 +185,8 @@ attribute value uses the store_attribute() method. ...@@ -193,6 +185,8 @@ attribute value uses the store_attribute() method.
char *ca_name; char *ca_name;
struct module *ca_owner; struct module *ca_owner;
umode_t ca_mode; umode_t ca_mode;
ssize_t (*show)(struct config_item *, char *);
ssize_t (*store)(struct config_item *, const char *, size_t);
}; };
When a config_item wants an attribute to appear as a file in the item's When a config_item wants an attribute to appear as a file in the item's
...@@ -202,10 +196,10 @@ config_item_type->ct_attrs. When the item appears in configfs, the ...@@ -202,10 +196,10 @@ config_item_type->ct_attrs. When the item appears in configfs, the
attribute file will appear with the configfs_attribute->ca_name attribute file will appear with the configfs_attribute->ca_name
filename. configfs_attribute->ca_mode specifies the file permissions. filename. configfs_attribute->ca_mode specifies the file permissions.
If an attribute is readable and the config_item provides a If an attribute is readable and provides a ->show method, that method will
ct_item_ops->show_attribute() method, that method will be called be called whenever userspace asks for a read(2) on the attribute. If an
whenever userspace asks for a read(2) on the attribute. The converse attribute is writable and provides a ->store method, that method will be
will happen for write(2). be called whenever userspace asks for a write(2) on the attribute.
[struct config_group] [struct config_group]
...@@ -311,20 +305,10 @@ the subsystem must be ready for it. ...@@ -311,20 +305,10 @@ the subsystem must be ready for it.
[An Example] [An Example]
The best example of these basic concepts is the simple_children The best example of these basic concepts is the simple_children
subsystem/group and the simple_child item in configfs_example_explicit.c subsystem/group and the simple_child item in
and configfs_example_macros.c. It shows a trivial object displaying and samples/configfs/configfs_sample.c. It shows a trivial object displaying
storing an attribute, and a simple group creating and destroying these and storing an attribute, and a simple group creating and destroying
children. these children.
The only difference between configfs_example_explicit.c and
configfs_example_macros.c is how the attributes of the childless item
are defined. The childless item has extended attributes, each with
their own show()/store() operation. This follows a convention commonly
used in sysfs. configfs_example_explicit.c creates these attributes
by explicitly defining the structures involved. Conversely
configfs_example_macros.c uses some convenience macros from configfs.h
to define the attributes. These macros are similar to their sysfs
counterparts.
[Hierarchy Navigation and the Subsystem Mutex] [Hierarchy Navigation and the Subsystem Mutex]
......
...@@ -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"
......
...@@ -76,9 +76,10 @@ to_stp_policy_node(struct config_item *item) ...@@ -76,9 +76,10 @@ to_stp_policy_node(struct config_item *item)
NULL; NULL;
} }
static ssize_t stp_policy_node_masters_show(struct stp_policy_node *policy_node, static ssize_t
char *page) stp_policy_node_masters_show(struct config_item *item, char *page)
{ {
struct stp_policy_node *policy_node = to_stp_policy_node(item);
ssize_t count; ssize_t count;
count = sprintf(page, "%u %u\n", policy_node->first_master, count = sprintf(page, "%u %u\n", policy_node->first_master,
...@@ -88,9 +89,10 @@ static ssize_t stp_policy_node_masters_show(struct stp_policy_node *policy_node, ...@@ -88,9 +89,10 @@ static ssize_t stp_policy_node_masters_show(struct stp_policy_node *policy_node,
} }
static ssize_t static ssize_t
stp_policy_node_masters_store(struct stp_policy_node *policy_node, stp_policy_node_masters_store(struct config_item *item, const char *page,
const char *page, size_t count) size_t count)
{ {
struct stp_policy_node *policy_node = to_stp_policy_node(item);
unsigned int first, last; unsigned int first, last;
struct stm_device *stm; struct stm_device *stm;
char *p = (char *)page; char *p = (char *)page;
...@@ -123,8 +125,9 @@ stp_policy_node_masters_store(struct stp_policy_node *policy_node, ...@@ -123,8 +125,9 @@ stp_policy_node_masters_store(struct stp_policy_node *policy_node,
} }
static ssize_t static ssize_t
stp_policy_node_channels_show(struct stp_policy_node *policy_node, char *page) stp_policy_node_channels_show(struct config_item *item, char *page)
{ {
struct stp_policy_node *policy_node = to_stp_policy_node(item);
ssize_t count; ssize_t count;
count = sprintf(page, "%u %u\n", policy_node->first_channel, count = sprintf(page, "%u %u\n", policy_node->first_channel,
...@@ -134,9 +137,10 @@ stp_policy_node_channels_show(struct stp_policy_node *policy_node, char *page) ...@@ -134,9 +137,10 @@ stp_policy_node_channels_show(struct stp_policy_node *policy_node, char *page)
} }
static ssize_t static ssize_t
stp_policy_node_channels_store(struct stp_policy_node *policy_node, stp_policy_node_channels_store(struct config_item *item, const char *page,
const char *page, size_t count) size_t count)
{ {
struct stp_policy_node *policy_node = to_stp_policy_node(item);
unsigned int first, last; unsigned int first, last;
struct stm_device *stm; struct stm_device *stm;
char *p = (char *)page; char *p = (char *)page;
...@@ -171,71 +175,16 @@ static void stp_policy_node_release(struct config_item *item) ...@@ -171,71 +175,16 @@ static void stp_policy_node_release(struct config_item *item)
kfree(to_stp_policy_node(item)); kfree(to_stp_policy_node(item));
} }
struct stp_policy_node_attribute {
struct configfs_attribute attr;
ssize_t (*show)(struct stp_policy_node *, char *);
ssize_t (*store)(struct stp_policy_node *, const char *, size_t);
};
static ssize_t stp_policy_node_attr_show(struct config_item *item,
struct configfs_attribute *attr,
char *page)
{
struct stp_policy_node *policy_node = to_stp_policy_node(item);
struct stp_policy_node_attribute *pn_attr =
container_of(attr, struct stp_policy_node_attribute, attr);
ssize_t count = 0;
if (pn_attr->show)
count = pn_attr->show(policy_node, page);
return count;
}
static ssize_t stp_policy_node_attr_store(struct config_item *item,
struct configfs_attribute *attr,
const char *page, size_t len)
{
struct stp_policy_node *policy_node = to_stp_policy_node(item);
struct stp_policy_node_attribute *pn_attr =
container_of(attr, struct stp_policy_node_attribute, attr);
ssize_t count = -EINVAL;
if (pn_attr->store)
count = pn_attr->store(policy_node, page, len);
return count;
}
static struct configfs_item_operations stp_policy_node_item_ops = { static struct configfs_item_operations stp_policy_node_item_ops = {
.release = stp_policy_node_release, .release = stp_policy_node_release,
.show_attribute = stp_policy_node_attr_show,
.store_attribute = stp_policy_node_attr_store,
};
static struct stp_policy_node_attribute stp_policy_node_attr_range = {
.attr = {
.ca_owner = THIS_MODULE,
.ca_name = "masters",
.ca_mode = S_IRUGO | S_IWUSR,
},
.show = stp_policy_node_masters_show,
.store = stp_policy_node_masters_store,
}; };
static struct stp_policy_node_attribute stp_policy_node_attr_channels = { CONFIGFS_ATTR(stp_policy_node_, masters);
.attr = { CONFIGFS_ATTR(stp_policy_node_, channels);
.ca_owner = THIS_MODULE,
.ca_name = "channels",
.ca_mode = S_IRUGO | S_IWUSR,
},
.show = stp_policy_node_channels_show,
.store = stp_policy_node_channels_store,
};
static struct configfs_attribute *stp_policy_node_attrs[] = { static struct configfs_attribute *stp_policy_node_attrs[] = {
&stp_policy_node_attr_range.attr, &stp_policy_node_attr_masters,
&stp_policy_node_attr_channels.attr, &stp_policy_node_attr_channels,
NULL, NULL,
}; };
...@@ -298,19 +247,7 @@ static struct config_item_type stp_policy_node_type = { ...@@ -298,19 +247,7 @@ static struct config_item_type stp_policy_node_type = {
/* /*
* Root group: policies. * Root group: policies.
*/ */
static struct configfs_attribute stp_policy_attr_device = { static ssize_t stp_policy_device_show(struct config_item *item,
.ca_owner = THIS_MODULE,
.ca_name = "device",
.ca_mode = S_IRUGO,
};
static struct configfs_attribute *stp_policy_attrs[] = {
&stp_policy_attr_device,
NULL,
};
static ssize_t stp_policy_attr_show(struct config_item *item,
struct configfs_attribute *attr,
char *page) char *page)
{ {
struct stp_policy *policy = to_stp_policy(item); struct stp_policy *policy = to_stp_policy(item);
...@@ -324,6 +261,13 @@ static ssize_t stp_policy_attr_show(struct config_item *item, ...@@ -324,6 +261,13 @@ static ssize_t stp_policy_attr_show(struct config_item *item,
return count; return count;
} }
CONFIGFS_ATTR_RO(stp_policy_, device);
static struct configfs_attribute *stp_policy_attrs[] = {
&stp_policy_attr_device,
NULL,
};
void stp_policy_unbind(struct stp_policy *policy) void stp_policy_unbind(struct stp_policy *policy)
{ {
struct stm_device *stm = policy->stm; struct stm_device *stm = policy->stm;
...@@ -350,7 +294,6 @@ static void stp_policy_release(struct config_item *item) ...@@ -350,7 +294,6 @@ static void stp_policy_release(struct config_item *item)
static struct configfs_item_operations stp_policy_item_ops = { static struct configfs_item_operations stp_policy_item_ops = {
.release = stp_policy_release, .release = stp_policy_release,
.show_attribute = stp_policy_attr_show,
}; };
static struct configfs_group_operations stp_policy_group_ops = { static struct configfs_group_operations stp_policy_group_ops = {
......
...@@ -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"
...@@ -3546,20 +3544,19 @@ static void srpt_cleanup_nodeacl(struct se_node_acl *se_nacl) ...@@ -3546,20 +3544,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;
...@@ -3584,22 +3581,19 @@ static ssize_t srpt_tpg_attrib_store_srp_max_rdma_size( ...@@ -3584,22 +3581,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;
...@@ -3624,22 +3618,19 @@ static ssize_t srpt_tpg_attrib_store_srp_max_rsp_size( ...@@ -3624,22 +3618,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;
...@@ -3664,29 +3655,29 @@ static ssize_t srpt_tpg_attrib_store_srp_sq_size( ...@@ -3664,29 +3655,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;
...@@ -3709,10 +3700,10 @@ static ssize_t srpt_tpg_store_enable( ...@@ -3709,10 +3700,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,
}; };
...@@ -3782,16 +3773,15 @@ static void srpt_drop_tport(struct se_wwn *wwn) ...@@ -3782,16 +3773,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,
}; };
......
This diff is collapsed.
This diff is collapsed.
...@@ -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"
......
This diff is collapsed.
...@@ -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"
......
This diff is collapsed.
...@@ -761,21 +761,6 @@ static inline struct f_serial_opts *to_f_serial_opts(struct config_item *item) ...@@ -761,21 +761,6 @@ static inline struct f_serial_opts *to_f_serial_opts(struct config_item *item)
func_inst.group); func_inst.group);
} }
CONFIGFS_ATTR_STRUCT(f_serial_opts);
static ssize_t f_acm_attr_show(struct config_item *item,
struct configfs_attribute *attr,
char *page)
{
struct f_serial_opts *opts = to_f_serial_opts(item);
struct f_serial_opts_attribute *f_serial_opts_attr =
container_of(attr, struct f_serial_opts_attribute, attr);
ssize_t ret = 0;
if (f_serial_opts_attr->show)
ret = f_serial_opts_attr->show(opts, page);
return ret;
}
static void acm_attr_release(struct config_item *item) static void acm_attr_release(struct config_item *item)
{ {
struct f_serial_opts *opts = to_f_serial_opts(item); struct f_serial_opts *opts = to_f_serial_opts(item);
...@@ -785,20 +770,17 @@ static void acm_attr_release(struct config_item *item) ...@@ -785,20 +770,17 @@ static void acm_attr_release(struct config_item *item)
static struct configfs_item_operations acm_item_ops = { static struct configfs_item_operations acm_item_ops = {
.release = acm_attr_release, .release = acm_attr_release,
.show_attribute = f_acm_attr_show,
}; };
static ssize_t f_acm_port_num_show(struct f_serial_opts *opts, char *page) static ssize_t f_acm_port_num_show(struct config_item *item, char *page)
{ {
return sprintf(page, "%u\n", opts->port_num); return sprintf(page, "%u\n", to_f_serial_opts(item)->port_num);
} }
static struct f_serial_opts_attribute f_acm_port_num = CONFIGFS_ATTR_RO(f_acm_port_, num);
__CONFIGFS_ATTR_RO(port_num, f_acm_port_num_show);
static struct configfs_attribute *acm_attrs[] = { static struct configfs_attribute *acm_attrs[] = {
&f_acm_port_num.attr, &f_acm_port_attr_num,
NULL, NULL,
}; };
......
...@@ -838,10 +838,10 @@ USB_ETHERNET_CONFIGFS_ITEM_ATTR_QMULT(ecm); ...@@ -838,10 +838,10 @@ USB_ETHERNET_CONFIGFS_ITEM_ATTR_QMULT(ecm);
USB_ETHERNET_CONFIGFS_ITEM_ATTR_IFNAME(ecm); USB_ETHERNET_CONFIGFS_ITEM_ATTR_IFNAME(ecm);
static struct configfs_attribute *ecm_attrs[] = { static struct configfs_attribute *ecm_attrs[] = {
&f_ecm_opts_dev_addr.attr, &ecm_opts_attr_dev_addr,
&f_ecm_opts_host_addr.attr, &ecm_opts_attr_host_addr,
&f_ecm_opts_qmult.attr, &ecm_opts_attr_qmult,
&f_ecm_opts_ifname.attr, &ecm_opts_attr_ifname,
NULL, NULL,
}; };
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
obj-$(CONFIG_SAMPLE_CONFIGFS) += configfs_sample.o
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