diff options
author | Christoph Hellwig <hch@lst.de> | 2016-02-26 11:02:14 +0100 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2016-03-06 16:11:24 +0100 |
commit | 1ae1602de028acaa42a0f6ff18d19756f8e825c6 (patch) | |
tree | 3370e5c29945370f62b9c72adeec587ed102d048 /include | |
parent | b1f1a29d8fb5eeaeec2cafe4c62f276d950c015b (diff) | |
download | linux-1ae1602de028acaa42a0f6ff18d19756f8e825c6.tar.gz linux-1ae1602de028acaa42a0f6ff18d19756f8e825c6.tar.bz2 linux-1ae1602de028acaa42a0f6ff18d19756f8e825c6.zip |
configfs: switch ->default groups to a linked list
Replace the current NULL-terminated array of default groups with a linked
list. This gets rid of lots of nasty code to size and/or dynamically
allocate the array.
While we're at it also provide a conveniant helper to remove the default
groups.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Felipe Balbi <balbi@kernel.org> [drivers/usb/gadget]
Acked-by: Joel Becker <jlbec@evilplan.org>
Acked-by: Nicholas Bellinger <nab@linux-iscsi.org>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/configfs.h | 11 | ||||
-rw-r--r-- | include/target/target_core_base.h | 3 |
2 files changed, 10 insertions, 4 deletions
diff --git a/include/linux/configfs.h b/include/linux/configfs.h index f8165c129ccb..485fe5519448 100644 --- a/include/linux/configfs.h +++ b/include/linux/configfs.h @@ -96,7 +96,8 @@ struct config_group { struct config_item cg_item; struct list_head cg_children; struct configfs_subsystem *cg_subsys; - struct config_group **default_groups; + struct list_head default_groups; + struct list_head group_entry; }; extern void config_group_init(struct config_group *group); @@ -123,6 +124,12 @@ extern struct config_item *config_group_find_item(struct config_group *, const char *); +static inline void configfs_add_default_group(struct config_group *new_group, + struct config_group *group) +{ + list_add_tail(&new_group->group_entry, &group->default_groups); +} + struct configfs_attribute { const char *ca_name; struct module *ca_owner; @@ -251,6 +258,8 @@ int configfs_register_group(struct config_group *parent_group, struct config_group *group); void configfs_unregister_group(struct config_group *group); +void configfs_remove_default_groups(struct config_group *group); + struct config_group * configfs_register_default_group(struct config_group *parent_group, const char *name, diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index e8c8c08bf575..1b09cac06508 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -560,7 +560,6 @@ struct se_node_acl { struct config_group acl_auth_group; struct config_group acl_param_group; struct config_group acl_fabric_stat_group; - struct config_group *acl_default_groups[5]; struct list_head acl_list; struct list_head acl_sess_list; struct completion acl_free_comp; @@ -887,7 +886,6 @@ struct se_portal_group { 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]; struct config_group tpg_lun_group; struct config_group tpg_np_group; struct config_group tpg_acl_group; @@ -923,7 +921,6 @@ static inline struct se_portal_group *param_to_tpg(struct config_item *item) struct se_wwn { struct target_fabric_configfs *wwn_tf; struct config_group wwn_group; - struct config_group *wwn_default_groups[2]; struct config_group fabric_stat_group; }; |