diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2009-08-08 15:56:29 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-16 12:16:42 -0500 |
commit | 3d1e463158febf6e047897597722f768b15350cd (patch) | |
tree | f218ad1ccb0b8d7d2b18814e209ed97b2724ecc8 /fs/file_table.c | |
parent | cc3808f8c354889982e7e323050f1e50ad99a009 (diff) |
get rid of init_file()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/file_table.c')
-rw-r--r-- | fs/file_table.c | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/fs/file_table.c b/fs/file_table.c index f906ac8c9a9f..602a9ee3023a 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
@@ -171,32 +171,6 @@ struct file *alloc_file(struct vfsmount *mnt, struct dentry *dentry, | |||
171 | if (!file) | 171 | if (!file) |
172 | return NULL; | 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 | file->f_path.dentry = dentry; | 174 | file->f_path.dentry = dentry; |
201 | file->f_path.mnt = mntget(mnt); | 175 | file->f_path.mnt = mntget(mnt); |
202 | file->f_mapping = dentry->d_inode->i_mapping; | 176 | file->f_mapping = dentry->d_inode->i_mapping; |
@@ -210,13 +184,13 @@ int init_file(struct file *file, struct vfsmount *mnt, struct dentry *dentry, | |||
210 | * that we can do debugging checks at __fput() | 184 | * that we can do debugging checks at __fput() |
211 | */ | 185 | */ |
212 | if ((mode & FMODE_WRITE) && !special_file(dentry->d_inode->i_mode)) { | 186 | if ((mode & FMODE_WRITE) && !special_file(dentry->d_inode->i_mode)) { |
187 | int error = 0; | ||
213 | file_take_write(file); | 188 | file_take_write(file); |
214 | error = mnt_clone_write(mnt); | 189 | error = mnt_clone_write(mnt); |
215 | WARN_ON(error); | 190 | WARN_ON(error); |
216 | } | 191 | } |
217 | return error; | 192 | return file; |
218 | } | 193 | } |
219 | EXPORT_SYMBOL(init_file); | ||
220 | 194 | ||
221 | void fput(struct file *file) | 195 | void fput(struct file *file) |
222 | { | 196 | { |