diff options
author | Christoph Hellwig <hch@lst.de> | 2015-10-03 16:32:55 +0300 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-10-14 08:17:49 +0300 |
commit | 2eafd72939fda6118e27d3ee859684987f43921b (patch) | |
tree | a00a1f5686ec852e04b52ea5fb1ce37c05564dc9 /drivers/target/sbp/sbp_target.c | |
parent | 64c6be0e6df5b5804613863ca4fb05961948c999 (diff) | |
download | linux-2eafd72939fda6118e27d3ee859684987f43921b.tar.xz |
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>
Diffstat (limited to 'drivers/target/sbp/sbp_target.c')
-rw-r--r-- | drivers/target/sbp/sbp_target.c | 87 |
1 files changed, 38 insertions, 49 deletions
diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c index 0edf320fb685..35f7d31b29d2 100644 --- a/drivers/target/sbp/sbp_target.c +++ b/drivers/target/sbp/sbp_target.c @@ -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, }; |