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
493c84c0
Commit
493c84c0
authored
Apr 03, 2015
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new helper: __vfs_write()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
c48722c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
12 deletions
+17
-12
fs/read_write.c
fs/read_write.c
+16
-12
include/linux/fs.h
include/linux/fs.h
+1
-0
No files found.
fs/read_write.c
View file @
493c84c0
...
@@ -527,6 +527,20 @@ ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, lo
...
@@ -527,6 +527,20 @@ ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, lo
EXPORT_SYMBOL
(
new_sync_write
);
EXPORT_SYMBOL
(
new_sync_write
);
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
->
aio_write
)
return
do_sync_write
(
file
,
p
,
count
,
pos
);
else
if
(
file
->
f_op
->
write_iter
)
return
new_sync_write
(
file
,
p
,
count
,
pos
);
else
return
-
EINVAL
;
}
EXPORT_SYMBOL
(
__vfs_write
);
ssize_t
__kernel_write
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
loff_t
*
pos
)
ssize_t
__kernel_write
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
loff_t
*
pos
)
{
{
mm_segment_t
old_fs
;
mm_segment_t
old_fs
;
...
@@ -541,12 +555,7 @@ ssize_t __kernel_write(struct file *file, const char *buf, size_t count, loff_t
...
@@ -541,12 +555,7 @@ ssize_t __kernel_write(struct file *file, const char *buf, size_t count, loff_t
p
=
(
__force
const
char
__user
*
)
buf
;
p
=
(
__force
const
char
__user
*
)
buf
;
if
(
count
>
MAX_RW_COUNT
)
if
(
count
>
MAX_RW_COUNT
)
count
=
MAX_RW_COUNT
;
count
=
MAX_RW_COUNT
;
if
(
file
->
f_op
->
write
)
ret
=
__vfs_write
(
file
,
p
,
count
,
pos
);
ret
=
file
->
f_op
->
write
(
file
,
p
,
count
,
pos
);
else
if
(
file
->
f_op
->
aio_write
)
ret
=
do_sync_write
(
file
,
p
,
count
,
pos
);
else
ret
=
new_sync_write
(
file
,
p
,
count
,
pos
);
set_fs
(
old_fs
);
set_fs
(
old_fs
);
if
(
ret
>
0
)
{
if
(
ret
>
0
)
{
fsnotify_modify
(
file
);
fsnotify_modify
(
file
);
...
@@ -573,12 +582,7 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_
...
@@ -573,12 +582,7 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_
if
(
ret
>=
0
)
{
if
(
ret
>=
0
)
{
count
=
ret
;
count
=
ret
;
file_start_write
(
file
);
file_start_write
(
file
);
if
(
file
->
f_op
->
write
)
ret
=
__vfs_write
(
file
,
buf
,
count
,
pos
);
ret
=
file
->
f_op
->
write
(
file
,
buf
,
count
,
pos
);
else
if
(
file
->
f_op
->
aio_write
)
ret
=
do_sync_write
(
file
,
buf
,
count
,
pos
);
else
ret
=
new_sync_write
(
file
,
buf
,
count
,
pos
);
if
(
ret
>
0
)
{
if
(
ret
>
0
)
{
fsnotify_modify
(
file
);
fsnotify_modify
(
file
);
add_wchar
(
current
,
ret
);
add_wchar
(
current
,
ret
);
...
...
include/linux/fs.h
View file @
493c84c0
...
@@ -1639,6 +1639,7 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
...
@@ -1639,6 +1639,7 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
struct
iovec
**
ret_pointer
);
struct
iovec
**
ret_pointer
);
extern
ssize_t
__vfs_read
(
struct
file
*
,
char
__user
*
,
size_t
,
loff_t
*
);
extern
ssize_t
__vfs_read
(
struct
file
*
,
char
__user
*
,
size_t
,
loff_t
*
);
extern
ssize_t
__vfs_write
(
struct
file
*
,
const
char
__user
*
,
size_t
,
loff_t
*
);
extern
ssize_t
vfs_read
(
struct
file
*
,
char
__user
*
,
size_t
,
loff_t
*
);
extern
ssize_t
vfs_read
(
struct
file
*
,
char
__user
*
,
size_t
,
loff_t
*
);
extern
ssize_t
vfs_write
(
struct
file
*
,
const
char
__user
*
,
size_t
,
loff_t
*
);
extern
ssize_t
vfs_write
(
struct
file
*
,
const
char
__user
*
,
size_t
,
loff_t
*
);
extern
ssize_t
vfs_readv
(
struct
file
*
,
const
struct
iovec
__user
*
,
extern
ssize_t
vfs_readv
(
struct
file
*
,
const
struct
iovec
__user
*
,
...
...
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