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
Kirill Smelkov
linux
Commits
53ad8626
Commit
53ad8626
authored
May 13, 2020
by
Christoph Hellwig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs: remove __vfs_write
Fold it into the two callers. Signed-off-by:
Christoph Hellwig
<
hch@lst.de
>
parent
81238b2c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
24 deletions
+22
-24
fs/read_write.c
fs/read_write.c
+22
-24
No files found.
fs/read_write.c
View file @
53ad8626
...
...
@@ -488,17 +488,6 @@ static ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t
return
ret
;
}
static
ssize_t
__vfs_write
(
struct
file
*
file
,
const
char
__user
*
p
,
size_t
count
,
loff_t
*
pos
)
{
if
(
file
->
f_op
->
write
)
return
file
->
f_op
->
write
(
file
,
p
,
count
,
pos
);
else
if
(
file
->
f_op
->
write_iter
)
return
new_sync_write
(
file
,
p
,
count
,
pos
);
else
return
-
EINVAL
;
}
/* caller is responsible for file_start_write/file_end_write */
ssize_t
__kernel_write
(
struct
file
*
file
,
const
void
*
buf
,
size_t
count
,
loff_t
*
pos
)
{
...
...
@@ -516,7 +505,12 @@ ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t
p
=
(
__force
const
char
__user
*
)
buf
;
if
(
count
>
MAX_RW_COUNT
)
count
=
MAX_RW_COUNT
;
ret
=
__vfs_write
(
file
,
p
,
count
,
pos
);
if
(
file
->
f_op
->
write
)
ret
=
file
->
f_op
->
write
(
file
,
p
,
count
,
pos
);
else
if
(
file
->
f_op
->
write_iter
)
ret
=
new_sync_write
(
file
,
p
,
count
,
pos
);
else
ret
=
-
EINVAL
;
set_fs
(
old_fs
);
if
(
ret
>
0
)
{
fsnotify_modify
(
file
);
...
...
@@ -554,19 +548,23 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_
return
-
EFAULT
;
ret
=
rw_verify_area
(
WRITE
,
file
,
pos
,
count
);
if
(
!
ret
)
{
if
(
count
>
MAX_RW_COUNT
)
count
=
MAX_RW_COUNT
;
file_start_write
(
file
);
ret
=
__vfs_write
(
file
,
buf
,
count
,
pos
);
if
(
ret
>
0
)
{
fsnotify_modify
(
file
);
add_wchar
(
current
,
ret
);
}
inc_syscw
(
current
);
file_end_write
(
file
);
if
(
ret
)
return
ret
;
if
(
count
>
MAX_RW_COUNT
)
count
=
MAX_RW_COUNT
;
file_start_write
(
file
);
if
(
file
->
f_op
->
write
)
ret
=
file
->
f_op
->
write
(
file
,
buf
,
count
,
pos
);
else
if
(
file
->
f_op
->
write_iter
)
ret
=
new_sync_write
(
file
,
buf
,
count
,
pos
);
else
ret
=
-
EINVAL
;
if
(
ret
>
0
)
{
fsnotify_modify
(
file
);
add_wchar
(
current
,
ret
);
}
inc_syscw
(
current
);
file_end_write
(
file
);
return
ret
;
}
...
...
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