mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 12:44:11 +08:00
vfs: new helper - d_make_root()
d_alloc_root() with iput() in case of allocation failure... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
b48f03b319
commit
adc0e91ab1
17
fs/dcache.c
17
fs/dcache.c
@ -1440,6 +1440,23 @@ struct dentry * d_alloc_root(struct inode * root_inode)
|
||||
}
|
||||
EXPORT_SYMBOL(d_alloc_root);
|
||||
|
||||
struct dentry *d_make_root(struct inode *root_inode)
|
||||
{
|
||||
struct dentry *res = NULL;
|
||||
|
||||
if (root_inode) {
|
||||
static const struct qstr name = { .name = "/", .len = 1 };
|
||||
|
||||
res = __d_alloc(root_inode->i_sb, &name);
|
||||
if (res)
|
||||
d_instantiate(res, root_inode);
|
||||
else
|
||||
iput(root_inode);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
EXPORT_SYMBOL(d_make_root);
|
||||
|
||||
static struct dentry * __d_find_any_alias(struct inode *inode)
|
||||
{
|
||||
struct dentry *alias;
|
||||
|
@ -249,6 +249,7 @@ extern int d_invalidate(struct dentry *);
|
||||
|
||||
/* only used at mount-time */
|
||||
extern struct dentry * d_alloc_root(struct inode *);
|
||||
extern struct dentry * d_make_root(struct inode *);
|
||||
|
||||
/* <clickety>-<click> the ramfs-type tree */
|
||||
extern void d_genocide(struct dentry *);
|
||||
|
Loading…
Reference in New Issue
Block a user