summaryrefslogtreecommitdiffstats
path: root/fs/anon_inodes.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-06-09 09:58:23 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2018-07-12 10:04:27 -0400
commit52c91f8b3b1f5f69e47f7f65f76066d0c940b191 (patch)
treeb3c2bd8c0214a2e645f1e09138eb51426315d0d0 /fs/anon_inodes.c
parente68375c850b0d5699a27bb598317a3274913824b (diff)
downloadlinux-52c91f8b3b1f5f69e47f7f65f76066d0c940b191.tar.gz
linux-52c91f8b3b1f5f69e47f7f65f76066d0c940b191.tar.bz2
linux-52c91f8b3b1f5f69e47f7f65f76066d0c940b191.zip
anon_inode_getfile(): switch to alloc_file_pseudo()
Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/anon_inodes.c')
-rw-r--r--fs/anon_inodes.c29
1 files changed, 6 insertions, 23 deletions
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
index 6b235ab1df6c..91262c34b797 100644
--- a/fs/anon_inodes.c
+++ b/fs/anon_inodes.c
@@ -71,8 +71,6 @@ struct file *anon_inode_getfile(const char *name,
const struct file_operations *fops,
void *priv, int flags)
{
- struct qstr this;
- struct path path;
struct file *file;
if (IS_ERR(anon_inode_inode))
@@ -82,38 +80,23 @@ struct file *anon_inode_getfile(const char *name,
return ERR_PTR(-ENOENT);
/*
- * Link the inode to a directory entry by creating a unique name
- * using the inode sequence number.
- */
- file = ERR_PTR(-ENOMEM);
- this.name = name;
- this.len = strlen(name);
- this.hash = 0;
- path.dentry = d_alloc_pseudo(anon_inode_mnt->mnt_sb, &this);
- if (!path.dentry)
- goto err_module;
-
- path.mnt = mntget(anon_inode_mnt);
- /*
* We know the anon_inode inode count is always greater than zero,
* so ihold() is safe.
*/
ihold(anon_inode_inode);
-
- d_instantiate(path.dentry, anon_inode_inode);
-
- file = alloc_file(&path, flags & (O_ACCMODE | O_NONBLOCK), fops);
+ file = alloc_file_pseudo(anon_inode_inode, anon_inode_mnt, name,
+ flags & (O_ACCMODE | O_NONBLOCK), fops);
if (IS_ERR(file))
- goto err_dput;
+ goto err;
+
file->f_mapping = anon_inode_inode->i_mapping;
file->private_data = priv;
return file;
-err_dput:
- path_put(&path);
-err_module:
+err:
+ iput(anon_inode_inode);
module_put(fops->owner);
return file;
}