Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
3d1e4631
Commit
3d1e4631
authored
Aug 08, 2009
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get rid of init_file()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
cc3808f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
31 deletions
+2
-31
fs/file_table.c
fs/file_table.c
+2
-28
include/linux/file.h
include/linux/file.h
+0
-3
No files found.
fs/file_table.c
View file @
3d1e4631
...
@@ -171,32 +171,6 @@ struct file *alloc_file(struct vfsmount *mnt, struct dentry *dentry,
...
@@ -171,32 +171,6 @@ struct file *alloc_file(struct vfsmount *mnt, struct dentry *dentry,
if
(
!
file
)
if
(
!
file
)
return
NULL
;
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
.
dentry
=
dentry
;
file
->
f_path
.
mnt
=
mntget
(
mnt
);
file
->
f_path
.
mnt
=
mntget
(
mnt
);
file
->
f_mapping
=
dentry
->
d_inode
->
i_mapping
;
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,13 +184,13 @@ int init_file(struct file *file, struct vfsmount *mnt, struct dentry *dentry,
* that we can do debugging checks at __fput()
* that we can do debugging checks at __fput()
*/
*/
if
((
mode
&
FMODE_WRITE
)
&&
!
special_file
(
dentry
->
d_inode
->
i_mode
))
{
if
((
mode
&
FMODE_WRITE
)
&&
!
special_file
(
dentry
->
d_inode
->
i_mode
))
{
int
error
=
0
;
file_take_write
(
file
);
file_take_write
(
file
);
error
=
mnt_clone_write
(
mnt
);
error
=
mnt_clone_write
(
mnt
);
WARN_ON
(
error
);
WARN_ON
(
error
);
}
}
return
error
;
return
file
;
}
}
EXPORT_SYMBOL
(
init_file
);
void
fput
(
struct
file
*
file
)
void
fput
(
struct
file
*
file
)
{
{
...
...
include/linux/file.h
View file @
3d1e4631
...
@@ -18,9 +18,6 @@ extern void drop_file_write_access(struct file *file);
...
@@ -18,9 +18,6 @@ extern void drop_file_write_access(struct file *file);
struct
file_operations
;
struct
file_operations
;
struct
vfsmount
;
struct
vfsmount
;
struct
dentry
;
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
,
extern
struct
file
*
alloc_file
(
struct
vfsmount
*
,
struct
dentry
*
dentry
,
fmode_t
mode
,
const
struct
file_operations
*
fop
);
fmode_t
mode
,
const
struct
file_operations
*
fop
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment