Commit 5645cba0 authored by Nicholas Bellinger's avatar Nicholas Bellinger

target/iblock: Convert to external iblock_backend_dev_attrs

This patch converts IBLOCK 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(iblock) populates iblock_backend_dev_attrs[]

It introduces no functional change for existing IBLOCK device attributes.
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent e6c39f70
......@@ -41,6 +41,7 @@
#include <target/target_core_base.h>
#include <target/target_core_backend.h>
#include <target/target_core_backend_configfs.h>
#include "target_core_iblock.h"
......@@ -858,6 +859,41 @@ static bool iblock_get_write_cache(struct se_device *dev)
return q->flush_flags & REQ_FLUSH;
}
DEF_TB_DEFAULT_ATTRIBS(iblock);
static struct configfs_attribute *iblock_backend_dev_attrs[] = {
&iblock_dev_attrib_emulate_model_alias.attr,
&iblock_dev_attrib_emulate_dpo.attr,
&iblock_dev_attrib_emulate_fua_write.attr,
&iblock_dev_attrib_emulate_fua_read.attr,
&iblock_dev_attrib_emulate_write_cache.attr,
&iblock_dev_attrib_emulate_ua_intlck_ctrl.attr,
&iblock_dev_attrib_emulate_tas.attr,
&iblock_dev_attrib_emulate_tpu.attr,
&iblock_dev_attrib_emulate_tpws.attr,
&iblock_dev_attrib_emulate_caw.attr,
&iblock_dev_attrib_emulate_3pc.attr,
&iblock_dev_attrib_pi_prot_type.attr,
&iblock_dev_attrib_hw_pi_prot_type.attr,
&iblock_dev_attrib_pi_prot_format.attr,
&iblock_dev_attrib_enforce_pr_isids.attr,
&iblock_dev_attrib_is_nonrot.attr,
&iblock_dev_attrib_emulate_rest_reord.attr,
&iblock_dev_attrib_force_pr_aptpl.attr,
&iblock_dev_attrib_hw_block_size.attr,
&iblock_dev_attrib_block_size.attr,
&iblock_dev_attrib_hw_max_sectors.attr,
&iblock_dev_attrib_fabric_max_sectors.attr,
&iblock_dev_attrib_optimal_sectors.attr,
&iblock_dev_attrib_hw_queue_depth.attr,
&iblock_dev_attrib_queue_depth.attr,
&iblock_dev_attrib_max_unmap_lba_count.attr,
&iblock_dev_attrib_max_unmap_block_desc_count.attr,
&iblock_dev_attrib_unmap_granularity.attr,
&iblock_dev_attrib_unmap_granularity_alignment.attr,
&iblock_dev_attrib_max_write_same_len.attr,
NULL,
};
static struct se_subsystem_api iblock_template = {
.name = "iblock",
......@@ -884,6 +920,11 @@ static struct se_subsystem_api iblock_template = {
static int __init iblock_module_init(void)
{
struct target_backend_cits *tbc = &iblock_template.tb_cits;
target_core_setup_sub_cits(&iblock_template);
tbc->tb_dev_attrib_cit.ct_attrs = iblock_backend_dev_attrs;
return transport_subsystem_register(&iblock_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