From 9ac8928e6a3e1ed02e632e45aa766129fe6b1802 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 8 Apr 2015 20:01:35 +0200 Subject: target: simplify the target template registration API Instead of calling target_fabric_configfs_init() + target_fabric_configfs_register() / target_fabric_configfs_deregister() target_fabric_configfs_free() from every target driver, rewrite the API so that we have simple register/unregister functions that operate on a const operations vector. This patch also fixes a memory leak in several target drivers. Several target drivers namely called target_fabric_configfs_deregister() without calling target_fabric_configfs_free(). A large part of this patch is based on earlier changes from Bart Van Assche . (v2: Add a new TF_CIT_SETUP_DRV macro so that the core configfs code can declare attributes as either core only or for drivers) Signed-off-by: Christoph Hellwig Signed-off-by: Nicholas Bellinger --- include/target/target_core_base.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/target/target_core_base.h') diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 71699cf3cc71..383110d608a0 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -519,7 +519,7 @@ struct se_cmd { struct list_head se_cmd_list; struct completion cmd_wait_comp; struct kref cmd_kref; - struct target_core_fabric_ops *se_tfo; + const struct target_core_fabric_ops *se_tfo; sense_reason_t (*execute_cmd)(struct se_cmd *); sense_reason_t (*execute_rw)(struct se_cmd *, struct scatterlist *, u32, enum dma_data_direction); @@ -890,7 +890,7 @@ struct se_portal_group { /* List of TCM sessions associated wth this TPG */ struct list_head tpg_sess_list; /* Pointer to $FABRIC_MOD dependent code */ - struct target_core_fabric_ops *se_tpg_tfo; + const struct target_core_fabric_ops *se_tpg_tfo; struct se_wwn *se_tpg_wwn; struct config_group tpg_group; struct config_group *tpg_default_groups[7]; -- cgit v1.2.3