diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-11-27 23:56:30 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-12-02 00:36:02 -0500 |
commit | b23204970af2ce59c160f87f42baeacac33becb4 (patch) | |
tree | d833b336ebf453f79b18bec22d944c72790350da /drivers/target | |
parent | 5645cba011ddaf7dc46a636e5657bb764e11a472 (diff) |
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>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_file.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index 72c83d98662b..c2aea099ea4a 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c | |||
@@ -37,6 +37,7 @@ | |||
37 | 37 | ||
38 | #include <target/target_core_base.h> | 38 | #include <target/target_core_base.h> |
39 | #include <target/target_core_backend.h> | 39 | #include <target/target_core_backend.h> |
40 | #include <target/target_core_backend_configfs.h> | ||
40 | 41 | ||
41 | #include "target_core_file.h" | 42 | #include "target_core_file.h" |
42 | 43 | ||
@@ -934,6 +935,42 @@ fd_parse_cdb(struct se_cmd *cmd) | |||
934 | return sbc_parse_cdb(cmd, &fd_sbc_ops); | 935 | return sbc_parse_cdb(cmd, &fd_sbc_ops); |
935 | } | 936 | } |
936 | 937 | ||
938 | DEF_TB_DEFAULT_ATTRIBS(fileio); | ||
939 | |||
940 | static struct configfs_attribute *fileio_backend_dev_attrs[] = { | ||
941 | &fileio_dev_attrib_emulate_model_alias.attr, | ||
942 | &fileio_dev_attrib_emulate_dpo.attr, | ||
943 | &fileio_dev_attrib_emulate_fua_write.attr, | ||
944 | &fileio_dev_attrib_emulate_fua_read.attr, | ||
945 | &fileio_dev_attrib_emulate_write_cache.attr, | ||
946 | &fileio_dev_attrib_emulate_ua_intlck_ctrl.attr, | ||
947 | &fileio_dev_attrib_emulate_tas.attr, | ||
948 | &fileio_dev_attrib_emulate_tpu.attr, | ||
949 | &fileio_dev_attrib_emulate_tpws.attr, | ||
950 | &fileio_dev_attrib_emulate_caw.attr, | ||
951 | &fileio_dev_attrib_emulate_3pc.attr, | ||
952 | &fileio_dev_attrib_pi_prot_type.attr, | ||
953 | &fileio_dev_attrib_hw_pi_prot_type.attr, | ||
954 | &fileio_dev_attrib_pi_prot_format.attr, | ||
955 | &fileio_dev_attrib_enforce_pr_isids.attr, | ||
956 | &fileio_dev_attrib_is_nonrot.attr, | ||
957 | &fileio_dev_attrib_emulate_rest_reord.attr, | ||
958 | &fileio_dev_attrib_force_pr_aptpl.attr, | ||
959 | &fileio_dev_attrib_hw_block_size.attr, | ||
960 | &fileio_dev_attrib_block_size.attr, | ||
961 | &fileio_dev_attrib_hw_max_sectors.attr, | ||
962 | &fileio_dev_attrib_fabric_max_sectors.attr, | ||
963 | &fileio_dev_attrib_optimal_sectors.attr, | ||
964 | &fileio_dev_attrib_hw_queue_depth.attr, | ||
965 | &fileio_dev_attrib_queue_depth.attr, | ||
966 | &fileio_dev_attrib_max_unmap_lba_count.attr, | ||
967 | &fileio_dev_attrib_max_unmap_block_desc_count.attr, | ||
968 | &fileio_dev_attrib_unmap_granularity.attr, | ||
969 | &fileio_dev_attrib_unmap_granularity_alignment.attr, | ||
970 | &fileio_dev_attrib_max_write_same_len.attr, | ||
971 | NULL, | ||
972 | }; | ||
973 | |||
937 | static struct se_subsystem_api fileio_template = { | 974 | static struct se_subsystem_api fileio_template = { |
938 | .name = "fileio", | 975 | .name = "fileio", |
939 | .inquiry_prod = "FILEIO", | 976 | .inquiry_prod = "FILEIO", |
@@ -957,6 +994,11 @@ static struct se_subsystem_api fileio_template = { | |||
957 | 994 | ||
958 | static int __init fileio_module_init(void) | 995 | static int __init fileio_module_init(void) |
959 | { | 996 | { |
997 | struct target_backend_cits *tbc = &fileio_template.tb_cits; | ||
998 | |||
999 | target_core_setup_sub_cits(&fileio_template); | ||
1000 | tbc->tb_dev_attrib_cit.ct_attrs = fileio_backend_dev_attrs; | ||
1001 | |||
960 | return transport_subsystem_register(&fileio_template); | 1002 | return transport_subsystem_register(&fileio_template); |
961 | } | 1003 | } |
962 | 1004 | ||