diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-11-27 16:59:20 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-12-02 00:35:22 -0500 |
commit | 73112edca9be1d7c37d0b94348c82c3742c3ef58 (patch) | |
tree | c40004c13e5e3b107d491a909a543461c65f6197 /drivers/target | |
parent | 2ed37f6c9b69092afbbf2a990336f8cbd303947d (diff) |
target: Move dev_cit to struct se_subsystem_api
This patch adds initial support for dev_cit as external config_item_type.
This includes a new struct target_backend_cits to hold the external CITs
within struct se_subsystem_api, and target_core_setup_sub_cits() to be
used by backend drivers ahead of transport_subsystem_register().
It adds a TB_CIT_SETUP() helper following target_core_fabric_configfs.c
to perform the config_item_type assignments.
Also, drop left-over target_core_dev_cit from target_core_configfs.c code
and update comments.
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_configfs.c | 33 | ||||
-rw-r--r-- | drivers/target/target_core_hba.c | 1 |
2 files changed, 25 insertions, 9 deletions
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 41498b696641..f7b2186ba57b 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -50,6 +50,19 @@ | |||
50 | #include "target_core_rd.h" | 50 | #include "target_core_rd.h" |
51 | #include "target_core_xcopy.h" | 51 | #include "target_core_xcopy.h" |
52 | 52 | ||
53 | #define TB_CIT_SETUP(_name, _item_ops, _group_ops, _attrs) \ | ||
54 | static void target_core_setup_##_name##_cit(struct se_subsystem_api *sa) \ | ||
55 | { \ | ||
56 | struct target_backend_cits *tbc = &sa->tb_cits; \ | ||
57 | struct config_item_type *cit = &tbc->tb_##_name##_cit; \ | ||
58 | \ | ||
59 | cit->ct_item_ops = _item_ops; \ | ||
60 | cit->ct_group_ops = _group_ops; \ | ||
61 | cit->ct_attrs = _attrs; \ | ||
62 | cit->ct_owner = sa->owner; \ | ||
63 | pr_debug("Setup generic %s\n", __stringify(_name)); \ | ||
64 | } | ||
65 | |||
53 | extern struct t10_alua_lu_gp *default_lu_gp; | 66 | extern struct t10_alua_lu_gp *default_lu_gp; |
54 | 67 | ||
55 | static LIST_HEAD(g_tf_list); | 68 | static LIST_HEAD(g_tf_list); |
@@ -1470,7 +1483,7 @@ static struct config_item_type target_core_dev_pr_cit = { | |||
1470 | 1483 | ||
1471 | /* End functions for struct config_item_type target_core_dev_pr_cit */ | 1484 | /* End functions for struct config_item_type target_core_dev_pr_cit */ |
1472 | 1485 | ||
1473 | /* Start functions for struct config_item_type target_core_dev_cit */ | 1486 | /* Start functions for struct config_item_type tb_dev_cit */ |
1474 | 1487 | ||
1475 | static ssize_t target_core_show_dev_info(void *p, char *page) | 1488 | static ssize_t target_core_show_dev_info(void *p, char *page) |
1476 | { | 1489 | { |
@@ -1934,7 +1947,7 @@ static struct target_core_configfs_attribute target_core_attr_dev_lba_map = { | |||
1934 | .store = target_core_store_dev_lba_map, | 1947 | .store = target_core_store_dev_lba_map, |
1935 | }; | 1948 | }; |
1936 | 1949 | ||
1937 | static struct configfs_attribute *lio_core_dev_attrs[] = { | 1950 | static struct configfs_attribute *target_core_dev_attrs[] = { |
1938 | &target_core_attr_dev_info.attr, | 1951 | &target_core_attr_dev_info.attr, |
1939 | &target_core_attr_dev_control.attr, | 1952 | &target_core_attr_dev_control.attr, |
1940 | &target_core_attr_dev_alias.attr, | 1953 | &target_core_attr_dev_alias.attr, |
@@ -1993,13 +2006,9 @@ static struct configfs_item_operations target_core_dev_item_ops = { | |||
1993 | .store_attribute = target_core_dev_store, | 2006 | .store_attribute = target_core_dev_store, |
1994 | }; | 2007 | }; |
1995 | 2008 | ||
1996 | static struct config_item_type target_core_dev_cit = { | 2009 | TB_CIT_SETUP(dev, &target_core_dev_item_ops, NULL, target_core_dev_attrs); |
1997 | .ct_item_ops = &target_core_dev_item_ops, | ||
1998 | .ct_attrs = lio_core_dev_attrs, | ||
1999 | .ct_owner = THIS_MODULE, | ||
2000 | }; | ||
2001 | 2010 | ||
2002 | /* End functions for struct config_item_type target_core_dev_cit */ | 2011 | /* End functions for struct config_item_type tb_dev_cit */ |
2003 | 2012 | ||
2004 | /* Start functions for struct config_item_type target_core_alua_lu_gp_cit */ | 2013 | /* Start functions for struct config_item_type target_core_alua_lu_gp_cit */ |
2005 | 2014 | ||
@@ -2815,7 +2824,7 @@ static struct config_group *target_core_make_subdev( | |||
2815 | if (!dev_cg->default_groups) | 2824 | if (!dev_cg->default_groups) |
2816 | goto out_free_device; | 2825 | goto out_free_device; |
2817 | 2826 | ||
2818 | config_group_init_type_name(dev_cg, name, &target_core_dev_cit); | 2827 | config_group_init_type_name(dev_cg, name, &t->tb_cits.tb_dev_cit); |
2819 | config_group_init_type_name(&dev->dev_attrib.da_group, "attrib", | 2828 | config_group_init_type_name(&dev->dev_attrib.da_group, "attrib", |
2820 | &target_core_dev_attrib_cit); | 2829 | &target_core_dev_attrib_cit); |
2821 | config_group_init_type_name(&dev->dev_pr_group, "pr", | 2830 | config_group_init_type_name(&dev->dev_pr_group, "pr", |
@@ -3119,6 +3128,12 @@ static struct config_item_type target_core_cit = { | |||
3119 | 3128 | ||
3120 | /* Stop functions for struct config_item_type target_core_hba_cit */ | 3129 | /* Stop functions for struct config_item_type target_core_hba_cit */ |
3121 | 3130 | ||
3131 | void target_core_setup_sub_cits(struct se_subsystem_api *sa) | ||
3132 | { | ||
3133 | target_core_setup_dev_cit(sa); | ||
3134 | } | ||
3135 | EXPORT_SYMBOL(target_core_setup_sub_cits); | ||
3136 | |||
3122 | static int __init target_core_init_configfs(void) | 3137 | static int __init target_core_init_configfs(void) |
3123 | { | 3138 | { |
3124 | struct config_group *target_cg, *hba_cg = NULL, *alua_cg = NULL; | 3139 | struct config_group *target_cg, *hba_cg = NULL, *alua_cg = NULL; |
diff --git a/drivers/target/target_core_hba.c b/drivers/target/target_core_hba.c index e6e496ff9546..ff95f95dcd13 100644 --- a/drivers/target/target_core_hba.c +++ b/drivers/target/target_core_hba.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <target/target_core_base.h> | 36 | #include <target/target_core_base.h> |
37 | #include <target/target_core_backend.h> | 37 | #include <target/target_core_backend.h> |
38 | #include <target/target_core_fabric.h> | 38 | #include <target/target_core_fabric.h> |
39 | #include <target/target_core_configfs.h> | ||
39 | 40 | ||
40 | #include "target_core_internal.h" | 41 | #include "target_core_internal.h" |
41 | 42 | ||