[CRIU] [PATCH 3/4] protobuf: use generic show function for socket queues

Kinsbursky Stanislav skinsbursky at openvz.org
Wed Jul 25 08:40:41 EDT 2012


Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>

---
 sk-queue.c |   22 ++++++++--------------
 1 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/sk-queue.c b/sk-queue.c
index a40be05..55f3bf0 100644
--- a/sk-queue.c
+++ b/sk-queue.c
@@ -168,22 +168,16 @@ err_brk:
 	return ret;
 }
 
-void show_sk_queues(int fd, struct cr_options *o)
+static void sk_queue_data_handler(int fd, void *obj)
 {
-	SkPacketEntry *pe;
-	int ret;
+	SkPacketEntry *e = obj;
+	pr_msg("\n");
+	print_image_data(fd, e->length);
+}
 
-	pr_img_head(CR_FD_SK_QUEUES);
-	while (1) {
-		ret = pb_read_eof(fd, &pe, sk_packet_entry);
-		if (ret <= 0)
-			break;
-		pr_msg("pkt for %u length %u bytes\n",
-			pe->id_for, (unsigned int)pe->length);
-		print_image_data(fd, pe->length);
-		sk_packet_entry__free_unpacked(pe, NULL);
-	}
-	pr_img_tail(CR_FD_SK_QUEUES);
+void show_sk_queues(int fd, struct cr_options *o)
+{
+	pb_show_plain_payload(fd, sk_packet_entry, sk_queue_data_handler);
 }
 
 int restore_sk_queue(int fd, unsigned int peer_id)



More information about the CRIU mailing list