Commit fa437b65 authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Pavel Emelyanov

criu-print: use %# to print hex values w/ width specified

If we print "0x" with width specifier, it may go away which is not nice:
(00.005258) 21858 fdinfo 0: pos: 0x               0 flags:           100002/0
(00.004589)     Collected: ino 0x    51fd family    2 type    1 port    64000 state 10 src_addr 0.0.0.0

This patch is generated with the following sed one-liner:
find ./* -type f -print0 | xargs -0 sed -i '/pr.*/s/0x%\([0-9]\+\)/%#\1/g'

Don't know if we should change all 0x%*anything* printing to %#*anything*,
but where we use field width I think we should.

Impact: Just bothered by eyes, cleanup.
Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 5c89cc03
...@@ -278,7 +278,7 @@ int do_dump_gen_file(struct fd_parms *p, int lfd, ...@@ -278,7 +278,7 @@ int do_dump_gen_file(struct fd_parms *p, int lfd,
if (ret < 0) if (ret < 0)
return ret; return ret;
pr_info("fdinfo: type: 0x%2x flags: %#o/%#o pos: 0x%8"PRIx64" fd: %d\n", pr_info("fdinfo: type: %#2x flags: %#o/%#o pos: %#8"PRIx64" fd: %d\n",
ops->type, p->flags, (int)p->fd_flags, p->pos, p->fd); ops->type, p->flags, (int)p->fd_flags, p->pos, p->fd);
return pb_write_one(img, &e, PB_FDINFO); return pb_write_one(img, &e, PB_FDINFO);
...@@ -335,7 +335,7 @@ static int fill_fd_params(struct parasite_ctl *ctl, int fd, int lfd, ...@@ -335,7 +335,7 @@ static int fill_fd_params(struct parasite_ctl *ctl, int fd, int lfd,
fown_entry__init(&p->fown); fown_entry__init(&p->fown);
pr_info("%d fdinfo %d: pos: 0x%16"PRIx64" flags: %16o/%#x\n", pr_info("%d fdinfo %d: pos: %#16"PRIx64" flags: %16o/%#x\n",
ctl->pid.real, fd, p->pos, p->flags, (int)p->fd_flags); ctl->pid.real, fd, p->pos, p->flags, (int)p->fd_flags);
ret = fcntl(lfd, F_GETSIG, 0); ret = fcntl(lfd, F_GETSIG, 0);
......
...@@ -204,13 +204,13 @@ static int open_handle(unsigned int s_dev, unsigned long i_ino, ...@@ -204,13 +204,13 @@ static int open_handle(unsigned int s_dev, unsigned long i_ino,
mntfd = open_mount(s_dev); mntfd = open_mount(s_dev);
if (mntfd < 0) { if (mntfd < 0) {
pr_err("Mount root for 0x%08x not found\n", s_dev); pr_err("Mount root for %#08x not found\n", s_dev);
goto out; goto out;
} }
fd = userns_call(open_by_handle, UNS_FDOUT, &handle, sizeof(handle), mntfd); fd = userns_call(open_by_handle, UNS_FDOUT, &handle, sizeof(handle), mntfd);
if (fd < 0) { if (fd < 0) {
pr_perror("Can't open file handle for 0x%08x:0x%016lx", pr_perror("Can't open file handle for %#08x:%#016lx",
s_dev, i_ino); s_dev, i_ino);
} }
...@@ -307,9 +307,9 @@ static int dump_inotify_entry(union fdinfo_entries *e, void *arg) ...@@ -307,9 +307,9 @@ static int dump_inotify_entry(union fdinfo_entries *e, void *arg)
struct inotify_wd_entry *wd_entry = (struct inotify_wd_entry *) e; struct inotify_wd_entry *wd_entry = (struct inotify_wd_entry *) e;
InotifyWdEntry *we = &wd_entry->e; InotifyWdEntry *we = &wd_entry->e;
pr_info("wd: wd 0x%08x s_dev 0x%08x i_ino 0x%16"PRIx64" mask 0x%08x\n", pr_info("wd: wd %#08x s_dev %#08x i_ino %#16"PRIx64" mask %#08x\n",
we->wd, we->s_dev, we->i_ino, we->mask); we->wd, we->s_dev, we->i_ino, we->mask);
pr_info("\t[fhandle] bytes 0x%08x type 0x%08x __handle 0x%016"PRIx64":0x%016"PRIx64"\n", pr_info("\t[fhandle] bytes %#08x type %#08x __handle %#016"PRIx64":%#016"PRIx64"\n",
we->f_handle->bytes, we->f_handle->type, we->f_handle->bytes, we->f_handle->type,
we->f_handle->handle[0], we->f_handle->handle[1]); we->f_handle->handle[0], we->f_handle->handle[1]);
...@@ -339,7 +339,7 @@ static int dump_one_inotify(int lfd, u32 id, const struct fd_parms *p) ...@@ -339,7 +339,7 @@ static int dump_one_inotify(int lfd, u32 id, const struct fd_parms *p)
if (ret < 0) if (ret < 0)
return -1; return -1;
else if (ret > 0) else if (ret > 0)
pr_warn("The 0x%08x inotify events will be dropped\n", id); pr_warn("The %#08x inotify events will be dropped\n", id);
ie.id = id; ie.id = id;
ie.flags = p->flags; ie.flags = p->flags;
...@@ -357,7 +357,7 @@ static int dump_one_inotify(int lfd, u32 id, const struct fd_parms *p) ...@@ -357,7 +357,7 @@ static int dump_one_inotify(int lfd, u32 id, const struct fd_parms *p)
ie.wd[i++] = &we->ify.e; ie.wd[i++] = &we->ify.e;
ie.n_wd = wd_list.n; ie.n_wd = wd_list.n;
pr_info("id 0x%08x flags 0x%08x\n", ie.id, ie.flags); pr_info("id %#08x flags %#08x\n", ie.id, ie.flags);
if (pb_write_one(img_from_set(glob_imgset, CR_FD_INOTIFY_FILE), &ie, PB_INOTIFY_FILE)) if (pb_write_one(img_from_set(glob_imgset, CR_FD_INOTIFY_FILE), &ie, PB_INOTIFY_FILE))
goto free; goto free;
...@@ -401,10 +401,10 @@ static int dump_fanotify_entry(union fdinfo_entries *e, void *arg) ...@@ -401,10 +401,10 @@ static int dump_fanotify_entry(union fdinfo_entries *e, void *arg)
BUG_ON(!fme->ie); BUG_ON(!fme->ie);
pr_info("mark: s_dev 0x%08x i_ino 0x%016"PRIx64" mask 0x%08x\n", pr_info("mark: s_dev %#08x i_ino %#016"PRIx64" mask %#08x\n",
fme->s_dev, fme->ie->i_ino, fme->mask); fme->s_dev, fme->ie->i_ino, fme->mask);
pr_info("\t[fhandle] bytes 0x%08x type 0x%08x __handle 0x%016"PRIx64":0x%016"PRIx64"\n", pr_info("\t[fhandle] bytes %#08x type %#08x __handle %#016"PRIx64":%#016"PRIx64"\n",
fme->ie->f_handle->bytes, fme->ie->f_handle->type, fme->ie->f_handle->bytes, fme->ie->f_handle->type,
fme->ie->f_handle->handle[0], fme->ie->f_handle->handle[1]); fme->ie->f_handle->handle[0], fme->ie->f_handle->handle[1]);
...@@ -424,7 +424,7 @@ static int dump_fanotify_entry(union fdinfo_entries *e, void *arg) ...@@ -424,7 +424,7 @@ static int dump_fanotify_entry(union fdinfo_entries *e, void *arg)
} }
fme->s_dev = m->s_dev; fme->s_dev = m->s_dev;
pr_info("mark: s_dev 0x%08x mnt_id 0x%08x mask 0x%08x\n", pr_info("mark: s_dev %#08x mnt_id %#08x mask %#08x\n",
fme->s_dev, fme->me->mnt_id, fme->mask); fme->s_dev, fme->me->mnt_id, fme->mask);
} }
...@@ -449,7 +449,7 @@ static int dump_one_fanotify(int lfd, u32 id, const struct fd_parms *p) ...@@ -449,7 +449,7 @@ static int dump_one_fanotify(int lfd, u32 id, const struct fd_parms *p)
if (ret < 0) if (ret < 0)
return -1; return -1;
else if (ret > 0) else if (ret > 0)
pr_warn("The 0x%08x fanotify events will be dropped\n", id); pr_warn("The %#08x fanotify events will be dropped\n", id);
ret = -1; ret = -1;
fe.id = id; fe.id = id;
...@@ -469,7 +469,7 @@ static int dump_one_fanotify(int lfd, u32 id, const struct fd_parms *p) ...@@ -469,7 +469,7 @@ static int dump_one_fanotify(int lfd, u32 id, const struct fd_parms *p)
fe.mark[i++] = &we->ffy.e; fe.mark[i++] = &we->ffy.e;
fe.n_mark = wd_list.n; fe.n_mark = wd_list.n;
pr_info("id 0x%08x flags 0x%08x\n", fe.id, fe.flags); pr_info("id %#08x flags %#08x\n", fe.id, fe.flags);
fe.faflags = wd_list.fsn_params.faflags; fe.faflags = wd_list.fsn_params.faflags;
fe.evflags = wd_list.fsn_params.evflags; fe.evflags = wd_list.fsn_params.evflags;
...@@ -518,7 +518,7 @@ static char *get_mark_path(const char *who, struct file_remap *remap, ...@@ -518,7 +518,7 @@ static char *get_mark_path(const char *who, struct file_remap *remap,
mntns_root = mntns_get_root_by_mnt_id(remap->rmnt_id); mntns_root = mntns_get_root_by_mnt_id(remap->rmnt_id);
pr_debug("\t\tRestore %s watch for 0x%08x:0x%016lx (via %s)\n", pr_debug("\t\tRestore %s watch for %#08x:%#016lx (via %s)\n",
who, s_dev, i_ino, remap->rpath); who, s_dev, i_ino, remap->rpath);
*target = openat(mntns_root, remap->rpath, O_PATH); *target = openat(mntns_root, remap->rpath, O_PATH);
} else if (f_handle->path) { } else if (f_handle->path) {
...@@ -561,7 +561,7 @@ static char *get_mark_path(const char *who, struct file_remap *remap, ...@@ -561,7 +561,7 @@ static char *get_mark_path(const char *who, struct file_remap *remap,
if (read_fd_link(*target, link, sizeof(link)) < 0) if (read_fd_link(*target, link, sizeof(link)) < 0)
link[0] = '\0'; link[0] = '\0';
pr_debug("\t\tRestore %s watch for 0x%08x:0x%016lx (via %s -> %s)\n", pr_debug("\t\tRestore %s watch for %#08x:%#016lx (via %s -> %s)\n",
who, s_dev, i_ino, path, link); who, s_dev, i_ino, path, link);
} }
err: err:
...@@ -689,12 +689,12 @@ static int open_inotify_fd(struct file_desc *d) ...@@ -689,12 +689,12 @@ static int open_inotify_fd(struct file_desc *d)
tmp = inotify_init1(info->ife->flags); tmp = inotify_init1(info->ife->flags);
if (tmp < 0) { if (tmp < 0) {
pr_perror("Can't create inotify for 0x%08x", info->ife->id); pr_perror("Can't create inotify for %#08x", info->ife->id);
return -1; return -1;
} }
list_for_each_entry(wd_info, &info->marks, list) { list_for_each_entry(wd_info, &info->marks, list) {
pr_info("\tRestore 0x%x wd for 0x%08x\n", wd_info->iwe->wd, wd_info->iwe->id); pr_info("\tRestore 0x%x wd for %#08x\n", wd_info->iwe->wd, wd_info->iwe->id);
if (restore_one_inotify(tmp, wd_info)) { if (restore_one_inotify(tmp, wd_info)) {
close_safe(&tmp); close_safe(&tmp);
break; break;
...@@ -729,7 +729,7 @@ static int open_fanotify_fd(struct file_desc *d) ...@@ -729,7 +729,7 @@ static int open_fanotify_fd(struct file_desc *d)
} }
list_for_each_entry(mark, &info->marks, list) { list_for_each_entry(mark, &info->marks, list) {
pr_info("\tRestore fanotify for 0x%08x\n", mark->fme->id); pr_info("\tRestore fanotify for %#08x\n", mark->fme->id);
if (restore_one_fanotify(ret, mark)) { if (restore_one_fanotify(ret, mark)) {
close_safe(&ret); close_safe(&ret);
break; break;
...@@ -763,7 +763,7 @@ static struct fsnotify_file_info *find_inotify_info(unsigned id) ...@@ -763,7 +763,7 @@ static struct fsnotify_file_info *find_inotify_info(unsigned id)
* wd-s for one inotify in one row, thus sometimes * wd-s for one inotify in one row, thus sometimes
* we can avoid scanning the inotify_info_head. * we can avoid scanning the inotify_info_head.
*/ */
pr_debug("\t\tlast ify for 0x%08x found\n", id); pr_debug("\t\tlast ify for %#08x found\n", id);
return last; return last;
} }
...@@ -773,7 +773,7 @@ static struct fsnotify_file_info *find_inotify_info(unsigned id) ...@@ -773,7 +773,7 @@ static struct fsnotify_file_info *find_inotify_info(unsigned id)
return p; return p;
} }
pr_err("Can't find inotify with id 0x%08x\n", id); pr_err("Can't find inotify with id %#08x\n", id);
return NULL; return NULL;
} }
...@@ -824,7 +824,7 @@ static int collect_fanotify_mark(struct fsnotify_mark_info *mark) ...@@ -824,7 +824,7 @@ static int collect_fanotify_mark(struct fsnotify_mark_info *mark)
return __collect_inotify_mark(p, mark); return __collect_inotify_mark(p, mark);
} }
pr_err("Can't find fanotify with id 0x%08x\n", mark->fme->id); pr_err("Can't find fanotify with id %#08x\n", mark->fme->id);
return -1; return -1;
} }
...@@ -836,7 +836,7 @@ static int collect_one_inotify(void *o, ProtobufCMessage *msg, struct cr_img *im ...@@ -836,7 +836,7 @@ static int collect_one_inotify(void *o, ProtobufCMessage *msg, struct cr_img *im
info->ife = pb_msg(msg, InotifyFileEntry); info->ife = pb_msg(msg, InotifyFileEntry);
INIT_LIST_HEAD(&info->marks); INIT_LIST_HEAD(&info->marks);
list_add(&info->list, &inotify_info_head); list_add(&info->list, &inotify_info_head);
pr_info("Collected id 0x%08x flags 0x%08x\n", info->ife->id, info->ife->flags); pr_info("Collected id %#08x flags %#08x\n", info->ife->id, info->ife->flags);
for (i = 0; i < info->ife->n_wd; i++) { for (i = 0; i < info->ife->n_wd; i++) {
struct fsnotify_mark_info *mark; struct fsnotify_mark_info *mark;
...@@ -871,7 +871,7 @@ static int collect_one_fanotify(void *o, ProtobufCMessage *msg, struct cr_img *i ...@@ -871,7 +871,7 @@ static int collect_one_fanotify(void *o, ProtobufCMessage *msg, struct cr_img *i
info->ffe = pb_msg(msg, FanotifyFileEntry); info->ffe = pb_msg(msg, FanotifyFileEntry);
INIT_LIST_HEAD(&info->marks); INIT_LIST_HEAD(&info->marks);
list_add(&info->list, &fanotify_info_head); list_add(&info->list, &fanotify_info_head);
pr_info("Collected id 0x%08x flags 0x%08x\n", info->ffe->id, info->ffe->flags); pr_info("Collected id %#08x flags %#08x\n", info->ffe->id, info->ffe->flags);
for (i = 0; i < info->ffe->n_mark; i++) { for (i = 0; i < info->ffe->n_mark; i++) {
struct fsnotify_mark_info *mark; struct fsnotify_mark_info *mark;
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
static void pr_ipc_desc_entry(unsigned int loglevel, const IpcDescEntry *desc) static void pr_ipc_desc_entry(unsigned int loglevel, const IpcDescEntry *desc)
{ {
print_on_level(loglevel, "id: %-10d key: 0x%08x uid: %-10d gid: %-10d " print_on_level(loglevel, "id: %-10d key: %#08x uid: %-10d gid: %-10d "
"cuid: %-10d cgid: %-10d mode: %-10o ", "cuid: %-10d cgid: %-10d mode: %-10o ",
desc->id, desc->key, desc->uid, desc->gid, desc->id, desc->key, desc->uid, desc->gid,
desc->cuid, desc->cgid, desc->mode); desc->cuid, desc->cgid, desc->mode);
......
...@@ -531,7 +531,7 @@ static int map_private_vma(struct pstree_item *t, ...@@ -531,7 +531,7 @@ static int map_private_vma(struct pstree_item *t,
vma->e->shmid != p->e->shmid) vma->e->shmid != p->e->shmid)
break; break;
pr_info("COW 0x%016"PRIx64"-0x%016"PRIx64" 0x%016"PRIx64" vma\n", pr_info("COW %#016"PRIx64"-%#016"PRIx64" %#016"PRIx64" vma\n",
vma->e->start, vma->e->end, vma->e->pgoff); vma->e->start, vma->e->end, vma->e->pgoff);
paddr = decode_pointer(p->premmaped_addr); paddr = decode_pointer(p->premmaped_addr);
...@@ -555,7 +555,7 @@ static int map_private_vma(struct pstree_item *t, ...@@ -555,7 +555,7 @@ static int map_private_vma(struct pstree_item *t,
* The respective memory area was NOT found in the parent. * The respective memory area was NOT found in the parent.
* Map a new one. * Map a new one.
*/ */
pr_info("Map 0x%016"PRIx64"-0x%016"PRIx64" 0x%016"PRIx64" vma\n", pr_info("Map %#016"PRIx64"-%#016"PRIx64" %#016"PRIx64" vma\n",
vma->e->start, vma->e->end, vma->e->pgoff); vma->e->start, vma->e->end, vma->e->pgoff);
/* /*
...@@ -594,7 +594,7 @@ static int map_private_vma(struct pstree_item *t, ...@@ -594,7 +594,7 @@ static int map_private_vma(struct pstree_item *t,
} }
vma->premmaped_addr = (unsigned long) addr; vma->premmaped_addr = (unsigned long) addr;
pr_debug("\tpremap 0x%016"PRIx64"-0x%016"PRIx64" -> %016lx\n", pr_debug("\tpremap %#016"PRIx64"-%#016"PRIx64" -> %016lx\n",
vma->e->start, vma->e->end, (unsigned long)addr); vma->e->start, vma->e->end, (unsigned long)addr);
if (vma->e->flags & MAP_GROWSDOWN) { /* Skip gurad page */ if (vma->e->flags & MAP_GROWSDOWN) { /* Skip gurad page */
...@@ -889,7 +889,7 @@ int open_vmas(struct pstree_item *t) ...@@ -889,7 +889,7 @@ int open_vmas(struct pstree_item *t)
if (!vma_area_is(vma, VMA_AREA_REGULAR) || !vma->vm_open) if (!vma_area_is(vma, VMA_AREA_REGULAR) || !vma->vm_open)
continue; continue;
pr_info("Opening 0x%016"PRIx64"-0x%016"PRIx64" 0x%016"PRIx64" (%x) vma\n", pr_info("Opening %#016"PRIx64"-%#016"PRIx64" %#016"PRIx64" (%x) vma\n",
vma->e->start, vma->e->end, vma->e->start, vma->e->end,
vma->e->pgoff, vma->e->status); vma->e->pgoff, vma->e->status);
......
...@@ -500,7 +500,7 @@ int handle_elf(void *mem, size_t size) ...@@ -500,7 +500,7 @@ int handle_elf(void *mem, size_t size)
for (j=0; j < sh->sh_size; j++, k++) { for (j=0; j < sh->sh_size; j++, k++) {
if (k && (k % 8) == 0) if (k && (k % 8) == 0)
pr_out("\n\t"); pr_out("\n\t");
pr_out("0x%02x,", shdata[j]); pr_out("%#02x,", shdata[j]);
} }
} }
pr_out("};\n"); pr_out("};\n");
......
...@@ -318,7 +318,7 @@ int collect_shmem(int pid, struct vma_area *vma) ...@@ -318,7 +318,7 @@ int collect_shmem(int pid, struct vma_area *vma)
if (!si) if (!si)
return -1; return -1;
pr_info("Add new shmem 0x%"PRIx64" (0x%016"PRIx64"-0x%016"PRIx64")\n", pr_info("Add new shmem 0x%"PRIx64" (%#016"PRIx64"-%#016"PRIx64")\n",
vi->shmid, vi->start, vi->end); vi->shmid, vi->start, vi->end);
si->shmid = vi->shmid; si->shmid = vi->shmid;
...@@ -400,9 +400,9 @@ static int open_shmem(int pid, struct vma_area *vma) ...@@ -400,9 +400,9 @@ static int open_shmem(int pid, struct vma_area *vma)
int flags; int flags;
si = shmem_find(vi->shmid); si = shmem_find(vi->shmid);
pr_info("Search for 0x%016"PRIx64" shmem 0x%"PRIx64" %p/%d\n", vi->start, vi->shmid, si, si ? si->pid : -1); pr_info("Search for %#016"PRIx64" shmem 0x%"PRIx64" %p/%d\n", vi->start, vi->shmid, si, si ? si->pid : -1);
if (!si) { if (!si) {
pr_err("Can't find my shmem 0x%016"PRIx64"\n", vi->start); pr_err("Can't find my shmem %#016"PRIx64"\n", vi->start);
return -1; return -1;
} }
......
...@@ -72,7 +72,7 @@ static void show_one_inet(const char *act, const struct inet_sk_desc *sk) ...@@ -72,7 +72,7 @@ static void show_one_inet(const char *act, const struct inet_sk_desc *sk)
pr_perror("Failed to translate address"); pr_perror("Failed to translate address");
} }
pr_debug("\t%s: ino 0x%8x family %4d type %4d port %8d " pr_debug("\t%s: ino %#8x family %4d type %4d port %8d "
"state %2d src_addr %s\n", "state %2d src_addr %s\n",
act, sk->sd.ino, sk->sd.family, sk->type, sk->src_port, act, sk->sd.ino, sk->sd.family, sk->type, sk->src_port,
sk->state, src_addr); sk->state, src_addr);
......
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