[CRIU] [PATCH 3/3] page-read: Remove get_pagemap method

Pavel Emelyanov xemul at virtuozzo.com
Wed Nov 30 02:48:16 PST 2016


Now it's obsoleted by the advance method.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/cr-dedup.c        |  2 +-
 criu/include/pagemap.h |  5 -----
 criu/mem.c             |  2 +-
 criu/pagemap.c         | 19 +++++--------------
 criu/shmem.c           |  2 +-
 5 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/criu/cr-dedup.c b/criu/cr-dedup.c
index 30a73e1..7ecc99c 100644
--- a/criu/cr-dedup.c
+++ b/criu/cr-dedup.c
@@ -84,7 +84,7 @@ static int cr_dedup_one_pagemap(int id, int flags)
 		goto exit;
 
 	while (1) {
-		ret = pr.get_pagemap(&pr);
+		ret = pr.advance(&pr, true);
 		if (ret <= 0)
 			goto exit;
 
diff --git a/criu/include/pagemap.h b/criu/include/pagemap.h
index d128103..87795a3 100644
--- a/criu/include/pagemap.h
+++ b/criu/include/pagemap.h
@@ -42,11 +42,6 @@
  */
 
 struct page_read {
-	/*
-	 * Gets next vaddr:len pair to work on. The zero pagemaps are skipped.
-	 * Pagemap entries should be returned in sorted order.
-	 */
-	int (*get_pagemap)(struct page_read *);
 	/* reads page from current pagemap */
 	int (*read_pages)(struct page_read *, unsigned long vaddr, int nr,
 			  void *, unsigned flags);
diff --git a/criu/mem.c b/criu/mem.c
index 4578ba9..23305f0 100644
--- a/criu/mem.c
+++ b/criu/mem.c
@@ -737,7 +737,7 @@ static int restore_priv_vma_content(struct pstree_item *t)
 	while (1) {
 		unsigned long off, i, nr_pages;
 
-		ret = pr.get_pagemap(&pr);
+		ret = pr.advance(&pr, true);
 		if (ret <= 0)
 			break;
 
diff --git a/criu/pagemap.c b/criu/pagemap.c
index afdfc6a..6ea2bb3 100644
--- a/criu/pagemap.c
+++ b/criu/pagemap.c
@@ -152,19 +152,6 @@ static int advance(struct page_read *pr, bool skip_zero)
 	return 1;
 }
 
-static int get_pagemap(struct page_read *pr)
-{
-	if (!advance(pr, true))
-		return 0;
-
-	if (pagemap_in_parent(pr->pe) && !pr->parent) {
-		pr_err("No parent for snapshot pagemap\n");
-		return -1;
-	}
-
-	return 1;
-}
-
 static void skip_pagemap_pages(struct page_read *pr, unsigned long len)
 {
 	if (!len)
@@ -226,6 +213,11 @@ static int read_parent_page(struct page_read *pr, unsigned long vaddr,
 	struct page_read *ppr = pr->parent;
 	int ret;
 
+	if (!ppr) {
+		pr_err("No parent for snapshot pagemap\n");
+		return -1;
+	}
+
 	/*
 	 * Parent pagemap at this point entry may be shorter
 	 * than the current vaddr:nr needs, so we have to
@@ -721,7 +713,6 @@ int open_page_read_at(int dfd, int pid, struct page_read *pr, int pr_flags)
 		return -1;
 	}
 
-	pr->get_pagemap = get_pagemap;
 	pr->read_pages = read_pagemap_page;
 	pr->advance = advance;
 	pr->close = close_page_read;
diff --git a/criu/shmem.c b/criu/shmem.c
index 89e5f3e..edd1127 100644
--- a/criu/shmem.c
+++ b/criu/shmem.c
@@ -472,7 +472,7 @@ static int restore_shmem_content(void *addr, struct shmem_info *si)
 		unsigned long vaddr;
 		unsigned nr_pages;
 
-		ret = pr.get_pagemap(&pr);
+		ret = pr.advance(&pr, true);
 		if (ret <= 0)
 			break;
 
-- 
2.5.0



More information about the CRIU mailing list