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
faa97c48
Commit
faa97c48
authored
Jan 25, 2021
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
take the guts of file-to-pipe splice into a helper function
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
313d64a3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
fs/splice.c
fs/splice.c
+18
-7
No files found.
fs/splice.c
View file @
faa97c48
...
...
@@ -1002,6 +1002,23 @@ static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe,
struct
pipe_inode_info
*
opipe
,
size_t
len
,
unsigned
int
flags
);
static
long
splice_file_to_pipe
(
struct
file
*
in
,
struct
pipe_inode_info
*
opipe
,
loff_t
*
offset
,
size_t
len
,
unsigned
int
flags
)
{
long
ret
;
pipe_lock
(
opipe
);
ret
=
wait_for_space
(
opipe
,
flags
);
if
(
!
ret
)
ret
=
do_splice_to
(
in
,
offset
,
opipe
,
len
,
flags
);
pipe_unlock
(
opipe
);
if
(
ret
>
0
)
wakeup_pipe_readers
(
opipe
);
return
ret
;
}
/*
* Determine where to splice to/from.
*/
...
...
@@ -1081,13 +1098,7 @@ long do_splice(struct file *in, loff_t *off_in, struct file *out,
if
(
out
->
f_flags
&
O_NONBLOCK
)
flags
|=
SPLICE_F_NONBLOCK
;
pipe_lock
(
opipe
);
ret
=
wait_for_space
(
opipe
,
flags
);
if
(
!
ret
)
ret
=
do_splice_to
(
in
,
&
offset
,
opipe
,
len
,
flags
);
pipe_unlock
(
opipe
);
if
(
ret
>
0
)
wakeup_pipe_readers
(
opipe
);
ret
=
splice_file_to_pipe
(
in
,
opipe
,
&
offset
,
len
,
flags
);
if
(
!
off_in
)
in
->
f_pos
=
offset
;
else
...
...
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