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 /fs/configfs | |
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 'fs/configfs')
-rw-r--r-- | fs/configfs/dir.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 614e382a6049..0e64312a084c 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c | |||
@@ -1073,25 +1073,24 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
1073 | group = NULL; | 1073 | group = NULL; |
1074 | item = NULL; | 1074 | item = NULL; |
1075 | if (type->ct_group_ops->make_group) { | 1075 | if (type->ct_group_ops->make_group) { |
1076 | group = type->ct_group_ops->make_group(to_config_group(parent_item), name); | 1076 | ret = type->ct_group_ops->make_group(to_config_group(parent_item), name, &group); |
1077 | if (group) { | 1077 | if (!ret) { |
1078 | link_group(to_config_group(parent_item), group); | 1078 | link_group(to_config_group(parent_item), group); |
1079 | item = &group->cg_item; | 1079 | item = &group->cg_item; |
1080 | } | 1080 | } |
1081 | } else { | 1081 | } else { |
1082 | item = type->ct_group_ops->make_item(to_config_group(parent_item), name); | 1082 | ret = type->ct_group_ops->make_item(to_config_group(parent_item), name, &item); |
1083 | if (item) | 1083 | if (!ret) |
1084 | link_obj(parent_item, item); | 1084 | link_obj(parent_item, item); |
1085 | } | 1085 | } |
1086 | mutex_unlock(&subsys->su_mutex); | 1086 | mutex_unlock(&subsys->su_mutex); |
1087 | 1087 | ||
1088 | kfree(name); | 1088 | kfree(name); |
1089 | if (!item) { | 1089 | if (ret) { |
1090 | /* | 1090 | /* |
1091 | * If item == NULL, then link_obj() was never called. | 1091 | * If ret != 0, then link_obj() was never called. |
1092 | * There are no extra references to clean up. | 1092 | * There are no extra references to clean up. |
1093 | */ | 1093 | */ |
1094 | ret = -ENOMEM; | ||
1095 | goto out_put; | 1094 | goto out_put; |
1096 | } | 1095 | } |
1097 | 1096 | ||