mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
mount: Restore external bind-mounts with plugins
All the entries with with_plugin set will be mounted by plugin. The interesting case is when we do the pivot-root restore. In this case we call restore callback very early (before we unmount the old tree) and ask it to create the mountpoint at temporary location. Later we move the mount to proper place. The old_root argument of the callback is where it can find files in the original mount namespace. The is_file is return-argument. Sine files and directories cannot be bind-mounted to each-other, the callback should create the mountpoint itself and report whether it created file or directory. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
8
plugin.c
8
plugin.c
@@ -20,6 +20,7 @@ struct cr_plugin_entry {
|
||||
cr_plugin_dump_file_t *cr_plugin_dump_file;
|
||||
cr_plugin_restore_file_t *cr_plugin_restore_file;
|
||||
cr_plugin_dump_ext_mount_t *cr_plugin_dump_ext_mount;
|
||||
cr_plugin_restore_ext_mount_t *cr_plugin_restore_ext_mount;
|
||||
};
|
||||
|
||||
struct cr_plugin_entry *next;
|
||||
@@ -33,6 +34,7 @@ struct cr_plugins {
|
||||
struct cr_plugin_entry *cr_plugin_dump_file;
|
||||
struct cr_plugin_entry *cr_plugin_restore_file;
|
||||
struct cr_plugin_entry *cr_plugin_dump_ext_mount;
|
||||
struct cr_plugin_entry *cr_plugin_restore_ext_mount;
|
||||
};
|
||||
|
||||
struct cr_plugins cr_plugins;
|
||||
@@ -94,6 +96,11 @@ int cr_plugin_dump_ext_mount(char *mountpoint, int id)
|
||||
return run_plugin_funcs(cr_plugin_dump_ext_mount, mountpoint, id);
|
||||
}
|
||||
|
||||
int cr_plugin_restore_ext_mount(int id, char *mountpoint, char *old_root, int *is_file)
|
||||
{
|
||||
return run_plugin_funcs(cr_plugin_restore_ext_mount, id, mountpoint, old_root, is_file);
|
||||
}
|
||||
|
||||
static int cr_lib_load(char *path)
|
||||
{
|
||||
struct cr_plugin_entry *ce;
|
||||
@@ -114,6 +121,7 @@ static int cr_lib_load(char *path)
|
||||
add_plugin_func(cr_plugin_restore_file);
|
||||
|
||||
add_plugin_func(cr_plugin_dump_ext_mount);
|
||||
add_plugin_func(cr_plugin_restore_ext_mount);
|
||||
|
||||
ce = NULL;
|
||||
f_fini = dlsym(h, "cr_plugin_fini");
|
||||
|
Reference in New Issue
Block a user