target: simplify the target template registration API
authorChristoph Hellwig <hch@lst.de>
Wed, 8 Apr 2015 18:01:35 +0000 (20:01 +0200)
committerNicholas Bellinger <nab@linux-iscsi.org>
Tue, 14 Apr 2015 19:28:41 +0000 (12:28 -0700)
commit9ac8928e6a3e1ed02e632e45aa766129fe6b1802
treeea516680cc5f811df862966bb43cfbe3e34dfb26
parent2c336e3a2e1728d9b3116422655832184dc7046c
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 <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>
25 files changed:
Documentation/target/tcm_mod_builder.py
drivers/infiniband/ulp/srpt/ib_srpt.c
drivers/scsi/qla2xxx/qla_target.c
drivers/scsi/qla2xxx/tcm_qla2xxx.c
drivers/target/iscsi/iscsi_target.c
drivers/target/iscsi/iscsi_target.h
drivers/target/iscsi/iscsi_target_configfs.c
drivers/target/iscsi/iscsi_target_configfs.h [deleted file]
drivers/target/iscsi/iscsi_target_tpg.c
drivers/target/loopback/tcm_loop.c
drivers/target/sbp/sbp_target.c
drivers/target/target_core_configfs.c
drivers/target/target_core_fabric_configfs.c
drivers/target/target_core_pr.c
drivers/target/target_core_tpg.c
drivers/target/target_core_transport.c
drivers/target/target_core_xcopy.c
drivers/target/tcm_fc/tcm_fc.h
drivers/target/tcm_fc/tfc_conf.c
drivers/usb/gadget/legacy/tcm_usb_gadget.c
drivers/vhost/scsi.c
drivers/xen/xen-scsiback.c
include/target/target_core_base.h
include/target/target_core_configfs.h
include/target/target_core_fabric.h