[CRIU] [PATCH v2 11/13] protobuf: use pretty output for pstree
Kinsbursky Stanislav
skinsbursky at openvz.org
Mon Aug 6 12:11:52 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 | 10 ++++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
-------------- next part --------------
diff --git a/cr-show.c b/cr-show.c
index 9e1db5a..27020cb 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, pstree_entry, pstree_handler, collect);
+ pb_show_plain_payload_pretty(fd, pstree_entry, 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 2607c06..794f2ce 100644
--- a/include/protobuf.h
+++ b/include/protobuf.h
@@ -64,11 +64,17 @@ extern void do_pb_show_plain(int fd, const ProtobufCMessageDescriptor *d,
int flags, const char *pretty_fmt);
/* Don't have objects at hands to also do typechecking here */
-#define pb_show_plain_payload(__fd, __proto_message_name, payload_hadler, flags) \
+#define pb_show_plain_payload_pretty(__fd, __proto_message_name, payload_hadler, flags, pretty) \
do_pb_show_plain(__fd, &__proto_message_name##__descriptor, \
(pb_unpack_t)__proto_message_name##__unpack, \
(pb_free_t)__proto_message_name##__free_unpacked, \
- 0, payload_hadler, flags, NULL)
+ 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, __proto_message_name) \
pb_show_plain_payload(__fd, __proto_message_name, NULL, 0)
More information about the CRIU
mailing list