aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/configfs/item.c18
-rw-r--r--fs/dlm/config.c2
-rw-r--r--include/linux/configfs.h7
3 files changed, 11 insertions, 16 deletions
diff --git a/fs/configfs/item.c b/fs/configfs/item.c
index b762bbeaa0be..76dc4c3e5d51 100644
--- a/fs/configfs/item.c
+++ b/fs/configfs/item.c
@@ -183,27 +183,25 @@ void config_group_init(struct config_group *group)
183 INIT_LIST_HEAD(&group->cg_children); 183 INIT_LIST_HEAD(&group->cg_children);
184} 184}
185 185
186
187/** 186/**
188 * config_group_find_obj - search for item in group. 187 * config_group_find_item - search for item in group.
189 * @group: group we're looking in. 188 * @group: group we're looking in.
190 * @name: item's name. 189 * @name: item's name.
191 * 190 *
192 * Lock group via @group->cg_subsys, and iterate over @group->cg_list, 191 * Iterate over @group->cg_list, looking for a matching config_item.
193 * looking for a matching config_item. If matching item is found 192 * If matching item is found take a reference and return the item.
194 * take a reference and return the item. 193 * Caller must have locked group via @group->cg_subsys->su_mtx.
195 */ 194 */
196struct config_item *config_group_find_obj(struct config_group *group, 195struct config_item *config_group_find_item(struct config_group *group,
197 const char * name) 196 const char *name)
198{ 197{
199 struct list_head * entry; 198 struct list_head * entry;
200 struct config_item * ret = NULL; 199 struct config_item * ret = NULL;
201 200
202 /* XXX LOCKING! */
203 list_for_each(entry,&group->cg_children) { 201 list_for_each(entry,&group->cg_children) {
204 struct config_item * item = to_item(entry); 202 struct config_item * item = to_item(entry);
205 if (config_item_name(item) && 203 if (config_item_name(item) &&
206 !strcmp(config_item_name(item), name)) { 204 !strcmp(config_item_name(item), name)) {
207 ret = config_item_get(item); 205 ret = config_item_get(item);
208 break; 206 break;
209 } 207 }
@@ -215,4 +213,4 @@ EXPORT_SYMBOL(config_item_init);
215EXPORT_SYMBOL(config_group_init); 213EXPORT_SYMBOL(config_group_init);
216EXPORT_SYMBOL(config_item_get); 214EXPORT_SYMBOL(config_item_get);
217EXPORT_SYMBOL(config_item_put); 215EXPORT_SYMBOL(config_item_put);
218EXPORT_SYMBOL(config_group_find_obj); 216EXPORT_SYMBOL(config_group_find_item);
diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index e47eb42406fa..4348cb42cf17 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -752,7 +752,7 @@ static struct space *get_space(char *name)
752 return NULL; 752 return NULL;
753 753
754 down(&space_list->cg_subsys->su_sem); 754 down(&space_list->cg_subsys->su_sem);
755 i = config_group_find_obj(space_list, name); 755 i = config_group_find_item(space_list, name);
756 up(&space_list->cg_subsys->su_sem); 756 up(&space_list->cg_subsys->su_sem);
757 757
758 return to_space(i); 758 return to_space(i);
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index def7c83d43a2..bbb1b6cafa8b 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -86,12 +86,10 @@ struct config_item_type {
86 struct configfs_attribute **ct_attrs; 86 struct configfs_attribute **ct_attrs;
87}; 87};
88 88
89
90/** 89/**
91 * group - a group of config_items of a specific type, belonging 90 * group - a group of config_items of a specific type, belonging
92 * to a specific subsystem. 91 * to a specific subsystem.
93 */ 92 */
94
95struct config_group { 93struct config_group {
96 struct config_item cg_item; 94 struct config_item cg_item;
97 struct list_head cg_children; 95 struct list_head cg_children;
@@ -99,13 +97,11 @@ struct config_group {
99 struct config_group **default_groups; 97 struct config_group **default_groups;
100}; 98};
101 99
102
103extern void config_group_init(struct config_group *group); 100extern void config_group_init(struct config_group *group);
104extern void config_group_init_type_name(struct config_group *group, 101extern void config_group_init_type_name(struct config_group *group,
105 const char *name, 102 const char *name,
106 struct config_item_type *type); 103 struct config_item_type *type);
107 104
108
109static inline struct config_group *to_config_group(struct config_item *item) 105static inline struct config_group *to_config_group(struct config_item *item)
110{ 106{
111 return item ? container_of(item,struct config_group,cg_item) : NULL; 107 return item ? container_of(item,struct config_group,cg_item) : NULL;
@@ -121,7 +117,8 @@ static inline void config_group_put(struct config_group *group)
121 config_item_put(&group->cg_item); 117 config_item_put(&group->cg_item);
122} 118}
123 119
124extern struct config_item *config_group_find_obj(struct config_group *, const char *); 120extern struct config_item *config_group_find_item(struct config_group *,
121 const char *);
125 122
126 123
127struct configfs_attribute { 124struct configfs_attribute {