Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
7687a7a4
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
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,发现更多精彩内容 >>
提交
7687a7a4
编写于
2月 20, 2017
作者:
M
Miklos Szeredi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vfs: extract common parts of {compat_,}do_readv_writev()
Signed-off-by:
N
Miklos Szeredi
<
mszeredi@redhat.com
>
上级
bfe219d3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
29 addition
and
51 deletion
+29
-51
fs/read_write.c
fs/read_write.c
+29
-51
未找到文件。
fs/read_write.c
浏览文件 @
7687a7a4
...
...
@@ -834,25 +834,15 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
return
ret
;
}
static
ssize_t
do_readv_writev
(
int
type
,
struct
file
*
file
,
const
struct
iovec
__user
*
uvector
,
unsigned
long
nr_segs
,
loff_t
*
pos
,
int
flags
)
static
ssize_t
__do_readv_writev
(
int
type
,
struct
file
*
file
,
struct
iov_iter
*
iter
,
loff_t
*
pos
,
int
flags
)
{
size_t
tot_len
;
struct
iovec
iovstack
[
UIO_FASTIOV
];
struct
iovec
*
iov
=
iovstack
;
struct
iov_iter
iter
;
ssize_t
ret
;
ssize_t
ret
=
0
;
io_fn_t
fn
;
iter_fn_t
iter_fn
;
ret
=
import_iovec
(
type
,
uvector
,
nr_segs
,
ARRAY_SIZE
(
iovstack
),
&
iov
,
&
iter
);
if
(
ret
<
0
)
return
ret
;
tot_len
=
iov_iter_count
(
&
iter
);
tot_len
=
iov_iter_count
(
iter
);
if
(
!
tot_len
)
goto
out
;
ret
=
rw_verify_area
(
type
,
file
,
pos
,
tot_len
);
...
...
@@ -869,15 +859,14 @@ static ssize_t do_readv_writev(int type, struct file *file,
}
if
(
iter_fn
)
ret
=
do_iter_readv_writev
(
file
,
&
iter
,
pos
,
iter_fn
,
flags
);
ret
=
do_iter_readv_writev
(
file
,
iter
,
pos
,
iter_fn
,
flags
);
else
ret
=
do_loop_readv_writev
(
file
,
&
iter
,
pos
,
fn
,
flags
);
ret
=
do_loop_readv_writev
(
file
,
iter
,
pos
,
fn
,
flags
);
if
(
type
!=
READ
)
file_end_write
(
file
);
out:
kfree
(
iov
);
if
((
ret
+
(
type
==
READ
))
>
0
)
{
if
(
type
==
READ
)
fsnotify_access
(
file
);
...
...
@@ -887,6 +876,27 @@ static ssize_t do_readv_writev(int type, struct file *file,
return
ret
;
}
static
ssize_t
do_readv_writev
(
int
type
,
struct
file
*
file
,
const
struct
iovec
__user
*
uvector
,
unsigned
long
nr_segs
,
loff_t
*
pos
,
int
flags
)
{
struct
iovec
iovstack
[
UIO_FASTIOV
];
struct
iovec
*
iov
=
iovstack
;
struct
iov_iter
iter
;
ssize_t
ret
;
ret
=
import_iovec
(
type
,
uvector
,
nr_segs
,
ARRAY_SIZE
(
iovstack
),
&
iov
,
&
iter
);
if
(
ret
<
0
)
return
ret
;
ret
=
__do_readv_writev
(
type
,
file
,
&
iter
,
pos
,
flags
);
kfree
(
iov
);
return
ret
;
}
ssize_t
vfs_readv
(
struct
file
*
file
,
const
struct
iovec
__user
*
vec
,
unsigned
long
vlen
,
loff_t
*
pos
,
int
flags
)
{
...
...
@@ -1064,51 +1074,19 @@ static ssize_t compat_do_readv_writev(int type, struct file *file,
unsigned
long
nr_segs
,
loff_t
*
pos
,
int
flags
)
{
compat_ssize_t
tot_len
;
struct
iovec
iovstack
[
UIO_FASTIOV
];
struct
iovec
*
iov
=
iovstack
;
struct
iov_iter
iter
;
ssize_t
ret
;
io_fn_t
fn
;
iter_fn_t
iter_fn
;
ret
=
compat_import_iovec
(
type
,
uvector
,
nr_segs
,
UIO_FASTIOV
,
&
iov
,
&
iter
);
if
(
ret
<
0
)
return
ret
;
tot_len
=
iov_iter_count
(
&
iter
);
if
(
!
tot_len
)
goto
out
;
ret
=
rw_verify_area
(
type
,
file
,
pos
,
tot_len
);
if
(
ret
<
0
)
goto
out
;
if
(
type
==
READ
)
{
fn
=
file
->
f_op
->
read
;
iter_fn
=
file
->
f_op
->
read_iter
;
}
else
{
fn
=
(
io_fn_t
)
file
->
f_op
->
write
;
iter_fn
=
file
->
f_op
->
write_iter
;
file_start_write
(
file
);
}
if
(
iter_fn
)
ret
=
do_iter_readv_writev
(
file
,
&
iter
,
pos
,
iter_fn
,
flags
);
else
ret
=
do_loop_readv_writev
(
file
,
&
iter
,
pos
,
fn
,
flags
);
if
(
type
!=
READ
)
file_end_write
(
file
);
out:
ret
=
__do_readv_writev
(
type
,
file
,
&
iter
,
pos
,
flags
);
kfree
(
iov
);
if
((
ret
+
(
type
==
READ
))
>
0
)
{
if
(
type
==
READ
)
fsnotify_access
(
file
);
else
fsnotify_modify
(
file
);
}
return
ret
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录