[CRIU] [PATCH 02/15] protobuf: use generic show function for fdinfo
Kinsbursky Stanislav
skinsbursky at openvz.org
Wed Jul 18 05:04:55 EDT 2012
From: Stanislav Kinsbursky <skinsbursky at openvz.org>
Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
cr-show.c | 28 ++--------------------------
1 files changed, 2 insertions(+), 26 deletions(-)
-------------- next part --------------
diff --git a/cr-show.c b/cr-show.c
index 8bdfd31..b1a6d0c 100644
--- a/cr-show.c
+++ b/cr-show.c
@@ -67,41 +67,17 @@
static char local_buf[PAGE_SIZE];
static LIST_HEAD(pstree_list);
-static char *fdtype2s(u8 type)
-{
- static char und[4];
- static char *fdtypes[] = {
- [FDINFO_REG] = "reg",
- [FDINFO_INETSK] = "isk",
- [FDINFO_PIPE] = "pipe",
- [FDINFO_FIFO] = "fifo",
- [FDINFO_UNIXSK] = "usk",
- [FDINFO_EVENTFD] = "efd",
- [FDINFO_EVENTPOLL] = "epl",
- [FDINFO_INOTIFY] = "ify",
- };
-
- if (type > FDINFO_UND && type < FD_INFO_MAX)
- return fdtypes[type];
- snprintf(und, sizeof(und), "x%03d\n", (int)type);
- return und;
-}
-
void show_files(int fd_files, struct cr_options *o)
{
pr_img_head(CR_FD_FDINFO);
-
while (1) {
FdinfoEntry *e;
int ret = pb_read_eof(fd_files, &e, fdinfo_entry);
if (ret <= 0)
- goto out;
- pr_msg("type: %-5s fd: %-5d id: %#x flags %#x\n",
- fdtype2s(e->type), e->fd, e->id, e->flags);
+ break;
+ pb_show_msg(e, &fdinfo_entry__descriptor);
fdinfo_entry__free_unpacked(e, NULL);
}
-
-out:
pr_img_tail(CR_FD_FDINFO);
}
More information about the CRIU
mailing list