[CRIU] [PATCH 11/15] image-desc: Use unsigned format for pid driven entries

Cyrill Gorcunov gorcunov at openvz.org
Wed Oct 25 11:39:36 MSK 2017


For images which are using pid as id for image names
use unsigned format since here is no negative pid
in real system.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 criu/image-desc.c | 52 ++++++++++++++++++++++++++--------------------------
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/criu/image-desc.c b/criu/image-desc.c
index 5db474b461a4..49ee1ffdf877 100644
--- a/criu/image-desc.c
+++ b/criu/image-desc.c
@@ -40,42 +40,42 @@ struct cr_fd_desc_tmpl imgset_template[CR_FD_MAX] = {
 	FD_ENTRY(INOTIFY_WD,	"inotify-wd"),
 	FD_ENTRY(FANOTIFY_FILE,	"fanotify"),
 	FD_ENTRY(FANOTIFY_MARK,	"fanotify-mark"),
-	FD_ENTRY(CORE,		"core-%d"),
-	FD_ENTRY(IDS,		"ids-%d"),
-	FD_ENTRY(MM,		"mm-%d"),
-	FD_ENTRY(VMAS,		"vmas-%d"),
+	FD_ENTRY(CORE,		"core-%u"),
+	FD_ENTRY(IDS,		"ids-%u"),
+	FD_ENTRY(MM,		"mm-%u"),
+	FD_ENTRY(VMAS,		"vmas-%u"),
 	FD_ENTRY(PIPES,		"pipes"),
 	FD_ENTRY_F(PIPES_DATA,	"pipes-data", O_NOBUF), /* splices data */
 	FD_ENTRY(FIFO,		"fifo"),
 	FD_ENTRY_F(FIFO_DATA,	"fifo-data", O_NOBUF), /* the same */
 	FD_ENTRY(PSTREE,	"pstree"),
-	FD_ENTRY(SIGACT,	"sigacts-%d"),
+	FD_ENTRY(SIGACT,	"sigacts-%u"),
 	FD_ENTRY(UNIXSK,	"unixsk"),
 	FD_ENTRY(INETSK,	"inetsk"),
 	FD_ENTRY(PACKETSK,	"packetsk"),
 	FD_ENTRY(NETLINK_SK,	"netlinksk"),
 	FD_ENTRY_F(SK_QUEUES,	"sk-queues", O_NOBUF), /* lseeks the image */
-	FD_ENTRY(ITIMERS,	"itimers-%d"),
-	FD_ENTRY(POSIX_TIMERS,	"posix-timers-%d"),
-	FD_ENTRY(CREDS,		"creds-%d"),
-	FD_ENTRY(UTSNS,		"utsns-%d"),
-	FD_ENTRY(IPC_VAR,	"ipcns-var-%d"),
-	FD_ENTRY_F(IPCNS_SHM,	"ipcns-shm-%d", O_NOBUF), /* writes segments of data */
-	FD_ENTRY(IPCNS_MSG,	"ipcns-msg-%d"),
-	FD_ENTRY(IPCNS_SEM,	"ipcns-sem-%d"),
-	FD_ENTRY(FS,		"fs-%d"),
+	FD_ENTRY(ITIMERS,	"itimers-%u"),
+	FD_ENTRY(POSIX_TIMERS,	"posix-timers-%u"),
+	FD_ENTRY(CREDS,		"creds-%u"),
+	FD_ENTRY(UTSNS,		"utsns-%u"),
+	FD_ENTRY(IPC_VAR,	"ipcns-var-%u"),
+	FD_ENTRY_F(IPCNS_SHM,	"ipcns-shm-%u", O_NOBUF), /* writes segments of data */
+	FD_ENTRY(IPCNS_MSG,	"ipcns-msg-%u"),
+	FD_ENTRY(IPCNS_SEM,	"ipcns-sem-%u"),
+	FD_ENTRY(FS,		"fs-%u"),
 	FD_ENTRY(REMAP_FPATH,	"remap-fpath"),
 	FD_ENTRY_F(GHOST_FILE,	"ghost-file-%x", O_NOBUF),
 	FD_ENTRY(TCP_STREAM,	"tcp-stream-%x"),
 	FD_ENTRY(MNTS,		"mountpoints-%u"),
 	FD_ENTRY(NETDEV,	"netdev-%u"),
 	FD_ENTRY(NETNS,		"netns-%u"),
-	FD_ENTRY_F(IFADDR,	"ifaddr-%d", O_NOBUF),
-	FD_ENTRY_F(ROUTE,	"route-%d", O_NOBUF),
-	FD_ENTRY_F(ROUTE6,	"route6-%d", O_NOBUF),
-	FD_ENTRY_F(RULE,	"rule-%d", O_NOBUF),
-	FD_ENTRY_F(IPTABLES,	"iptables-%d", O_NOBUF),
-	FD_ENTRY_F(IP6TABLES,	"ip6tables-%d", O_NOBUF),
+	FD_ENTRY_F(IFADDR,	"ifaddr-%u", O_NOBUF),
+	FD_ENTRY_F(ROUTE,	"route-%u", O_NOBUF),
+	FD_ENTRY_F(ROUTE6,	"route6-%u", O_NOBUF),
+	FD_ENTRY_F(RULE,	"rule-%u", O_NOBUF),
+	FD_ENTRY_F(IPTABLES,	"iptables-%u", O_NOBUF),
+	FD_ENTRY_F(IP6TABLES,	"ip6tables-%u", O_NOBUF),
 	FD_ENTRY_F(TMPFS_IMG,	"tmpfs-%d.tar.gz", O_NOBUF),
 	FD_ENTRY_F(TMPFS_DEV,	"tmpfs-dev-%u.tar.gz", O_NOBUF),
 	FD_ENTRY_F(AUTOFS,	"autofs-%u", O_NOBUF),
@@ -85,20 +85,20 @@ struct cr_fd_desc_tmpl imgset_template[CR_FD_MAX] = {
 	FD_ENTRY(TTY_INFO,	"tty-info"),
 	FD_ENTRY_F(TTY_DATA,	"tty-data", O_NOBUF),
 	FD_ENTRY(FILE_LOCKS,	"filelocks"),
-	FD_ENTRY(RLIMIT,	"rlimit-%d"),
+	FD_ENTRY(RLIMIT,	"rlimit-%u"),
 	FD_ENTRY_F(PAGES,	"pages-%u", O_NOBUF),
 	FD_ENTRY_F(PAGES_OLD,	"pages-%d", O_NOBUF),
 	FD_ENTRY_F(SHM_PAGES_OLD, "pages-shmem-%ld", O_NOBUF),
-	FD_ENTRY(SIGNAL,	"signal-s-%d"),
-	FD_ENTRY(PSIGNAL,	"signal-p-%d"),
+	FD_ENTRY(SIGNAL,	"signal-s-%u"),
+	FD_ENTRY(PSIGNAL,	"signal-p-%u"),
 	FD_ENTRY(TUNFILE,	"tunfile"),
 	FD_ENTRY(CGROUP,	"cgroup"),
 	FD_ENTRY(TIMERFD,	"timerfd"),
 	FD_ENTRY(CPUINFO,	"cpuinfo"),
 	FD_ENTRY(SECCOMP,	"seccomp"),
 	FD_ENTRY(USERNS,	"userns-%u"),
-	FD_ENTRY(NETNF_CT,	"netns-ct-%d"),
-	FD_ENTRY(NETNF_EXP,	"netns-exp-%d"),
+	FD_ENTRY(NETNF_CT,	"netns-ct-%u"),
+	FD_ENTRY(NETNF_EXP,	"netns-exp-%u"),
 	FD_ENTRY(FILES,		"files"),
 	FD_ENTRY(NS,		"ns"),
 
@@ -115,7 +115,7 @@ struct cr_fd_desc_tmpl imgset_template[CR_FD_MAX] = {
 	},
 
 	[CR_FD_FILE_LOCKS_PID] = {
-		.fmt	= "filelocks-%d.img",
+		.fmt	= "filelocks-%u.img",
 		.magic	= FILE_LOCKS_MAGIC,
 	},
 };
-- 
2.7.5



More information about the CRIU mailing list