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:

committed by
Nicholas Bellinger

父節點
64c6be0e6d
當前提交
2eafd72939
@@ -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,
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user