target/file: Convert to external fileio_backend_dev_attrs

This patch converts FILEIO 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
generated by DEF_TB_DEFAULT_ATTRIBS(fileio) populates fileio_backend_dev_attrs[]

It introduces no functional change for existing FILEIO device attributes.

Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
This commit is contained in:
Nicholas Bellinger 2014-11-28 04:56:30 +00:00
parent 5645cba011
commit b23204970a

View file

@ -37,6 +37,7 @@
#include <target/target_core_base.h>
#include <target/target_core_backend.h>
#include <target/target_core_backend_configfs.h>
#include "target_core_file.h"
@ -934,6 +935,42 @@ fd_parse_cdb(struct se_cmd *cmd)
return sbc_parse_cdb(cmd, &fd_sbc_ops);
}
DEF_TB_DEFAULT_ATTRIBS(fileio);
static struct configfs_attribute *fileio_backend_dev_attrs[] = {
&fileio_dev_attrib_emulate_model_alias.attr,
&fileio_dev_attrib_emulate_dpo.attr,
&fileio_dev_attrib_emulate_fua_write.attr,
&fileio_dev_attrib_emulate_fua_read.attr,
&fileio_dev_attrib_emulate_write_cache.attr,
&fileio_dev_attrib_emulate_ua_intlck_ctrl.attr,
&fileio_dev_attrib_emulate_tas.attr,
&fileio_dev_attrib_emulate_tpu.attr,
&fileio_dev_attrib_emulate_tpws.attr,
&fileio_dev_attrib_emulate_caw.attr,
&fileio_dev_attrib_emulate_3pc.attr,
&fileio_dev_attrib_pi_prot_type.attr,
&fileio_dev_attrib_hw_pi_prot_type.attr,
&fileio_dev_attrib_pi_prot_format.attr,
&fileio_dev_attrib_enforce_pr_isids.attr,
&fileio_dev_attrib_is_nonrot.attr,
&fileio_dev_attrib_emulate_rest_reord.attr,
&fileio_dev_attrib_force_pr_aptpl.attr,
&fileio_dev_attrib_hw_block_size.attr,
&fileio_dev_attrib_block_size.attr,
&fileio_dev_attrib_hw_max_sectors.attr,
&fileio_dev_attrib_fabric_max_sectors.attr,
&fileio_dev_attrib_optimal_sectors.attr,
&fileio_dev_attrib_hw_queue_depth.attr,
&fileio_dev_attrib_queue_depth.attr,
&fileio_dev_attrib_max_unmap_lba_count.attr,
&fileio_dev_attrib_max_unmap_block_desc_count.attr,
&fileio_dev_attrib_unmap_granularity.attr,
&fileio_dev_attrib_unmap_granularity_alignment.attr,
&fileio_dev_attrib_max_write_same_len.attr,
NULL,
};
static struct se_subsystem_api fileio_template = {
.name = "fileio",
.inquiry_prod = "FILEIO",
@ -957,6 +994,11 @@ static struct se_subsystem_api fileio_template = {
static int __init fileio_module_init(void)
{
struct target_backend_cits *tbc = &fileio_template.tb_cits;
target_core_setup_sub_cits(&fileio_template);
tbc->tb_dev_attrib_cit.ct_attrs = fileio_backend_dev_attrs;
return transport_subsystem_register(&fileio_template);
}