[CRIU] [PATCH 1/4] dump: add pid number to image name only if it's
not equal to zero
Kinsbursky Stanislav
skinsbursky at openvz.org
Fri Mar 16 06:25:34 EDT 2012
From: Stanislav Kinsbursky <skinsbursky at openvz.org>
Zero pid will be used later in the series to open global images.
Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
include/crtools.h | 38 +++++++++++++++++++-------------------
util.c | 5 ++++-
2 files changed, 23 insertions(+), 20 deletions(-)
-------------- next part --------------
diff --git a/include/crtools.h b/include/crtools.h
index ee35cc7..6806cc3 100644
--- a/include/crtools.h
+++ b/include/crtools.h
@@ -64,25 +64,25 @@ struct cr_fd_desc_tmpl {
extern struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX];
-#define FMT_FNAME_FDINFO "fdinfo-%d.img"
-#define FMT_FNAME_PAGES "pages-%d.img"
-#define FMT_FNAME_PAGES_SHMEM "pages-shmem-%d.img"
-#define FMT_FNAME_CORE "core-%d.img"
-#define FMT_FNAME_CORE_OUT "core-%d.img.out"
-#define FMT_FNAME_PIPES "pipes-%d.img"
-#define FMT_FNAME_PSTREE "pstree-%d.img"
-#define FMT_FNAME_SHMEM "shmem-%d.img"
-#define FMT_FNAME_SIGACTS "sigacts-%d.img"
-#define FMT_FNAME_UNIXSK "unixsk-%d.img"
-#define FMT_FNAME_INETSK "inetsk-%d.img"
-#define FMT_FNAME_ITIMERS "itimers-%d.img"
-#define FMT_FNAME_CREDS "creds-%d.img"
-#define FMT_FNAME_UTSNS "utsns-%d.img"
-#define FMT_FNAME_IPCNS_VAR "ipcns-var-%d.img"
-#define FMT_FNAME_IPCNS_SHM "ipcns-shm-%d.img"
-#define FMT_FNAME_IPCNS_MSG "ipcns-msg-%d.img"
-#define FMT_FNAME_IPCNS_SEM "ipcns-sem-%d.img"
-#define FMT_FNAME_SK_QUEUES "sk-queues-%d.img"
+#define FMT_FNAME_FDINFO "fdinfo"
+#define FMT_FNAME_PAGES "pages"
+#define FMT_FNAME_PAGES_SHMEM "pages-shmem"
+#define FMT_FNAME_CORE "core"
+#define FMT_FNAME_CORE_OUT "core.out"
+#define FMT_FNAME_PIPES "pipes"
+#define FMT_FNAME_PSTREE "pstree"
+#define FMT_FNAME_SHMEM "shmem"
+#define FMT_FNAME_SIGACTS "sigacts"
+#define FMT_FNAME_UNIXSK "unixsk"
+#define FMT_FNAME_INETSK "inetsk"
+#define FMT_FNAME_ITIMERS "itimers"
+#define FMT_FNAME_CREDS "creds"
+#define FMT_FNAME_UTSNS "utsns"
+#define FMT_FNAME_IPCNS_VAR "ipcns-var"
+#define FMT_FNAME_IPCNS_SHM "ipcns-shm"
+#define FMT_FNAME_IPCNS_MSG "ipcns-msg"
+#define FMT_FNAME_IPCNS_SEM "ipcns-sem"
+#define FMT_FNAME_SK_QUEUES "sk-queues"
extern int get_image_path(char *path, int size, const char *fmt, int pid);
diff --git a/util.c b/util.c
index 72c2c8f..1996180 100644
--- a/util.c
+++ b/util.c
@@ -153,7 +153,10 @@ int get_image_path(char *path, int size, const char *fmt, int pid)
int len;
len = snprintf(path, size, "%s/", image_dir);
- len += snprintf(path + len, size - len, fmt, pid);
+ len += snprintf(path + len, size - len, fmt);
+ if (pid)
+ len += snprintf(path + len, size - len, "-%d", pid);
+ len += snprintf(path + len, size - len, ".img");
if (len > size) {
pr_err("Image path buffer overflow %d/%d\n", size, len);
return -1;
More information about the CRIU
mailing list