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
362784f0
Commit
362784f0
authored
Mar 24, 2016
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pipe/fifo: Collect data via cinfo engine
Signed-off-by:
Pavel Emelyanov
<
xemul@virtuozzo.com
>
parent
f674cbd6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
49 deletions
+39
-49
cr-restore.c
criu/cr-restore.c
+2
-5
fifo.c
criu/fifo.c
+9
-2
fifo.h
criu/include/fifo.h
+1
-1
pipes.h
criu/include/pipes.h
+3
-2
pipes.c
criu/pipes.c
+24
-39
No files found.
criu/cr-restore.c
View file @
362784f0
...
...
@@ -180,6 +180,8 @@ static struct collect_image_info *cinfos[] = {
&
ext_file_cinfo
,
&
timerfd_cinfo
,
&
file_locks_cinfo
,
&
pipe_data_cinfo
,
&
fifo_data_cinfo
,
&
sk_queues_cinfo
,
};
...
...
@@ -241,11 +243,6 @@ static int root_prepare_shared(void)
return
-
1
;
}
if
(
collect_pipes
())
return
-
1
;
if
(
collect_fifo
())
return
-
1
;
if
(
tty_verify_active_pairs
())
return
-
1
;
...
...
criu/fifo.c
View file @
362784f0
...
...
@@ -162,7 +162,14 @@ struct collect_image_info fifo_cinfo = {
.
collect
=
collect_one_fifo
,
};
int
collect_fifo
(
void
)
static
int
collect_fifo_data
(
void
*
obj
,
ProtobufCMessage
*
msg
,
struct
cr_img
*
img
)
{
return
collect_pipe_data
(
CR_FD_FIFO_DATA
,
pd_hash_fifo
);
return
do_collect_pipe_data
(
obj
,
msg
,
img
,
pd_hash_fifo
);
}
struct
collect_image_info
fifo_data_cinfo
=
{
.
fd_type
=
CR_FD_FIFO_DATA
,
.
pb_type
=
PB_PIPE_DATA
,
.
priv_size
=
sizeof
(
struct
pipe_data_rst
),
.
collect
=
collect_fifo_data
,
};
criu/include/fifo.h
View file @
362784f0
...
...
@@ -6,6 +6,6 @@ struct cr_imgset;
extern
const
struct
fdtype_ops
fifo_dump_ops
;
extern
struct
collect_image_info
fifo_cinfo
;
extern
int
collect_fifo
(
void
)
;
extern
struct
collect_image_info
fifo_data_cinfo
;
#endif
/* __CR_FIFO_H__ */
criu/include/pipes.h
View file @
362784f0
...
...
@@ -5,7 +5,7 @@
#include "images/pipe.pb-c.h"
extern
struct
collect_image_info
pipe_cinfo
;
extern
int
collect_pipes
(
void
)
;
extern
struct
collect_image_info
pipe_data_cinfo
;
extern
const
struct
fdtype_ops
pipe_dump_ops
;
static
inline
u32
pipe_id
(
const
struct
fd_parms
*
p
)
...
...
@@ -33,7 +33,8 @@ struct pipe_data_rst {
#define PIPE_DATA_HASH_SIZE (1 << PIPE_DATA_HASH_BITS)
#define PIPE_DATA_HASH_MASK (PIPE_DATA_HASH_SIZE - 1)
extern
int
collect_pipe_data
(
int
img_type
,
struct
pipe_data_rst
**
hash
);
extern
int
do_collect_pipe_data
(
struct
pipe_data_rst
*
,
ProtobufCMessage
*
,
struct
cr_img
*
,
struct
pipe_data_rst
**
hash
);
extern
int
restore_pipe_data
(
int
img_type
,
int
pfd
,
u32
id
,
struct
pipe_data_rst
**
hash
);
/*
...
...
criu/pipes.c
View file @
362784f0
...
...
@@ -53,44 +53,22 @@ static int pipe_data_read(struct cr_img *img, struct pipe_data_rst *r)
return
read_img_buf
(
img
,
r
->
data
,
bytes
);
}
int
collect_pipe_data
(
int
img_type
,
struct
pipe_data_rst
**
hash
)
int
do_collect_pipe_data
(
struct
pipe_data_rst
*
r
,
ProtobufCMessage
*
msg
,
struct
cr_img
*
img
,
struct
pipe_data_rst
**
hash
)
{
int
ret
;
struct
cr_img
*
img
;
struct
pipe_data_rst
*
r
=
NULL
;
img
=
open_image
(
img_type
,
O_RSTR
);
if
(
!
img
)
return
-
1
;
while
(
1
)
{
ret
=
-
1
;
r
=
xmalloc
(
sizeof
(
*
r
));
if
(
!
r
)
break
;
ret
=
pb_read_one_eof
(
img
,
&
r
->
pde
,
PB_PIPE_DATA
);
if
(
ret
<=
0
)
break
;
ret
=
pipe_data_read
(
img
,
r
);
if
(
ret
<
0
)
break
;
ret
=
r
->
pde
->
pipe_id
&
PIPE_DATA_HASH_MASK
;
r
->
next
=
hash
[
ret
];
hash
[
ret
]
=
r
;
pr_info
(
"Collected pipe data for %#x (chain %u)
\n
"
,
r
->
pde
->
pipe_id
,
ret
);
}
if
(
r
&&
r
->
pde
)
pipe_data_entry__free_unpacked
(
r
->
pde
,
NULL
);
xfree
(
r
);
close_image
(
img
);
return
ret
;
int
aux
;
r
->
pde
=
pb_msg
(
msg
,
PipeDataEntry
);
aux
=
pipe_data_read
(
img
,
r
);
if
(
aux
<
0
)
return
aux
;
aux
=
r
->
pde
->
pipe_id
&
PIPE_DATA_HASH_MASK
;
r
->
next
=
hash
[
aux
];
hash
[
aux
]
=
r
;
pr_info
(
"Collected pipe data for %#x (chain %u)
\n
"
,
r
->
pde
->
pipe_id
,
aux
);
return
0
;
}
/* Choose who will restore a pipe. */
...
...
@@ -412,11 +390,18 @@ struct collect_image_info pipe_cinfo = {
.
collect
=
collect_one_pipe
,
};
int
collect_pipes
(
void
)
static
int
collect_pipe_data
(
void
*
obj
,
ProtobufCMessage
*
msg
,
struct
cr_img
*
img
)
{
return
collect_pipe_data
(
CR_FD_PIPES_DATA
,
pd_hash_pipes
);
return
do_collect_pipe_data
(
obj
,
msg
,
img
,
pd_hash_pipes
);
}
struct
collect_image_info
pipe_data_cinfo
=
{
.
fd_type
=
CR_FD_PIPES_DATA
,
.
pb_type
=
PB_PIPE_DATA
,
.
priv_size
=
sizeof
(
struct
pipe_data_rst
),
.
collect
=
collect_pipe_data
,
};
int
dump_one_pipe_data
(
struct
pipe_data_dump
*
pd
,
int
lfd
,
const
struct
fd_parms
*
p
)
{
struct
cr_img
*
img
;
...
...
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