Commit b18fb09e authored by Pavel Emelyanov's avatar Pavel Emelyanov

show: Replace one-line show_foo calls with args array

We have generic do_pb_show() call and tons of show_foo
routines, that just call one with proper args. Compact
the code by putting the args into array and calling
the do_pb_show() in one place.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 8af6a39f
...@@ -54,11 +54,6 @@ ...@@ -54,11 +54,6 @@
static LIST_HEAD(pstree_list); static LIST_HEAD(pstree_list);
void show_files(int fd_files)
{
pb_show_plain_pretty(fd_files, PB_FDINFO, "flags:%#o fd:%d");
}
void show_fown_cont(void *p) void show_fown_cont(void *p)
{ {
FownEntry *fown = p; FownEntry *fown = p;
...@@ -66,82 +61,12 @@ void show_fown_cont(void *p) ...@@ -66,82 +61,12 @@ void show_fown_cont(void *p)
fown->uid, fown->euid, fown->signum, fown->pid_type, fown->pid); fown->uid, fown->euid, fown->signum, fown->pid_type, fown->pid);
} }
void show_ns_files(int fd)
{
pb_show_plain(fd, PB_NS_FILE);
}
void show_reg_files(int fd_reg_files)
{
pb_show_plain(fd_reg_files, PB_REG_FILE);
}
void show_remap_files(int fd)
{
pb_show_plain(fd, PB_REMAP_FPATH);
}
void show_ghost_file(int fd)
{
pb_show_vertical(fd, PB_GHOST_FILE);
}
static void pipe_data_handler(int fd, void *obj) static void pipe_data_handler(int fd, void *obj)
{ {
PipeDataEntry *e = obj; PipeDataEntry *e = obj;
print_image_data(fd, e->bytes, opts.show_pages_content); print_image_data(fd, e->bytes, opts.show_pages_content);
} }
void show_pipes_data(int fd)
{
pb_show_plain_payload(fd, PB_PIPE_DATA, pipe_data_handler);
}
void show_pipes(int fd_pipes)
{
pb_show_plain(fd_pipes, PB_PIPE);
}
void show_fifo_data(int fd)
{
show_pipes_data(fd);
}
void show_fifo(int fd)
{
pb_show_plain(fd, PB_FIFO);
}
void show_tty(int fd)
{
pb_show_plain(fd, PB_TTY_FILE);
}
void show_tty_info(int fd)
{
pb_show_plain(fd, PB_TTY_INFO);
}
void show_file_locks(int fd)
{
pb_show_plain(fd, PB_FILE_LOCK);
}
void show_fs(int fd_fs)
{
pb_show_vertical(fd_fs, PB_FS);
}
void show_vmas(int fd_vma)
{
pb_show_plain(fd_vma, PB_VMA);
}
void show_rlimit(int fd)
{
pb_show_plain(fd, PB_RLIMIT);
}
static int nice_width_for(unsigned long addr) static int nice_width_for(unsigned long addr)
{ {
int ret = 3; int ret = 3;
...@@ -223,11 +148,6 @@ static void show_pagemaps(int fd, void *obj) ...@@ -223,11 +148,6 @@ static void show_pagemaps(int fd, void *obj)
pb_show_plain_pretty(fd, PB_PAGEMAP, "nr_pages:%u"); pb_show_plain_pretty(fd, PB_PAGEMAP, "nr_pages:%u");
} }
void show_pagemap(int fd)
{
do_pb_show_plain(fd, PB_PAGEMAP_HEAD, 1, show_pagemaps, NULL);
}
void show_siginfo(int fd) void show_siginfo(int fd)
{ {
int ret; int ret;
...@@ -250,26 +170,6 @@ void show_siginfo(int fd) ...@@ -250,26 +170,6 @@ void show_siginfo(int fd)
pr_img_tail(CR_FD_SIGNAL); pr_img_tail(CR_FD_SIGNAL);
} }
void show_sigacts(int fd_sigacts)
{
pb_show_plain(fd_sigacts, PB_SIGACT);
}
void show_itimers(int fd)
{
pb_show_plain_pretty(fd, PB_ITIMER, "*:%Lu");
}
void show_posix_timers(int fd)
{
pb_show_plain_pretty(fd, PB_POSIX_TIMER, "*:%d 5:%Lu 7:%Lu 8:%lu 9:%Lu 10:%Lu");
}
void show_creds(int fd)
{
pb_show_vertical(fd, PB_CREDS);
}
static int pstree_item_from_pb(PstreeEntry *e, struct pstree_item *item) static int pstree_item_from_pb(PstreeEntry *e, struct pstree_item *item)
{ {
int i; int i;
...@@ -309,11 +209,6 @@ void show_collect_pstree(int fd, int collect) ...@@ -309,11 +209,6 @@ void show_collect_pstree(int fd, int collect)
collect ? pstree_handler : NULL, "*:%d"); collect ? pstree_handler : NULL, "*:%d");
} }
void show_pstree(int fd)
{
show_collect_pstree(fd, 0);
}
static inline char *task_state_str(int state) static inline char *task_state_str(int state)
{ {
switch (state) { switch (state) {
...@@ -370,21 +265,6 @@ void show_thread_info(ThreadInfoX86 *thread_info) ...@@ -370,21 +265,6 @@ void show_thread_info(ThreadInfoX86 *thread_info)
show_core_regs(thread_info->gpregs); show_core_regs(thread_info->gpregs);
} }
void show_core(int fd_core)
{
pb_show_vertical(fd_core, PB_CORE);
}
void show_ids(int fd_ids)
{
pb_show_vertical(fd_ids, PB_IDS);
}
void show_mm(int fd_mm)
{
pb_show_vertical(fd_mm, PB_MM);
}
static struct { static struct {
u32 magic; u32 magic;
u32 mask; u32 mask;
...@@ -405,41 +285,117 @@ static void try_hint_magic(u32 magic) ...@@ -405,41 +285,117 @@ static void try_hint_magic(u32 magic)
pr_msg("This can be %s\n", magic_hints[i].hint); pr_msg("This can be %s\n", magic_hints[i].hint);
} }
#define SHOW_PLAIN(name) { name##_MAGIC, PB_##name, false, NULL, NULL, }
/* nothing special behind this -S, just to avoid heavy patching */
#define SHOW_PLAINS(name) { name##S_MAGIC, PB_##name, false, NULL, NULL, }
#define SHOW_VERT(name) { name##_MAGIC, PB_##name, true, NULL, NULL, }
static struct show_image_info show_infos[] = {
SHOW_VERT(INVENTORY),
SHOW_VERT(CORE),
SHOW_VERT(IDS),
SHOW_VERT(CREDS),
SHOW_VERT(UTSNS),
SHOW_VERT(IPC_VAR),
SHOW_VERT(FS),
SHOW_VERT(GHOST_FILE),
SHOW_PLAINS(REG_FILE),
SHOW_PLAINS(NS_FILE),
SHOW_PLAIN(EVENTFD_FILE),
SHOW_PLAIN(EVENTPOLL_FILE),
SHOW_PLAIN(EVENTPOLL_TFD),
SHOW_PLAIN(SIGNALFD),
SHOW_PLAIN(INOTIFY_FILE),
SHOW_PLAIN(INOTIFY_WD),
SHOW_PLAIN(FANOTIFY_FILE),
SHOW_PLAIN(FANOTIFY_MARK),
SHOW_PLAINS(VMA),
SHOW_PLAINS(PIPE),
SHOW_PLAIN(FIFO),
SHOW_PLAIN(SIGACT),
SHOW_PLAIN(NETLINK_SK),
SHOW_PLAIN(REMAP_FPATH),
SHOW_PLAINS(MNT),
SHOW_PLAINS(TTY_FILE),
SHOW_PLAIN(TTY_INFO),
SHOW_PLAINS(FILE_LOCK),
SHOW_PLAIN(RLIMIT),
SHOW_PLAIN(TUNFILE),
{ TCP_STREAM_MAGIC, PB_TCP_STREAM, true, NULL, "1:%u 2:%u 3:%u 4:%u", },
{ STATS_MAGIC, PB_STATS, true, NULL, "1.1:%u 1.2:%u 1.3:%u 1.4:%u 1.5:%Lu 1.6:%Lu 1.7:%Lu", },
{ FDINFO_MAGIC, PB_FDINFO, false, NULL, "flags:%#o fd:%d", },
{ UNIXSK_MAGIC, PB_UNIX_SK, false, NULL, "1:%#x 2:%#x 3:%d 4:%d 5:%d 6:%d 7:%d 8:%#x 11:S", },
{ INETSK_MAGIC, PB_INET_SK, false, NULL, "1:%#x 2:%#x 3:%d 4:%d 5:%d 6:%d 7:%d 8:%d 9:%2x 11:A 12:A", },
{ PACKETSK_MAGIC, PB_PACKET_SOCK, false, NULL, "5:%d", },
{ ITIMERS_MAGIC, PB_ITIMER, false, NULL, "*:%Lu", },
{ POSIX_TIMERS_MAGIC, PB_POSIX_TIMER, false, NULL, "*:%d 5:%Lu 7:%Lu 8:%lu 9:%Lu 10:%Lu", },
{ NETDEV_MAGIC, PB_NETDEV, false, NULL, "2:%d", },
{ PAGEMAP_MAGIC, PB_PAGEMAP_HEAD, true, show_pagemaps, NULL, },
{ PIPES_DATA_MAGIC, PB_PIPE_DATA, false, pipe_data_handler, NULL, },
{ FIFO_DATA_MAGIC, PB_PIPE_DATA, false, pipe_data_handler, NULL, },
{ SK_QUEUES_MAGIC, PB_SK_QUEUES, false, sk_queue_data_handler, NULL, },
{ IPCNS_SHM_MAGIC, PB_IPC_SHM, false, ipc_shm_handler, NULL, },
{ IPCNS_SEM_MAGIC, PB_IPC_SEM, false, ipc_sem_handler, NULL, },
{ IPCNS_MSG_MAGIC, PB_IPCNS_MSG_ENT, false, ipc_msg_handler, NULL, },
{ }
};
static int cr_parse_file(void) static int cr_parse_file(void)
{ {
u32 magic; u32 magic;
int fd = -1, ret = -1, i; int ret = -1, fd;
fd = open(opts.show_dump_file, O_RDONLY); fd = open(opts.show_dump_file, O_RDONLY);
if (fd < 0) { if (fd < 0) {
pr_perror("Can't open %s", opts.show_dump_file); pr_perror("Can't open %s", opts.show_dump_file);
goto err; goto out;
} }
if (read_img(fd, &magic) < 0) if (read_img(fd, &magic) < 0)
goto err; goto out;
for (i = 0; i < CR_FD_MAX; i++) ret = cr_parse_fd(fd, magic);
if (fdset_template[i].magic == magic) out:
break; close_safe(&fd);
return ret;
}
int cr_parse_fd(int fd, u32 magic)
{
int ret = 0, i;
if (i == CR_FD_MAX) { if (magic == PSTREE_MAGIC) {
pr_err("Unknown magic %#x in %s\n", show_collect_pstree(fd, 0);
magic, opts.show_dump_file); goto out;
try_hint_magic(magic);
goto err;
} }
if (!fdset_template[i].show) { if (magic == SIGNAL_MAGIC || magic == PSIGNAL_MAGIC) {
pr_err("No handler for %#x/%s\n", show_siginfo(fd);
magic, opts.show_dump_file); goto out;
goto err;
} }
fdset_template[i].show(fd); for (i = 0; show_infos[i].magic; i++) {
ret = 0; struct show_image_info *si;
err:
close_safe(&fd); si = &show_infos[i];
if (si->magic != magic)
continue;
do_pb_show_plain(fd, si->pb_type, si->single,
si->payload, si->fmt);
goto out;
}
ret = -1;
pr_err("Unknown magic %#x in %s\n",
magic, opts.show_dump_file);
try_hint_magic(magic);
out:
return ret; return ret;
} }
...@@ -456,7 +412,7 @@ static int cr_show_pstree_item(struct pstree_item *item) ...@@ -456,7 +412,7 @@ static int cr_show_pstree_item(struct pstree_item *item)
pr_msg("Task %d:\n", item->pid.virt); pr_msg("Task %d:\n", item->pid.virt);
pr_msg("----------------------------------------\n"); pr_msg("----------------------------------------\n");
show_core(fdset_fd(cr_fdset, CR_FD_CORE)); cr_parse_fd(fdset_fd(cr_fdset, CR_FD_CORE), CORE_MAGIC);
if (item->nr_threads > 1) { if (item->nr_threads > 1) {
int fd_th; int fd_th;
...@@ -473,7 +429,7 @@ static int cr_show_pstree_item(struct pstree_item *item) ...@@ -473,7 +429,7 @@ static int cr_show_pstree_item(struct pstree_item *item)
pr_msg("Thread %d.%d:\n", item->pid.virt, item->threads[i].virt); pr_msg("Thread %d.%d:\n", item->pid.virt, item->threads[i].virt);
pr_msg("----------------------------------------\n"); pr_msg("----------------------------------------\n");
show_core(fd_th); cr_parse_fd(fd_th, CORE_MAGIC);
close_safe(&fd_th); close_safe(&fd_th);
} }
} }
...@@ -481,12 +437,11 @@ static int cr_show_pstree_item(struct pstree_item *item) ...@@ -481,12 +437,11 @@ static int cr_show_pstree_item(struct pstree_item *item)
pr_msg("Resources for %d:\n", item->pid.virt); pr_msg("Resources for %d:\n", item->pid.virt);
pr_msg("----------------------------------------\n"); pr_msg("----------------------------------------\n");
for (i = _CR_FD_TASK_FROM + 1; i < _CR_FD_TASK_TO; i++) for (i = _CR_FD_TASK_FROM + 1; i < _CR_FD_TASK_TO; i++)
if ((i != CR_FD_CORE) && (i != CR_FD_IDS) && if ((i != CR_FD_CORE) && (i != CR_FD_IDS)) {
fdset_template[i].show) {
pr_msg("* "); pr_msg("* ");
pr_msg(fdset_template[i].fmt, item->pid.virt); pr_msg(fdset_template[i].fmt, item->pid.virt);
pr_msg(":\n"); pr_msg(":\n");
fdset_template[i].show(fdset_fd(cr_fdset, i)); cr_parse_fd(fdset_fd(cr_fdset, i), fdset_template[i].magic);
} }
if (pb_read_one(fdset_fd(cr_fdset, CR_FD_IDS), &ids, PB_IDS) > 0) { if (pb_read_one(fdset_fd(cr_fdset, CR_FD_IDS), &ids, PB_IDS) > 0) {
...@@ -496,7 +451,7 @@ static int cr_show_pstree_item(struct pstree_item *item) ...@@ -496,7 +451,7 @@ static int cr_show_pstree_item(struct pstree_item *item)
pr_msg(fdset_template[CR_FD_FDINFO].fmt, ids->files_id); pr_msg(fdset_template[CR_FD_FDINFO].fmt, ids->files_id);
pr_msg(":\n"); pr_msg(":\n");
show_files(i); cr_parse_fd(i, FDINFO_MAGIC);
close(i); close(i);
} }
...@@ -559,7 +514,6 @@ static int cr_show_all(void) ...@@ -559,7 +514,6 @@ static int cr_show_all(void)
if (fd < 0) if (fd < 0)
goto out; goto out;
show_sk_queues(fd);
close(fd); close(fd);
pid = list_first_entry(&pstree_list, struct pstree_item, sibling)->pid.virt; pid = list_first_entry(&pstree_list, struct pstree_item, sibling)->pid.virt;
......
...@@ -44,11 +44,6 @@ static void pr_info_eventfd(char *action, EventfdFileEntry *efe) ...@@ -44,11 +44,6 @@ static void pr_info_eventfd(char *action, EventfdFileEntry *efe)
action, efe->id, efe->flags, efe->counter); action, efe->id, efe->flags, efe->counter);
} }
void show_eventfds(int fd)
{
pb_show_plain(fd, PB_EVENTFD_FILE);
}
struct eventfd_dump_arg { struct eventfd_dump_arg {
u32 id; u32 id;
const struct fd_parms *p; const struct fd_parms *p;
...@@ -70,7 +65,7 @@ static int dump_eventfd_entry(union fdinfo_entries *e, void *arg) ...@@ -70,7 +65,7 @@ static int dump_eventfd_entry(union fdinfo_entries *e, void *arg)
e->efd.fown = (FownEntry *)&da->p->fown; e->efd.fown = (FownEntry *)&da->p->fown;
pr_info_eventfd("Dumping ", &e->efd); pr_info_eventfd("Dumping ", &e->efd);
return pb_write_one(fdset_fd(glob_fdset, CR_FD_EVENTFD), return pb_write_one(fdset_fd(glob_fdset, CR_FD_EVENTFD_FILE),
&e->efd, PB_EVENTFD_FILE); &e->efd, PB_EVENTFD_FILE);
} }
...@@ -127,7 +122,7 @@ static int collect_one_efd(void *obj, ProtobufCMessage *msg) ...@@ -127,7 +122,7 @@ static int collect_one_efd(void *obj, ProtobufCMessage *msg)
} }
struct collect_image_info eventfd_cinfo = { struct collect_image_info eventfd_cinfo = {
.fd_type = CR_FD_EVENTFD, .fd_type = CR_FD_EVENTFD_FILE,
.pb_type = PB_EVENTFD_FILE, .pb_type = PB_EVENTFD_FILE,
.priv_size = sizeof(struct eventfd_file_info), .priv_size = sizeof(struct eventfd_file_info),
.collect = collect_one_efd, .collect = collect_one_efd,
......
...@@ -56,16 +56,6 @@ static void pr_info_eventpoll(char *action, EventpollFileEntry *e) ...@@ -56,16 +56,6 @@ static void pr_info_eventpoll(char *action, EventpollFileEntry *e)
pr_info("%seventpoll: id %#08x flags %#04x\n", action, e->id, e->flags); pr_info("%seventpoll: id %#08x flags %#04x\n", action, e->id, e->flags);
} }
void show_eventpoll_tfd(int fd)
{
pb_show_plain(fd, PB_EVENTPOLL_TFD);
}
void show_eventpoll(int fd)
{
pb_show_plain(fd, PB_EVENTPOLL_FILE);
}
static int dump_eventpoll_entry(union fdinfo_entries *e, void *arg) static int dump_eventpoll_entry(union fdinfo_entries *e, void *arg)
{ {
EventpollTfdEntry *efd = &e->epl; EventpollTfdEntry *efd = &e->epl;
...@@ -85,7 +75,7 @@ static int dump_one_eventpoll(int lfd, u32 id, const struct fd_parms *p) ...@@ -85,7 +75,7 @@ static int dump_one_eventpoll(int lfd, u32 id, const struct fd_parms *p)
e.fown = (FownEntry *)&p->fown; e.fown = (FownEntry *)&p->fown;
pr_info_eventpoll("Dumping ", &e); pr_info_eventpoll("Dumping ", &e);
if (pb_write_one(fdset_fd(glob_fdset, CR_FD_EVENTPOLL), if (pb_write_one(fdset_fd(glob_fdset, CR_FD_EVENTPOLL_FILE),
&e, PB_EVENTPOLL_FILE)) &e, PB_EVENTPOLL_FILE))
return -1; return -1;
...@@ -193,7 +183,7 @@ static int collect_one_epoll(void *o, ProtobufCMessage *msg) ...@@ -193,7 +183,7 @@ static int collect_one_epoll(void *o, ProtobufCMessage *msg)
} }
struct collect_image_info epoll_cinfo = { struct collect_image_info epoll_cinfo = {
.fd_type = CR_FD_EVENTPOLL, .fd_type = CR_FD_EVENTPOLL_FILE,
.pb_type = PB_EVENTPOLL_FILE, .pb_type = PB_EVENTPOLL_FILE,
.priv_size = sizeof(struct eventpoll_file_info), .priv_size = sizeof(struct eventpoll_file_info),
.collect = collect_one_epoll, .collect = collect_one_epoll,
......
...@@ -77,26 +77,6 @@ int is_fanotify_link(int lfd) ...@@ -77,26 +77,6 @@ int is_fanotify_link(int lfd)
return is_anon_link_type(lfd, "[fanotify]"); return is_anon_link_type(lfd, "[fanotify]");
} }
void show_inotify_wd(int fd_inotify_wd)
{
pb_show_plain(fd_inotify_wd, PB_INOTIFY_WD);
}
void show_inotify(int fd_inotify)
{
pb_show_plain(fd_inotify, PB_INOTIFY_FILE);
}
void show_fanotify_mark(int fd)
{
pb_show_plain(fd, PB_FANOTIFY_MARK);
}
void show_fanotify(int fd)
{
pb_show_plain(fd, PB_FANOTIFY_FILE);
}
static int dump_inotify_entry(union fdinfo_entries *e, void *arg) static int dump_inotify_entry(union fdinfo_entries *e, void *arg)
{ {
InotifyWdEntry *we = &e->ify; InotifyWdEntry *we = &e->ify;
...@@ -119,7 +99,7 @@ static int dump_one_inotify(int lfd, u32 id, const struct fd_parms *p) ...@@ -119,7 +99,7 @@ static int dump_one_inotify(int lfd, u32 id, const struct fd_parms *p)
ie.fown = (FownEntry *)&p->fown; ie.fown = (FownEntry *)&p->fown;
pr_info("id 0x%08x flags 0x%08x\n", ie.id, ie.flags); pr_info("id 0x%08x flags 0x%08x\n", ie.id, ie.flags);
if (pb_write_one(fdset_fd(glob_fdset, CR_FD_INOTIFY), &ie, PB_INOTIFY_FILE)) if (pb_write_one(fdset_fd(glob_fdset, CR_FD_INOTIFY_FILE), &ie, PB_INOTIFY_FILE))
return -1; return -1;
return parse_fdinfo(lfd, FD_TYPES__INOTIFY, dump_inotify_entry, &id); return parse_fdinfo(lfd, FD_TYPES__INOTIFY, dump_inotify_entry, &id);
...@@ -187,7 +167,7 @@ static int dump_one_fanotify(int lfd, u32 id, const struct fd_parms *p) ...@@ -187,7 +167,7 @@ static int dump_one_fanotify(int lfd, u32 id, const struct fd_parms *p)
fe.faflags = fsn_params.faflags; fe.faflags = fsn_params.faflags;
fe.evflags = fsn_params.evflags; fe.evflags = fsn_params.evflags;
return pb_write_one(fdset_fd(glob_fdset, CR_FD_FANOTIFY), &fe, PB_FANOTIFY_FILE); return pb_write_one(fdset_fd(glob_fdset, CR_FD_FANOTIFY_FILE), &fe, PB_FANOTIFY_FILE);
} }
const struct fdtype_ops fanotify_dump_ops = { const struct fdtype_ops fanotify_dump_ops = {
...@@ -460,7 +440,7 @@ static int collect_one_inotify(void *o, ProtobufCMessage *msg) ...@@ -460,7 +440,7 @@ static int collect_one_inotify(void *o, ProtobufCMessage *msg)
} }
struct collect_image_info inotify_cinfo = { struct collect_image_info inotify_cinfo = {
.fd_type = CR_FD_INOTIFY, .fd_type = CR_FD_INOTIFY_FILE,
.pb_type = PB_INOTIFY_FILE, .pb_type = PB_INOTIFY_FILE,
.priv_size = sizeof(struct fsnotify_file_info), .priv_size = sizeof(struct fsnotify_file_info),
.collect = collect_one_inotify, .collect = collect_one_inotify,
...@@ -479,7 +459,7 @@ static int collect_one_fanotify(void *o, ProtobufCMessage *msg) ...@@ -479,7 +459,7 @@ static int collect_one_fanotify(void *o, ProtobufCMessage *msg)
} }
struct collect_image_info fanotify_cinfo = { struct collect_image_info fanotify_cinfo = {
.fd_type = CR_FD_FANOTIFY, .fd_type = CR_FD_FANOTIFY_FILE,
.pb_type = PB_FANOTIFY_FILE, .pb_type = PB_FANOTIFY_FILE,
.priv_size = sizeof(struct fsnotify_file_info), .priv_size = sizeof(struct fsnotify_file_info),
.collect = collect_one_fanotify, .collect = collect_one_fanotify,
......
...@@ -11,74 +11,72 @@ ...@@ -11,74 +11,72 @@
* for more details. * for more details.
*/ */
#define FD_ENTRY(_name, _fmt, _show) \ #define FD_ENTRY(_name, _fmt) \
[CR_FD_##_name] = { \ [CR_FD_##_name] = { \
.fmt = _fmt ".img", \ .fmt = _fmt ".img", \
.magic = _name##_MAGIC, \ .magic = _name##_MAGIC, \
.show = _show, \
} }
struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX] = { struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX] = {
FD_ENTRY(INVENTORY, "inventory", show_inventory), FD_ENTRY(INVENTORY, "inventory"),
FD_ENTRY(FDINFO, "fdinfo-%d", show_files), FD_ENTRY(FDINFO, "fdinfo-%d"),
FD_ENTRY(PAGEMAP, "pagemap-%ld", show_pagemap), FD_ENTRY(PAGEMAP, "pagemap-%ld"),
FD_ENTRY(SHMEM_PAGEMAP, "pagemap-shmem-%ld", show_pagemap), FD_ENTRY(SHMEM_PAGEMAP, "pagemap-shmem-%ld"),
FD_ENTRY(REG_FILES, "reg-files", show_reg_files), FD_ENTRY(REG_FILES, "reg-files"),
FD_ENTRY(NS_FILES, "ns-files", show_ns_files), FD_ENTRY(NS_FILES, "ns-files"),
FD_ENTRY(EVENTFD, "eventfd", show_eventfds), FD_ENTRY(EVENTFD_FILE, "eventfd"),
FD_ENTRY(EVENTPOLL, "eventpoll", show_eventpoll), FD_ENTRY(EVENTPOLL_FILE,"eventpoll"),
FD_ENTRY(EVENTPOLL_TFD, "eventpoll-tfd", show_eventpoll_tfd), FD_ENTRY(EVENTPOLL_TFD, "eventpoll-tfd"),
FD_ENTRY(SIGNALFD, "signalfd", show_signalfd), FD_ENTRY(SIGNALFD, "signalfd"),
FD_ENTRY(INOTIFY, "inotify", show_inotify), FD_ENTRY(INOTIFY_FILE, "inotify"),
FD_ENTRY(INOTIFY_WD, "inotify-wd", show_inotify_wd), FD_ENTRY(INOTIFY_WD, "inotify-wd"),
FD_ENTRY(FANOTIFY, "fanotify", show_fanotify), FD_ENTRY(FANOTIFY_FILE, "fanotify"),
FD_ENTRY(FANOTIFY_MARK, "fanotify-mark", show_fanotify_mark), FD_ENTRY(FANOTIFY_MARK, "fanotify-mark"),
FD_ENTRY(CORE, "core-%d", show_core), FD_ENTRY(CORE, "core-%d"),
FD_ENTRY(IDS, "ids-%d", show_ids), FD_ENTRY(IDS, "ids-%d"),
FD_ENTRY(MM, "mm-%d", show_mm), FD_ENTRY(MM, "mm-%d"),
FD_ENTRY(VMAS, "vmas-%d", show_vmas), FD_ENTRY(VMAS, "vmas-%d"),
FD_ENTRY(PIPES, "pipes", show_pipes), FD_ENTRY(PIPES, "pipes"),
FD_ENTRY(PIPES_DATA, "pipes-data", show_pipes_data), FD_ENTRY(PIPES_DATA, "pipes-data"),
FD_ENTRY(FIFO, "fifo", show_fifo), FD_ENTRY(FIFO, "fifo"),
FD_ENTRY(FIFO_DATA, "fifo-data", show_fifo_data), FD_ENTRY(FIFO_DATA, "fifo-data"),
FD_ENTRY(PSTREE, "pstree", show_pstree), FD_ENTRY(PSTREE, "pstree"),
FD_ENTRY(SIGACT, "sigacts-%d", show_sigacts), FD_ENTRY(SIGACT, "sigacts-%d"),
FD_ENTRY(UNIXSK, "unixsk", show_unixsk), FD_ENTRY(UNIXSK, "unixsk"),
FD_ENTRY(INETSK, "inetsk", show_inetsk), FD_ENTRY(INETSK, "inetsk"),
FD_ENTRY(PACKETSK, "packetsk", show_packetsk), FD_ENTRY(PACKETSK, "packetsk"),
FD_ENTRY(NETLINKSK, "netlinksk", show_netlinksk), FD_ENTRY(NETLINK_SK, "netlinksk"),
FD_ENTRY(SK_QUEUES, "sk-queues", show_sk_queues), FD_ENTRY(SK_QUEUES, "sk-queues"),
FD_ENTRY(ITIMERS, "itimers-%d", show_itimers), FD_ENTRY(ITIMERS, "itimers-%d"),
FD_ENTRY(POSIX_TIMERS, "posix-timers-%d", show_posix_timers), FD_ENTRY(POSIX_TIMERS, "posix-timers-%d"),
FD_ENTRY(CREDS, "creds-%d", show_creds), FD_ENTRY(CREDS, "creds-%d"),
FD_ENTRY(UTSNS, "utsns-%d", show_utsns), FD_ENTRY(UTSNS, "utsns-%d"),
FD_ENTRY(IPCNS_VAR, "ipcns-var-%d", show_ipc_var), FD_ENTRY(IPC_VAR, "ipcns-var-%d"),
FD_ENTRY(IPCNS_SHM, "ipcns-shm-%d", show_ipc_shm), FD_ENTRY(IPCNS_SHM, "ipcns-shm-%d"),
FD_ENTRY(IPCNS_MSG, "ipcns-msg-%d", show_ipc_msg), FD_ENTRY(IPCNS_MSG, "ipcns-msg-%d"),
FD_ENTRY(IPCNS_SEM, "ipcns-sem-%d", show_ipc_sem), FD_ENTRY(IPCNS_SEM, "ipcns-sem-%d"),
FD_ENTRY(FS, "fs-%d", show_fs), FD_ENTRY(FS, "fs-%d"),
FD_ENTRY(REMAP_FPATH, "remap-fpath", show_remap_files), FD_ENTRY(REMAP_FPATH, "remap-fpath"),
FD_ENTRY(GHOST_FILE, "ghost-file-%x", show_ghost_file), FD_ENTRY(GHOST_FILE, "ghost-file-%x"),
FD_ENTRY(TCP_STREAM, "tcp-stream-%x", show_tcp_stream), FD_ENTRY(TCP_STREAM, "tcp-stream-%x"),
FD_ENTRY(MOUNTPOINTS, "mountpoints-%d", show_mountpoints), FD_ENTRY(MNTS, "mountpoints-%d"),
FD_ENTRY(NETDEV, "netdev-%d", show_netdevices), FD_ENTRY(NETDEV, "netdev-%d"),
FD_ENTRY(IFADDR, "ifaddr-%d", show_raw_image), FD_ENTRY(IFADDR, "ifaddr-%d"),
FD_ENTRY(ROUTE, "route-%d", show_raw_image), FD_ENTRY(ROUTE, "route-%d"),
FD_ENTRY(TMPFS, "tmpfs-%d.tar.gz", show_raw_image), FD_ENTRY(TMPFS, "tmpfs-%d.tar.gz"),
FD_ENTRY(TTY, "tty", show_tty), FD_ENTRY(TTY_FILES, "tty"),
FD_ENTRY(TTY_INFO, "tty-info", show_tty_info), FD_ENTRY(TTY_INFO, "tty-info"),
FD_ENTRY(FILE_LOCKS, "filelocks-%d", show_file_locks), FD_ENTRY(FILE_LOCKS, "filelocks-%d"),
FD_ENTRY(RLIMIT, "rlimit-%d", show_rlimit), FD_ENTRY(RLIMIT, "rlimit-%d"),
FD_ENTRY(PAGES, "pages-%u", NULL), FD_ENTRY(PAGES, "pages-%u"),
FD_ENTRY(PAGES_OLD, "pages-%d", NULL), FD_ENTRY(PAGES_OLD, "pages-%d"),
FD_ENTRY(SHM_PAGES_OLD, "pages-shmem-%ld", NULL), FD_ENTRY(SHM_PAGES_OLD, "pages-shmem-%ld"),
FD_ENTRY(SIGNAL, "signal-s-%d", show_siginfo), /* shared signals */ FD_ENTRY(SIGNAL, "signal-s-%d"),
FD_ENTRY(PSIGNAL, "signal-p-%d", show_siginfo), /* private signals */ FD_ENTRY(PSIGNAL, "signal-p-%d"),
FD_ENTRY(TUNFILE, "tunfile", show_tunfile), FD_ENTRY(TUNFILE, "tunfile"),
[CR_FD_STATS] = { [CR_FD_STATS] = {
.fmt = "stats-%s", .fmt = "stats-%s",
.magic = STATS_MAGIC, .magic = STATS_MAGIC,
.show = show_stats,
}, },
}; };
...@@ -95,13 +95,6 @@ void kill_inventory(void) ...@@ -95,13 +95,6 @@ void kill_inventory(void)
fdset_template[CR_FD_INVENTORY].fmt, 0); fdset_template[CR_FD_INVENTORY].fmt, 0);
} }
void show_inventory(int fd)
{
pb_show_vertical(fd, PB_INVENTORY);
}
void show_raw_image(int fd) {};
static struct cr_fdset *alloc_cr_fdset(int nr) static struct cr_fdset *alloc_cr_fdset(int nr)
{ {
struct cr_fdset *cr_fdset; struct cr_fdset *cr_fdset;
......
#ifndef __CR_SHOW_H__ #ifndef __CR_SHOW_H__
#define __CR_SHOW_H__ #define __CR_SHOW_H__
#include <stdbool.h>
struct show_image_info {
u32 magic;
int pb_type;
bool single;
void (*payload)(int, void *);
char *fmt;
};
extern void show_files(int fd);
extern void show_pagemap(int fd);
extern void show_reg_files(int fd);
extern void show_ns_files(int fd);
extern void show_core(int fd);
extern void show_ids(int fd);
extern void show_mm(int fd);
extern void show_vmas(int fd);
extern void show_pipes(int fd);
extern void show_pipes_data(int fd);
extern void show_fifo(int fd);
extern void show_fifo_data(int fd);
extern void show_pstree(int fd);
extern void show_sigacts(int fd);
extern void show_siginfo(int fd); extern void show_siginfo(int fd);
extern void show_itimers(int fd);
extern void show_posix_timers(int fd);
extern void show_creds(int fd);
extern void show_fs(int fd);
extern void show_remap_files(int fd);
extern void show_ghost_file(int fd);
extern void show_fown_cont(void *p); extern void show_fown_cont(void *p);
extern void show_eventfds(int fd); extern void sk_queue_data_handler(int fd, void *obj);
extern void show_tty(int fd); extern void ipc_shm_handler(int fd, void *obj);
extern void show_tty_info(int fd); extern void ipc_msg_handler(int fd, void *obj);
extern void show_file_locks(int fd); extern void ipc_sem_handler(int fd, void *obj);
extern void show_rlimit(int fd); extern int cr_parse_fd(int fd, u32 magic);
extern void show_inventory(int fd);
extern void show_raw_image(int fd);
extern void show_eventpoll(int fd);
extern void show_eventpoll_tfd(int fd);
extern void show_signalfd(int fd);
extern void show_inotify(int fd);
extern void show_inotify_wd(int fd);
extern void show_fanotify(int fd);
extern void show_fanotify_mark(int fd);
extern void show_unixsk(int fd);
extern void show_inetsk(int fd);
extern void show_packetsk(int fd);
extern void show_netlinksk(int fd);
extern void show_sk_queues(int fd);
extern void show_utsns(int fd);
extern void show_ipc_var(int fd);
extern void show_ipc_shm(int fd);
extern void show_ipc_msg(int fd);
extern void show_ipc_sem(int fd);
extern void show_tcp_stream(int fd);
extern void show_mountpoints(int fd);
extern void show_netdevices(int fd);
extern void show_stats(int fd);
extern void show_tunfile(int fd);
#endif /* __CR_SHOW_H__ */ #endif /* __CR_SHOW_H__ */
...@@ -74,7 +74,6 @@ extern int close_service_fd(enum sfd_type type); ...@@ -74,7 +74,6 @@ extern int close_service_fd(enum sfd_type type);
extern bool is_service_fd(int fd, enum sfd_type type); extern bool is_service_fd(int fd, enum sfd_type type);
extern bool is_any_service_fd(int fd); extern bool is_any_service_fd(int fd);
void show_posix_timers(int fd);
int check_img_inventory(void); int check_img_inventory(void);
int write_img_inventory(void); int write_img_inventory(void);
void kill_inventory(void); void kill_inventory(void);
......
...@@ -12,6 +12,5 @@ ...@@ -12,6 +12,5 @@
extern int is_eventfd_link(int lfd); extern int is_eventfd_link(int lfd);
extern const struct fdtype_ops eventfd_dump_ops; extern const struct fdtype_ops eventfd_dump_ops;
extern struct collect_image_info eventfd_cinfo; extern struct collect_image_info eventfd_cinfo;
extern void show_eventfds(int fd);
#endif /* __CR_EVENTFD_H__ */ #endif /* __CR_EVENTFD_H__ */
...@@ -13,7 +13,5 @@ extern int is_eventpoll_link(int lfd); ...@@ -13,7 +13,5 @@ extern int is_eventpoll_link(int lfd);
extern const struct fdtype_ops eventpoll_dump_ops; extern const struct fdtype_ops eventpoll_dump_ops;
extern struct collect_image_info epoll_tfd_cinfo; extern struct collect_image_info epoll_tfd_cinfo;
extern struct collect_image_info epoll_cinfo; extern struct collect_image_info epoll_cinfo;
extern void show_eventpoll(int fd);
extern void show_eventpoll_tfd(int fd);
#endif /* __CR_EVENTPOLL_H__ */ #endif /* __CR_EVENTPOLL_H__ */
...@@ -23,9 +23,5 @@ extern struct collect_image_info inotify_cinfo; ...@@ -23,9 +23,5 @@ extern struct collect_image_info inotify_cinfo;
extern struct collect_image_info inotify_mark_cinfo; extern struct collect_image_info inotify_mark_cinfo;
extern struct collect_image_info fanotify_cinfo; extern struct collect_image_info fanotify_cinfo;
extern struct collect_image_info fanotify_mark_cinfo; extern struct collect_image_info fanotify_mark_cinfo;
extern void show_inotify_wd(int fd);
extern void show_inotify(int fd);
extern void show_fanotify_mark(int fd);
extern void show_fanotify(int fd);
#endif /* __CR_FSNOTIFY_H__ */ #endif /* __CR_FSNOTIFY_H__ */
...@@ -33,11 +33,11 @@ enum { ...@@ -33,11 +33,11 @@ enum {
_CR_FD_NS_FROM, _CR_FD_NS_FROM,
CR_FD_UTSNS, CR_FD_UTSNS,
CR_FD_IPCNS_VAR, CR_FD_IPC_VAR,
CR_FD_IPCNS_SHM, CR_FD_IPCNS_SHM,
CR_FD_IPCNS_MSG, CR_FD_IPCNS_MSG,
CR_FD_IPCNS_SEM, CR_FD_IPCNS_SEM,
CR_FD_MOUNTPOINTS, CR_FD_MNTS,
CR_FD_NETDEV, CR_FD_NETDEV,
CR_FD_IFADDR, CR_FD_IFADDR,
CR_FD_ROUTE, CR_FD_ROUTE,
...@@ -56,21 +56,21 @@ enum { ...@@ -56,21 +56,21 @@ enum {
CR_FD_INETSK, CR_FD_INETSK,
CR_FD_UNIXSK, CR_FD_UNIXSK,
CR_FD_PACKETSK, CR_FD_PACKETSK,
CR_FD_NETLINKSK, CR_FD_NETLINK_SK,
CR_FD_PIPES, CR_FD_PIPES,
CR_FD_PIPES_DATA, CR_FD_PIPES_DATA,
CR_FD_FIFO, CR_FD_FIFO,
CR_FD_FIFO_DATA, CR_FD_FIFO_DATA,
CR_FD_TTY, CR_FD_TTY_FILES,
CR_FD_TTY_INFO, CR_FD_TTY_INFO,
CR_FD_REMAP_FPATH, CR_FD_REMAP_FPATH,
CR_FD_EVENTFD, CR_FD_EVENTFD_FILE,
CR_FD_EVENTPOLL, CR_FD_EVENTPOLL_FILE,
CR_FD_EVENTPOLL_TFD, CR_FD_EVENTPOLL_TFD,
CR_FD_SIGNALFD, CR_FD_SIGNALFD,
CR_FD_INOTIFY, CR_FD_INOTIFY_FILE,
CR_FD_INOTIFY_WD, CR_FD_INOTIFY_WD,
CR_FD_FANOTIFY, CR_FD_FANOTIFY_FILE,
CR_FD_FANOTIFY_MARK, CR_FD_FANOTIFY_MARK,
CR_FD_TUNFILE, CR_FD_TUNFILE,
_CR_FD_GLOB_TO, _CR_FD_GLOB_TO,
...@@ -89,7 +89,6 @@ enum { ...@@ -89,7 +89,6 @@ enum {
struct cr_fd_desc_tmpl { struct cr_fd_desc_tmpl {
const char *fmt; /* format for the name */ const char *fmt; /* format for the name */
u32 magic; /* magic in the header */ u32 magic; /* magic in the header */
void (*show)(int fd);
}; };
extern struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX]; extern struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX];
......
...@@ -3,10 +3,6 @@ ...@@ -3,10 +3,6 @@
#include "crtools.h" #include "crtools.h"
extern void show_ipc_var(int fd);
extern void show_ipc_shm(int fd);
extern void show_ipc_msg(int fd);
extern void show_ipc_sem(int fd);
extern int dump_ipc_ns(int ns_pid, const struct cr_fdset *fdset); extern int dump_ipc_ns(int ns_pid, const struct cr_fdset *fdset);
extern int prepare_ipc_ns(int pid); extern int prepare_ipc_ns(int pid);
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#define SK_QUEUES_MAGIC 0x56264026 /* Suzdal */ #define SK_QUEUES_MAGIC 0x56264026 /* Suzdal */
#define UTSNS_MAGIC 0x54473203 /* Smolensk */ #define UTSNS_MAGIC 0x54473203 /* Smolensk */
#define CREDS_MAGIC 0x54023547 /* Kozelsk */ #define CREDS_MAGIC 0x54023547 /* Kozelsk */
#define IPCNS_VAR_MAGIC 0x53115007 /* Samara */ #define IPC_VAR_MAGIC 0x53115007 /* Samara */
#define IPCNS_SHM_MAGIC 0x46283044 /* Odessa */ #define IPCNS_SHM_MAGIC 0x46283044 /* Odessa */
#define IPCNS_MSG_MAGIC 0x55453737 /* Moscow */ #define IPCNS_MSG_MAGIC 0x55453737 /* Moscow */
#define IPCNS_SEM_MAGIC 0x59573019 /* St. Petersburg */ #define IPCNS_SEM_MAGIC 0x59573019 /* St. Petersburg */
...@@ -52,23 +52,23 @@ ...@@ -52,23 +52,23 @@
#define REMAP_FPATH_MAGIC 0x59133954 /* Vologda */ #define REMAP_FPATH_MAGIC 0x59133954 /* Vologda */
#define GHOST_FILE_MAGIC 0x52583605 /* Oryol */ #define GHOST_FILE_MAGIC 0x52583605 /* Oryol */
#define TCP_STREAM_MAGIC 0x51465506 /* Orenburg */ #define TCP_STREAM_MAGIC 0x51465506 /* Orenburg */
#define EVENTFD_MAGIC 0x44523722 /* Anapa */ #define EVENTFD_FILE_MAGIC 0x44523722 /* Anapa */
#define EVENTPOLL_MAGIC 0x45023858 /* Krasnodar */ #define EVENTPOLL_FILE_MAGIC 0x45023858 /* Krasnodar */
#define EVENTPOLL_TFD_MAGIC 0x44433746 /* Novorossiysk */ #define EVENTPOLL_TFD_MAGIC 0x44433746 /* Novorossiysk */
#define SIGNALFD_MAGIC 0x57323820 /* Uglich */ #define SIGNALFD_MAGIC 0x57323820 /* Uglich */
#define INOTIFY_MAGIC 0x48424431 /* Volgograd */ #define INOTIFY_FILE_MAGIC 0x48424431 /* Volgograd */
#define INOTIFY_WD_MAGIC 0x54562009 /* Svetlogorsk (Rauschen) */ #define INOTIFY_WD_MAGIC 0x54562009 /* Svetlogorsk (Rauschen) */
#define MOUNTPOINTS_MAGIC 0x55563928 /* Petushki */ #define MNTS_MAGIC 0x55563928 /* Petushki */
#define NETDEV_MAGIC 0x57373951 /* Yaroslavl */ #define NETDEV_MAGIC 0x57373951 /* Yaroslavl */
#define TTY_MAGIC 0x59433025 /* Pushkin */ #define TTY_FILES_MAGIC 0x59433025 /* Pushkin */
#define TTY_INFO_MAGIC 0x59453036 /* Kolpino */ #define TTY_INFO_MAGIC 0x59453036 /* Kolpino */
#define FILE_LOCKS_MAGIC 0x54323616 /* Kaluga */ #define FILE_LOCKS_MAGIC 0x54323616 /* Kaluga */
#define RLIMIT_MAGIC 0x57113925 /* Rostov */ #define RLIMIT_MAGIC 0x57113925 /* Rostov */
#define FANOTIFY_MAGIC 0x55096122 /* Chelyabinsk */ #define FANOTIFY_FILE_MAGIC 0x55096122 /* Chelyabinsk */
#define FANOTIFY_MARK_MAGIC 0x56506035 /* Yekaterinburg */ #define FANOTIFY_MARK_MAGIC 0x56506035 /* Yekaterinburg */
#define SIGNAL_MAGIC 0x59255647 /* Berezniki */ #define SIGNAL_MAGIC 0x59255647 /* Berezniki */
#define PSIGNAL_MAGIC SIGNAL_MAGIC #define PSIGNAL_MAGIC SIGNAL_MAGIC
#define NETLINKSK_MAGIC 0x58005614 /* Perm */ #define NETLINK_SK_MAGIC 0x58005614 /* Perm */
#define NS_FILES_MAGIC 0x61394011 /* Nyandoma */ #define NS_FILES_MAGIC 0x61394011 /* Nyandoma */
#define TUNFILE_MAGIC 0x57143751 /* Kalyazin */ #define TUNFILE_MAGIC 0x57143751 /* Kalyazin */
......
...@@ -12,7 +12,6 @@ extern struct fstype *find_fstype_by_name(char *fst); ...@@ -12,7 +12,6 @@ extern struct fstype *find_fstype_by_name(char *fst);
struct cr_fdset; struct cr_fdset;
extern int dump_mnt_ns(int pid, struct cr_fdset *); extern int dump_mnt_ns(int pid, struct cr_fdset *);
extern void show_mountpoints(int fd);
int prepare_mnt_ns(int pid); int prepare_mnt_ns(int pid);
extern int pivot_root(const char *new_root, const char *put_old); extern int pivot_root(const char *new_root, const char *put_old);
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
#include "list.h" #include "list.h"
void show_netdevices(int fd);
struct cr_fdset; struct cr_fdset;
int dump_net_ns(int pid, struct cr_fdset *); int dump_net_ns(int pid, struct cr_fdset *);
int prepare_net_ns(int pid); int prepare_net_ns(int pid);
......
...@@ -5,7 +5,6 @@ struct cr_fdset; ...@@ -5,7 +5,6 @@ struct cr_fdset;
struct fd_parms; struct fd_parms;
extern int is_signalfd_link(int lfd); extern int is_signalfd_link(int lfd);
extern const struct fdtype_ops signalfd_dump_ops; extern const struct fdtype_ops signalfd_dump_ops;
extern void show_signalfd(int fd);
extern struct collect_image_info signalfd_cinfo; extern struct collect_image_info signalfd_cinfo;
#endif /* __CR_SIGNALFD_H__ */ #endif /* __CR_SIGNALFD_H__ */
...@@ -76,8 +76,6 @@ int restore_one_tcp(int sk, struct inet_sk_info *si); ...@@ -76,8 +76,6 @@ int restore_one_tcp(int sk, struct inet_sk_info *si);
#define SK_EST_PARAM "tcp-established" #define SK_EST_PARAM "tcp-established"
void show_tcp_stream(int fd);
int check_tcp(void); int check_tcp(void);
extern int rst_tcp_socks_add(int fd, bool reuseaddr); extern int rst_tcp_socks_add(int fd, bool reuseaddr);
......
...@@ -10,7 +10,6 @@ struct fd_parms; ...@@ -10,7 +10,6 @@ struct fd_parms;
struct vma_area; struct vma_area;
extern struct collect_image_info packet_sk_cinfo; extern struct collect_image_info packet_sk_cinfo;
void show_packetsk(int fd);
int dump_socket_map(struct vma_area *vma); int dump_socket_map(struct vma_area *vma);
int get_socket_fd(int pid, VmaEntry *vma); int get_socket_fd(int pid, VmaEntry *vma);
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
extern int read_sk_queues(void); extern int read_sk_queues(void);
extern int dump_sk_queue(int sock_fd, int sock_id); extern int dump_sk_queue(int sock_fd, int sock_id);
extern void show_sk_queues(int fd);
extern int restore_sk_queue(int fd, unsigned int peer_id); extern int restore_sk_queue(int fd, unsigned int peer_id);
#endif /* __CR_SK_QUEUE_H__ */ #endif /* __CR_SK_QUEUE_H__ */
...@@ -43,11 +43,6 @@ extern int resolve_unix_peers(void); ...@@ -43,11 +43,6 @@ extern int resolve_unix_peers(void);
extern struct collect_image_info netlink_sk_cinfo; extern struct collect_image_info netlink_sk_cinfo;
extern void show_unixsk(int fd);
extern void show_inetsk(int fd);
extern void show_sk_queues(int fd);
extern void show_netlinksk(int fd);
extern char *skfamily2s(u32 f); extern char *skfamily2s(u32 f);
extern char *sktype2s(u32 t); extern char *sktype2s(u32 t);
extern char *skproto2s(u32 p); extern char *skproto2s(u32 p);
......
#ifndef __CR_STATS_H__ #ifndef __CR_STATS_H__
#define __CR_STATS_H__ #define __CR_STATS_H__
void show_stats(int fd);
enum { enum {
TIME_FREEZING, TIME_FREEZING,
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "crtools.h" #include "crtools.h"
int dump_uts_ns(int ns_pid, struct cr_fdset *fdset); int dump_uts_ns(int ns_pid, struct cr_fdset *fdset);
void show_utsns(int fd);
int prepare_utsns(int pid); int prepare_utsns(int pid);
extern struct ns_desc uts_ns_desc; extern struct ns_desc uts_ns_desc;
......
...@@ -433,7 +433,7 @@ static int dump_ipc_data(const struct cr_fdset *fdset) ...@@ -433,7 +433,7 @@ static int dump_ipc_data(const struct cr_fdset *fdset)
{ {
int ret; int ret;
ret = dump_ipc_var(fdset_fd(fdset, CR_FD_IPCNS_VAR)); ret = dump_ipc_var(fdset_fd(fdset, CR_FD_IPC_VAR));
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = dump_ipc_shm(fdset_fd(fdset, CR_FD_IPCNS_SHM)); ret = dump_ipc_shm(fdset_fd(fdset, CR_FD_IPCNS_SHM));
...@@ -464,7 +464,7 @@ int dump_ipc_ns(int ns_pid, const struct cr_fdset *fdset) ...@@ -464,7 +464,7 @@ int dump_ipc_ns(int ns_pid, const struct cr_fdset *fdset)
return 0; return 0;
} }
static void ipc_sem_handler(int fd, void *obj) void ipc_sem_handler(int fd, void *obj)
{ {
IpcSemEntry *e = obj; IpcSemEntry *e = obj;
u16 *values; u16 *values;
...@@ -482,18 +482,13 @@ static void ipc_sem_handler(int fd, void *obj) ...@@ -482,18 +482,13 @@ static void ipc_sem_handler(int fd, void *obj)
pr_msg_ipc_sem_array(e->nsems, values); pr_msg_ipc_sem_array(e->nsems, values);
} }
void show_ipc_sem(int fd)
{
pb_show_plain_payload(fd, PB_IPC_SEM, ipc_sem_handler);
}
static void ipc_msg_data_handler(int fd, void *obj) static void ipc_msg_data_handler(int fd, void *obj)
{ {
IpcMsg *e = obj; IpcMsg *e = obj;
print_image_data(fd, round_up(e->msize, sizeof(u64)), opts.show_pages_content); print_image_data(fd, round_up(e->msize, sizeof(u64)), opts.show_pages_content);
} }
static void ipc_msg_handler(int fd, void *obj) void ipc_msg_handler(int fd, void *obj)
{ {
IpcMsgEntry *e = obj; IpcMsgEntry *e = obj;
int msg_nr = 0; int msg_nr = 0;
...@@ -504,27 +499,12 @@ static void ipc_msg_handler(int fd, void *obj) ...@@ -504,27 +499,12 @@ static void ipc_msg_handler(int fd, void *obj)
} }
void show_ipc_msg(int fd) void ipc_shm_handler(int fd, void *obj)
{
pb_show_plain_payload(fd, PB_IPCNS_MSG_ENT, ipc_msg_handler);
}
static void ipc_shm_handler(int fd, void *obj)
{ {
IpcShmEntry *e = obj; IpcShmEntry *e = obj;
print_image_data(fd, round_up(e->size, sizeof(u32)), opts.show_pages_content); print_image_data(fd, round_up(e->size, sizeof(u32)), opts.show_pages_content);
} }
void show_ipc_shm(int fd)
{
pb_show_plain_payload(fd, PB_IPC_SHM, ipc_shm_handler);
}
void show_ipc_var(int fd)
{
pb_show_vertical(fd, PB_IPC_VAR);
}
static int prepare_ipc_sem_values(int fd, const IpcSemEntry *sem) static int prepare_ipc_sem_values(int fd, const IpcSemEntry *sem)
{ {
int ret, size; int ret, size;
...@@ -894,7 +874,7 @@ static int prepare_ipc_var(int pid) ...@@ -894,7 +874,7 @@ static int prepare_ipc_var(int pid)
IpcVarEntry *var; IpcVarEntry *var;
pr_info("Restoring IPC variables\n"); pr_info("Restoring IPC variables\n");
fd = open_image(CR_FD_IPCNS_VAR, O_RSTR, pid); fd = open_image(CR_FD_IPC_VAR, O_RSTR, pid);
if (fd < 0) if (fd < 0)
return -1; return -1;
......
...@@ -540,7 +540,7 @@ int dump_mnt_ns(int ns_pid, struct cr_fdset *fdset) ...@@ -540,7 +540,7 @@ int dump_mnt_ns(int ns_pid, struct cr_fdset *fdset)
pr_info("Dumping mountpoints\n"); pr_info("Dumping mountpoints\n");
img_fd = fdset_fd(fdset, CR_FD_MOUNTPOINTS); img_fd = fdset_fd(fdset, CR_FD_MNTS);
do { do {
struct mount_info *n = pm->next; struct mount_info *n = pm->next;
...@@ -771,7 +771,7 @@ static int populate_mnt_ns(int ns_pid) ...@@ -771,7 +771,7 @@ static int populate_mnt_ns(int ns_pid)
pr_info("Populating mount namespace\n"); pr_info("Populating mount namespace\n");
img = open_image(CR_FD_MOUNTPOINTS, O_RSTR, ns_pid); img = open_image(CR_FD_MNTS, O_RSTR, ns_pid);
if (img < 0) if (img < 0)
return -1; return -1;
...@@ -868,11 +868,6 @@ int prepare_mnt_ns(int ns_pid) ...@@ -868,11 +868,6 @@ int prepare_mnt_ns(int ns_pid)
return ret; return ret;
} }
void show_mountpoints(int fd)
{
pb_show_plain(fd, PB_MNT);
}
int mntns_collect_root(pid_t pid) int mntns_collect_root(pid_t pid)
{ {
int fd, pfd; int fd, pfd;
......
...@@ -473,14 +473,11 @@ int try_show_namespaces(int ns_pid) ...@@ -473,14 +473,11 @@ int try_show_namespaces(int ns_pid)
for (i = _CR_FD_NS_FROM + 1; i < _CR_FD_NS_TO; i++) { for (i = _CR_FD_NS_FROM + 1; i < _CR_FD_NS_TO; i++) {
int fd; int fd;
if (!fdset_template[i].show)
continue;
fd = fdset_fd(fdset, i); fd = fdset_fd(fdset, i);
if (fd == -1) if (fd == -1)
continue; continue;
fdset_template[i].show(fdset_fd(fdset, i)); cr_parse_fd(fd, fdset_template[i].magic);
} }
pr_msg("---[ end of %d namespaces ]---\n", ns_pid); pr_msg("---[ end of %d namespaces ]---\n", ns_pid);
close_cr_fdset(&fdset); close_cr_fdset(&fdset);
......
...@@ -44,11 +44,6 @@ int read_ns_sys_file(char *path, char *buf, int len) ...@@ -44,11 +44,6 @@ int read_ns_sys_file(char *path, char *buf, int len)
return rlen; return rlen;
} }
void show_netdevices(int fd)
{
pb_show_plain_pretty(fd, PB_NETDEV, "2:%d");
}
int write_netdev_img(NetDeviceEntry *nde, struct cr_fdset *fds) int write_netdev_img(NetDeviceEntry *nde, struct cr_fdset *fds)
{ {
return pb_write_one(fdset_fd(fds, CR_FD_NETDEV), nde, PB_NETDEV); return pb_write_one(fdset_fd(fds, CR_FD_NETDEV), nde, PB_NETDEV);
......
...@@ -31,11 +31,6 @@ struct signalfd_dump_arg { ...@@ -31,11 +31,6 @@ struct signalfd_dump_arg {
bool dumped; bool dumped;
}; };
void show_signalfd(int fd)
{
pb_show_plain(fd, PB_SIGNALFD);
}
static int dump_signalfd_entry(union fdinfo_entries *e, void *arg) static int dump_signalfd_entry(union fdinfo_entries *e, void *arg)
{ {
struct signalfd_dump_arg *da = arg; struct signalfd_dump_arg *da = arg;
......
...@@ -621,8 +621,3 @@ int inet_connect(int sk, struct inet_sk_info *ii) ...@@ -621,8 +621,3 @@ int inet_connect(int sk, struct inet_sk_info *ii)
return 0; return 0;
} }
void show_inetsk(int fd)
{
pb_show_plain_pretty(fd, PB_INET_SK, "1:%#x 2:%#x 3:%d 4:%d 5:%d 6:%d 7:%d 8:%d 9:%2x 11:A 12:A");
}
...@@ -65,11 +65,6 @@ int netlink_receive_one(struct nlmsghdr *hdr, void *arg) ...@@ -65,11 +65,6 @@ int netlink_receive_one(struct nlmsghdr *hdr, void *arg)
return sk_collect_one(m->ndiag_ino, PF_NETLINK, &sd->sd); return sk_collect_one(m->ndiag_ino, PF_NETLINK, &sd->sd);
} }
void show_netlinksk(int fd)
{
pb_show_plain(fd, PB_NETLINK_SK);
}
static bool can_dump_netlink_sk(int lfd) static bool can_dump_netlink_sk(int lfd)
{ {
struct pollfd pfd = {lfd, POLLIN, 0}; struct pollfd pfd = {lfd, POLLIN, 0};
...@@ -146,7 +141,7 @@ static int dump_one_netlink_fd(int lfd, u32 id, const struct fd_parms *p) ...@@ -146,7 +141,7 @@ static int dump_one_netlink_fd(int lfd, u32 id, const struct fd_parms *p)
if (dump_socket_opts(lfd, &skopts)) if (dump_socket_opts(lfd, &skopts))
goto err; goto err;
if (pb_write_one(fdset_fd(glob_fdset, CR_FD_NETLINKSK), &ne, PB_NETLINK_SK)) if (pb_write_one(fdset_fd(glob_fdset, CR_FD_NETLINK_SK), &ne, PB_NETLINK_SK))
goto err; goto err;
return 0; return 0;
...@@ -235,7 +230,7 @@ static int collect_one_netlink_sk(void *o, ProtobufCMessage *base) ...@@ -235,7 +230,7 @@ static int collect_one_netlink_sk(void *o, ProtobufCMessage *base)
} }
struct collect_image_info netlink_sk_cinfo = { struct collect_image_info netlink_sk_cinfo = {
.fd_type = CR_FD_NETLINKSK, .fd_type = CR_FD_NETLINK_SK,
.pb_type = PB_NETLINK_SK, .pb_type = PB_NETLINK_SK,
.priv_size = sizeof(struct netlink_sock_info), .priv_size = sizeof(struct netlink_sock_info),
.collect = collect_one_netlink_sk, .collect = collect_one_netlink_sk,
......
...@@ -42,11 +42,6 @@ struct packet_sock_desc { ...@@ -42,11 +42,6 @@ struct packet_sock_desc {
#define NO_FANOUT ((unsigned int)-1) #define NO_FANOUT ((unsigned int)-1)
void show_packetsk(int fd)
{
pb_show_plain_pretty(fd, PB_PACKET_SOCK, "5:%d");
}
static int dump_mreqs(PacketSockEntry *psk, struct packet_sock_desc *sd) static int dump_mreqs(PacketSockEntry *psk, struct packet_sock_desc *sd)
{ {
int i; int i;
......
...@@ -170,17 +170,12 @@ err_brk: ...@@ -170,17 +170,12 @@ err_brk:
return ret; return ret;
} }
static void sk_queue_data_handler(int fd, void *obj) void sk_queue_data_handler(int fd, void *obj)
{ {
SkPacketEntry *e = obj; SkPacketEntry *e = obj;
print_image_data(fd, e->length, opts.show_pages_content); print_image_data(fd, e->length, opts.show_pages_content);
} }
void show_sk_queues(int fd)
{
pb_show_plain_payload(fd, PB_SK_QUEUES, sk_queue_data_handler);
}
int restore_sk_queue(int fd, unsigned int peer_id) int restore_sk_queue(int fd, unsigned int peer_id)
{ {
struct sk_packet *pkt, *tmp; struct sk_packet *pkt, *tmp;
......
...@@ -609,11 +609,6 @@ void rst_unlock_tcp_connections(void) ...@@ -609,11 +609,6 @@ void rst_unlock_tcp_connections(void)
nf_unlock_connection_info(ii); nf_unlock_connection_info(ii);
} }
void show_tcp_stream(int fd)
{
do_pb_show_plain(fd, PB_TCP_STREAM, 1, NULL, "1:%u 2:%u 3:%u 4:%u");
}
int check_tcp(void) int check_tcp(void)
{ {
socklen_t optlen; socklen_t optlen;
......
...@@ -497,11 +497,6 @@ static struct unix_sk_info *find_unix_sk_by_ino(int ino) ...@@ -497,11 +497,6 @@ static struct unix_sk_info *find_unix_sk_by_ino(int ino)
return NULL; return NULL;
} }
void show_unixsk(int fd)
{
pb_show_plain_pretty(fd, PB_UNIX_SK, "1:%#x 2:%#x 3:%d 4:%d 5:%d 6:%d 7:%d 8:%#x 11:S");
}
static int shutdown_unix_sk(int sk, struct unix_sk_info *ui) static int shutdown_unix_sk(int sk, struct unix_sk_info *ui)
{ {
int how; int how;
......
...@@ -89,12 +89,6 @@ void timing_stop(int t) ...@@ -89,12 +89,6 @@ void timing_stop(int t)
timeval_accumulate(&tm->start, &now, &tm->total); timeval_accumulate(&tm->start, &now, &tm->total);
} }
void show_stats(int fd)
{
do_pb_show_plain(fd, PB_STATS, 1, NULL,
"1.1:%u 1.2:%u 1.3:%u 1.4:%u 1.5:%Lu 1.6:%Lu 1.7:%Lu");
}
static void encode_time(int t, u_int32_t *to) static void encode_time(int t, u_int32_t *to)
{ {
struct timing *tm; struct timing *tm;
......
...@@ -984,7 +984,7 @@ static int collect_one_tty(void *obj, ProtobufCMessage *msg) ...@@ -984,7 +984,7 @@ static int collect_one_tty(void *obj, ProtobufCMessage *msg)
} }
struct collect_image_info tty_cinfo = { struct collect_image_info tty_cinfo = {
.fd_type = CR_FD_TTY, .fd_type = CR_FD_TTY_FILES,
.pb_type = PB_TTY_FILE, .pb_type = PB_TTY_FILE,
.priv_size = sizeof(struct tty_info), .priv_size = sizeof(struct tty_info),
.collect = collect_one_tty, .collect = collect_one_tty,
...@@ -1187,7 +1187,7 @@ static int dump_one_pty(int lfd, u32 id, const struct fd_parms *p) ...@@ -1187,7 +1187,7 @@ static int dump_one_pty(int lfd, u32 id, const struct fd_parms *p)
ret = dump_pty_info(lfd, e.tty_info_id, p, major, index); ret = dump_pty_info(lfd, e.tty_info_id, p, major, index);
if (!ret) if (!ret)
ret = pb_write_one(fdset_fd(glob_fdset, CR_FD_TTY), &e, PB_TTY_FILE); ret = pb_write_one(fdset_fd(glob_fdset, CR_FD_TTY_FILES), &e, PB_TTY_FILE);
return ret; return ret;
} }
......
...@@ -388,11 +388,6 @@ struct collect_image_info tunfile_cinfo = { ...@@ -388,11 +388,6 @@ struct collect_image_info tunfile_cinfo = {
.flags = COLLECT_OPTIONAL, .flags = COLLECT_OPTIONAL,
}; };
void show_tunfile(int fd)
{
pb_show_plain(fd, PB_TUNFILE);
}
int dump_tun_link(NetDeviceEntry *nde, struct cr_fdset *fds) int dump_tun_link(NetDeviceEntry *nde, struct cr_fdset *fds)
{ {
TunLinkEntry tle = TUN_LINK_ENTRY__INIT; TunLinkEntry tle = TUN_LINK_ENTRY__INIT;
......
...@@ -65,9 +65,4 @@ out: ...@@ -65,9 +65,4 @@ out:
return ret; return ret;
} }
void show_utsns(int fd)
{
pb_show_vertical(fd, PB_UTSNS);
}
struct ns_desc uts_ns_desc = NS_DESC_ENTRY(CLONE_NEWUTS, "uts"); struct ns_desc uts_ns_desc = NS_DESC_ENTRY(CLONE_NEWUTS, "uts");
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