mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-18 00:58:31 +00:00
protobuf: Use FifoEntry instead of struct fifo_entry
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
5364592157
commit
dbf29ef92a
5 changed files with 16 additions and 16 deletions
|
|
@ -28,6 +28,7 @@
|
|||
#include "protobuf/fdinfo.pb-c.h"
|
||||
#include "protobuf/regfile.pb-c.h"
|
||||
#include "protobuf/ghost-file.pb-c.h"
|
||||
#include "protobuf/fifo.pb-c.h"
|
||||
|
||||
#define DEF_PAGES_PER_LINE 6
|
||||
|
||||
|
|
@ -217,13 +218,14 @@ void show_fifo_data(int fd, struct cr_options *o)
|
|||
|
||||
void show_fifo(int fd, struct cr_options *o)
|
||||
{
|
||||
struct fifo_entry e;
|
||||
FifoEntry *e;
|
||||
|
||||
pr_img_head(CR_FD_FIFO);
|
||||
while (1) {
|
||||
if (read_img_eof(fd, &e) <= 0)
|
||||
if (pb_read_eof(fd, &e, fifo_entry) <= 0)
|
||||
break;
|
||||
pr_msg("id: 0x%8x pipeid: 0x%8x\n", e.id, e.pipe_id);
|
||||
pr_msg("id: 0x%8x pipeid: 0x%8x\n", e->id, e->pipe_id);
|
||||
fifo_entry__free_unpacked(e, NULL);
|
||||
}
|
||||
pr_img_tail(CR_FD_FIFO);
|
||||
}
|
||||
|
|
|
|||
14
fifo.c
14
fifo.c
|
|
@ -12,7 +12,9 @@
|
|||
|
||||
#include "fifo.h"
|
||||
|
||||
#include "protobuf.h"
|
||||
#include "protobuf/regfile.pb-c.h"
|
||||
#include "protobuf/fifo.pb-c.h"
|
||||
|
||||
/*
|
||||
* FIFO checkpoint and restore is done in a bit unusual manner.
|
||||
|
|
@ -29,7 +31,7 @@
|
|||
struct fifo_info {
|
||||
struct list_head list;
|
||||
struct file_desc d;
|
||||
struct fifo_entry *fe;
|
||||
FifoEntry *fe;
|
||||
bool restore_data;
|
||||
};
|
||||
|
||||
|
|
@ -39,7 +41,7 @@ static struct pipe_data_dump pd_fifo = { .img_type = CR_FD_FIFO_DATA, };
|
|||
static int dump_one_fifo(int lfd, u32 id, const struct fd_parms *p)
|
||||
{
|
||||
int img = fdset_fd(glob_fdset, CR_FD_FIFO);
|
||||
struct fifo_entry e;
|
||||
FifoEntry e = FIFO_ENTRY__INIT;
|
||||
|
||||
/*
|
||||
* It's a trick here, we use regular files dumping
|
||||
|
|
@ -55,7 +57,7 @@ static int dump_one_fifo(int lfd, u32 id, const struct fd_parms *p)
|
|||
e.id = id;
|
||||
e.pipe_id = pipe_id(p);
|
||||
|
||||
if (write_img(img, &e) < 0)
|
||||
if (pb_write(img, &e, fifo_entry))
|
||||
return -1;
|
||||
|
||||
return dump_one_pipe_data(&pd_fifo, lfd, p);
|
||||
|
|
@ -136,11 +138,7 @@ int collect_fifo(void)
|
|||
if (!info)
|
||||
break;
|
||||
|
||||
info->fe = xzalloc(sizeof(*info->fe));
|
||||
if (!info->fe)
|
||||
break;
|
||||
|
||||
ret = read_img_eof(img, info->fe);
|
||||
ret = pb_read_eof(img, &info->fe, fifo_entry);
|
||||
if (ret <= 0)
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -142,11 +142,6 @@ struct pipe_data_entry {
|
|||
u8 data[0];
|
||||
} __packed;
|
||||
|
||||
struct fifo_entry {
|
||||
u32 id;
|
||||
u32 pipe_id;
|
||||
} __packed;
|
||||
|
||||
#define USK_EXTERN (1 << 0)
|
||||
|
||||
struct sk_opts_entry {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ PROTO_FILES += fdinfo.proto
|
|||
PROTO_FILES += fown.proto
|
||||
PROTO_FILES += regfile.proto
|
||||
PROTO_FILES += ghost-file.proto
|
||||
PROTO_FILES += fifo.proto
|
||||
|
||||
HDRS := $(patsubst %.proto,%.pb-c.h,$(PROTO_FILES))
|
||||
SRCS := $(patsubst %.proto,%.pb-c.c,$(PROTO_FILES))
|
||||
|
|
|
|||
4
protobuf/fifo.proto
Normal file
4
protobuf/fifo.proto
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
message fifo_entry {
|
||||
required uint32 id = 1;
|
||||
required uint32 pipe_id = 2;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue