summaryrefslogtreecommitdiff
path: root/fs/file_table.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-08-08 23:56:29 +0400
committerAl Viro <viro@zeniv.linux.org.uk>2009-12-16 12:16:42 -0500
commit3d1e463158febf6e047897597722f768b15350cd (patch)
treef218ad1ccb0b8d7d2b18814e209ed97b2724ecc8 /fs/file_table.c
parentcc3808f8c354889982e7e323050f1e50ad99a009 (diff)
downloadlwn-3d1e463158febf6e047897597722f768b15350cd.tar.gz
lwn-3d1e463158febf6e047897597722f768b15350cd.zip
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.c30
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,
if (!file)
return NULL;
- init_file(file, mnt, dentry, mode, fop);
- return file;
-}
-EXPORT_SYMBOL(alloc_file);
-
-/**
- * init_file - initialize a 'struct file'
- * @file: the already allocated 'struct file' to initialized
- * @mnt: the vfsmount on which the file resides
- * @dentry: the dentry representing this file
- * @mode: the mode the file is opened with
- * @fop: the 'struct file_operations' for this file
- *
- * Use this instead of setting the members directly. Doing so
- * avoids making mistakes like forgetting the mntget() or
- * forgetting to take a write on the mnt.
- *
- * Note: This is a crappy interface. It is here to make
- * merging with the existing users of get_empty_filp()
- * who have complex failure logic easier. All users
- * of this should be moving to alloc_file().
- */
-int init_file(struct file *file, struct vfsmount *mnt, struct dentry *dentry,
- fmode_t mode, const struct file_operations *fop)
-{
- int error = 0;
file->f_path.dentry = dentry;
file->f_path.mnt = mntget(mnt);
file->f_mapping = dentry->d_inode->i_mapping;
@@ -210,13 +184,13 @@ int init_file(struct file *file, struct vfsmount *mnt, struct dentry *dentry,
* that we can do debugging checks at __fput()
*/
if ((mode & FMODE_WRITE) && !special_file(dentry->d_inode->i_mode)) {
+ int error = 0;
file_take_write(file);
error = mnt_clone_write(mnt);
WARN_ON(error);
}
- return error;
+ return file;
}
-EXPORT_SYMBOL(init_file);
void fput(struct file *file)
{