diff options
author | Christoph Hellwig <hch@lst.de> | 2016-02-26 05:02:14 -0500 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2016-03-06 10:11:24 -0500 |
commit | 1ae1602de028acaa42a0f6ff18d19756f8e825c6 (patch) | |
tree | 3370e5c29945370f62b9c72adeec587ed102d048 /include/linux/configfs.h | |
parent | b1f1a29d8fb5eeaeec2cafe4c62f276d950c015b (diff) |
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/linux/configfs.h')
-rw-r--r-- | include/linux/configfs.h | 11 |
1 files changed, 10 insertions, 1 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 { | |||
96 | struct config_item cg_item; | 96 | struct config_item cg_item; |
97 | struct list_head cg_children; | 97 | struct list_head cg_children; |
98 | struct configfs_subsystem *cg_subsys; | 98 | struct configfs_subsystem *cg_subsys; |
99 | struct config_group **default_groups; | 99 | struct list_head default_groups; |
100 | struct list_head group_entry; | ||
100 | }; | 101 | }; |
101 | 102 | ||
102 | extern void config_group_init(struct config_group *group); | 103 | extern void config_group_init(struct config_group *group); |
@@ -123,6 +124,12 @@ extern struct config_item *config_group_find_item(struct config_group *, | |||
123 | const char *); | 124 | const char *); |
124 | 125 | ||
125 | 126 | ||
127 | static inline void configfs_add_default_group(struct config_group *new_group, | ||
128 | struct config_group *group) | ||
129 | { | ||
130 | list_add_tail(&new_group->group_entry, &group->default_groups); | ||
131 | } | ||
132 | |||
126 | struct configfs_attribute { | 133 | struct configfs_attribute { |
127 | const char *ca_name; | 134 | const char *ca_name; |
128 | struct module *ca_owner; | 135 | struct module *ca_owner; |
@@ -251,6 +258,8 @@ int configfs_register_group(struct config_group *parent_group, | |||
251 | struct config_group *group); | 258 | struct config_group *group); |
252 | void configfs_unregister_group(struct config_group *group); | 259 | void configfs_unregister_group(struct config_group *group); |
253 | 260 | ||
261 | void configfs_remove_default_groups(struct config_group *group); | ||
262 | |||
254 | struct config_group * | 263 | struct config_group * |
255 | configfs_register_default_group(struct config_group *parent_group, | 264 | configfs_register_default_group(struct config_group *parent_group, |
256 | const char *name, | 265 | const char *name, |