diff options
Diffstat (limited to 'fs/configfs/item.c')
-rw-r--r-- | fs/configfs/item.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/fs/configfs/item.c b/fs/configfs/item.c index 24421209f854..76dc4c3e5d51 100644 --- a/fs/configfs/item.c +++ b/fs/configfs/item.c | |||
@@ -62,7 +62,6 @@ void config_item_init(struct config_item * item) | |||
62 | * dynamically allocated string that @item->ci_name points to. | 62 | * dynamically allocated string that @item->ci_name points to. |
63 | * Otherwise, use the static @item->ci_namebuf array. | 63 | * Otherwise, use the static @item->ci_namebuf array. |
64 | */ | 64 | */ |
65 | |||
66 | int config_item_set_name(struct config_item * item, const char * fmt, ...) | 65 | int config_item_set_name(struct config_item * item, const char * fmt, ...) |
67 | { | 66 | { |
68 | int error = 0; | 67 | int error = 0; |
@@ -139,12 +138,7 @@ struct config_item * config_item_get(struct config_item * item) | |||
139 | return item; | 138 | return item; |
140 | } | 139 | } |
141 | 140 | ||
142 | /** | 141 | static void config_item_cleanup(struct config_item * item) |
143 | * config_item_cleanup - free config_item resources. | ||
144 | * @item: item. | ||
145 | */ | ||
146 | |||
147 | void config_item_cleanup(struct config_item * item) | ||
148 | { | 142 | { |
149 | struct config_item_type * t = item->ci_type; | 143 | struct config_item_type * t = item->ci_type; |
150 | struct config_group * s = item->ci_group; | 144 | struct config_group * s = item->ci_group; |
@@ -179,39 +173,35 @@ void config_item_put(struct config_item * item) | |||
179 | kref_put(&item->ci_kref, config_item_release); | 173 | kref_put(&item->ci_kref, config_item_release); |
180 | } | 174 | } |
181 | 175 | ||
182 | |||
183 | /** | 176 | /** |
184 | * config_group_init - initialize a group for use | 177 | * config_group_init - initialize a group for use |
185 | * @k: group | 178 | * @k: group |
186 | */ | 179 | */ |
187 | |||
188 | void config_group_init(struct config_group *group) | 180 | void config_group_init(struct config_group *group) |
189 | { | 181 | { |
190 | config_item_init(&group->cg_item); | 182 | config_item_init(&group->cg_item); |
191 | INIT_LIST_HEAD(&group->cg_children); | 183 | INIT_LIST_HEAD(&group->cg_children); |
192 | } | 184 | } |
193 | 185 | ||
194 | |||
195 | /** | 186 | /** |
196 | * config_group_find_obj - search for item in group. | 187 | * config_group_find_item - search for item in group. |
197 | * @group: group we're looking in. | 188 | * @group: group we're looking in. |
198 | * @name: item's name. | 189 | * @name: item's name. |
199 | * | 190 | * |
200 | * Lock group via @group->cg_subsys, and iterate over @group->cg_list, | 191 | * Iterate over @group->cg_list, looking for a matching config_item. |
201 | * looking for a matching config_item. If matching item is found | 192 | * If matching item is found take a reference and return the item. |
202 | * take a reference and return the item. | 193 | * Caller must have locked group via @group->cg_subsys->su_mtx. |
203 | */ | 194 | */ |
204 | 195 | struct config_item *config_group_find_item(struct config_group *group, | |
205 | struct config_item * config_group_find_obj(struct config_group * group, const char * name) | 196 | const char *name) |
206 | { | 197 | { |
207 | struct list_head * entry; | 198 | struct list_head * entry; |
208 | struct config_item * ret = NULL; | 199 | struct config_item * ret = NULL; |
209 | 200 | ||
210 | /* XXX LOCKING! */ | ||
211 | list_for_each(entry,&group->cg_children) { | 201 | list_for_each(entry,&group->cg_children) { |
212 | struct config_item * item = to_item(entry); | 202 | struct config_item * item = to_item(entry); |
213 | if (config_item_name(item) && | 203 | if (config_item_name(item) && |
214 | !strcmp(config_item_name(item), name)) { | 204 | !strcmp(config_item_name(item), name)) { |
215 | ret = config_item_get(item); | 205 | ret = config_item_get(item); |
216 | break; | 206 | break; |
217 | } | 207 | } |
@@ -219,9 +209,8 @@ struct config_item * config_group_find_obj(struct config_group * group, const ch | |||
219 | return ret; | 209 | return ret; |
220 | } | 210 | } |
221 | 211 | ||
222 | |||
223 | EXPORT_SYMBOL(config_item_init); | 212 | EXPORT_SYMBOL(config_item_init); |
224 | EXPORT_SYMBOL(config_group_init); | 213 | EXPORT_SYMBOL(config_group_init); |
225 | EXPORT_SYMBOL(config_item_get); | 214 | EXPORT_SYMBOL(config_item_get); |
226 | EXPORT_SYMBOL(config_item_put); | 215 | EXPORT_SYMBOL(config_item_put); |
227 | EXPORT_SYMBOL(config_group_find_obj); | 216 | EXPORT_SYMBOL(config_group_find_item); |