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
3d4d3e48
Commit
3d4d3e48
authored
Nov 27, 2014
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iov_iter.c: convert copy_to_iter() to iterate_and_advance
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
0dbca9a4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
82 deletions
+9
-82
mm/iov_iter.c
mm/iov_iter.c
+9
-82
No files found.
mm/iov_iter.c
View file @
3d4d3e48
...
@@ -97,51 +97,6 @@
...
@@ -97,51 +97,6 @@
i->iov_offset = skip; \
i->iov_offset = skip; \
}
}
static
size_t
copy_to_iter_iovec
(
void
*
from
,
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_to_user
(
buf
,
from
,
copy
);
copy
-=
left
;
skip
+=
copy
;
from
+=
copy
;
bytes
-=
copy
;
while
(
unlikely
(
!
left
&&
bytes
))
{
iov
++
;
buf
=
iov
->
iov_base
;
copy
=
min
(
bytes
,
iov
->
iov_len
);
left
=
__copy_to_user
(
buf
,
from
,
copy
);
copy
-=
left
;
skip
=
copy
;
from
+=
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
,
static
size_t
copy_page_to_iter_iovec
(
struct
page
*
page
,
size_t
offset
,
size_t
bytes
,
struct
iov_iter
*
i
)
struct
iov_iter
*
i
)
{
{
...
@@ -360,51 +315,23 @@ static void memzero_page(struct page *page, size_t offset, size_t len)
...
@@ -360,51 +315,23 @@ static void memzero_page(struct page *page, size_t offset, size_t len)
kunmap_atomic
(
addr
);
kunmap_atomic
(
addr
);
}
}
s
tatic
size_t
copy_to_iter_bvec
(
void
*
from
,
size_t
bytes
,
struct
iov_iter
*
i
)
s
ize_t
copy_to_iter
(
void
*
addr
,
size_t
bytes
,
struct
iov_iter
*
i
)
{
{
size_t
skip
,
copy
,
wanted
;
char
*
from
=
addr
;
const
struct
bio_vec
*
bvec
;
if
(
unlikely
(
bytes
>
i
->
count
))
if
(
unlikely
(
bytes
>
i
->
count
))
bytes
=
i
->
count
;
bytes
=
i
->
count
;
if
(
unlikely
(
!
bytes
))
if
(
unlikely
(
!
bytes
))
return
0
;
return
0
;
wanted
=
bytes
;
iterate_and_advance
(
i
,
bytes
,
v
,
bvec
=
i
->
bvec
;
__copy_to_user
(
v
.
iov_base
,
(
from
+=
v
.
iov_len
)
-
v
.
iov_len
,
skip
=
i
->
iov_offset
;
v
.
iov_len
),
copy
=
min_t
(
size_t
,
bytes
,
bvec
->
bv_len
-
skip
);
memcpy_to_page
(
v
.
bv_page
,
v
.
bv_offset
,
(
from
+=
v
.
bv_len
)
-
v
.
bv_len
,
v
.
bv_len
)
memcpy_to_page
(
bvec
->
bv_page
,
skip
+
bvec
->
bv_offset
,
from
,
copy
);
)
skip
+=
copy
;
from
+=
copy
;
bytes
-=
copy
;
while
(
bytes
)
{
bvec
++
;
copy
=
min
(
bytes
,
(
size_t
)
bvec
->
bv_len
);
memcpy_to_page
(
bvec
->
bv_page
,
bvec
->
bv_offset
,
from
,
copy
);
skip
=
copy
;
from
+=
copy
;
bytes
-=
copy
;
}
if
(
skip
==
bvec
->
bv_len
)
{
bvec
++
;
skip
=
0
;
}
i
->
count
-=
wanted
-
bytes
;
i
->
nr_segs
-=
bvec
-
i
->
bvec
;
i
->
bvec
=
bvec
;
i
->
iov_offset
=
skip
;
return
wanted
-
bytes
;
}
size_t
copy_to_iter
(
void
*
addr
,
size_t
bytes
,
struct
iov_iter
*
i
)
return
bytes
;
{
if
(
i
->
type
&
ITER_BVEC
)
return
copy_to_iter_bvec
(
addr
,
bytes
,
i
);
else
return
copy_to_iter_iovec
(
addr
,
bytes
,
i
);
}
}
EXPORT_SYMBOL
(
copy_to_iter
);
EXPORT_SYMBOL
(
copy_to_iter
);
...
...
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