diff options
author | Joel Becker <joel.becker@oracle.com> | 2008-06-12 17:00:18 -0400 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2008-07-14 16:57:16 -0400 |
commit | 11c3b79218390a139f2d474ee1e983a672d5839a (patch) | |
tree | 03fa1a4927f2d9856ee45a64d522424478058b6f /Documentation | |
parent | 6d8344baee99402de58b5fa5dfea197242955c15 (diff) |
configfs: Allow ->make_item() and ->make_group() to return detailed errors.
The configfs operations ->make_item() and ->make_group() currently
return a new item/group. A return of NULL signifies an error. Because
of this, -ENOMEM is the only return code bubbled up the stack.
Multiple folks have requested the ability to return specific error codes
when these operations fail. This patch adds that ability by changing the
->make_item/group() ops to return an int.
Also updated are the in-kernel users of configfs.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/filesystems/configfs/configfs.txt | 10 | ||||
-rw-r--r-- | Documentation/filesystems/configfs/configfs_example.c | 14 |
2 files changed, 14 insertions, 10 deletions
diff --git a/Documentation/filesystems/configfs/configfs.txt b/Documentation/filesystems/configfs/configfs.txt index 44c97e6accb2..15838d706ea2 100644 --- a/Documentation/filesystems/configfs/configfs.txt +++ b/Documentation/filesystems/configfs/configfs.txt | |||
@@ -233,10 +233,12 @@ accomplished via the group operations specified on the group's | |||
233 | config_item_type. | 233 | config_item_type. |
234 | 234 | ||
235 | struct configfs_group_operations { | 235 | struct configfs_group_operations { |
236 | struct config_item *(*make_item)(struct config_group *group, | 236 | int (*make_item)(struct config_group *group, |
237 | const char *name); | 237 | const char *name, |
238 | struct config_group *(*make_group)(struct config_group *group, | 238 | struct config_item **new_item); |
239 | const char *name); | 239 | int (*make_group)(struct config_group *group, |
240 | const char *name, | ||
241 | struct config_group **new_group); | ||
240 | int (*commit_item)(struct config_item *item); | 242 | int (*commit_item)(struct config_item *item); |
241 | void (*disconnect_notify)(struct config_group *group, | 243 | void (*disconnect_notify)(struct config_group *group, |
242 | struct config_item *item); | 244 | struct config_item *item); |
diff --git a/Documentation/filesystems/configfs/configfs_example.c b/Documentation/filesystems/configfs/configfs_example.c index 25151fd5c2c6..0b422acd470c 100644 --- a/Documentation/filesystems/configfs/configfs_example.c +++ b/Documentation/filesystems/configfs/configfs_example.c | |||
@@ -273,13 +273,13 @@ static inline struct simple_children *to_simple_children(struct config_item *ite | |||
273 | return item ? container_of(to_config_group(item), struct simple_children, group) : NULL; | 273 | return item ? container_of(to_config_group(item), struct simple_children, group) : NULL; |
274 | } | 274 | } |
275 | 275 | ||
276 | static struct config_item *simple_children_make_item(struct config_group *group, const char *name) | 276 | static int simple_children_make_item(struct config_group *group, const char *name, struct config_item **new_item) |
277 | { | 277 | { |
278 | struct simple_child *simple_child; | 278 | struct simple_child *simple_child; |
279 | 279 | ||
280 | simple_child = kzalloc(sizeof(struct simple_child), GFP_KERNEL); | 280 | simple_child = kzalloc(sizeof(struct simple_child), GFP_KERNEL); |
281 | if (!simple_child) | 281 | if (!simple_child) |
282 | return NULL; | 282 | return -ENOMEM; |
283 | 283 | ||
284 | 284 | ||
285 | config_item_init_type_name(&simple_child->item, name, | 285 | config_item_init_type_name(&simple_child->item, name, |
@@ -287,7 +287,8 @@ static struct config_item *simple_children_make_item(struct config_group *group, | |||
287 | 287 | ||
288 | simple_child->storeme = 0; | 288 | simple_child->storeme = 0; |
289 | 289 | ||
290 | return &simple_child->item; | 290 | *new_item = &simple_child->item; |
291 | return 0; | ||
291 | } | 292 | } |
292 | 293 | ||
293 | static struct configfs_attribute simple_children_attr_description = { | 294 | static struct configfs_attribute simple_children_attr_description = { |
@@ -359,20 +360,21 @@ static struct configfs_subsystem simple_children_subsys = { | |||
359 | * children of its own. | 360 | * children of its own. |
360 | */ | 361 | */ |
361 | 362 | ||
362 | static struct config_group *group_children_make_group(struct config_group *group, const char *name) | 363 | static int group_children_make_group(struct config_group *group, const char *name, struct config_group **new_group) |
363 | { | 364 | { |
364 | struct simple_children *simple_children; | 365 | struct simple_children *simple_children; |
365 | 366 | ||
366 | simple_children = kzalloc(sizeof(struct simple_children), | 367 | simple_children = kzalloc(sizeof(struct simple_children), |
367 | GFP_KERNEL); | 368 | GFP_KERNEL); |
368 | if (!simple_children) | 369 | if (!simple_children) |
369 | return NULL; | 370 | return -ENOMEM; |
370 | 371 | ||
371 | 372 | ||
372 | config_group_init_type_name(&simple_children->group, name, | 373 | config_group_init_type_name(&simple_children->group, name, |
373 | &simple_children_type); | 374 | &simple_children_type); |
374 | 375 | ||
375 | return &simple_children->group; | 376 | *new_group = &simple_children->group; |
377 | return 0; | ||
376 | } | 378 | } |
377 | 379 | ||
378 | static struct configfs_attribute group_children_attr_description = { | 380 | static struct configfs_attribute group_children_attr_description = { |