2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-05 00:35:23 +00:00

image: Open images via openat

Using absolute paths for this is dangerous - while doing c/r we should
be extremely carefully and not change tasks' roots and mount namespaces
too early. Sometimes it will not work -- when restoring containers we'll
be unable to switch to new CT and still have the ability to open images.

Rework the images opening via openat and keep the image dir fd open all
the time as the service fd (introduced earlier).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2012-03-16 17:24:00 +04:00
parent 3dd8f2e659
commit ffacd0f17c
4 changed files with 49 additions and 33 deletions

View File

@@ -91,9 +91,13 @@ extern struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX];
#define FMT_FNAME_IPCNS_SEM "ipcns-sem-%d.img"
#define FMT_FNAME_SK_QUEUES "sk-queues-%d.img"
extern int get_image_path(char *path, int size, const char *fmt, int pid);
extern char image_dir[];
/*
* FIXME -- this is required for legacy image copy only.
* Don't use it for other reason and remove the former one.
*/
extern int image_dir_fd;
extern int open_image_dir(void);
extern void close_image_dir(void);
extern int open_image_ro(int type, int pid);
extern int open_image_ro_nocheck(const char *fmt, int pid);