[CRIU] [PATCH 2/7] parasite: Rename misnamed nr_pages

Dmitry Safonov dima at arista.com
Mon Mar 26 16:06:57 MSK 2018


It's actually number of bytes spliced, not pages.
And I bet (unsigned long) suits the purpose more than (int).

Signed-off-by: Dmitry Safonov <dima at arista.com>
---
 criu/pie/parasite.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/criu/pie/parasite.c b/criu/pie/parasite.c
index 7a48f324e919..b9dae3f94fd8 100644
--- a/criu/pie/parasite.c
+++ b/criu/pie/parasite.c
@@ -67,7 +67,8 @@ static int dump_pages(struct parasite_dump_pages_args *args)
 {
 	int p, ret, tsock;
 	struct iovec *iovs;
-	int off, nr_segs, nr_pages;
+	int off, nr_segs;
+	unsigned long spliced_bytes = 0;
 
 	tsock = parasite_get_rpc_sock();
 	p = recv_fd(tsock);
@@ -75,7 +76,6 @@ static int dump_pages(struct parasite_dump_pages_args *args)
 		return -1;
 
 	iovs = pargs_iovs(args);
-	nr_pages = 0;
 	off = 0;
 	nr_segs = args->nr_segs;
 	if (nr_segs > UIO_MAXIOV)
@@ -89,16 +89,16 @@ static int dump_pages(struct parasite_dump_pages_args *args)
 						ret, nr_segs, args->off + off);
 			return -1;
 		}
-		nr_pages += ret;
+		spliced_bytes += ret;
 		off += nr_segs;
 		if (off == args->nr_segs)
 			break;
 		if (off + nr_segs > args->nr_segs)
 			nr_segs = args->nr_segs - off;
 	}
-	if (nr_pages != args->nr_pages * PAGE_SIZE) {
+	if (spliced_bytes != args->nr_pages * PAGE_SIZE) {
 		sys_close(p);
-		pr_err("Can't splice all pages to pipe (%d/%d)\n", nr_pages, args->nr_pages);
+		pr_err("Can't splice all pages to pipe (%lu/%d)\n", spliced_bytes, args->nr_pages);
 		return -1;
 	}
 
-- 
2.13.6



More information about the CRIU mailing list