mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 22:05:36 +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:
committed by
Pavel Emelyanov
parent
9de01e1b89
commit
80e146da20
@@ -52,6 +52,7 @@ struct page_read {
|
|||||||
void (*skip_pages)(struct page_read *, unsigned long len);
|
void (*skip_pages)(struct page_read *, unsigned long len);
|
||||||
int (*sync)(struct page_read *pr);
|
int (*sync)(struct page_read *pr);
|
||||||
int (*seek_pagemap)(struct page_read *pr, unsigned long vaddr);
|
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 */
|
/* Whether or not pages can be read in PIE code */
|
||||||
bool pieok;
|
bool pieok;
|
||||||
|
@@ -547,6 +547,19 @@ static void close_page_read(struct page_read *pr)
|
|||||||
free_pagemaps(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)
|
static int try_open_parent(int dfd, int pid, struct page_read *pr, int pr_flags)
|
||||||
{
|
{
|
||||||
int pfd, ret;
|
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->skip_pages = skip_pagemap_pages;
|
||||||
pr->sync = process_async_reads;
|
pr->sync = process_async_reads;
|
||||||
pr->seek_pagemap = seek_pagemap;
|
pr->seek_pagemap = seek_pagemap;
|
||||||
|
pr->reset = reset_pagemap;
|
||||||
pr->id = ids++;
|
pr->id = ids++;
|
||||||
if (!pr->parent)
|
if (!pr->parent)
|
||||||
pr->pieok = true;
|
pr->pieok = true;
|
||||||
|
Reference in New Issue
Block a user