aboutsummaryrefslogtreecommitdiffstats
path: root/include/target/target_core_backend.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2015-05-10 18:14:56 +0200
committerNicholas Bellinger <nab@linux-iscsi.org>2015-06-01 00:25:34 -0700
commit0a06d4309dc168dfa70cec3cf0cd9eb7fc15a2fd (patch)
tree38dda3f7dc5e049761c80b55796e48cacbb6924c /include/target/target_core_backend.h
parenttarget: Drop left-over se_lun->lun_status (diff)
downloadlinux-dev-0a06d4309dc168dfa70cec3cf0cd9eb7fc15a2fd.tar.xz
linux-dev-0a06d4309dc168dfa70cec3cf0cd9eb7fc15a2fd.zip
target: simplify backend driver registration
Rewrite the backend driver registration based on what we did to the fabric drivers: introduce a read-only struct target_bakckend_ops that the driver registers, which is then instanciate as a struct target_backend by the core. This allows the ops vector to be smaller and allows us to mark it const. At the same time the registration function can set up the configfs attributes, avoiding the need to add additional boilerplate code for that to the drivers. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'include/target/target_core_backend.h')
-rw-r--r--include/target/target_core_backend.h22
1 files changed, 4 insertions, 18 deletions
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index 80d9e486e33e..514b52019380 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -3,18 +3,7 @@
#define TRANSPORT_FLAG_PASSTHROUGH 1
-struct target_backend_cits {
- struct config_item_type tb_dev_cit;
- struct config_item_type tb_dev_attrib_cit;
- struct config_item_type tb_dev_pr_cit;
- struct config_item_type tb_dev_wwn_cit;
- struct config_item_type tb_dev_alua_tg_pt_gps_cit;
- struct config_item_type tb_dev_stat_cit;
-};
-
-struct se_subsystem_api {
- struct list_head sub_api_list;
-
+struct target_backend_ops {
char name[16];
char inquiry_prod[16];
char inquiry_rev[4];
@@ -52,7 +41,7 @@ struct se_subsystem_api {
int (*format_prot)(struct se_device *);
void (*free_prot)(struct se_device *);
- struct target_backend_cits tb_cits;
+ struct configfs_attribute **tb_dev_attrib_attrs;
};
struct sbc_ops {
@@ -64,8 +53,8 @@ struct sbc_ops {
sense_reason_t (*execute_unmap)(struct se_cmd *cmd);
};
-int transport_subsystem_register(struct se_subsystem_api *);
-void transport_subsystem_release(struct se_subsystem_api *);
+int transport_backend_register(const struct target_backend_ops *);
+void target_backend_unregister(const struct target_backend_ops *);
void target_complete_cmd(struct se_cmd *, u8);
void target_complete_cmd_with_length(struct se_cmd *, u8, int);
@@ -103,9 +92,6 @@ sense_reason_t transport_generic_map_mem_to_cmd(struct se_cmd *,
bool target_lun_is_rdonly(struct se_cmd *);
-/* From target_core_configfs.c to setup default backend config_item_types */
-void target_core_setup_sub_cits(struct se_subsystem_api *);
-
/* attribute helpers from target_core_device.c for backend drivers */
bool se_dev_check_wce(struct se_device *);
int se_dev_set_max_unmap_lba_count(struct se_device *, u32);