aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2014-11-28 00:26:18 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2014-12-02 00:36:03 -0500
commit6cfb546bfce644bd4fb6662a5049a73406f655c9 (patch)
tree3cdbb64defd1831941047982f4afa0c95a74907c /drivers/target
parente9f720d63b476c9dc2a936c186878f1795b8b4c5 (diff)
target/pscsi: Convert to external pscsi_backend_dev_attrs
This patch converts PSCSI to use an external set of device attributes, and utilizes target_core_backend_configfs.h macros to generate a default set of configfs extended-attr handlers. It calls target_core_setup_sub_cits() to setup the initial config_item_type based on existing target_core_configfs.c defaults, and using configfs_attribute for hw_pi_prot_type, hw_block_size, hw_max_sectors, hw_queue_depth populates pscsi_backend_dev_attrs[] Only these four hw_* read-only device attributes are exports for PSCSI. Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_pscsi.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index 7c8291f0bbbc..74873e42cf7e 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -44,6 +44,7 @@
44 44
45#include <target/target_core_base.h> 45#include <target/target_core_base.h>
46#include <target/target_core_backend.h> 46#include <target/target_core_backend.h>
47#include <target/target_core_backend_configfs.h>
47 48
48#include "target_core_alua.h" 49#include "target_core_alua.h"
49#include "target_core_pscsi.h" 50#include "target_core_pscsi.h"
@@ -1165,6 +1166,26 @@ static void pscsi_req_done(struct request *req, int uptodate)
1165 kfree(pt); 1166 kfree(pt);
1166} 1167}
1167 1168
1169DEF_TB_DEV_ATTRIB_RO(pscsi, hw_pi_prot_type);
1170TB_DEV_ATTR_RO(pscsi, hw_pi_prot_type);
1171
1172DEF_TB_DEV_ATTRIB_RO(pscsi, hw_block_size);
1173TB_DEV_ATTR_RO(pscsi, hw_block_size);
1174
1175DEF_TB_DEV_ATTRIB_RO(pscsi, hw_max_sectors);
1176TB_DEV_ATTR_RO(pscsi, hw_max_sectors);
1177
1178DEF_TB_DEV_ATTRIB_RO(pscsi, hw_queue_depth);
1179TB_DEV_ATTR_RO(pscsi, hw_queue_depth);
1180
1181static struct configfs_attribute *pscsi_backend_dev_attrs[] = {
1182 &pscsi_dev_attrib_hw_pi_prot_type.attr,
1183 &pscsi_dev_attrib_hw_block_size.attr,
1184 &pscsi_dev_attrib_hw_max_sectors.attr,
1185 &pscsi_dev_attrib_hw_queue_depth.attr,
1186 NULL,
1187};
1188
1168static struct se_subsystem_api pscsi_template = { 1189static struct se_subsystem_api pscsi_template = {
1169 .name = "pscsi", 1190 .name = "pscsi",
1170 .owner = THIS_MODULE, 1191 .owner = THIS_MODULE,
@@ -1185,6 +1206,11 @@ static struct se_subsystem_api pscsi_template = {
1185 1206
1186static int __init pscsi_module_init(void) 1207static int __init pscsi_module_init(void)
1187{ 1208{
1209 struct target_backend_cits *tbc = &pscsi_template.tb_cits;
1210
1211 target_core_setup_sub_cits(&pscsi_template);
1212 tbc->tb_dev_attrib_cit.ct_attrs = pscsi_backend_dev_attrs;
1213
1188 return transport_subsystem_register(&pscsi_template); 1214 return transport_subsystem_register(&pscsi_template);
1189} 1215}
1190 1216