[CRIU] [PATCH v3 11/12] protobuf: use pretty output for pstree
Kinsbursky Stanislav
skinsbursky at openvz.org
Mon Aug 13 09:59:56 EDT 2012
From: Stanislav Kinsbursky <skinsbursky at openvz.org>
Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
cr-show.c | 3 ++-
include/protobuf.h | 11 +++++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
-------------- next part --------------
diff --git a/cr-show.c b/cr-show.c
index 8f8f5a3..ccff31e 100644
--- a/cr-show.c
+++ b/cr-show.c
@@ -283,7 +283,8 @@ static void pstree_handler(int fd, void *obj, int collect)
void show_collect_pstree(int fd, int collect)
{
- pb_show_plain_payload(fd, PB_PSTREE, pstree_handler, collect);
+ pb_show_plain_payload_pretty(fd, PB_PSTREE, pstree_handler,
+ collect, "1:%d 2:%d 3:%d 4:%d 5:%d");
}
void show_pstree(int fd, struct cr_options *o)
diff --git a/include/protobuf.h b/include/protobuf.h
index 83f2e04..c6d0106 100644
--- a/include/protobuf.h
+++ b/include/protobuf.h
@@ -82,8 +82,15 @@ extern void do_pb_show_plain(int fd, int type, int single_entry,
void (*payload_hadler)(int fd, void *obj, int flags),
int flags, const char *pretty_fmt);
-#define pb_show_plain_payload(__fd, __type, payload_hadler, flags) \
- do_pb_show_plain(__fd, __type, 0, payload_hadler, flags, NULL)
+/* Don't have objects at hands to also do typechecking here */
+#define pb_show_plain_payload_pretty(__fd, __type, payload_hadler, flags, pretty) \
+ do_pb_show_plain(__fd, __type, 0, payload_hadler, flags, pretty)
+
+#define pb_show_plain_payload(__fd, __proto_message_name, payload_hadler, flags) \
+ pb_show_plain_payload_pretty(__fd, __proto_message_name, payload_hadler, flags, NULL)
+
+#define pb_show_plain_pretty(__fd, __proto_message_name, __pretty) \
+ pb_show_plain_payload_pretty(__fd, __proto_message_name, NULL, 0, __pretty)
#define pb_show_plain(__fd, __type) \
pb_show_plain_payload(__fd, __type, NULL, 0)
More information about the CRIU
mailing list