Commit 1cf97d0d authored by Al Viro's avatar Al Viro

configfs: fold create_dir() into its only caller

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent c88b1e70
......@@ -260,25 +260,39 @@ static void init_symlink(struct inode * inode)
inode->i_op = &configfs_symlink_inode_operations;
}
static int create_dir(struct config_item *k, struct dentry *d)
/**
* configfs_create_dir - create a directory for an config_item.
* @item: config_itemwe're creating directory for.
* @dentry: config_item's dentry.
*
* Note: user-created entries won't be allowed under this new directory
* until it is validated by configfs_dir_set_ready()
*/
static int configfs_create_dir(struct config_item *item, struct dentry *dentry)
{
int error;
umode_t mode = S_IFDIR| S_IRWXU | S_IRUGO | S_IXUGO;
struct dentry *p = d->d_parent;
struct dentry *p = dentry->d_parent;
BUG_ON(!item);
BUG_ON(!k);
error = configfs_dirent_exists(p->d_fsdata, dentry->d_name.name);
if (unlikely(error))
return error;
error = configfs_dirent_exists(p->d_fsdata, d->d_name.name);
if (!error)
error = configfs_make_dirent(p->d_fsdata, d, k, mode,
error = configfs_make_dirent(p->d_fsdata, dentry, item, mode,
CONFIGFS_DIR | CONFIGFS_USET_CREATING);
if (!error) {
configfs_set_dir_dirent_depth(p->d_fsdata, d->d_fsdata);
error = configfs_create(d, mode, init_dir);
if (unlikely(error))
return error;
configfs_set_dir_dirent_depth(p->d_fsdata, dentry->d_fsdata);
error = configfs_create(dentry, mode, init_dir);
if (!error) {
inc_nlink(p->d_inode);
item->ci_dentry = dentry;
} else {
struct configfs_dirent *sd = d->d_fsdata;
struct configfs_dirent *sd = dentry->d_fsdata;
if (sd) {
spin_lock(&configfs_dirent_lock);
list_del_init(&sd->s_sibling);
......@@ -286,25 +300,6 @@ static int create_dir(struct config_item *k, struct dentry *d)
configfs_put(sd);
}
}
}
return error;
}
/**
* configfs_create_dir - create a directory for an config_item.
* @item: config_itemwe're creating directory for.
* @dentry: config_item's dentry.
*
* Note: user-created entries won't be allowed under this new directory
* until it is validated by configfs_dir_set_ready()
*/
static int configfs_create_dir(struct config_item * item, struct dentry *dentry)
{
int error = create_dir(item, dentry);
if (!error)
item->ci_dentry = dentry;
return error;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment