Commit d3ecc80e authored by Rodrigo Bruno's avatar Rodrigo Bruno Committed by Andrei Vagin

img: Introduce O_FORCE_LOCAL flag for images

 criu/image-desc.c    | 4 ++--
 criu/image.c         | 4 ++--
 criu/include/image.h | 1 +
 3 files changed, 5 insertions(+), 4 deletions(-)

In order to prepare for remote snapshots (possible with Image Proxy and Image
Cache) the O_FORCE_LOCAL flag is added to force some images not to be remote
and stay as local files in the file system.
Signed-off-by: 's avatarRodrigo Bruno <rbruno@gsd.inesc-id.pt>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 3f994bcf
......@@ -104,13 +104,13 @@ struct cr_fd_desc_tmpl imgset_template[CR_FD_MAX] = {
[CR_FD_STATS] = {
.fmt = "stats-%s",
.magic = STATS_MAGIC,
.oflags = O_SERVICE,
.oflags = O_SERVICE | O_FORCE_LOCAL,
},
[CR_FD_IRMAP_CACHE] = {
.fmt = "irmap-cache",
.magic = IRMAP_CACHE_MAGIC,
.oflags = O_SERVICE,
.oflags = O_SERVICE | O_FORCE_LOCAL,
},
[CR_FD_FILE_LOCKS_PID] = {
......
......@@ -371,11 +371,11 @@ static int do_open_image(struct cr_img *img, int dfd, int type, unsigned long of
{
int ret, flags;
flags = oflags & ~(O_NOBUF | O_SERVICE);
flags = oflags & ~(O_NOBUF | O_SERVICE | O_FORCE_LOCAL);
ret = openat(dfd, path, flags, CR_FD_PERM);
if (ret < 0) {
if (!(flags & O_CREAT) && (errno == ENOENT)) {
if (!(flags & O_CREAT) && (errno == ENOENT || ret == -ENOENT)) {
pr_info("No %s image\n", path);
img->_x.fd = EMPTY_IMG_FD;
goto skip_magic;
......
......@@ -103,6 +103,7 @@ extern bool img_common_magic;
#define O_DUMP (O_WRONLY | O_CREAT | O_TRUNC)
#define O_SHOW (O_RDONLY | O_NOBUF)
#define O_RSTR (O_RDONLY)
#define O_FORCE_LOCAL (O_SYNC)
struct cr_img {
union {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment