[CRIU] [PATCH] criu: page-read: make seek_pagemap_page a method of page_read
Mike Rapoport
rppt at linux.vnet.ibm.com
Thu Jun 2 06:03:34 PDT 2016
Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---
criu/cr-dedup.c | 2 +-
criu/include/page-read.h | 2 +-
criu/page-read.c | 5 ++++-
criu/page-xfer.c | 2 +-
criu/uffd.c | 2 +-
5 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/criu/cr-dedup.c b/criu/cr-dedup.c
index b453c3e..39609a7 100644
--- a/criu/cr-dedup.c
+++ b/criu/cr-dedup.c
@@ -154,7 +154,7 @@ int dedup_one_iovec(struct page_read *pr, struct iovec *iov)
struct iovec tiov;
struct page_read * prp;
- ret = seek_pagemap_page(pr, off, false);
+ ret = pr->seek_page(pr, off, false);
if (ret == -1)
return -1;
diff --git a/criu/include/page-read.h b/criu/include/page-read.h
index 3ba1ee9..4b6b5b7 100644
--- a/criu/include/page-read.h
+++ b/criu/include/page-read.h
@@ -52,6 +52,7 @@ struct page_read {
void (*put_pagemap)(struct page_read *);
void (*close)(struct page_read *);
void (*skip_pages)(struct page_read *, unsigned long len);
+ int (*seek_page)(struct page_read *pr, unsigned long vaddr, bool warn);
/* Private data of reader */
struct cr_img *pmi;
@@ -84,7 +85,6 @@ extern int open_page_read(int pid, struct page_read *, int pr_flags);
extern int open_page_read_at(int dfd, int pid, struct page_read *pr, int pr_flags);
extern void pagemap2iovec(PagemapEntry *pe, struct iovec *iov);
extern void iovec2pagemap(struct iovec *iov, PagemapEntry *pe);
-extern int seek_pagemap_page(struct page_read *pr, unsigned long vaddr, bool warn);
extern int dedup_one_iovec(struct page_read *pr, struct iovec *iov);
extern int punch_hole(struct page_read *pr, unsigned long off, unsigned long len, bool cleanup);
diff --git a/criu/page-read.c b/criu/page-read.c
index 89d41cd..933f047 100644
--- a/criu/page-read.c
+++ b/criu/page-read.c
@@ -95,7 +95,8 @@ static void skip_pagemap_pages(struct page_read *pr, unsigned long len)
pr->cvaddr += len;
}
-int seek_pagemap_page(struct page_read *pr, unsigned long vaddr, bool warn)
+static int seek_pagemap_page(struct page_read *pr, unsigned long vaddr,
+ bool warn)
{
int ret;
struct iovec iov;
@@ -327,6 +328,7 @@ int open_page_read_at(int dfd, int pid, struct page_read *pr, int pr_flags)
pr->read_pages = read_pagemap_page;
pr->close = close_page_read;
pr->skip_pages = skip_pagemap_pages;
+ pr->seek_page = seek_pagemap_page;
pr->id = ids++;
pr_debug("Opened page read %u (parent %u)\n",
@@ -350,6 +352,7 @@ open_old:
pr->pi = NULL;
pr->close = close_page_read;
pr->skip_pages = NULL;
+ pr->seek_page = NULL;
return 1;
}
diff --git a/criu/page-xfer.c b/criu/page-xfer.c
index 2ebe8cc..06769ab 100644
--- a/criu/page-xfer.c
+++ b/criu/page-xfer.c
@@ -528,7 +528,7 @@ static int check_pagehole_in_parent(struct page_read *p, struct iovec *iov)
struct iovec piov;
unsigned long pend;
- ret = seek_pagemap_page(p, off, true);
+ ret = p->seek_page(p, off, true);
if (ret <= 0 || !p->pe)
return -1;
diff --git a/criu/uffd.c b/criu/uffd.c
index 4e9d46a..61100b8 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -338,7 +338,7 @@ static int get_page(struct lazy_pages_info *lpi, unsigned long addr, void *dest)
if (ret <= 0)
return ret;
- ret = seek_pagemap_page(&pr, addr, true);
+ ret = pr.seek_page(&pr, addr, true);
pr_debug("seek_pagemap_page ret 0x%x\n", ret);
if (ret <= 0)
return ret;
--
1.9.1
More information about the CRIU
mailing list