Commit 84737e27 authored by Pavel Emelyanov's avatar Pavel Emelyanov

build: Generate most of the pb-desc automatically

These contain linkage between number, data type and routines
for pb messages we write/read to/from image files. Most of them
have simple number-type-routines mapping, so introduce a generating
script for that.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 889a2129
......@@ -22,3 +22,4 @@ arch/x86/sys-exec-tbl.c
arch/x86/syscalls.S
pie/pie.lds.S
include/config.h
protobuf-desc-gen.h
......@@ -195,6 +195,7 @@ clean: clean-built
$(Q) $(RM) -r ./gcov
$(Q) $(RM) -r ./test/lib/
$(Q) $(RM) -r ./test/lib64/
$(Q) $(RM) protobuf-desc-gen.h
$(Q) $(MAKE) -C test/zdtm cleandep clean cleanout
distclean: clean
......
......@@ -56,3 +56,11 @@ obj-y += arch/$(ARCH)/vdso.o
ifneq ($(MAKECMDGOALS),clean)
incdeps := y
endif
PROTOBUF_GEN := protobuf-gen.sh
protobuf-desc.c: protobuf-desc-gen.h
protobuf-desc-gen.h: $(PROTOBUF_GEN) include/protobuf-desc.h
$(E) " GEN " $@
$(Q) $(SH) $(obj)/$(PROTOBUF_GEN) > $@
......@@ -382,7 +382,7 @@ static int dump_task_mappings(pid_t pid, const struct vm_area_list *vma_area_lis
ret = 0;
if (!ret)
ret = pb_write_one(fd, vma, PB_VMAS);
ret = pb_write_one(fd, vma, PB_VMA);
if (ret)
goto err;
}
......
......@@ -456,7 +456,7 @@ static int prepare_mappings(int pid)
if (!vma)
break;
ret = pb_read_one_eof(fd, &e, PB_VMAS);
ret = pb_read_one_eof(fd, &e, PB_VMA);
if (ret <= 0) {
xfree(vma);
break;
......@@ -1623,7 +1623,7 @@ static int prepare_itimers(int pid, struct task_restore_core_args *args)
if (fd < 0)
return fd;
ret = pb_read_one(fd, &ie, PB_ITIMERS);
ret = pb_read_one(fd, &ie, PB_ITIMER);
if (ret < 0)
goto out;
ret = itimer_restore_and_fix("real", ie, &args->itimers[0]);
......@@ -1631,7 +1631,7 @@ static int prepare_itimers(int pid, struct task_restore_core_args *args)
if (ret < 0)
goto out;
ret = pb_read_one(fd, &ie, PB_ITIMERS);
ret = pb_read_one(fd, &ie, PB_ITIMER);
if (ret < 0)
goto out;
ret = itimer_restore_and_fix("virt", ie, &args->itimers[1]);
......@@ -1639,7 +1639,7 @@ static int prepare_itimers(int pid, struct task_restore_core_args *args)
if (ret < 0)
goto out;
ret = pb_read_one(fd, &ie, PB_ITIMERS);
ret = pb_read_one(fd, &ie, PB_ITIMER);
if (ret < 0)
goto out;
ret = itimer_restore_and_fix("prof", ie, &args->itimers[2]);
......@@ -1711,7 +1711,7 @@ static int open_posix_timers_image(int pid, unsigned long *rpt, int *nr)
while (1) {
PosixTimerEntry *pte;
ret = pb_read_one_eof(fd, &pte, PB_POSIX_TIMERS);
ret = pb_read_one_eof(fd, &pte, PB_POSIX_TIMER);
if (ret <= 0) {
goto out;
}
......
......@@ -68,12 +68,12 @@ void show_fown_cont(void *p)
void show_ns_files(int fd)
{
pb_show_plain(fd, PB_NS_FILES);
pb_show_plain(fd, PB_NS_FILE);
}
void show_reg_files(int fd_reg_files)
{
pb_show_plain(fd_reg_files, PB_REG_FILES);
pb_show_plain(fd_reg_files, PB_REG_FILE);
}
void show_remap_files(int fd)
......@@ -94,12 +94,12 @@ static void pipe_data_handler(int fd, void *obj)
void show_pipes_data(int fd)
{
pb_show_plain_payload(fd, PB_PIPES_DATA, pipe_data_handler);
pb_show_plain_payload(fd, PB_PIPE_DATA, pipe_data_handler);
}
void show_pipes(int fd_pipes)
{
pb_show_plain(fd_pipes, PB_PIPES);
pb_show_plain(fd_pipes, PB_PIPE);
}
void show_fifo_data(int fd)
......@@ -114,7 +114,7 @@ void show_fifo(int fd)
void show_tty(int fd)
{
pb_show_plain(fd, PB_TTY);
pb_show_plain(fd, PB_TTY_FILE);
}
void show_tty_info(int fd)
......@@ -134,7 +134,7 @@ void show_fs(int fd_fs)
void show_vmas(int fd_vma)
{
pb_show_plain(fd_vma, PB_VMAS);
pb_show_plain(fd_vma, PB_VMA);
}
void show_rlimit(int fd)
......@@ -257,12 +257,12 @@ void show_sigacts(int fd_sigacts)
void show_itimers(int fd)
{
pb_show_plain_pretty(fd, PB_ITIMERS, "*:%Lu");
pb_show_plain_pretty(fd, PB_ITIMER, "*:%Lu");
}
void show_posix_timers(int fd)
{
pb_show_plain_pretty(fd, PB_POSIX_TIMERS, "*:%d 5:%Lu 7:%Lu 8:%lu 9:%Lu 10:%Lu");
pb_show_plain_pretty(fd, PB_POSIX_TIMER, "*:%d 5:%Lu 7:%Lu 8:%lu 9:%Lu 10:%Lu");
}
void show_creds(int fd)
......
......@@ -46,7 +46,7 @@ static void pr_info_eventfd(char *action, EventfdFileEntry *efe)
void show_eventfds(int fd)
{
pb_show_plain(fd, PB_EVENTFD);
pb_show_plain(fd, PB_EVENTFD_FILE);
}
struct eventfd_dump_arg {
......@@ -71,7 +71,7 @@ static int dump_eventfd_entry(union fdinfo_entries *e, void *arg)
pr_info_eventfd("Dumping ", &e->efd);
return pb_write_one(fdset_fd(glob_fdset, CR_FD_EVENTFD),
&e->efd, PB_EVENTFD);
&e->efd, PB_EVENTFD_FILE);
}
static int dump_one_eventfd(int lfd, u32 id, const struct fd_parms *p)
......@@ -128,7 +128,7 @@ static int collect_one_efd(void *obj, ProtobufCMessage *msg)
struct collect_image_info eventfd_cinfo = {
.fd_type = CR_FD_EVENTFD,
.pb_type = PB_EVENTFD,
.pb_type = PB_EVENTFD_FILE,
.priv_size = sizeof(struct eventfd_file_info),
.collect = collect_one_efd,
};
......@@ -63,7 +63,7 @@ void show_eventpoll_tfd(int fd)
void show_eventpoll(int fd)
{
pb_show_plain(fd, PB_EVENTPOLL);
pb_show_plain(fd, PB_EVENTPOLL_FILE);
}
static int dump_eventpoll_entry(union fdinfo_entries *e, void *arg)
......@@ -86,7 +86,7 @@ static int dump_one_eventpoll(int lfd, u32 id, const struct fd_parms *p)
pr_info_eventpoll("Dumping ", &e);
if (pb_write_one(fdset_fd(glob_fdset, CR_FD_EVENTPOLL),
&e, PB_EVENTPOLL))
&e, PB_EVENTPOLL_FILE))
return -1;
return parse_fdinfo(lfd, FD_TYPES__EVENTPOLL, dump_eventpoll_entry, &id);
......@@ -194,7 +194,7 @@ static int collect_one_epoll(void *o, ProtobufCMessage *msg)
struct collect_image_info epoll_cinfo = {
.fd_type = CR_FD_EVENTPOLL,
.pb_type = PB_EVENTPOLL,
.pb_type = PB_EVENTPOLL_FILE,
.priv_size = sizeof(struct eventpoll_file_info),
.collect = collect_one_epoll,
};
......@@ -353,7 +353,7 @@ static int create_link_remap(char *path, int len, int lfd, u32 *idp)
return -1;
}
return pb_write_one(fdset_fd(glob_fdset, CR_FD_REG_FILES), &rfe, PB_REG_FILES);
return pb_write_one(fdset_fd(glob_fdset, CR_FD_REG_FILES), &rfe, PB_REG_FILE);
}
static int dump_linked_remap(char *path, int len, const struct stat *ost, int lfd, u32 id)
......@@ -459,7 +459,7 @@ int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p)
rfd = fdset_fd(glob_fdset, CR_FD_REG_FILES);
return pb_write_one(rfd, &rfe, PB_REG_FILES);
return pb_write_one(rfd, &rfe, PB_REG_FILE);
}
const struct fdtype_ops regfile_dump_ops = {
......@@ -568,7 +568,7 @@ static int collect_one_regfile(void *o, ProtobufCMessage *base)
struct collect_image_info reg_file_cinfo = {
.fd_type = CR_FD_REG_FILES,
.pb_type = PB_REG_FILES,
.pb_type = PB_REG_FILE,
.priv_size = sizeof(struct reg_file_info),
.collect = collect_one_regfile,
};
......
......@@ -84,7 +84,7 @@ void show_inotify_wd(int fd_inotify_wd)
void show_inotify(int fd_inotify)
{
pb_show_plain(fd_inotify, PB_INOTIFY);
pb_show_plain(fd_inotify, PB_INOTIFY_FILE);
}
void show_fanotify_mark(int fd)
......@@ -94,7 +94,7 @@ void show_fanotify_mark(int fd)
void show_fanotify(int fd)
{
pb_show_plain(fd, PB_FANOTIFY);
pb_show_plain(fd, PB_FANOTIFY_FILE);
}
static int dump_inotify_entry(union fdinfo_entries *e, void *arg)
......@@ -119,7 +119,7 @@ static int dump_one_inotify(int lfd, u32 id, const struct fd_parms *p)
ie.fown = (FownEntry *)&p->fown;
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))
if (pb_write_one(fdset_fd(glob_fdset, CR_FD_INOTIFY), &ie, PB_INOTIFY_FILE))
return -1;
return parse_fdinfo(lfd, FD_TYPES__INOTIFY, dump_inotify_entry, &id);
......@@ -187,7 +187,7 @@ static int dump_one_fanotify(int lfd, u32 id, const struct fd_parms *p)
fe.faflags = fsn_params.faflags;
fe.evflags = fsn_params.evflags;
return pb_write_one(fdset_fd(glob_fdset, CR_FD_FANOTIFY), &fe, PB_FANOTIFY);
return pb_write_one(fdset_fd(glob_fdset, CR_FD_FANOTIFY), &fe, PB_FANOTIFY_FILE);
}
const struct fdtype_ops fanotify_dump_ops = {
......@@ -461,7 +461,7 @@ static int collect_one_inotify(void *o, ProtobufCMessage *msg)
struct collect_image_info inotify_cinfo = {
.fd_type = CR_FD_INOTIFY,
.pb_type = PB_INOTIFY,
.pb_type = PB_INOTIFY_FILE,
.priv_size = sizeof(struct fsnotify_file_info),
.collect = collect_one_inotify,
.flags = COLLECT_OPTIONAL,
......@@ -480,7 +480,7 @@ static int collect_one_fanotify(void *o, ProtobufCMessage *msg)
struct collect_image_info fanotify_cinfo = {
.fd_type = CR_FD_FANOTIFY,
.pb_type = PB_FANOTIFY,
.pb_type = PB_FANOTIFY_FILE,
.priv_size = sizeof(struct fsnotify_file_info),
.collect = collect_one_fanotify,
.flags = COLLECT_OPTIONAL,
......
......@@ -5,58 +5,62 @@
#include <google/protobuf-c/protobuf-c.h>
enum {
/* PB_AUTOGEN_START */
PB_INVENTORY,
PB_STATS,
PB_FDINFO,
PB_CORE,
PB_MM,
PB_VMAS,
PB_SIGACT,
PB_ITIMERS,
PB_POSIX_TIMERS,
PB_VMA,
PB_ITIMER,
PB_POSIX_TIMER,
PB_CREDS,
PB_FS,
PB_UTSNS,
PB_IPCNS_VAR,
PB_IPCNS_SHM,
PB_IPCNS_MSG,
PB_IPCNS_MSG_ENT,
PB_IPCNS_SEM,
PB_MOUNTPOINTS,
PB_NETDEV,
PB_IPC_VAR,
PB_IPC_SHM,
PB_IPC_SEM,
PB_MNT,
PB_PSTREE,
PB_GHOST_FILE,
PB_TCP_STREAM,
PB_SK_QUEUES,
PB_REG_FILES,
PB_NS_FILES,
PB_INETSK,
PB_UNIXSK,
PB_PACKETSK,
PB_NETLINKSK,
PB_PIPES,
PB_REG_FILE,
PB_NS_FILE,
PB_INET_SK,
PB_UNIX_SK,
PB_PACKET_SOCK,
PB_NETLINK_SK,
PB_PIPE,
PB_FIFO,
PB_PIPES_DATA,
PB_REMAP_FPATH,
PB_EVENTFD,
PB_EVENTPOLL,
PB_PIPE_DATA,
PB_EVENTFD_FILE,
PB_EVENTPOLL_FILE,
PB_EVENTPOLL_TFD,
PB_SIGNALFD,
PB_INOTIFY,
PB_INOTIFY_FILE,
PB_INOTIFY_WD,
PB_FANOTIFY,
PB_FANOTIFY_FILE,
PB_FANOTIFY_MARK,
PB_TTY,
PB_TTY_FILE,
PB_TTY_INFO,
PB_FILE_LOCK,
PB_RLIMIT,
PB_IDS,
PB_PAGEMAP_HEAD,
PB_PAGEMAP,
PB_SIGINFO,
PB_TUNFILE,
PB_MAX
/* PB_AUTOGEN_STOP */
PB_PAGEMAP_HEAD,
PB_IDS,
PB_SIGACT,
PB_NETDEV,
PB_REMAP_FPATH,
PB_SK_QUEUES,
PB_IPCNS_MSG,
PB_IPCNS_MSG_ENT,
PB_MAX,
};
typedef size_t (*pb_getpksize_t)(void *obj);
......
......@@ -111,7 +111,7 @@ static int dump_ipc_sem_desc(int fd, int id, const struct semid_ds *ds)
fill_ipc_desc(id, sem.desc, &ds->sem_perm);
pr_info_ipc_sem_entry(&sem);
ret = pb_write_one(fd, &sem, PB_IPCNS_SEM);
ret = pb_write_one(fd, &sem, PB_IPC_SEM);
if (ret < 0) {
pr_err("Failed to write IPC semaphores set\n");
return ret;
......@@ -357,7 +357,7 @@ static int dump_ipc_shm_seg(int fd, int id, const struct shmid_ds *ds)
fill_ipc_desc(id, shm.desc, &ds->shm_perm);
pr_info_ipc_shm(&shm);
ret = pb_write_one(fd, &shm, PB_IPCNS_SHM);
ret = pb_write_one(fd, &shm, PB_IPC_SHM);
if (ret < 0) {
pr_err("Failed to write IPC shared memory segment\n");
return ret;
......@@ -418,7 +418,7 @@ static int dump_ipc_var(int fd)
goto err;
}
ret = pb_write_one(fd, &var, PB_IPCNS_VAR);
ret = pb_write_one(fd, &var, PB_IPC_VAR);
if (ret < 0) {
pr_err("Failed to write IPC variables\n");
goto err;
......@@ -484,7 +484,7 @@ static void ipc_sem_handler(int fd, void *obj)
void show_ipc_sem(int fd)
{
pb_show_plain_payload(fd, PB_IPCNS_SEM, ipc_sem_handler);
pb_show_plain_payload(fd, PB_IPC_SEM, ipc_sem_handler);
}
static void ipc_msg_data_handler(int fd, void *obj)
......@@ -517,12 +517,12 @@ static void ipc_shm_handler(int fd, void *obj)
void show_ipc_shm(int fd)
{
pb_show_plain_payload(fd, PB_IPCNS_SHM, ipc_shm_handler);
pb_show_plain_payload(fd, PB_IPC_SHM, ipc_shm_handler);
}
void show_ipc_var(int fd)
{
pb_show_vertical(fd, PB_IPCNS_VAR);
pb_show_vertical(fd, PB_IPC_VAR);
}
static int prepare_ipc_sem_values(int fd, const IpcSemEntry *sem)
......@@ -620,7 +620,7 @@ static int prepare_ipc_sem(int pid)
while (1) {
IpcSemEntry *sem;
ret = pb_read_one_eof(fd, &sem, PB_IPCNS_SEM);
ret = pb_read_one_eof(fd, &sem, PB_IPC_SEM);
if (ret < 0) {
ret = -EIO;
goto err;
......@@ -863,7 +863,7 @@ static int prepare_ipc_shm(int pid)
while (1) {
IpcShmEntry *shm;
ret = pb_read_one_eof(fd, &shm, PB_IPCNS_SHM);
ret = pb_read_one_eof(fd, &shm, PB_IPC_SHM);
if (ret < 0) {
pr_err("Failed to read IPC shared memory segment\n");
ret = -EIO;
......@@ -898,7 +898,7 @@ static int prepare_ipc_var(int pid)
if (fd < 0)
return -1;
ret = pb_read_one(fd, &var, PB_IPCNS_VAR);
ret = pb_read_one(fd, &var, PB_IPC_VAR);
close_safe(&fd);
if (ret <= 0) {
pr_err("Failed to read IPC namespace variables\n");
......
......@@ -513,7 +513,7 @@ static int dump_one_mountpoint(struct mount_info *pm, int fd)
return -1;
}
if (pb_write_one(fd, &me, PB_MOUNTPOINTS))
if (pb_write_one(fd, &me, PB_MNT))
return -1;
return 0;
......@@ -780,7 +780,7 @@ static int populate_mnt_ns(int ns_pid)
while (1) {
struct mount_info *pm;
ret = pb_read_one_eof(img, &me, PB_MOUNTPOINTS);
ret = pb_read_one_eof(img, &me, PB_MNT);
if (ret <= 0)
break;
......@@ -870,7 +870,7 @@ int prepare_mnt_ns(int ns_pid)
void show_mountpoints(int fd)
{
pb_show_plain(fd, PB_MOUNTPOINTS);
pb_show_plain(fd, PB_MNT);
}
int mntns_collect_root(pid_t pid)
......
......@@ -209,7 +209,7 @@ int dump_one_ns_file(int lfd, u32 id, const struct fd_parms *p)
nfe.ns_cflag = link->ns_d->cflag;
nfe.flags = p->flags;
return pb_write_one(fd, &nfe, PB_NS_FILES);
return pb_write_one(fd, &nfe, PB_NS_FILE);
}
const struct fdtype_ops nsfile_dump_ops = {
......@@ -299,7 +299,7 @@ static int collect_one_nsfile(void *o, ProtobufCMessage *base)
struct collect_image_info nsfile_cinfo = {
.fd_type = CR_FD_NS_FILES,
.pb_type = PB_NS_FILES,
.pb_type = PB_NS_FILE,
.priv_size = sizeof(struct ns_file_info),
.collect = collect_one_nsfile,
.flags = COLLECT_OPTIONAL,
......
......@@ -525,7 +525,7 @@ static int dump_one_timer(struct itimerval *v, int fd)
ie.vsec = v->it_value.tv_sec;
ie.vusec = v->it_value.tv_usec;
return pb_write_one(fd, &ie, PB_ITIMERS);
return pb_write_one(fd, &ie, PB_ITIMER);
}
int parasite_dump_itimers_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_fdset)
......@@ -567,7 +567,7 @@ static int dump_one_posix_timer(struct posix_timer *v, struct proc_posix_timer *
pte.vsec = v->val.it_value.tv_sec;
pte.vnsec = v->val.it_value.tv_nsec;
return pb_write_one(fd, &pte, PB_POSIX_TIMERS);
return pb_write_one(fd, &pte, PB_POSIX_TIMER);
}
int parasite_dump_posix_timers_seized(struct proc_posix_timers_stat *proc_args, struct parasite_ctl *ctl, struct cr_fdset *cr_fdset)
......
......@@ -84,7 +84,7 @@ int collect_pipe_data(int img_type, struct pipe_data_rst **hash)
if (!r)
break;
ret = pb_read_one_eof(fd, &r->pde, PB_PIPES_DATA);
ret = pb_read_one_eof(fd, &r->pde, PB_PIPE_DATA);
if (ret <= 0)
break;
......@@ -391,7 +391,7 @@ static int collect_one_pipe(void *o, ProtobufCMessage *base)
struct collect_image_info pipe_cinfo = {
.fd_type = CR_FD_PIPES,
.pb_type = PB_PIPES,
.pb_type = PB_PIPE,
.priv_size = sizeof(struct pipe_info),
.collect = collect_one_pipe,
};
......@@ -454,7 +454,7 @@ int dump_one_pipe_data(struct pipe_data_dump *pd, int lfd, const struct fd_parms
pde.has_size = true;
pde.size = pipe_size;
if (pb_write_one(img, &pde, PB_PIPES_DATA))
if (pb_write_one(img, &pde, PB_PIPE_DATA))
goto err_close;
if (bytes) {
......@@ -499,7 +499,7 @@ static int dump_one_pipe(int lfd, u32 id, const struct fd_parms *p)
pe.flags = p->flags;
pe.fown = (FownEntry *)&p->fown;
if (pb_write_one(fdset_fd(glob_fdset, CR_FD_PIPES), &pe, PB_PIPES))
if (pb_write_one(fdset_fd(glob_fdset, CR_FD_PIPES), &pe, PB_PIPE))
return -1;
return dump_one_pipe_data(&pd_pipes, lfd, p);
......
......@@ -84,60 +84,14 @@ struct cr_pb_message_desc cr_pb_descs[PB_MAX];
void cr_pb_init(void)
{
CR_PB_DESC(INVENTORY, Inventory, inventory);
CR_PB_DESC(STATS, Stats, stats);
CR_PB_DESC(FDINFO, Fdinfo, fdinfo);
CR_PB_DESC(REG_FILES, RegFile, reg_file);
CR_PB_DESC(NS_FILES, NsFile, ns_file);
CR_PB_DESC(EVENTFD, EventfdFile, eventfd_file);
CR_PB_DESC(EVENTPOLL, EventpollFile, eventpoll_file);
CR_PB_DESC(EVENTPOLL_TFD, EventpollTfd, eventpoll_tfd);
CR_PB_DESC(SIGNALFD, Signalfd, signalfd);
CR_PB_DESC(INOTIFY, InotifyFile, inotify_file);
CR_PB_DESC(INOTIFY_WD, InotifyWd, inotify_wd);
CR_PB_DESC(FANOTIFY, FanotifyFile, fanotify_file);
CR_PB_DESC(FANOTIFY_MARK, FanotifyMark, fanotify_mark);
CR_PB_DESC(CORE, Core, core);
CR_PB_DESC(IDS, TaskKobjIds, task_kobj_ids);
CR_PB_DESC(MM, Mm, mm);
CR_PB_DESC(VMAS, Vma, vma);
CR_PB_DESC(PIPES, Pipe, pipe);
CR_PB_DESC(PIPES_DATA, PipeData, pipe_data);
CR_PB_DESC(FIFO, Fifo, fifo);
CR_PB_DESC(PSTREE, Pstree, pstree);
CR_PB_DESC(SIGACT, Sa, sa);
CR_PB_DESC(UNIXSK, UnixSk, unix_sk);
CR_PB_DESC(INETSK, InetSk, inet_sk);
CR_PB_DESC(SK_QUEUES, SkPacket, sk_packet);
CR_PB_DESC(ITIMERS, Itimer, itimer);
CR_PB_DESC(POSIX_TIMERS, PosixTimer, posix_timer);
CR_PB_DESC(CREDS, Creds, creds);
CR_PB_DESC(UTSNS, Utsns, utsns);
CR_PB_DESC(IPCNS_VAR, IpcVar, ipc_var);
CR_PB_DESC(IPCNS_SHM, IpcShm, ipc_shm);
/* There's no _entry suffix in this one :( */
CR_PB_MDESC_INIT(cr_pb_descs[PB_IPCNS_MSG], IpcMsg, ipc_msg);
CR_PB_DESC(IPCNS_MSG_ENT, IpcMsg, ipc_msg);
CR_PB_DESC(IPCNS_SEM, IpcSem, ipc_sem);
CR_PB_DESC(FS, Fs, fs);
CR_PB_DESC(REMAP_FPATH, RemapFilePath, remap_file_path);
CR_PB_DESC(GHOST_FILE, GhostFile, ghost_file);
CR_PB_DESC(TCP_STREAM, TcpStream, tcp_stream);
CR_PB_DESC(MOUNTPOINTS, Mnt, mnt);
CR_PB_DESC(NETDEV, NetDevice, net_device);
CR_PB_DESC(PACKETSK, PacketSock, packet_sock);
CR_PB_DESC(TTY, TtyFile, tty_file);
CR_PB_DESC(TTY_INFO, TtyInfo, tty_info);
CR_PB_DESC(FILE_LOCK, FileLock, file_lock);
CR_PB_DESC(RLIMIT, Rlimit, rlimit);
CR_PB_MDESC_INIT(cr_pb_descs[PB_PAGEMAP_HEAD], PagemapHead, pagemap_head);
CR_PB_DESC(PAGEMAP, Pagemap, pagemap);
CR_PB_DESC(SIGINFO, Siginfo, siginfo);
CR_PB_DESC(NETLINKSK, NetlinkSk, netlink_sk);
CR_PB_DESC(TUNFILE, Tunfile, tunfile);
#include "protobuf-desc-gen.h"
}
for x in $(cat include/protobuf-desc.h | \
sed -n '/PB_AUTOGEN_START/,/PB_AUTOGEN_STOP/p' | \
fgrep -v 'PB_AUTOGEN_S' | sed -e 's/,//' -e 's/PB_//'); do
x_la=$(echo $x | tr 'A-Z' 'a-z')
x_uf=$(echo $x_la | sed -e 's/^./\u&/' -e 's/_./\U&/g' -e 's/_//g')
echo "CR_PB_DESC($x, $x_uf, $x_la);"
done
......@@ -92,7 +92,7 @@ int prepare_shmem_pid(int pid)
}
while (1) {
ret = pb_read_one_eof(fd, &vi, PB_VMAS);
ret = pb_read_one_eof(fd, &vi, PB_VMA);
if (ret <= 0)
break;
......
......@@ -288,7 +288,7 @@ static int do_dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p, int fa
if (dump_socket_opts(lfd, &skopts))
goto err;
if (pb_write_one(fdset_fd(glob_fdset, CR_FD_INETSK), &ie, PB_INETSK))
if (pb_write_one(fdset_fd(glob_fdset, CR_FD_INETSK), &ie, PB_INET_SK))
goto err;
pr_info("Dumping inet socket at %d\n", p->fd);
......@@ -403,7 +403,7 @@ static int collect_one_inetsk(void *o, ProtobufCMessage *base)
struct collect_image_info inet_sk_cinfo = {
.fd_type = CR_FD_INETSK,
.pb_type = PB_INETSK,
.pb_type = PB_INET_SK,
.priv_size = sizeof(struct inet_sk_info),
.collect = collect_one_inetsk,
};
......@@ -624,5 +624,5 @@ int inet_connect(int sk, struct inet_sk_info *ii)
void show_inetsk(int fd)
{
pb_show_plain_pretty(fd, PB_INETSK, "1:%#x 2:%#x 3:%d 4:%d 5:%d 6:%d 7:%d 8:%d 9:%2x 11:A 12:A");
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");
}
......@@ -67,7 +67,7 @@ int netlink_receive_one(struct nlmsghdr *hdr, void *arg)
void show_netlinksk(int fd)
{
pb_show_plain(fd, PB_NETLINKSK);
pb_show_plain(fd, PB_NETLINK_SK);
}
static bool can_dump_netlink_sk(int lfd)
......@@ -146,7 +146,7 @@ static int dump_one_netlink_fd(int lfd, u32 id, const struct fd_parms *p)
if (dump_socket_opts(lfd, &skopts))
goto err;
if (pb_write_one(fdset_fd(glob_fdset, CR_FD_NETLINKSK), &ne, PB_NETLINKSK))
if (pb_write_one(fdset_fd(glob_fdset, CR_FD_NETLINKSK), &ne, PB_NETLINK_SK))
goto err;
return 0;
......@@ -236,7 +236,7 @@ static int collect_one_netlink_sk(void *o, ProtobufCMessage *base)
struct collect_image_info netlink_sk_cinfo = {
.fd_type = CR_FD_NETLINKSK,
.pb_type = PB_NETLINKSK,
.pb_type = PB_NETLINK_SK,
.priv_size = sizeof(struct netlink_sock_info),
.collect = collect_one_netlink_sk,
.flags = COLLECT_OPTIONAL,
......
......@@ -44,7 +44,7 @@ struct packet_sock_desc {
void show_packetsk(int fd)
{
pb_show_plain_pretty(fd, PB_PACKETSK, "5:%d");
pb_show_plain_pretty(fd, PB_PACKET_SOCK, "5:%d");
}
static int dump_mreqs(PacketSockEntry *psk, struct packet_sock_desc *sd)
......@@ -194,7 +194,7 @@ static int dump_one_packet_fd(int lfd, u32 id, const struct fd_parms *p)
if (ret)
goto out;
ret = pb_write_one(fdset_fd(glob_fdset, CR_FD_PACKETSK), &psk, PB_PACKETSK);
ret = pb_write_one(fdset_fd(glob_fdset, CR_FD_PACKETSK), &psk, PB_PACKET_SOCK);
out:
release_skopts(&skopts);
xfree(psk.rx_ring);
......@@ -501,7 +501,7 @@ static int collect_one_packet_sk(void *o, ProtobufCMessage *base)
struct collect_image_info packet_sk_cinfo = {
.fd_type = CR_FD_PACKETSK,
.pb_type = PB_PACKETSK,
.pb_type = PB_PACKET_SOCK,
.priv_size = sizeof(struct packet_sock_info),
.collect = collect_one_packet_sk,
.flags = COLLECT_OPTIONAL,
......
......@@ -239,7 +239,7 @@ dump:
if (dump_socket_opts(lfd, &skopts))
goto err;
if (pb_write_one(fdset_fd(glob_fdset, CR_FD_UNIXSK), &ue, PB_UNIXSK))
if (pb_write_one(fdset_fd(glob_fdset, CR_FD_UNIXSK), &ue, PB_UNIX_SK))
goto err;
if (sk->rqlen != 0 && !(sk->type == SOCK_STREAM &&
......@@ -461,7 +461,7 @@ int fix_external_unix_sockets(void)
e.fown = &fown;
e.opts = &skopts;
if (pb_write_one(fdset_fd(glob_fdset, CR_FD_UNIXSK), &e, PB_UNIXSK))
if (pb_write_one(fdset_fd(glob_fdset, CR_FD_UNIXSK), &e, PB_UNIX_SK))
goto err;
show_one_unix_img("Dumped extern", &e);
......@@ -499,7 +499,7 @@ static struct unix_sk_info *find_unix_sk_by_ino(int ino)
void show_unixsk(int fd)
{
pb_show_plain_pretty(fd, PB_UNIXSK, "1:%#x 2:%#x 3:%d 4:%d 5:%d 6:%d 7:%d 8:%#x 11:S");
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)
......@@ -828,7 +828,7 @@ static int collect_one_unixsk(void *o, ProtobufCMessage *base)
struct collect_image_info unix_sk_cinfo = {
.fd_type = CR_FD_UNIXSK,
.pb_type = PB_UNIXSK,
.pb_type = PB_UNIX_SK,
.priv_size = sizeof(struct unix_sk_info),
.collect = collect_one_unixsk,
.flags = COLLECT_SHARED,
......
......@@ -985,7 +985,7 @@ static int collect_one_tty(void *obj, ProtobufCMessage *msg)
struct collect_image_info tty_cinfo = {
.fd_type = CR_FD_TTY,
.pb_type = PB_TTY,
.pb_type = PB_TTY_FILE,
.priv_size = sizeof(struct tty_info),
.collect = collect_one_tty,
.flags = COLLECT_OPTIONAL,
......@@ -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);
if (!ret)
ret = pb_write_one(fdset_fd(glob_fdset, CR_FD_TTY), &e, PB_TTY);
ret = pb_write_one(fdset_fd(glob_fdset, CR_FD_TTY), &e, PB_TTY_FILE);
return ret;
}
......
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