diff options
| author | Christoph Hellwig <hch@lst.de> | 2015-10-03 09:32:55 -0400 |
|---|---|---|
| committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-10-14 01:17:49 -0400 |
| commit | 2eafd72939fda6118e27d3ee859684987f43921b (patch) | |
| tree | a00a1f5686ec852e04b52ea5fb1ce37c05564dc9 /drivers/vhost | |
| parent | 64c6be0e6df5b5804613863ca4fb05961948c999 (diff) | |
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/vhost')
| -rw-r--r-- | drivers/vhost/scsi.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index f114a9dbb48f..a971765eb9f2 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
| @@ -42,8 +42,6 @@ | |||
| 42 | #include <scsi/scsi_proto.h> | 42 | #include <scsi/scsi_proto.h> |
| 43 | #include <target/target_core_base.h> | 43 | #include <target/target_core_base.h> |
| 44 | #include <target/target_core_fabric.h> | 44 | #include <target/target_core_fabric.h> |
| 45 | #include <target/target_core_fabric_configfs.h> | ||
| 46 | #include <target/configfs_macros.h> | ||
| 47 | #include <linux/vhost.h> | 45 | #include <linux/vhost.h> |
| 48 | #include <linux/virtio_scsi.h> | 46 | #include <linux/virtio_scsi.h> |
| 49 | #include <linux/llist.h> | 47 | #include <linux/llist.h> |
| @@ -1686,11 +1684,10 @@ static void vhost_scsi_free_cmd_map_res(struct vhost_scsi_nexus *nexus, | |||
| 1686 | } | 1684 | } |
| 1687 | } | 1685 | } |
| 1688 | 1686 | ||
| 1689 | static ssize_t vhost_scsi_tpg_attrib_store_fabric_prot_type( | 1687 | static ssize_t vhost_scsi_tpg_attrib_fabric_prot_type_store( |
| 1690 | struct se_portal_group *se_tpg, | 1688 | struct config_item *item, const char *page, size_t count) |
| 1691 | const char *page, | ||
| 1692 | size_t count) | ||
| 1693 | { | 1689 | { |
| 1690 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
| 1694 | struct vhost_scsi_tpg *tpg = container_of(se_tpg, | 1691 | struct vhost_scsi_tpg *tpg = container_of(se_tpg, |
| 1695 | struct vhost_scsi_tpg, se_tpg); | 1692 | struct vhost_scsi_tpg, se_tpg); |
| 1696 | unsigned long val; | 1693 | unsigned long val; |
| @@ -1709,19 +1706,20 @@ static ssize_t vhost_scsi_tpg_attrib_store_fabric_prot_type( | |||
| 1709 | return count; | 1706 | return count; |
| 1710 | } | 1707 | } |
| 1711 | 1708 | ||
| 1712 | static ssize_t vhost_scsi_tpg_attrib_show_fabric_prot_type( | 1709 | static ssize_t vhost_scsi_tpg_attrib_fabric_prot_type_show( |
| 1713 | struct se_portal_group *se_tpg, | 1710 | struct config_item *item, char *page) |
| 1714 | char *page) | ||
| 1715 | { | 1711 | { |
| 1712 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
| 1716 | struct vhost_scsi_tpg *tpg = container_of(se_tpg, | 1713 | struct vhost_scsi_tpg *tpg = container_of(se_tpg, |
| 1717 | struct vhost_scsi_tpg, se_tpg); | 1714 | struct vhost_scsi_tpg, se_tpg); |
| 1718 | 1715 | ||
| 1719 | return sprintf(page, "%d\n", tpg->tv_fabric_prot_type); | 1716 | return sprintf(page, "%d\n", tpg->tv_fabric_prot_type); |
| 1720 | } | 1717 | } |
| 1721 | TF_TPG_ATTRIB_ATTR(vhost_scsi, fabric_prot_type, S_IRUGO | S_IWUSR); | 1718 | |
| 1719 | CONFIGFS_ATTR(vhost_scsi_tpg_attrib_, fabric_prot_type); | ||
| 1722 | 1720 | ||
| 1723 | static struct configfs_attribute *vhost_scsi_tpg_attrib_attrs[] = { | 1721 | static struct configfs_attribute *vhost_scsi_tpg_attrib_attrs[] = { |
| 1724 | &vhost_scsi_tpg_attrib_fabric_prot_type.attr, | 1722 | &vhost_scsi_tpg_attrib_attr_fabric_prot_type, |
| 1725 | NULL, | 1723 | NULL, |
| 1726 | }; | 1724 | }; |
| 1727 | 1725 | ||
| @@ -1869,9 +1867,9 @@ static int vhost_scsi_drop_nexus(struct vhost_scsi_tpg *tpg) | |||
| 1869 | return 0; | 1867 | return 0; |
| 1870 | } | 1868 | } |
| 1871 | 1869 | ||
| 1872 | static ssize_t vhost_scsi_tpg_show_nexus(struct se_portal_group *se_tpg, | 1870 | static ssize_t vhost_scsi_tpg_nexus_show(struct config_item *item, char *page) |
| 1873 | char *page) | ||
| 1874 | { | 1871 | { |
| 1872 | struct se_portal_group *se_tpg = to_tpg(item); | ||
| 1875 | struct vhost_scsi_tpg *tpg = container_of(se_tpg, | 1873 | struct vhost_scsi_tpg *tpg = container_of(se_tpg, |
| 1876 | struct vhost_scsi_tpg, se_tpg); | 1874 | struct vhost_scsi_tpg, se_tpg); |
| 1877 | struct vhost_scsi_nexus *tv_nexus; | 1875 | struct vhost_scsi_nexus *tv_nexus; |
| @@ -1890,10 +1888,10 @@ static ssize_t vhost_scsi_tpg_show_nexus(struct se_portal_group *se_tpg, | |||
| 1890 | return ret; | 1888 | return ret; |
| 1891 | } | 1889 | } |
| 1892 | 1890 | ||
| 1893 | static ssize_t vhost_scsi_tpg_store_nexus(struct se_portal_group *se_tpg, | 1891 | static ssize_t vhost_scsi_tpg_nexus_store(struct config_item *item, |
| 1894 | const char *page, | 1892 | const char *page, size_t count) |
| 1895 | size_t count) | ||
| 1896 | { | 1893 | { |
| 1894 | struct se_portal_group *se_tpg = to_tpg(item); | ||
| 1897 | struct vhost_scsi_tpg *tpg = container_of(se_tpg, | 1895 | struct vhost_scsi_tpg *tpg = container_of(se_tpg, |
| 1898 | struct vhost_scsi_tpg, se_tpg); | 1896 | struct vhost_scsi_tpg, se_tpg); |
| 1899 | struct vhost_scsi_tport *tport_wwn = tpg->tport; | 1897 | struct vhost_scsi_tport *tport_wwn = tpg->tport; |
| @@ -1968,10 +1966,10 @@ check_newline: | |||
| 1968 | return count; | 1966 | return count; |
| 1969 | } | 1967 | } |
| 1970 | 1968 | ||
| 1971 | TF_TPG_BASE_ATTR(vhost_scsi, nexus, S_IRUGO | S_IWUSR); | 1969 | CONFIGFS_ATTR(vhost_scsi_tpg_, nexus); |
| 1972 | 1970 | ||
| 1973 | static struct configfs_attribute *vhost_scsi_tpg_attrs[] = { | 1971 | static struct configfs_attribute *vhost_scsi_tpg_attrs[] = { |
| 1974 | &vhost_scsi_tpg_nexus.attr, | 1972 | &vhost_scsi_tpg_attr_nexus, |
| 1975 | NULL, | 1973 | NULL, |
| 1976 | }; | 1974 | }; |
| 1977 | 1975 | ||
| @@ -2107,18 +2105,17 @@ static void vhost_scsi_drop_tport(struct se_wwn *wwn) | |||
| 2107 | } | 2105 | } |
| 2108 | 2106 | ||
| 2109 | static ssize_t | 2107 | static ssize_t |
| 2110 | vhost_scsi_wwn_show_attr_version(struct target_fabric_configfs *tf, | 2108 | vhost_scsi_wwn_version_show(struct config_item *item, char *page) |
| 2111 | char *page) | ||
| 2112 | { | 2109 | { |
| 2113 | return sprintf(page, "TCM_VHOST fabric module %s on %s/%s" | 2110 | return sprintf(page, "TCM_VHOST fabric module %s on %s/%s" |
| 2114 | "on "UTS_RELEASE"\n", VHOST_SCSI_VERSION, utsname()->sysname, | 2111 | "on "UTS_RELEASE"\n", VHOST_SCSI_VERSION, utsname()->sysname, |
| 2115 | utsname()->machine); | 2112 | utsname()->machine); |
| 2116 | } | 2113 | } |
| 2117 | 2114 | ||
| 2118 | TF_WWN_ATTR_RO(vhost_scsi, version); | 2115 | CONFIGFS_ATTR_RO(vhost_scsi_wwn_, version); |
| 2119 | 2116 | ||
| 2120 | static struct configfs_attribute *vhost_scsi_wwn_attrs[] = { | 2117 | static struct configfs_attribute *vhost_scsi_wwn_attrs[] = { |
| 2121 | &vhost_scsi_wwn_version.attr, | 2118 | &vhost_scsi_wwn_attr_version, |
| 2122 | NULL, | 2119 | NULL, |
| 2123 | }; | 2120 | }; |
| 2124 | 2121 | ||
