[CRIU] [PATCH 1/9] img: Open images "at" functionality
Pavel Emelyanov
xemul at parallels.com
Thu Apr 11 09:49:43 EDT 2013
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
image.c | 12 ++++++++----
include/crtools.h | 4 +++-
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/image.c b/image.c
index 2f01fe2..6a0376c 100644
--- a/image.c
+++ b/image.c
@@ -264,9 +264,8 @@ struct cr_fdset *cr_glob_fdset_open(int mode)
return cr_fdset_open(-1 /* ignored */, _CR_FD_GLOB_FROM, _CR_FD_GLOB_TO, mode);
}
-int open_image(int type, unsigned long flags, ...)
+int open_image_at(int dfd, int type, unsigned long flags, ...)
{
- int dfd = get_service_fd(IMG_FD_OFF);
char path[PATH_MAX];
va_list args;
int ret;
@@ -350,7 +349,7 @@ void up_page_ids_base(void)
page_ids += 0x10000;
}
-int open_pages_image(unsigned long flags, int pm_fd)
+int open_pages_image_at(int dfd, unsigned long flags, int pm_fd)
{
unsigned id;
@@ -367,5 +366,10 @@ int open_pages_image(unsigned long flags, int pm_fd)
return -1;
}
- return open_image(CR_FD_PAGES, flags, id);
+ return open_image_at(dfd, CR_FD_PAGES, flags, id);
+}
+
+int open_pages_image(unsigned long flags, int pm_fd)
+{
+ return open_pages_image_at(get_service_fd(IMG_FD_OFF), flags, pm_fd);
}
diff --git a/include/crtools.h b/include/crtools.h
index 6cd4cde..206710d 100644
--- a/include/crtools.h
+++ b/include/crtools.h
@@ -188,8 +188,10 @@ extern struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX];
extern int open_image_dir(void);
extern void close_image_dir(void);
-int open_image(int type, unsigned long flags, ...);
+int open_image_at(int dfd, int type, unsigned long flags, ...);
+#define open_image(typ, flags, ...) open_image_at(get_service_fd(IMG_FD_OFF), typ, flags, ##__VA_ARGS__)
int open_pages_image(unsigned long flags, int pm_fd);
+int open_pages_image_at(int dfd, unsigned long flags, int pm_fd);
void up_page_ids_base(void);
#define LAST_PID_PATH "/proc/sys/kernel/ns_last_pid"
--
1.7.11.7
More information about the CRIU
mailing list