Commit 3d1e463158febf6e047897597722f768b15350cd
1 parent
cc3808f8c3
Exists in
master
and in
4 other branches
get rid of init_file()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 2 changed files with 2 additions and 31 deletions Side-by-side Diff
fs/file_table.c
... | ... | @@ -171,32 +171,6 @@ |
171 | 171 | if (!file) |
172 | 172 | return NULL; |
173 | 173 | |
174 | - init_file(file, mnt, dentry, mode, fop); | |
175 | - return file; | |
176 | -} | |
177 | -EXPORT_SYMBOL(alloc_file); | |
178 | - | |
179 | -/** | |
180 | - * init_file - initialize a 'struct file' | |
181 | - * @file: the already allocated 'struct file' to initialized | |
182 | - * @mnt: the vfsmount on which the file resides | |
183 | - * @dentry: the dentry representing this file | |
184 | - * @mode: the mode the file is opened with | |
185 | - * @fop: the 'struct file_operations' for this file | |
186 | - * | |
187 | - * Use this instead of setting the members directly. Doing so | |
188 | - * avoids making mistakes like forgetting the mntget() or | |
189 | - * forgetting to take a write on the mnt. | |
190 | - * | |
191 | - * Note: This is a crappy interface. It is here to make | |
192 | - * merging with the existing users of get_empty_filp() | |
193 | - * who have complex failure logic easier. All users | |
194 | - * of this should be moving to alloc_file(). | |
195 | - */ | |
196 | -int init_file(struct file *file, struct vfsmount *mnt, struct dentry *dentry, | |
197 | - fmode_t mode, const struct file_operations *fop) | |
198 | -{ | |
199 | - int error = 0; | |
200 | 174 | file->f_path.dentry = dentry; |
201 | 175 | file->f_path.mnt = mntget(mnt); |
202 | 176 | file->f_mapping = dentry->d_inode->i_mapping; |
203 | 177 | |
204 | 178 | |
... | ... | @@ -210,13 +184,13 @@ |
210 | 184 | * that we can do debugging checks at __fput() |
211 | 185 | */ |
212 | 186 | if ((mode & FMODE_WRITE) && !special_file(dentry->d_inode->i_mode)) { |
187 | + int error = 0; | |
213 | 188 | file_take_write(file); |
214 | 189 | error = mnt_clone_write(mnt); |
215 | 190 | WARN_ON(error); |
216 | 191 | } |
217 | - return error; | |
192 | + return file; | |
218 | 193 | } |
219 | -EXPORT_SYMBOL(init_file); | |
220 | 194 | |
221 | 195 | void fput(struct file *file) |
222 | 196 | { |
include/linux/file.h
... | ... | @@ -18,9 +18,6 @@ |
18 | 18 | struct file_operations; |
19 | 19 | struct vfsmount; |
20 | 20 | struct dentry; |
21 | -extern int init_file(struct file *, struct vfsmount *mnt, | |
22 | - struct dentry *dentry, fmode_t mode, | |
23 | - const struct file_operations *fop); | |
24 | 21 | extern struct file *alloc_file(struct vfsmount *, struct dentry *dentry, |
25 | 22 | fmode_t mode, const struct file_operations *fop); |
26 | 23 |