mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 20:54:10 +08:00
9ac8928e6a
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 <bart.vanassche@sandisk.com>. (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 <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
51 lines
1.8 KiB
C
51 lines
1.8 KiB
C
#define TARGET_CORE_CONFIGFS_VERSION TARGET_CORE_MOD_VERSION
|
|
|
|
#define TARGET_CORE_CONFIG_ROOT "/sys/kernel/config"
|
|
|
|
#define TARGET_CORE_NAME_MAX_LEN 64
|
|
#define TARGET_FABRIC_NAME_SIZE 32
|
|
|
|
struct target_fabric_configfs_template {
|
|
struct config_item_type tfc_discovery_cit;
|
|
struct config_item_type tfc_wwn_cit;
|
|
struct config_item_type tfc_wwn_fabric_stats_cit;
|
|
struct config_item_type tfc_tpg_cit;
|
|
struct config_item_type tfc_tpg_base_cit;
|
|
struct config_item_type tfc_tpg_lun_cit;
|
|
struct config_item_type tfc_tpg_port_cit;
|
|
struct config_item_type tfc_tpg_port_stat_cit;
|
|
struct config_item_type tfc_tpg_np_cit;
|
|
struct config_item_type tfc_tpg_np_base_cit;
|
|
struct config_item_type tfc_tpg_attrib_cit;
|
|
struct config_item_type tfc_tpg_auth_cit;
|
|
struct config_item_type tfc_tpg_param_cit;
|
|
struct config_item_type tfc_tpg_nacl_cit;
|
|
struct config_item_type tfc_tpg_nacl_base_cit;
|
|
struct config_item_type tfc_tpg_nacl_attrib_cit;
|
|
struct config_item_type tfc_tpg_nacl_auth_cit;
|
|
struct config_item_type tfc_tpg_nacl_param_cit;
|
|
struct config_item_type tfc_tpg_nacl_stat_cit;
|
|
struct config_item_type tfc_tpg_mappedlun_cit;
|
|
struct config_item_type tfc_tpg_mappedlun_stat_cit;
|
|
};
|
|
|
|
struct target_fabric_configfs {
|
|
char tf_name[TARGET_FABRIC_NAME_SIZE];
|
|
atomic_t tf_access_cnt;
|
|
struct list_head tf_list;
|
|
struct config_group tf_group;
|
|
struct config_group tf_disc_group;
|
|
struct config_group *tf_default_groups[2];
|
|
/* Pointer to fabric's config_item */
|
|
struct config_item *tf_fabric;
|
|
/* Passed from fabric modules */
|
|
struct config_item_type *tf_fabric_cit;
|
|
/* Pointer to target core subsystem */
|
|
struct configfs_subsystem *tf_subsys;
|
|
/* Pointer to fabric's struct module */
|
|
struct module *tf_module;
|
|
struct target_core_fabric_ops tf_ops;
|
|
struct target_fabric_configfs_template tf_cit_tmpl;
|
|
};
|
|
|