cxl_getfile(): switch to alloc_file_pseudo()
Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
93dec2da7b
commit
908f7ca173
@ -67,10 +67,8 @@ static struct file *cxl_getfile(const char *name,
|
|||||||
const struct file_operations *fops,
|
const struct file_operations *fops,
|
||||||
void *priv, int flags)
|
void *priv, int flags)
|
||||||
{
|
{
|
||||||
struct qstr this;
|
|
||||||
struct path path;
|
|
||||||
struct file *file;
|
struct file *file;
|
||||||
struct inode *inode = NULL;
|
struct inode *inode;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* strongly inspired by anon_inode_getfile() */
|
/* strongly inspired by anon_inode_getfile() */
|
||||||
@ -91,22 +89,11 @@ static struct file *cxl_getfile(const char *name,
|
|||||||
goto err_fs;
|
goto err_fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
file = ERR_PTR(-ENOMEM);
|
file = alloc_file_pseudo(inode, cxl_vfs_mount, name,
|
||||||
this.name = name;
|
flags & (O_ACCMODE | O_NONBLOCK), fops);
|
||||||
this.len = strlen(name);
|
if (IS_ERR(file))
|
||||||
this.hash = 0;
|
|
||||||
path.dentry = d_alloc_pseudo(cxl_vfs_mount->mnt_sb, &this);
|
|
||||||
if (!path.dentry)
|
|
||||||
goto err_inode;
|
goto err_inode;
|
||||||
|
|
||||||
path.mnt = mntget(cxl_vfs_mount);
|
|
||||||
d_instantiate(path.dentry, inode);
|
|
||||||
|
|
||||||
file = alloc_file(&path, flags & (O_ACCMODE | O_NONBLOCK), fops);
|
|
||||||
if (IS_ERR(file)) {
|
|
||||||
path_put(&path);
|
|
||||||
goto err_fs;
|
|
||||||
}
|
|
||||||
file->private_data = priv;
|
file->private_data = priv;
|
||||||
|
|
||||||
return file;
|
return file;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user