[CRIU] [PATCH 1/2] output: add "0x" to hex prints using sed

Kinsbursky Stanislav skinsbursky at openvz.org
Fri Apr 13 11:44:12 EDT 2012


From: Stanislav Kinsbursky <skinsbursky at openvz.org>

Command below was executed several times:

sed 's/\(pr_.*[^%,x,X]\)\(\%[0-9,l,L]*x\)/\10x\2/g' -i *.c

Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
 cr-dump.c    |   24 +++++++++---------
 cr-restore.c |   16 ++++++------
 cr-show.c    |   76 +++++++++++++++++++++++++++++-----------------------------
 files.c      |   18 +++++++-------
 kcmp-ids.c   |    4 ++-
 namespaces.c |    2 +-
 pipes.c      |   14 +++++------
 proc_parse.c |    2 +-
 ptrace.c     |    6 ++---
 sockets.c    |   32 ++++++++++++------------
 10 files changed, 97 insertions(+), 97 deletions(-)
-------------- next part --------------
diff --git a/cr-dump.c b/cr-dump.c
index 28cd965..b3e6fff 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -152,7 +152,7 @@ static int dump_ghost_file(int _fd, u32 id, const struct stat *st)
 	struct ghost_file_entry gfe;
 	char lpath[32];
 
-	pr_info("Dumping ghost file contents (id %x)\n", id);
+	pr_info("Dumping ghost file contents (id 0x%x)\n", id);
 
 	img = open_image(CR_FD_GHOST_FILE, O_DUMP, id);
 	if (img < 0)
@@ -189,7 +189,7 @@ static int dump_ghost_remap(char *path, const struct stat *st, int lfd, u32 id)
 	struct ghost_file *gf;
 	struct remap_file_path_entry rpe;
 
-	pr_info("Dumping ghost file for fd %d id %x\n", lfd, id);
+	pr_info("Dumping ghost file for fd %d id 0x%x\n", lfd, id);
 
 	if (st->st_size > MAX_GHOST_FILE_SIZE) {
 		pr_err("Can't dump ghost file %s of %lu size\n",
@@ -315,14 +315,14 @@ static int dump_one_pipe(int lfd, u32 id, const struct fd_parms *p)
 	int ret = -1;
 	int i = 0;
 
-	pr_info("Dumping pipe %d with id %x pipe_id %x\n", lfd, id, p->id);
+	pr_info("Dumping pipe %d with id 0x%x pipe_id 0x%x\n", lfd, id, p->id);
 
 	fd_pipes = fdset_fd(glob_fdset, CR_FD_PIPES);
 
 	if (p->flags & O_WRONLY)
 		goto dump;
 
-	pr_info("Dumping data from pipe %x fd %d\n", id, lfd);
+	pr_info("Dumping data from pipe 0x%x fd %d\n", id, lfd);
 
 	for (i = 0; i < nr_pipes; i++)
 		if (pipes[i] == p->id)
@@ -380,7 +380,7 @@ dump:
 			off &= PAGE_SIZE -1;
 			if (off)
 				pde.off = PAGE_SIZE - off;
-			pr_info("off %lx %x\n", off, pde.off);
+			pr_info("off 0x%lx 0x%x\n", off, pde.off);
 		}
 
 		if (write_img(fd_pipes, &pde))
@@ -388,7 +388,7 @@ dump:
 
 		if (pde.off) {
 			off = lseek(fd_pipes, pde.off, SEEK_CUR);
-			pr_info("off %lx\n", off);
+			pr_info("off 0x%lx\n", off);
 		}
 
 		ret = splice(steal_pipe[0], NULL, fd_pipes,
@@ -435,7 +435,7 @@ static int do_dump_gen_file(const struct fd_parms *p, int lfd,
 	if (ret < 0)
 		goto err;
 
-	pr_info("fdinfo: type: %2x flags: %4x pos: %8lx fd: %d\n",
+	pr_info("fdinfo: type: 0x%2x flags: 0x%4x pos: 0x%8lx fd: %d\n",
 		p->type, p->flags, p->pos, p->fd);
 
 	if (write_img(fdset_fd(cr_fdset, CR_FD_FDINFO), &e))
@@ -502,7 +502,7 @@ static int fill_fd_params(pid_t pid, int fd, int lfd, char fd_flags, struct fd_p
 	p->fd_flags	= fd_flags;
 	p->fown		= (fown_t){ };
 
-	pr_info("%d fdinfo %d: pos: %16lx flags: %16o/%x\n",
+	pr_info("%d fdinfo %d: pos: 0x%16lx flags: %16o/0x%x\n",
 		pid, fd, p->pos, p->flags, (int)fd_flags);
 
 	p->fown.signum = fcntl(lfd, F_GETSIG, 0);
@@ -537,7 +537,7 @@ static int fill_fd_params(pid_t pid, int fd, int lfd, char fd_flags, struct fd_p
 
 static int dump_unsupp_fd(const struct fd_parms *p)
 {
-	pr_err("Can't dump file %d of that type [%x]\n",
+	pr_err("Can't dump file %d of that type [0x%x]\n",
 			p->fd, p->stat.st_mode);
 	return -1;
 }
@@ -669,7 +669,7 @@ static int dump_task_fs(pid_t pid, struct cr_fdset *fdset)
 
 	close(fd);
 
-	pr_info("Dumping task cwd id %x root id %x\n",
+	pr_info("Dumping task cwd id 0x%x root id 0x%x\n",
 			fe.cwd_id, fe.root_id);
 
 	return write_img(fdset_fd(fdset, CR_FD_FS), &fe);
@@ -1798,7 +1798,7 @@ static int cr_dump_shmem(void)
 	unsigned long pfn, nrpages;
 
 	for (si = shmems; si < &shmems[nr_shmems]; si++) {
-		pr_info("Dumping shared memory %lx\n", si->shmid);
+		pr_info("Dumping shared memory 0x%lx\n", si->shmid);
 
 		nrpages = (si->size + PAGE_SIZE -1) / PAGE_SIZE;
 		map = xmalloc(nrpages * sizeof(*map));
@@ -1812,7 +1812,7 @@ static int cr_dump_shmem(void)
 		addr = mmap(NULL, si->size, PROT_READ, MAP_SHARED, fd, 0);
 		close(fd);
 		if (addr == MAP_FAILED) {
-			pr_err("Can't map shmem %lx (%lx-%lx)\n",
+			pr_err("Can't map shmem 0x%lx (0x%lx-0x%lx)\n",
 					si->shmid, si->start, si->end);
 			goto err;
 		}
diff --git a/cr-restore.c b/cr-restore.c
index d3ca7e8..fdc19bd 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -56,7 +56,7 @@ static void show_saved_shmems(void)
 	pr_info("\tSaved shmems:\n");
 
 	for (i = 0; i < shmems->nr_shmems; i++)
-		pr_info("\t\tstart: %016lx shmid: %lx pid: %d\n",
+		pr_info("\t\tstart: 0x%016lx shmid: 0x%lx pid: %d\n",
 			shmems->entries[i].start,
 			shmems->entries[i].shmid,
 			shmems->entries[i].pid);
@@ -118,7 +118,7 @@ static int collect_shmem(int pid, struct vma_entry *vi)
 		return -1;
 	}
 
-	pr_info("Add new shmem %lx (0x016%lx-0x016%lx)",
+	pr_info("Add new shmem 0x%lx (0x0160x%lx-0x0160x%lx)",
 				vi->shmid, vi->start, vi->end);
 
 	si = &shmems->entries[nr_shmems];
@@ -156,7 +156,7 @@ static int prepare_shmem_pid(int pid)
 		if (ret <= 0)
 			break;
 
-		pr_info("%d: vma %lx %lx\n", pid, vi.start, vi.end);
+		pr_info("%d: vma 0x%lx 0x%lx\n", pid, vi.start, vi.end);
 
 		if (!vma_entry_is(&vi, VMA_ANON_SHARED))
 			continue;
@@ -345,9 +345,9 @@ static int get_shmem_fd(int pid, struct vma_entry *vi)
 	int f;
 
 	si = find_shmem(shmems, vi->shmid);
-	pr_info("%d: Search for %016lx shmem %lx %p/%d\n", pid, vi->start, vi->shmid, si, si ? si->pid : -1);
+	pr_info("%d: Search for 0x%016lx shmem 0x%lx %p/%d\n", pid, vi->start, vi->shmid, si, si ? si->pid : -1);
 	if (!si) {
-		pr_err("Can't find my shmem %016lx\n", vi->start);
+		pr_err("Can't find my shmem 0x%016lx\n", vi->start);
 		return -1;
 	}
 
@@ -414,7 +414,7 @@ static int read_and_open_vmas(int pid, struct list_head *vmas, int *nr_vmas)
 		if (!(vma_entry_is(&vma->vma, VMA_AREA_REGULAR)))
 			continue;
 
-		pr_info("%d: Opening %016lx-%016lx %016lx vma\n",
+		pr_info("%d: Opening 0x%016lx-0x%016lx 0x%016lx vma\n",
 				pid, vma->vma.start, vma->vma.end, vma->vma.pgoff);
 
 		if (vma_entry_is(&vma->vma, VMA_AREA_SYSVIPC))
@@ -664,7 +664,7 @@ static inline int fork_with_pid(int pid, unsigned long ns_clone_flags)
 	struct cr_clone_arg ca;
 	void *stack;
 
-	pr_info("Forking task with %d pid (flags %lx)\n", pid, ns_clone_flags);
+	pr_info("Forking task with %d pid (flags 0x%lx)\n", pid, ns_clone_flags);
 
 	stack = mmap(NULL, STACK_SIZE, PROT_WRITE | PROT_READ,
 			MAP_PRIVATE | MAP_GROWSDOWN | MAP_ANONYMOUS, -1, 0);
@@ -1202,7 +1202,7 @@ static int sigreturn_restore(pid_t pid, struct list_head *tgt_vmas, int nr_vmas)
 		goto err;
 	}
 
-	pr_info("Found bootstrap VMA hint at: %lx (needs ~%ldK)\n", exec_mem_hint,
+	pr_info("Found bootstrap VMA hint at: 0x%lx (needs ~%ldK)\n", exec_mem_hint,
 			KBYTES(restore_task_vma_len + restore_thread_vma_len));
 
 	/* VMA we need to run task_restore code */
diff --git a/cr-show.c b/cr-show.c
index 647dafb..f95e2f2 100644
--- a/cr-show.c
+++ b/cr-show.c
@@ -34,7 +34,7 @@
 	(isprint(sym) ? sym : '.')
 
 #define pr_regs4(s, n1, n2, n3, n4)	\
-	pr_msg("%8s: %16lx "		\
+	pr_msg("%8s: 0x%16lx "		\
 	       "%8s: %16lx "		\
 	       "%8s: %16lx "		\
 	       "%8s: %16lx\n",		\
@@ -44,7 +44,7 @@
 	       #n4, s.n4)
 
 #define pr_regs3(s, n1, n2, n3)		\
-	pr_msg("%8s: %16lx "		\
+	pr_msg("%8s: 0x%16lx "		\
 	       "%8s: %16lx "		\
 	       "%8s: %16lx\n",		\
 	       #n1, s.n1,		\
@@ -83,7 +83,7 @@ void show_files(int fd_files, struct cr_options *o)
 		if (ret <= 0)
 			goto out;
 
-		pr_msg("type: %5s fd: %5d id: %8x flags %x",
+		pr_msg("type: %5s fd: %5d id: 0x%8x flags 0x%x",
 		       fdtype2s(e.type), e.fd, e.id, e.flags);
 
 		pr_msg("\n");
@@ -95,7 +95,7 @@ out:
 
 void show_fown_cont(fown_t *fown)
 {
-	pr_msg("fown: uid: %x euid: %x signum: %x pid_type: %x pid: %u",
+	pr_msg("fown: uid: 0x%x euid: 0x%x signum: 0x%x pid_type: 0x%x pid: %u",
 	       fown->uid, fown->euid, fown->signum, fown->pid_type, fown->pid);
 }
 
@@ -112,7 +112,7 @@ void show_reg_files(int fd_reg_files, struct cr_options *o)
 		if (ret <= 0)
 			goto out;
 
-		pr_msg("id: %8x flags: %4x pos: %lx ", rfe.id, rfe.flags, rfe.pos);
+		pr_msg("id: 0x%8x flags: 0x%4x pos: 0x%lx ", rfe.id, rfe.flags, rfe.pos);
 		show_fown_cont(&rfe.fown);
 
 		if (rfe.len) {
@@ -153,7 +153,7 @@ void show_remap_files(int fd, struct cr_options *o)
 		if (ret <= 0)
 			break;
 
-		pr_msg("%x -> %x (%s)\n", rfe.orig_id,
+		pr_msg("0x%x -> 0x%x (%s)\n", rfe.orig_id,
 				(rfe.remap_id & ~REMAP_GHOST),
 				remap_id_type(rfe.remap_id));
 	}
@@ -167,7 +167,7 @@ void show_ghost_file(int fd, struct cr_options *o)
 
 	pr_img_head(CR_FD_GHOST_FILE);
 	if (read_img(fd, &gfe) > 0)
-		pr_msg("uid %u god %u mode %x\n", gfe.uid, gfe.gid, gfe.mode);
+		pr_msg("uid %u god %u mode 0x%x\n", gfe.uid, gfe.gid, gfe.mode);
 	pr_img_tail(CR_FD_GHOST_FILE);
 }
 
@@ -185,7 +185,7 @@ void show_pipes_data(int fd_pipes, struct cr_options *o)
 		ret = read_img_eof(fd_pipes, &e);
 		if (ret <= 0)
 			goto out;
-		pr_msg("pipeid: %8x bytes: %8x off: %8x\n",
+		pr_msg("pipeid: 0x%8x bytes: 0x%8x off: 0x%8x\n",
 		       e.pipe_id, e.bytes, e.off);
 
 		lseek(fd_pipes, e.off + e.bytes, SEEK_CUR);
@@ -208,7 +208,7 @@ void show_pipes(int fd_pipes, struct cr_options *o)
 		ret = read_img_eof(fd_pipes, &e);
 		if (ret <= 0)
 			goto out;
-		pr_msg("id: %8x pipeid: %8x flags: %8x ",
+		pr_msg("id: 0x%8x pipeid: 0x%8x flags: 0x%8x ",
 		       e.id, e.pipe_id, e.flags);
 		show_fown_cont(&e.fown);
 		pr_msg("\n");
@@ -225,8 +225,8 @@ void show_fs(int fd_fs, struct cr_options *o)
 	pr_img_head(CR_FD_FS);
 
 	if (read_img(fd_fs, &fe) > 0) {
-		pr_msg("CWD : %x\n", fe.cwd_id);
-		pr_msg("ROOT: %x\n", fe.root_id);
+		pr_msg("CWD : 0x%x\n", fe.cwd_id);
+		pr_msg("ROOT: 0x%x\n", fe.root_id);
 	}
 
 	pr_img_tail(CR_FD_FS);
@@ -259,12 +259,12 @@ void print_data(unsigned long addr, unsigned char *data, size_t size)
 	int i, j;
 
 	for (i = 0; i < size; i+= 16) {
-		pr_msg("%16lx: ", addr + i);
+		pr_msg("0x%16lx: ", addr + i);
 		for (j = 0; j < 8; j++)
-			pr_msg("%02x ", data[i +  j]);
+			pr_msg("0x%02x ", data[i +  j]);
 		pr_msg(" ");
 		for (j = 8; j < 16; j++)
-			pr_msg("%02x ", data[i +  j]);
+			pr_msg("0x%02x ", data[i +  j]);
 
 		pr_msg(" |");
 		for (j = 0; j < 8; j++)
@@ -303,7 +303,7 @@ void show_pages(int fd_pages, struct cr_options *o)
 					goto out;
 				}
 
-				pr_msg("%16lx ", e.va);
+				pr_msg("0x%16lx ", e.va);
 			}
 			pr_msg("\n");
 		}
@@ -325,7 +325,7 @@ void show_sigacts(int fd_sigacts, struct cr_options *o)
 		ret = read_img_eof(fd_sigacts, &e);
 		if (ret <= 0)
 			goto out;
-		pr_msg("sigaction: %016lx mask: %08lx "
+		pr_msg("sigaction: 0x%016lx mask: 0x%08lx "
 		       "flags: %016lx restorer: %016lx\n",
 		       (long)e.sigaction,
 		       (long)e.mask,
@@ -365,7 +365,7 @@ static void show_cap(char *name, u32 *v)
 
 	pr_msg("%s: ", name);
 	for (i = CR_CAP_SIZE - 1; i >= 0; i--)
-		pr_msg("%08x", v[i]);
+		pr_msg("0x%08x", v[i]);
 	pr_msg("\n");
 }
 
@@ -387,7 +387,7 @@ void show_creds(int fd, struct cr_options *o)
 	show_cap("Prm", ce.cap_prm);
 	show_cap("Bnd", ce.cap_bnd);
 
-	pr_msg("secbits: %x\n", ce.secbits);
+	pr_msg("secbits: 0x%x\n", ce.secbits);
 out:
 	pr_img_tail(CR_FD_CREDS);
 }
@@ -511,7 +511,7 @@ static void show_core_rest(int fd_core)
 		goto err;
 
 	pr_msg("\n\t---[Task parameters]---\n");
-	pr_msg("\tPersonality:  %x\n", tc.personality);
+	pr_msg("\tPersonality:  0x%x\n", tc.personality);
 	pr_msg("\tCommand:      %s\n", tc.comm);
 	pr_msg("\tState:        %d (%s)\n",
 	       (int)tc.task_state,
@@ -520,7 +520,7 @@ static void show_core_rest(int fd_core)
 	pr_msg("\t   Exit code: %u\n",
 	       (unsigned int)tc.exit_code);
 
-	pr_msg("\tBlkSig: %lx\n", tc.blk_sigset);
+	pr_msg("\tBlkSig: 0x%lx\n", tc.blk_sigset);
 	pr_msg("\n");
 
 err:
@@ -535,10 +535,10 @@ static void show_core_ids(int fd)
 	if (read_img(fd, &cie) < 0)
 		goto err;
 
-	pr_msg("\tVM:      %x\n", cie.vm_id);
-	pr_msg("\tFS:      %x\n", cie.fs_id);
-	pr_msg("\tFILES:   %x\n", cie.files_id);
-	pr_msg("\tSIGHAND: %x\n", cie.sighand_id);
+	pr_msg("\tVM:      0x%x\n", cie.vm_id);
+	pr_msg("\tFS:      0x%x\n", cie.fs_id);
+	pr_msg("\tFILES:   0x%x\n", cie.files_id);
+	pr_msg("\tSIGHAND: 0x%x\n", cie.sighand_id);
 err:
 	return;
 }
@@ -576,18 +576,18 @@ void show_mm(int fd_mm, struct cr_options *o)
 	if (read_img(fd_mm, &mme) < 0)
 		goto out;
 
-	pr_msg("\tBrk:          %lx\n", mme.mm_brk);
-	pr_msg("\tStart code:   %lx\n", mme.mm_start_code);
-	pr_msg("\tEnd code:     %lx\n", mme.mm_end_code);
-	pr_msg("\tStart stack:  %lx\n", mme.mm_start_stack);
-	pr_msg("\tStart data:   %lx\n", mme.mm_start_data);
-	pr_msg("\tEnd data:     %lx\n", mme.mm_end_data);
-	pr_msg("\tStart brk:    %lx\n", mme.mm_start_brk);
-	pr_msg("\tArg start:    %lx\n", mme.mm_arg_start);
-	pr_msg("\tArg end:      %lx\n", mme.mm_arg_end);
-	pr_msg("\tEnv start:    %lx\n", mme.mm_env_start);
-	pr_msg("\tEnv end:      %lx\n", mme.mm_env_end);
-	pr_msg("\tExe file ID   %x\n", mme.exe_file_id);
+	pr_msg("\tBrk:          0x%lx\n", mme.mm_brk);
+	pr_msg("\tStart code:   0x%lx\n", mme.mm_start_code);
+	pr_msg("\tEnd code:     0x%lx\n", mme.mm_end_code);
+	pr_msg("\tStart stack:  0x%lx\n", mme.mm_start_stack);
+	pr_msg("\tStart data:   0x%lx\n", mme.mm_start_data);
+	pr_msg("\tEnd data:     0x%lx\n", mme.mm_end_data);
+	pr_msg("\tStart brk:    0x%lx\n", mme.mm_start_brk);
+	pr_msg("\tArg start:    0x%lx\n", mme.mm_arg_start);
+	pr_msg("\tArg end:      0x%lx\n", mme.mm_arg_end);
+	pr_msg("\tEnv start:    0x%lx\n", mme.mm_env_start);
+	pr_msg("\tEnv end:      0x%lx\n", mme.mm_env_end);
+	pr_msg("\tExe file ID   0x%x\n", mme.exe_file_id);
 out:
 	pr_img_tail(CR_FD_MM);
 }
@@ -611,13 +611,13 @@ static int cr_parse_file(struct cr_options *opts)
 			break;
 
 	if (i == CR_FD_MAX) {
-		pr_err("Unknown magic %x in %s\n",
+		pr_err("Unknown magic 0x%x in %s\n",
 				magic, opts->show_dump_file);
 		goto err;
 	}
 
 	if (!fdset_template[i].show) {
-		pr_err("No handler for %x/%s\n",
+		pr_err("No handler for 0x%x/%s\n",
 				magic, opts->show_dump_file);
 		goto err;
 	}
diff --git a/files.c b/files.c
index 31f8b33..3dcfa8d 100644
--- a/files.c
+++ b/files.c
@@ -96,7 +96,7 @@ void show_saved_files(void)
 		list_for_each_entry(fd, &file_descs[i], hash) {
 			struct fdinfo_list_entry *le;
 
-			pr_info(" `- type %d ID %x\n", fd->type, fd->id);
+			pr_info(" `- type %d ID 0x%x\n", fd->type, fd->id);
 			list_for_each_entry(le, &fd->fd_info_head, list)
 				pr_info("   `- FD %d pid %d\n", le->fd, le->pid);
 		}
@@ -189,7 +189,7 @@ static int open_remap_ghost(struct reg_file_info *rfi,
 	 * issues with cross-device links.
 	 */
 
-	pr_info("Opening ghost file %x for %s\n", rfe->remap_id, rfi->path);
+	pr_info("Opening ghost file 0x%x for %s\n", rfe->remap_id, rfi->path);
 
 	gf = xmalloc(sizeof(*gf));
 	if (!gf)
@@ -213,7 +213,7 @@ static int open_remap_ghost(struct reg_file_info *rfi,
 	}
 
 	if (fchown(gfd, gfe.uid, gfe.gid) < 0) {
-		pr_perror("Can't reset user/group on ghost %x\n", rfe->remap_id);
+		pr_perror("Can't reset user/group on ghost 0x%x\n", rfe->remap_id);
 		return -1;
 	}
 
@@ -250,21 +250,21 @@ static int collect_remaps(void)
 		ret = -1;
 
 		if (!(rfe.remap_id & REMAP_GHOST)) {
-			pr_err("Non ghost remap not supported @%x\n",
+			pr_err("Non ghost remap not supported @0x%x\n",
 					rfe.orig_id);
 			break;
 		}
 
 		fdesc = find_file_desc_raw(FDINFO_REG, rfe.orig_id);
 		if (fdesc == NULL) {
-			pr_err("Remap for non existing file %x\n",
+			pr_err("Remap for non existing file 0x%x\n",
 					rfe.orig_id);
 			break;
 		}
 
 		rfe.remap_id &= ~REMAP_GHOST;
 		rfi = container_of(fdesc, struct reg_file_info, d);
-		pr_info("Configuring remap %x -> %x\n", rfi->rfe.id, rfe.remap_id);
+		pr_info("Configuring remap 0x%x -> 0x%x\n", rfi->rfe.id, rfe.remap_id);
 		ret = open_remap_ghost(rfi, &rfe);
 		if (ret < 0)
 			break;
@@ -309,7 +309,7 @@ int collect_reg_files(void)
 		rfi->remap_path = NULL;
 		rfi->path[len] = '\0';
 
-		pr_info("Collected [%s] ID %x\n", rfi->path, rfi->rfe.id);
+		pr_info("Collected [%s] ID 0x%x\n", rfi->path, rfi->rfe.id);
 		file_desc_add(&rfi->d, FDINFO_REG, rfi->rfe.id,
 				&reg_desc_ops);
 	}
@@ -330,7 +330,7 @@ static int collect_fd(int pid, struct fdinfo_entry *e)
 	struct fdinfo_list_entry *l, *le = &fdinfo_list[nr_fdinfo_list];
 	struct file_desc *fdesc;
 
-	pr_info("Collect fdinfo pid=%d fd=%d id=%16x\n",
+	pr_info("Collect fdinfo pid=%d fd=%d id=0x%16x\n",
 		pid, e->fd, e->id);
 
 	nr_fdinfo_list++;
@@ -423,7 +423,7 @@ int open_reg_by_id(u32 id)
 
 	fd = find_file_desc_raw(FDINFO_REG, id);
 	if (fd == NULL) {
-		pr_perror("Can't find regfile for %x\n", id);
+		pr_perror("Can't find regfile for 0x%x\n", id);
 		return -1;
 	}
 
diff --git a/kcmp-ids.c b/kcmp-ids.c
index aaad8c9..c8cd9ad 100644
--- a/kcmp-ids.c
+++ b/kcmp-ids.c
@@ -59,7 +59,7 @@ static void show_subnode(struct rb_node *node, int self)
 {
 	struct kid_entry *this = rb_entry(node, struct kid_entry, subtree_node);
 
-	pr_info("\t\t| %x.%x %s\n", this->elem.genid, this->subid,
+	pr_info("\t\t| 0x%x.0x%x %s\n", this->elem.genid, this->subid,
 			self ? "(self)" : "");
 	if (node->rb_left) {
 		pr_info("\t\t| left:\n");
@@ -83,7 +83,7 @@ static void show_node(struct rb_node *node)
 {
 	struct kid_entry *this = rb_entry(node, struct kid_entry, node);
 
-	pr_info("\t%x.%x\n", this->elem.genid, this->subid);
+	pr_info("\t0x%x.0x%x\n", this->elem.genid, this->subid);
 	if (node->rb_left) {
 		pr_info("\tleft:\n");
 		show_node(node->rb_left);
diff --git a/namespaces.c b/namespaces.c
index 4b4785c..7a89a29 100644
--- a/namespaces.c
+++ b/namespaces.c
@@ -103,7 +103,7 @@ int prepare_namespace(int pid, unsigned long clone_flags)
 {
 	int ret = 0;
 
-	pr_info("Restoring namespaces %d flags %lx\n",
+	pr_info("Restoring namespaces %d flags 0x%lx\n",
 			pid, clone_flags);
 
 	if (clone_flags & CLONE_NEWUTS)
diff --git a/pipes.c b/pipes.c
index 6b70ae2..2575035 100644
--- a/pipes.c
+++ b/pipes.c
@@ -57,7 +57,7 @@ int collect_pipes(void)
 		if (ret <= 0)
 			break;
 
-		pr_info("Collected pipe entry ID %x PIPE ID %x\n",
+		pr_info("Collected pipe entry ID 0x%x PIPE ID 0x%x\n",
 					pi->pe.id, pi->pe.pipe_id);
 
 		file_desc_add(&pi->d, FDINFO_PIPE, pi->pe.id,
@@ -85,7 +85,7 @@ static void show_saved_pipe_fds(struct pipe_info *pi)
 {
 	struct fdinfo_list_entry *fle;
 
-	pr_info("  `- ID %p %xpn", pi, pi->pe.id);
+	pr_info("  `- ID %p 0x%xpn", pi, pi->pe.id);
 	list_for_each_entry(fle, &pi->d.fd_info_head, list)
 		pr_info("   `- FD %d pid %d\n", fle->fd, fle->pid);
 }
@@ -145,7 +145,7 @@ void mark_pipe_master()
 		pi = list_first_entry(&pipes, struct pipe_info, list);
 		list_move(&pi->list, &head);
 
-		pr_info(" `- PIPE ID %x\n", pi->pe.pipe_id);
+		pr_info(" `- PIPE ID 0x%x\n", pi->pe.pipe_id);
 		show_saved_pipe_fds(pi);
 
 		fle = file_master(&pi->d);
@@ -167,7 +167,7 @@ void mark_pipe_master()
 			show_saved_pipe_fds(pic);
 		}
 		p->create = 1;
-		pr_info("    by %x\n", p->pe.id);
+		pr_info("    by 0x%x\n", p->pe.id);
 	}
 
 	list_splice(&head, &pipes);
@@ -227,12 +227,12 @@ static int restore_pipe_data(int pfd, struct pipe_info *pi)
 	while (size != pi->bytes) {
 		ret = splice(fd, NULL, pfd, NULL, pi->bytes - size, 0);
 		if (ret < 0) {
-			pr_perror("%x: Error splicing data", pi->pe.id);
+			pr_perror("0x%x: Error splicing data", pi->pe.id);
 			goto err;
 		}
 
 		if (ret == 0) {
-			pr_err("%x: Wanted to restore %d bytes, but got %d\n",
+			pr_err("0x%x: Wanted to restore %d bytes, but got %d\n",
 				pi->pe.id, pi->bytes, size);
 			ret = -1;
 			goto err;
@@ -256,7 +256,7 @@ static int open_pipe(struct file_desc *d)
 
 	pi = container_of(d, struct pipe_info, d);
 
-	pr_info("\tCreating pipe pipe_id=%x id=%x\n", pi->pe.pipe_id, pi->pe.id);
+	pr_info("\tCreating pipe pipe_id=0x%x id=0x%x\n", pi->pe.pipe_id, pi->pe.id);
 
 	if (!pi->create)
 		return recv_pipe_fd(pi);
diff --git a/proc_parse.c b/proc_parse.c
index 015ba61..2246369 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -178,7 +178,7 @@ err:
 	return ret;
 
 err_bogus_mapping:
-	pr_err("Bogus mapping %lx-%lx (flags: %x vm_file_fd: %d)\n",
+	pr_err("Bogus mapping 0x%lx-0x%lx (flags: 0x%x vm_file_fd: %d)\n",
 	       vma_area->vma.start, vma_area->vma.end,
 	       vma_area->vma.flags, vma_area->vm_file_fd);
 	goto err;
diff --git a/ptrace.c b/ptrace.c
index 5c3bef9..4e36c45 100644
--- a/ptrace.c
+++ b/ptrace.c
@@ -155,7 +155,7 @@ int ptrace_show_area_r(pid_t pid, void *addr, long bytes)
 		else {
 			unsigned char *c = (unsigned char *)&v;
 			for (i = sizeof(v)/sizeof(*c); i > 0; i--)
-				pr_msg("%02x ", c[i - 1]);
+				pr_msg("0x%02x ", c[i - 1]);
 			pr_msg("  ");
 		}
 	}
@@ -170,7 +170,7 @@ int ptrace_show_area(pid_t pid, void *addr, long bytes)
 	unsigned long w, i;
 	if (bytes & (sizeof(long) - 1))
 		return -1;
-	pr_msg("%016lx: ", (unsigned long)addr);
+	pr_msg("0x%016lx: ", (unsigned long)addr);
 	for (w = 0; w < bytes / sizeof(long); w++) {
 		unsigned long *a = addr;
 		unsigned long v;
@@ -180,7 +180,7 @@ int ptrace_show_area(pid_t pid, void *addr, long bytes)
 		else {
 			unsigned char *c = (unsigned char *)&v;
 			for (i = 0; i < sizeof(v)/sizeof(*c); i++)
-				pr_msg("%02x ", c[i]);
+				pr_msg("0x%02x ", c[i]);
 			pr_msg("  ");
 		}
 	}
diff --git a/sockets.c b/sockets.c
index 74862b4..3f04854 100644
--- a/sockets.c
+++ b/sockets.c
@@ -219,7 +219,7 @@ static void show_one_inet(const char *act, const struct inet_sk_desc *sk)
 		pr_perror("Failed to translate address");
 	}
 
-	pr_debug("\t%s: ino %x family %d type %d port %d "
+	pr_debug("\t%s: ino 0x%x family %d type %d port %d "
 		"state %d src_addr %s\n",
 		act, sk->sd.ino, sk->sd.family, sk->type, sk->src_port,
 		sk->state, src_addr);
@@ -242,7 +242,7 @@ static void show_one_inet_img(const char *act, const struct inet_sk_entry *e)
 
 static void show_one_unix(char *act, const struct unix_sk_desc *sk)
 {
-	pr_debug("\t%s: ino %x type %d state %d name %s\n",
+	pr_debug("\t%s: ino 0x%x type %d state %d name %s\n",
 		act, sk->sd.ino, sk->type, sk->state, sk->name);
 
 	if (sk->nr_icons) {
@@ -403,7 +403,7 @@ static int dump_one_unix(const struct socket_desc *_sk, struct fd_parms *p,
 
 		peer = (struct unix_sk_desc *)lookup_socket(ue.peer);
 		if (!peer) {
-			pr_err("Unix socket %x without peer %x\n",
+			pr_err("Unix socket 0x%x without peer 0x%x\n",
 					ue.id, ue.peer);
 			goto err;
 		}
@@ -413,7 +413,7 @@ static int dump_one_unix(const struct socket_desc *_sk, struct fd_parms *p,
 		 * we can access one.
 		 */
 		if (!peer->name && (peer->peer_ino != ue.id)) {
-			pr_err("Unix socket %x with unreachable peer %x (%x/%s)\n",
+			pr_err("Unix socket 0x%x with unreachable peer 0x%x (0x%x/%s)\n",
 					ue.id, ue.peer, peer->peer_ino, peer->name);
 			goto err;
 		}
@@ -444,7 +444,7 @@ static int dump_one_unix(const struct socket_desc *_sk, struct fd_parms *p,
 
 		ue.peer		= e->sk_desc->sd.ino;
 
-		pr_debug("\t\tFixed inflight socket %x peer %x)\n",
+		pr_debug("\t\tFixed inflight socket 0x%x peer 0x%x)\n",
 				ue.id, ue.peer);
 	}
 
@@ -1107,7 +1107,7 @@ void show_inetsk(int fd, struct cr_options *o)
 			}
 		}
 
-		pr_msg("id %x family %s type %s proto %s state %s %s:%d <-> %s:%d flags %2x\n",
+		pr_msg("id 0x%x family %s type %s proto %s state %s %s:%d <-> %s:%d flags 0x%2x\n",
 			ie.id, skfamily2s(ie.family), sktype2s(ie.type), skproto2s(ie.proto),
 			skstate2s(ie.state), src_addr, ie.src_port, dst_addr, ie.dst_port, ie.flags);
 		pr_msg("\t"), show_fown_cont(&ie.fown), pr_msg("\n");
@@ -1131,7 +1131,7 @@ void show_unixsk(int fd, struct cr_options *o)
 		if (ret <= 0)
 			goto out;
 
-		pr_msg("id %8x type %s state %s namelen %4d backlog %4d peer %8x flags %2x",
+		pr_msg("id 0x%8x type %s state %s namelen %4d backlog %4d peer 0x%8x flags 0x%2x",
 			ue.id, sktype2s(ue.type), skstate2s(ue.state),
 			ue.namelen, ue.backlog, ue.peer, ue.flags);
 
@@ -1212,7 +1212,7 @@ int run_unix_connections(void)
 		struct fdinfo_list_entry *fle;
 		struct sockaddr_un addr;
 
-		pr_info("\tConnect %x to %x\n", ui->ue.id, peer->ue.id);
+		pr_info("\tConnect 0x%x to 0x%x\n", ui->ue.id, peer->ue.id);
 
 		fle = file_master(&ui->d);
 
@@ -1229,7 +1229,7 @@ try_again:
 				goto try_again; /* FIXME use futex waiters */
 			}
 
-			pr_perror("Can't connect %x socket", ui->ue.id);
+			pr_perror("Can't connect 0x%x socket", ui->ue.id);
 			return -1;
 		}
 
@@ -1287,7 +1287,7 @@ static int open_unixsk_pair_master(struct unix_sk_info *ui)
 	struct unix_sk_info *peer = ui->peer;
 	struct fdinfo_list_entry *fle;
 
-	pr_info("Opening pair master (id %x peer %x)\n",
+	pr_info("Opening pair master (id 0x%x peer 0x%x)\n",
 			ui->ue.id, ui->ue.peer);
 
 	if (socketpair(PF_UNIX, ui->ue.type, 0, sk) < 0) {
@@ -1338,7 +1338,7 @@ static int open_unixsk_pair_slave(struct unix_sk_info *ui)
 
 	fle = file_master(&ui->d);
 
-	pr_info("Opening pair slave (id %x peer %x) on %d\n",
+	pr_info("Opening pair slave (id 0x%x peer 0x%x) on %d\n",
 			ui->ue.id, ui->ue.peer, fle->fd);
 
 	sk = recv_fd(fle->fd);
@@ -1358,7 +1358,7 @@ static int open_unixsk_standalone(struct unix_sk_info *ui)
 {
 	int sk;
 
-	pr_info("Opening standalone socket (id %x peer %x)\n",
+	pr_info("Opening standalone socket (id 0x%x peer 0x%x)\n",
 			ui->ue.id, ui->ue.peer);
 
 	sk = socket(PF_UNIX, ui->ue.type, 0);
@@ -1374,13 +1374,13 @@ static int open_unixsk_standalone(struct unix_sk_info *ui)
 		return -1;
 
 	if (ui->ue.state == TCP_LISTEN) {
-		pr_info("\tPutting %x into listen state\n", ui->ue.id);
+		pr_info("\tPutting 0x%x into listen state\n", ui->ue.id);
 		if (listen(sk, ui->ue.backlog) < 0) {
 			pr_perror("Can't make usk listen");
 			return -1;
 		}
 	} else if (ui->peer) {
-		pr_info("\tWill connect %x to %x later\n", ui->ue.id, ui->ue.peer);
+		pr_info("\tWill connect 0x%x to 0x%x later\n", ui->ue.id, ui->ue.peer);
 		if (schedule_conn_job(ui))
 			return -1;
 	}
@@ -1485,7 +1485,7 @@ int resolve_unix_peers(void)
 
 		peer = find_unix_sk(ui->ue.peer);
 		if (!peer) {
-			pr_err("FATAL: Peer %x unresolved for %x\n",
+			pr_err("FATAL: Peer 0x%x unresolved for 0x%x\n",
 					ui->ue.peer, ui->ue.id);
 			return -1;
 		}
@@ -1524,7 +1524,7 @@ int resolve_unix_peers(void)
 	list_for_each_entry(ui, &unix_sockets, list) {
 		struct fdinfo_list_entry *fle;
 
-		pr_info("\t%x -> %x (%x) flags %x\n", ui->ue.id, ui->ue.peer,
+		pr_info("\t0x%x -> 0x%x (0x%x) flags 0x%x\n", ui->ue.id, ui->ue.peer,
 				ui->peer ? ui->peer->ue.id : 0, ui->flags);
 		list_for_each_entry(fle, &ui->d.fd_info_head, list)
 			pr_info("\t\tfd %d in pid %d\n",


More information about the CRIU mailing list