aboutsummaryrefslogtreecommitdiffstats
path: root/fs/anon_inodes.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/anon_inodes.c')
-rw-r--r--fs/anon_inodes.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
index 598237e97221..9f0bf13291e5 100644
--- a/fs/anon_inodes.c
+++ b/fs/anon_inodes.c
@@ -89,19 +89,11 @@ struct file *anon_inode_getfile(const char *name,
89 struct qstr this; 89 struct qstr this;
90 struct path path; 90 struct path path;
91 struct file *file; 91 struct file *file;
92 fmode_t mode;
93 int error; 92 int error;
94 93
95 if (IS_ERR(anon_inode_inode)) 94 if (IS_ERR(anon_inode_inode))
96 return ERR_PTR(-ENODEV); 95 return ERR_PTR(-ENODEV);
97 96
98 switch (flags & O_ACCMODE) {
99 case O_RDONLY: mode = FMODE_READ; break;
100 case O_WRONLY: mode = FMODE_WRITE; break;
101 case O_RDWR: mode = FMODE_READ | FMODE_WRITE; break;
102 default: return ERR_PTR(-EINVAL);
103 }
104
105 if (fops->owner && !try_module_get(fops->owner)) 97 if (fops->owner && !try_module_get(fops->owner))
106 return ERR_PTR(-ENOENT); 98 return ERR_PTR(-ENOENT);
107 99
@@ -129,7 +121,7 @@ struct file *anon_inode_getfile(const char *name,
129 d_instantiate(path.dentry, anon_inode_inode); 121 d_instantiate(path.dentry, anon_inode_inode);
130 122
131 error = -ENFILE; 123 error = -ENFILE;
132 file = alloc_file(&path, mode, fops); 124 file = alloc_file(&path, OPEN_FMODE(flags), fops);
133 if (!file) 125 if (!file)
134 goto err_dput; 126 goto err_dput;
135 file->f_mapping = anon_inode_inode->i_mapping; 127 file->f_mapping = anon_inode_inode->i_mapping;