Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177389
b: refs/heads/master
c: 3d1e463
h: refs/heads/master
i:
  177387: b7aa293
v: v3
  • Loading branch information
Al Viro committed Dec 16, 2009
1 parent 2c74ae8 commit 1352dd0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 32 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cc3808f8c354889982e7e323050f1e50ad99a009
refs/heads/master: 3d1e463158febf6e047897597722f768b15350cd
30 changes: 2 additions & 28 deletions trunk/fs/file_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
{
Expand Down
3 changes: 0 additions & 3 deletions trunk/include/linux/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ extern void drop_file_write_access(struct file *file);
struct file_operations;
struct vfsmount;
struct dentry;
extern int init_file(struct file *, struct vfsmount *mnt,
struct dentry *dentry, fmode_t mode,
const struct file_operations *fop);
extern struct file *alloc_file(struct vfsmount *, struct dentry *dentry,
fmode_t mode, const struct file_operations *fop);

Expand Down

0 comments on commit 1352dd0

Please sign in to comment.