Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
7995bd28
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
153
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7995bd28
编写于
6月 20, 2013
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
splice: don't pass the address of ->f_pos to methods
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
c9036e9f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
41 addition
and
23 deletion
+41
-23
fs/internal.h
fs/internal.h
+6
-0
fs/read_write.c
fs/read_write.c
+16
-8
fs/splice.c
fs/splice.c
+18
-13
include/linux/fs.h
include/linux/fs.h
+0
-2
include/linux/splice.h
include/linux/splice.h
+1
-0
未找到文件。
fs/internal.h
浏览文件 @
7995bd28
...
...
@@ -131,6 +131,12 @@ extern struct dentry *__d_alloc(struct super_block *, const struct qstr *);
*/
extern
ssize_t
__kernel_write
(
struct
file
*
,
const
char
*
,
size_t
,
loff_t
*
);
/*
* splice.c
*/
extern
long
do_splice_direct
(
struct
file
*
in
,
loff_t
*
ppos
,
struct
file
*
out
,
loff_t
*
opos
,
size_t
len
,
unsigned
int
flags
);
/*
* pipe.c
*/
...
...
fs/read_write.c
浏览文件 @
7995bd28
...
...
@@ -1064,6 +1064,7 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
struct
fd
in
,
out
;
struct
inode
*
in_inode
,
*
out_inode
;
loff_t
pos
;
loff_t
out_pos
;
ssize_t
retval
;
int
fl
;
...
...
@@ -1077,12 +1078,14 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
if
(
!
(
in
.
file
->
f_mode
&
FMODE_READ
))
goto
fput_in
;
retval
=
-
ESPIPE
;
if
(
!
ppos
)
ppos
=
&
in
.
file
->
f_pos
;
else
if
(
!
ppos
)
{
pos
=
in
.
file
->
f_pos
;
}
else
{
pos
=
*
ppos
;
if
(
!
(
in
.
file
->
f_mode
&
FMODE_PREAD
))
goto
fput_in
;
retval
=
rw_verify_area
(
READ
,
in
.
file
,
ppos
,
count
);
}
retval
=
rw_verify_area
(
READ
,
in
.
file
,
&
pos
,
count
);
if
(
retval
<
0
)
goto
fput_in
;
count
=
retval
;
...
...
@@ -1099,7 +1102,8 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
retval
=
-
EINVAL
;
in_inode
=
file_inode
(
in
.
file
);
out_inode
=
file_inode
(
out
.
file
);
retval
=
rw_verify_area
(
WRITE
,
out
.
file
,
&
out
.
file
->
f_pos
,
count
);
out_pos
=
out
.
file
->
f_pos
;
retval
=
rw_verify_area
(
WRITE
,
out
.
file
,
&
out_pos
,
count
);
if
(
retval
<
0
)
goto
fput_out
;
count
=
retval
;
...
...
@@ -1107,7 +1111,6 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
if
(
!
max
)
max
=
min
(
in_inode
->
i_sb
->
s_maxbytes
,
out_inode
->
i_sb
->
s_maxbytes
);
pos
=
*
ppos
;
if
(
unlikely
(
pos
+
count
>
max
))
{
retval
=
-
EOVERFLOW
;
if
(
pos
>=
max
)
...
...
@@ -1126,18 +1129,23 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
if (in.file->f_flags & O_NONBLOCK)
fl = SPLICE_F_NONBLOCK;
#endif
retval
=
do_splice_direct
(
in
.
file
,
ppos
,
out
.
file
,
count
,
fl
);
retval
=
do_splice_direct
(
in
.
file
,
&
pos
,
out
.
file
,
&
out_pos
,
count
,
fl
);
if
(
retval
>
0
)
{
add_rchar
(
current
,
retval
);
add_wchar
(
current
,
retval
);
fsnotify_access
(
in
.
file
);
fsnotify_modify
(
out
.
file
);
out
.
file
->
f_pos
=
out_pos
;
if
(
ppos
)
*
ppos
=
pos
;
else
in
.
file
->
f_pos
=
pos
;
}
inc_syscr
(
current
);
inc_syscw
(
current
);
if
(
*
p
pos
>
max
)
if
(
pos
>
max
)
retval
=
-
EOVERFLOW
;
fput_out:
...
...
fs/splice.c
浏览文件 @
7995bd28
...
...
@@ -1274,7 +1274,7 @@ static int direct_splice_actor(struct pipe_inode_info *pipe,
{
struct
file
*
file
=
sd
->
u
.
file
;
return
do_splice_from
(
pipe
,
file
,
&
file
->
f_
pos
,
sd
->
total_len
,
return
do_splice_from
(
pipe
,
file
,
sd
->
o
pos
,
sd
->
total_len
,
sd
->
flags
);
}
...
...
@@ -1294,7 +1294,7 @@ static int direct_splice_actor(struct pipe_inode_info *pipe,
*
*/
long
do_splice_direct
(
struct
file
*
in
,
loff_t
*
ppos
,
struct
file
*
out
,
size_t
len
,
unsigned
int
flags
)
loff_t
*
opos
,
size_t
len
,
unsigned
int
flags
)
{
struct
splice_desc
sd
=
{
.
len
=
len
,
...
...
@@ -1302,6 +1302,7 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
.
flags
=
flags
,
.
pos
=
*
ppos
,
.
u
.
file
=
out
,
.
opos
=
opos
,
};
long
ret
;
...
...
@@ -1325,7 +1326,7 @@ static long do_splice(struct file *in, loff_t __user *off_in,
{
struct
pipe_inode_info
*
ipipe
;
struct
pipe_inode_info
*
opipe
;
loff_t
offset
,
*
off
;
loff_t
offset
;
long
ret
;
ipipe
=
get_pipe_info
(
in
);
...
...
@@ -1356,13 +1357,15 @@ static long do_splice(struct file *in, loff_t __user *off_in,
return
-
EINVAL
;
if
(
copy_from_user
(
&
offset
,
off_out
,
sizeof
(
loff_t
)))
return
-
EFAULT
;
off
=
&
offset
;
}
else
off
=
&
out
->
f_pos
;
}
else
{
offset
=
out
->
f_pos
;
}
ret
=
do_splice_from
(
ipipe
,
out
,
off
,
len
,
flags
);
ret
=
do_splice_from
(
ipipe
,
out
,
&
offset
,
len
,
flags
);
if
(
off_out
&&
copy_to_user
(
off_out
,
off
,
sizeof
(
loff_t
)))
if
(
!
off_out
)
out
->
f_pos
=
offset
;
else
if
(
copy_to_user
(
off_out
,
&
offset
,
sizeof
(
loff_t
)))
ret
=
-
EFAULT
;
return
ret
;
...
...
@@ -1376,13 +1379,15 @@ static long do_splice(struct file *in, loff_t __user *off_in,
return
-
EINVAL
;
if
(
copy_from_user
(
&
offset
,
off_in
,
sizeof
(
loff_t
)))
return
-
EFAULT
;
off
=
&
offset
;
}
else
off
=
&
in
->
f_pos
;
}
else
{
offset
=
in
->
f_pos
;
}
ret
=
do_splice_to
(
in
,
off
,
opipe
,
len
,
flags
);
ret
=
do_splice_to
(
in
,
&
offset
,
opipe
,
len
,
flags
);
if
(
off_in
&&
copy_to_user
(
off_in
,
off
,
sizeof
(
loff_t
)))
if
(
!
off_in
)
in
->
f_pos
=
offset
;
else
if
(
copy_to_user
(
off_in
,
&
offset
,
sizeof
(
loff_t
)))
ret
=
-
EFAULT
;
return
ret
;
...
...
include/linux/fs.h
浏览文件 @
7995bd28
...
...
@@ -2414,8 +2414,6 @@ extern ssize_t generic_file_splice_write(struct pipe_inode_info *,
struct
file
*
,
loff_t
*
,
size_t
,
unsigned
int
);
extern
ssize_t
generic_splice_sendpage
(
struct
pipe_inode_info
*
pipe
,
struct
file
*
out
,
loff_t
*
,
size_t
len
,
unsigned
int
flags
);
extern
long
do_splice_direct
(
struct
file
*
in
,
loff_t
*
ppos
,
struct
file
*
out
,
size_t
len
,
unsigned
int
flags
);
extern
void
file_ra_state_init
(
struct
file_ra_state
*
ra
,
struct
address_space
*
mapping
);
...
...
include/linux/splice.h
浏览文件 @
7995bd28
...
...
@@ -35,6 +35,7 @@ struct splice_desc {
void
*
data
;
/* cookie */
}
u
;
loff_t
pos
;
/* file position */
loff_t
*
opos
;
/* sendfile: output position */
size_t
num_spliced
;
/* number of bytes already spliced */
bool
need_wakeup
;
/* need to wake up writer */
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录