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 /drivers/net | |
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 'drivers/net')
-rw-r--r-- | drivers/net/netconsole.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 665341e43055..387a13395015 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c | |||
@@ -585,8 +585,9 @@ static struct config_item_type netconsole_target_type = { | |||
585 | * Group operations and type for netconsole_subsys. | 585 | * Group operations and type for netconsole_subsys. |
586 | */ | 586 | */ |
587 | 587 | ||
588 | static struct config_item *make_netconsole_target(struct config_group *group, | 588 | static int make_netconsole_target(struct config_group *group, |
589 | const char *name) | 589 | const char *name, |
590 | struct config_item **new_item) | ||
590 | { | 591 | { |
591 | unsigned long flags; | 592 | unsigned long flags; |
592 | struct netconsole_target *nt; | 593 | struct netconsole_target *nt; |
@@ -598,7 +599,7 @@ static struct config_item *make_netconsole_target(struct config_group *group, | |||
598 | nt = kzalloc(sizeof(*nt), GFP_KERNEL); | 599 | nt = kzalloc(sizeof(*nt), GFP_KERNEL); |
599 | if (!nt) { | 600 | if (!nt) { |
600 | printk(KERN_ERR "netconsole: failed to allocate memory\n"); | 601 | printk(KERN_ERR "netconsole: failed to allocate memory\n"); |
601 | return NULL; | 602 | return -ENOMEM; |
602 | } | 603 | } |
603 | 604 | ||
604 | nt->np.name = "netconsole"; | 605 | nt->np.name = "netconsole"; |
@@ -615,7 +616,8 @@ static struct config_item *make_netconsole_target(struct config_group *group, | |||
615 | list_add(&nt->list, &target_list); | 616 | list_add(&nt->list, &target_list); |
616 | spin_unlock_irqrestore(&target_list_lock, flags); | 617 | spin_unlock_irqrestore(&target_list_lock, flags); |
617 | 618 | ||
618 | return &nt->item; | 619 | *new_item = &nt->item; |
620 | return 0; | ||
619 | } | 621 | } |
620 | 622 | ||
621 | static void drop_netconsole_target(struct config_group *group, | 623 | static void drop_netconsole_target(struct config_group *group, |