Commit dbf29ef9 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

protobuf: Use FifoEntry instead of struct fifo_entry

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 53645921
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "protobuf/fdinfo.pb-c.h" #include "protobuf/fdinfo.pb-c.h"
#include "protobuf/regfile.pb-c.h" #include "protobuf/regfile.pb-c.h"
#include "protobuf/ghost-file.pb-c.h" #include "protobuf/ghost-file.pb-c.h"
#include "protobuf/fifo.pb-c.h"
#define DEF_PAGES_PER_LINE 6 #define DEF_PAGES_PER_LINE 6
...@@ -217,13 +218,14 @@ void show_fifo_data(int fd, struct cr_options *o) ...@@ -217,13 +218,14 @@ void show_fifo_data(int fd, struct cr_options *o)
void show_fifo(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); pr_img_head(CR_FD_FIFO);
while (1) { while (1) {
if (read_img_eof(fd, &e) <= 0) if (pb_read_eof(fd, &e, fifo_entry) <= 0)
break; 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); pr_img_tail(CR_FD_FIFO);
} }
......
...@@ -12,7 +12,9 @@ ...@@ -12,7 +12,9 @@
#include "fifo.h" #include "fifo.h"
#include "protobuf.h"
#include "protobuf/regfile.pb-c.h" #include "protobuf/regfile.pb-c.h"
#include "protobuf/fifo.pb-c.h"
/* /*
* FIFO checkpoint and restore is done in a bit unusual manner. * FIFO checkpoint and restore is done in a bit unusual manner.
...@@ -29,7 +31,7 @@ ...@@ -29,7 +31,7 @@
struct fifo_info { struct fifo_info {
struct list_head list; struct list_head list;
struct file_desc d; struct file_desc d;
struct fifo_entry *fe; FifoEntry *fe;
bool restore_data; bool restore_data;
}; };
...@@ -39,7 +41,7 @@ static struct pipe_data_dump pd_fifo = { .img_type = CR_FD_FIFO_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) static int dump_one_fifo(int lfd, u32 id, const struct fd_parms *p)
{ {
int img = fdset_fd(glob_fdset, CR_FD_FIFO); 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 * 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) ...@@ -55,7 +57,7 @@ static int dump_one_fifo(int lfd, u32 id, const struct fd_parms *p)
e.id = id; e.id = id;
e.pipe_id = pipe_id(p); e.pipe_id = pipe_id(p);
if (write_img(img, &e) < 0) if (pb_write(img, &e, fifo_entry))
return -1; return -1;
return dump_one_pipe_data(&pd_fifo, lfd, p); return dump_one_pipe_data(&pd_fifo, lfd, p);
...@@ -136,11 +138,7 @@ int collect_fifo(void) ...@@ -136,11 +138,7 @@ int collect_fifo(void)
if (!info) if (!info)
break; break;
info->fe = xzalloc(sizeof(*info->fe)); ret = pb_read_eof(img, &info->fe, fifo_entry);
if (!info->fe)
break;
ret = read_img_eof(img, info->fe);
if (ret <= 0) if (ret <= 0)
break; break;
......
...@@ -142,11 +142,6 @@ struct pipe_data_entry { ...@@ -142,11 +142,6 @@ struct pipe_data_entry {
u8 data[0]; u8 data[0];
} __packed; } __packed;
struct fifo_entry {
u32 id;
u32 pipe_id;
} __packed;
#define USK_EXTERN (1 << 0) #define USK_EXTERN (1 << 0)
struct sk_opts_entry { struct sk_opts_entry {
......
...@@ -23,6 +23,7 @@ PROTO_FILES += fdinfo.proto ...@@ -23,6 +23,7 @@ PROTO_FILES += fdinfo.proto
PROTO_FILES += fown.proto PROTO_FILES += fown.proto
PROTO_FILES += regfile.proto PROTO_FILES += regfile.proto
PROTO_FILES += ghost-file.proto PROTO_FILES += ghost-file.proto
PROTO_FILES += fifo.proto
HDRS := $(patsubst %.proto,%.pb-c.h,$(PROTO_FILES)) HDRS := $(patsubst %.proto,%.pb-c.h,$(PROTO_FILES))
SRCS := $(patsubst %.proto,%.pb-c.c,$(PROTO_FILES)) SRCS := $(patsubst %.proto,%.pb-c.c,$(PROTO_FILES))
......
message fifo_entry {
required uint32 id = 1;
required uint32 pipe_id = 2;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment