Commit 6cfb546b authored by Nicholas Bellinger's avatar Nicholas Bellinger

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: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent e9f720d6
......@@ -44,6 +44,7 @@
#include <target/target_core_base.h>
#include <target/target_core_backend.h>
#include <target/target_core_backend_configfs.h>
#include "target_core_alua.h"
#include "target_core_pscsi.h"
......@@ -1165,6 +1166,26 @@ static void pscsi_req_done(struct request *req, int uptodate)
kfree(pt);
}
DEF_TB_DEV_ATTRIB_RO(pscsi, hw_pi_prot_type);
TB_DEV_ATTR_RO(pscsi, hw_pi_prot_type);
DEF_TB_DEV_ATTRIB_RO(pscsi, hw_block_size);
TB_DEV_ATTR_RO(pscsi, hw_block_size);
DEF_TB_DEV_ATTRIB_RO(pscsi, hw_max_sectors);
TB_DEV_ATTR_RO(pscsi, hw_max_sectors);
DEF_TB_DEV_ATTRIB_RO(pscsi, hw_queue_depth);
TB_DEV_ATTR_RO(pscsi, hw_queue_depth);
static struct configfs_attribute *pscsi_backend_dev_attrs[] = {
&pscsi_dev_attrib_hw_pi_prot_type.attr,
&pscsi_dev_attrib_hw_block_size.attr,
&pscsi_dev_attrib_hw_max_sectors.attr,
&pscsi_dev_attrib_hw_queue_depth.attr,
NULL,
};
static struct se_subsystem_api pscsi_template = {
.name = "pscsi",
.owner = THIS_MODULE,
......@@ -1185,6 +1206,11 @@ static struct se_subsystem_api pscsi_template = {
static int __init pscsi_module_init(void)
{
struct target_backend_cits *tbc = &pscsi_template.tb_cits;
target_core_setup_sub_cits(&pscsi_template);
tbc->tb_dev_attrib_cit.ct_attrs = pscsi_backend_dev_attrs;
return transport_subsystem_register(&pscsi_template);
}
......
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