Commit 1d216334 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Cyrill Gorcunov

crtools: Deduplicate file info showing code

Print common info once, then append path if required.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 6de20ba9
...@@ -78,6 +78,10 @@ static void show_files(int fd_files) ...@@ -78,6 +78,10 @@ static void show_files(int fd_files)
int ret = read_ptr_safe_eof(fd_files, &e, out); int ret = read_ptr_safe_eof(fd_files, &e, out);
if (!ret) if (!ret)
goto out; goto out;
pr_info("type: %02x len: %02x flags: %4x pos: %8x addr: %16lx",
e.type, e.len, e.flags, e.pos, e.addr);
if (e.len) { if (e.len) {
int ret = read(fd_files, local_buf, e.len); int ret = read(fd_files, local_buf, e.len);
if (ret != e.len) { if (ret != e.len) {
...@@ -85,11 +89,10 @@ static void show_files(int fd_files) ...@@ -85,11 +89,10 @@ static void show_files(int fd_files)
goto out; goto out;
} }
local_buf[e.len] = 0; local_buf[e.len] = 0;
pr_info("type: %02x len: %02x flags: %4x pos: %8x addr: %16lx --> %s\n", pr_info(" --> %s", local_buf);
e.type, e.len, e.flags, e.pos, e.addr, local_buf); }
} else
pr_info("type: %02x len: %02x flags: %4x pos: %8x addr: %16lx\n", pr_info("\n");
e.type, e.len, e.flags, e.pos, e.addr);
} }
out: out:
......
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