Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
cd347240
Commit
cd347240
authored
Jun 19, 2014
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iov: Add iov_init() helper
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
bb7ac03a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
page-pipe.c
page-pipe.c
+8
-9
No files found.
page-pipe.c
View file @
cd347240
...
@@ -19,6 +19,12 @@ static inline bool iov_grow_page(struct iovec *iov, unsigned long addr)
...
@@ -19,6 +19,12 @@ static inline bool iov_grow_page(struct iovec *iov, unsigned long addr)
return
false
;
return
false
;
}
}
static
inline
void
iov_init
(
struct
iovec
*
iov
,
unsigned
long
addr
)
{
iov
->
iov_base
=
(
void
*
)
addr
;
iov
->
iov_len
=
PAGE_SIZE
;
}
static
int
page_pipe_grow
(
struct
page_pipe
*
pp
)
static
int
page_pipe_grow
(
struct
page_pipe
*
pp
)
{
{
struct
page_pipe_buf
*
ppb
;
struct
page_pipe_buf
*
ppb
;
...
@@ -150,9 +156,7 @@ static inline int try_add_page_to(struct page_pipe *pp, struct page_pipe_buf *pp
...
@@ -150,9 +156,7 @@ static inline int try_add_page_to(struct page_pipe *pp, struct page_pipe_buf *pp
pr_debug
(
"Add iov to page pipe (%u iovs, %u/%u total)
\n
"
,
pr_debug
(
"Add iov to page pipe (%u iovs, %u/%u total)
\n
"
,
ppb
->
nr_segs
,
pp
->
free_iov
,
pp
->
nr_iovs
);
ppb
->
nr_segs
,
pp
->
free_iov
,
pp
->
nr_iovs
);
ppb
->
iov
[
ppb
->
nr_segs
].
iov_base
=
(
void
*
)
addr
;
iov_init
(
&
ppb
->
iov
[
ppb
->
nr_segs
++
],
addr
);
ppb
->
iov
[
ppb
->
nr_segs
].
iov_len
=
PAGE_SIZE
;
ppb
->
nr_segs
++
;
pp
->
free_iov
++
;
pp
->
free_iov
++
;
BUG_ON
(
pp
->
free_iov
>
pp
->
nr_iovs
);
BUG_ON
(
pp
->
free_iov
>
pp
->
nr_iovs
);
out:
out:
...
@@ -187,8 +191,6 @@ int page_pipe_add_page(struct page_pipe *pp, unsigned long addr)
...
@@ -187,8 +191,6 @@ int page_pipe_add_page(struct page_pipe *pp, unsigned long addr)
int
page_pipe_add_hole
(
struct
page_pipe
*
pp
,
unsigned
long
addr
)
int
page_pipe_add_hole
(
struct
page_pipe
*
pp
,
unsigned
long
addr
)
{
{
struct
iovec
*
iov
;
if
(
pp
->
free_hole
>=
pp
->
nr_holes
)
{
if
(
pp
->
free_hole
>=
pp
->
nr_holes
)
{
pp
->
holes
=
xrealloc
(
pp
->
holes
,
pp
->
holes
=
xrealloc
(
pp
->
holes
,
(
pp
->
nr_holes
+
PP_HOLES_BATCH
)
*
sizeof
(
struct
iovec
));
(
pp
->
nr_holes
+
PP_HOLES_BATCH
)
*
sizeof
(
struct
iovec
));
...
@@ -202,10 +204,7 @@ int page_pipe_add_hole(struct page_pipe *pp, unsigned long addr)
...
@@ -202,10 +204,7 @@ int page_pipe_add_hole(struct page_pipe *pp, unsigned long addr)
iov_grow_page
(
&
pp
->
holes
[
pp
->
free_hole
-
1
],
addr
))
iov_grow_page
(
&
pp
->
holes
[
pp
->
free_hole
-
1
],
addr
))
goto
out
;
goto
out
;
iov
=
&
pp
->
holes
[
pp
->
free_hole
];
iov_init
(
&
pp
->
holes
[
pp
->
free_hole
++
],
addr
);
iov
->
iov_base
=
(
void
*
)
addr
;
iov
->
iov_len
=
PAGE_SIZE
;
pp
->
free_hole
++
;
out:
out:
return
0
;
return
0
;
}
}
...
...
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