Commit 38431fb1 authored by Pavel Emelyanov's avatar Pavel Emelyanov

img: Introduce the notion of a raw image

Raw images are supposed to be files with non-crtools contents.
E.g. tarballs with tmpfs contents or iptables-save output. Another
example is -- ip tool addr and route dumps we're about to merge
soon.

Having these type of images allows to use the open_image and the
cr_fdset engine easily.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 7b7e4826
...@@ -240,6 +240,9 @@ int open_image(int type, unsigned long flags, ...) ...@@ -240,6 +240,9 @@ int open_image(int type, unsigned long flags, ...)
goto err; goto err;
} }
if (fdset_template[type].magic == RAW_IMAGE_MAGIC)
goto skip_magic;
if (flags == O_RDONLY) { if (flags == O_RDONLY) {
u32 magic; u32 magic;
...@@ -254,6 +257,7 @@ int open_image(int type, unsigned long flags, ...) ...@@ -254,6 +257,7 @@ int open_image(int type, unsigned long flags, ...)
goto err; goto err;
} }
skip_magic:
return ret; return ret;
err: err:
return -1; return -1;
......
...@@ -10,6 +10,13 @@ ...@@ -10,6 +10,13 @@
#define CRTOOLS_IMAGES_V1 1 #define CRTOOLS_IMAGES_V1 1
/*
* Raw images are images in which data is stored in some
* non-crtool format (ip tool dumps, tarballs, etc.)
*/
#define RAW_IMAGE_MAGIC 0x0
/* /*
* The magic-s below correspond to coordinates * The magic-s below correspond to coordinates
* of various Russian towns in the NNNNEEEE form. * of various Russian towns in the NNNNEEEE form.
......
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