2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 21:38:16 +00:00

criu: pagemap: add reset method

Rather than do open/close to reset pagemap, just update it's state.

Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Acked-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Mike Rapoport 2016-06-27 07:53:21 +03:00 committed by Pavel Emelyanov
parent 9de01e1b89
commit 80e146da20
2 changed files with 15 additions and 0 deletions

View File

@ -52,6 +52,7 @@ struct page_read {
void (*skip_pages)(struct page_read *, unsigned long len);
int (*sync)(struct page_read *pr);
int (*seek_pagemap)(struct page_read *pr, unsigned long vaddr);
void (*reset)(struct page_read *pr);
/* Whether or not pages can be read in PIE code */
bool pieok;

View File

@ -547,6 +547,19 @@ static void close_page_read(struct page_read *pr)
free_pagemaps(pr);
}
static void reset_pagemap(struct page_read *pr)
{
pr->cvaddr = 0;
pr->pi_off = 0;
pr->curr_pme = -1;
pr->pe = NULL;
/* FIXME: take care of bunch */
if (pr->parent)
reset_pagemap(pr->parent);
}
static int try_open_parent(int dfd, int pid, struct page_read *pr, int pr_flags)
{
int pfd, ret;
@ -701,6 +714,7 @@ int open_page_read_at(int dfd, int pid, struct page_read *pr, int pr_flags)
pr->skip_pages = skip_pagemap_pages;
pr->sync = process_async_reads;
pr->seek_pagemap = seek_pagemap;
pr->reset = reset_pagemap;
pr->id = ids++;
if (!pr->parent)
pr->pieok = true;