2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

mem: Protobuf format for page dumps

Since now we drain pages out of parasite, we can invent any format for
page dumps. Let is be ... prorobuf one! :)

Another thing to keep in mind, is that we're about to use splices and
implement iterative migration, so it's better to have actual pages be
page-aligned in the image.

And -- backward compatibility. That said the new format is:

1. pagemap-... file which contains a header (currently with a ID of
   the image with pages, see below) and an array of <nr_pages:vaddr>
   pairs. The first value means "how many pages to take from the
   file with pages (see below)" and the second -- where in the task
   address space to put them. Simple.

2. pages-... file which containes only pages one by one (thus aligned
   as we want).

This patch breaks backward compatibility (old images with pages wil
be restored and then crash). Need to do it before v0.5 release.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2013-03-12 21:00:05 +04:00
parent a59fd3533f
commit 8801f59615
15 changed files with 193 additions and 169 deletions

View File

@@ -22,7 +22,6 @@ enum {
_CR_FD_TASK_FROM,
CR_FD_FILE_LOCKS,
CR_FD_PAGES,
CR_FD_CORE,
CR_FD_IDS,
CR_FD_MM,
@@ -34,6 +33,8 @@ enum {
CR_FD_RLIMIT,
_CR_FD_TASK_TO,
CR_FD_PAGEMAP,
/*
* NS entries
*/
@@ -51,7 +52,7 @@ enum {
_CR_FD_NS_TO,
CR_FD_PSTREE,
CR_FD_SHMEM_PAGES,
CR_FD_SHMEM_PAGEMAP,
CR_FD_GHOST_FILE,
CR_FD_TCP_STREAM,
CR_FD_FDINFO,
@@ -80,6 +81,7 @@ enum {
_CR_FD_GLOB_TO,
CR_FD_TMPFS,
CR_FD_PAGES,
CR_FD_MAX
};
@@ -141,7 +143,7 @@ struct cr_fd_desc_tmpl {
};
void show_files(int fd_files, struct cr_options *o);
void show_pages(int fd_pages, struct cr_options *o);
void show_pagemap(int fd, struct cr_options *o);
void show_reg_files(int fd_reg_files, struct cr_options *o);
void show_core(int fd_core, struct cr_options *o);
void show_ids(int fd_ids, struct cr_options *o);
@@ -177,6 +179,7 @@ extern void close_image_dir(void);
int open_image(int type, unsigned long flags, ...);
#define open_image_ro(type, ...) open_image(type, O_RDONLY, ##__VA_ARGS__)
int open_pages_image(unsigned long flags, int pm_fd);
#define LAST_PID_PATH "/proc/sys/kernel/ns_last_pid"
#define LAST_PID_PERM 0666
@@ -209,6 +212,7 @@ int cr_exec(int pid, char **opts);
#define O_DUMP (O_RDWR | O_CREAT | O_EXCL)
#define O_SHOW (O_RDONLY)
#define O_RSTR (O_RDONLY)
struct cr_fdset *cr_task_fdset_open(int pid, int mode);
struct cr_fdset *cr_ns_fdset_open(int pid, int mode);