Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
0dbca9a4
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
161
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看板
提交
0dbca9a4
编写于
11月 27, 2014
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
iov_iter.c: convert copy_from_iter() to iterate_and_advance
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
d271524a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
15 addition
and
91 deletion
+15
-91
mm/iov_iter.c
mm/iov_iter.c
+15
-91
未找到文件。
mm/iov_iter.c
浏览文件 @
0dbca9a4
...
...
@@ -142,51 +142,6 @@ static size_t copy_to_iter_iovec(void *from, size_t bytes, struct iov_iter *i)
return
wanted
-
bytes
;
}
static
size_t
copy_from_iter_iovec
(
void
*
to
,
size_t
bytes
,
struct
iov_iter
*
i
)
{
size_t
skip
,
copy
,
left
,
wanted
;
const
struct
iovec
*
iov
;
char
__user
*
buf
;
if
(
unlikely
(
bytes
>
i
->
count
))
bytes
=
i
->
count
;
if
(
unlikely
(
!
bytes
))
return
0
;
wanted
=
bytes
;
iov
=
i
->
iov
;
skip
=
i
->
iov_offset
;
buf
=
iov
->
iov_base
+
skip
;
copy
=
min
(
bytes
,
iov
->
iov_len
-
skip
);
left
=
__copy_from_user
(
to
,
buf
,
copy
);
copy
-=
left
;
skip
+=
copy
;
to
+=
copy
;
bytes
-=
copy
;
while
(
unlikely
(
!
left
&&
bytes
))
{
iov
++
;
buf
=
iov
->
iov_base
;
copy
=
min
(
bytes
,
iov
->
iov_len
);
left
=
__copy_from_user
(
to
,
buf
,
copy
);
copy
-=
left
;
skip
=
copy
;
to
+=
copy
;
bytes
-=
copy
;
}
if
(
skip
==
iov
->
iov_len
)
{
iov
++
;
skip
=
0
;
}
i
->
count
-=
wanted
-
bytes
;
i
->
nr_segs
-=
iov
-
i
->
iov
;
i
->
iov
=
iov
;
i
->
iov_offset
=
skip
;
return
wanted
-
bytes
;
}
static
size_t
copy_page_to_iter_iovec
(
struct
page
*
page
,
size_t
offset
,
size_t
bytes
,
struct
iov_iter
*
i
)
{
...
...
@@ -444,48 +399,6 @@ static size_t copy_to_iter_bvec(void *from, size_t bytes, struct iov_iter *i)
return
wanted
-
bytes
;
}
static
size_t
copy_from_iter_bvec
(
void
*
to
,
size_t
bytes
,
struct
iov_iter
*
i
)
{
size_t
skip
,
copy
,
wanted
;
const
struct
bio_vec
*
bvec
;
if
(
unlikely
(
bytes
>
i
->
count
))
bytes
=
i
->
count
;
if
(
unlikely
(
!
bytes
))
return
0
;
wanted
=
bytes
;
bvec
=
i
->
bvec
;
skip
=
i
->
iov_offset
;
copy
=
min
(
bytes
,
bvec
->
bv_len
-
skip
);
memcpy_from_page
(
to
,
bvec
->
bv_page
,
bvec
->
bv_offset
+
skip
,
copy
);
to
+=
copy
;
skip
+=
copy
;
bytes
-=
copy
;
while
(
bytes
)
{
bvec
++
;
copy
=
min
(
bytes
,
(
size_t
)
bvec
->
bv_len
);
memcpy_from_page
(
to
,
bvec
->
bv_page
,
bvec
->
bv_offset
,
copy
);
skip
=
copy
;
to
+=
copy
;
bytes
-=
copy
;
}
if
(
skip
==
bvec
->
bv_len
)
{
bvec
++
;
skip
=
0
;
}
i
->
count
-=
wanted
;
i
->
nr_segs
-=
bvec
-
i
->
bvec
;
i
->
bvec
=
bvec
;
i
->
iov_offset
=
skip
;
return
wanted
;
}
size_t
copy_to_iter
(
void
*
addr
,
size_t
bytes
,
struct
iov_iter
*
i
)
{
if
(
i
->
type
&
ITER_BVEC
)
...
...
@@ -497,10 +410,21 @@ EXPORT_SYMBOL(copy_to_iter);
size_t
copy_from_iter
(
void
*
addr
,
size_t
bytes
,
struct
iov_iter
*
i
)
{
if
(
i
->
type
&
ITER_BVEC
)
return
copy_from_iter_bvec
(
addr
,
bytes
,
i
);
else
return
copy_from_iter_iovec
(
addr
,
bytes
,
i
);
char
*
to
=
addr
;
if
(
unlikely
(
bytes
>
i
->
count
))
bytes
=
i
->
count
;
if
(
unlikely
(
!
bytes
))
return
0
;
iterate_and_advance
(
i
,
bytes
,
v
,
__copy_from_user
((
to
+=
v
.
iov_len
)
-
v
.
iov_len
,
v
.
iov_base
,
v
.
iov_len
),
memcpy_from_page
((
to
+=
v
.
bv_len
)
-
v
.
bv_len
,
v
.
bv_page
,
v
.
bv_offset
,
v
.
bv_len
)
)
return
bytes
;
}
EXPORT_SYMBOL
(
copy_from_iter
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录