Commit 3e2f8957 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Andrei Vagin

infect: Remove parasite.h from infect.c

This header describes CRIU parasite code, it has nothing
to do with infect, so remove it.

To do this we need to:

* Detach infect RPC commands from criu-parasite ones
* Move parasite_init_args and parasite_unmap_args into infect
* Move PARASITE_AREA_MIN into infect
* Hiding PARASITE_STACK_SIZE-s in infect
* Hiding parasite symbols resolvers in infect
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 2abf96bb
#ifndef __COMPEL_INFECT_RPC_H__
#define __COMPEL_INFECT_RPC_H__
#include <sys/socket.h>
#include <sys/un.h>
struct parasite_ctl;
extern int compel_rpc_sync(unsigned int cmd, struct parasite_ctl *ctl);
extern int compel_rpc_call(unsigned int cmd, struct parasite_ctl *ctl);
extern int compel_rpc_call_sync(unsigned int cmd, struct parasite_ctl *ctl);
......@@ -17,4 +22,42 @@ struct ctl_msg {
#define ctl_msg_ack(_cmd, _err) \
(struct ctl_msg){.cmd = _cmd, .ack = _cmd, .err = _err, }
/*
* NOTE: each command's args should be arch-independed sized.
* If you want to use one of the standard types, declare
* alternative type for compatible tasks in parasite-compat.h
*/
enum {
PARASITE_CMD_IDLE = 0,
PARASITE_CMD_ACK,
PARASITE_CMD_INIT_DAEMON,
PARASITE_CMD_UNMAP,
/*
* This must be greater than INITs.
*/
PARASITE_CMD_FINI,
PARASITE_USER_CMDS,
};
struct parasite_init_args {
int h_addr_len;
struct sockaddr_un h_addr;
int log_level;
u64 sigframe; /* pointer to sigframe */
void *sigreturn_addr;
futex_t daemon_connected;
};
struct parasite_unmap_args {
void *parasite_start;
unsigned long parasite_len;
};
#endif
......@@ -4,6 +4,8 @@
#include "types.h"
#include "compel/include/uapi/ksigset.h"
#define PARASITE_START_AREA_MIN (4096)
extern int compel_stop_task(int pid);
struct seize_task_status {
......
#ifndef __CR_PARASITE_H__
#define __CR_PARASITE_H__
#define PARASITE_STACK_SIZE (16 << 10)
#define PARASITE_START_AREA_MIN (4096)
#define PARASITE_MAX_SIZE (64 << 10)
#ifndef __ASSEMBLY__
......@@ -16,6 +13,7 @@
#include "image.h"
#include "util-pie.h"
#include "common/lock.h"
#include "infect-rpc.h"
#include "images/vma.pb-c.h"
#include "images/tty.pb-c.h"
......@@ -23,18 +21,7 @@
#define __head __used __section(.head.text)
enum {
PARASITE_CMD_IDLE = 0,
PARASITE_CMD_ACK,
PARASITE_CMD_INIT_DAEMON,
PARASITE_CMD_DUMP_THREAD,
PARASITE_CMD_UNMAP,
/*
* This must be greater than INITs.
*/
PARASITE_CMD_FINI,
PARASITE_CMD_DUMP_THREAD = PARASITE_USER_CMDS,
PARASITE_CMD_MPROTECT_VMAS,
PARASITE_CMD_DUMPPAGES,
......@@ -52,23 +39,6 @@ enum {
PARASITE_CMD_MAX,
};
struct parasite_init_args {
int h_addr_len;
struct sockaddr_un h_addr;
int log_level;
u64 sigframe; /* pointer to sigframe */
void *sigreturn_addr;
futex_t daemon_connected;
};
struct parasite_unmap_args {
void *parasite_start;
unsigned long parasite_len;
};
struct parasite_vma_entry
{
unsigned long start;
......@@ -262,12 +232,6 @@ struct parasite_dump_cgroup_args {
char contents[1 << 12];
};
/* the parasite prefix is added by gen_offsets.sh */
#define __pblob_offset(ptype, symbol) \
parasite_ ## ptype ## _blob_offset__ ## symbol
#define parasite_sym(pblob, ptype, symbol) \
((void *)(pblob) + __pblob_offset(ptype, symbol))
#endif /* !__ASSEMBLY__ */
#endif /* __CR_PARASITE_H__ */
#include "xmalloc.h"
#include "types.h"
#include "parasite.h"
#include "parasite-syscall.h"
#include "log.h"
#include "common/bug.h"
#include "lock.h"
#include "infect.h"
#include "infect-priv.h"
#include "infect-rpc.h"
......
......@@ -11,7 +11,6 @@
#include "asm/parasite-syscall.h"
#include "asm/dump.h"
#include "restorer.h"
#include "parasite.h"
#include "parasite-syscall.h"
#include "pie-relocs.h"
#include "parasite-blob.h"
......@@ -20,6 +19,11 @@
#include "infect-rpc.h"
#include "infect-priv.h"
#define UNIX_PATH_MAX (sizeof(struct sockaddr_un) - \
(size_t)((struct sockaddr_un *) 0)->sun_path)
#define PARASITE_STACK_SIZE (16 << 10)
#define PTRACE_EVENT_STOP 128
#ifndef SECCOMP_MODE_DISABLED
......@@ -721,6 +725,12 @@ int compel_map_exchange(struct parasite_ctl *ctl, unsigned long size)
return ret;
}
/* the parasite prefix is added by gen_offsets.sh */
#define __pblob_offset(ptype, symbol) \
parasite_ ## ptype ## _blob_offset__ ## symbol
#define parasite_sym(pblob, ptype, symbol) \
((void *)(pblob) + __pblob_offset(ptype, symbol))
#define init_parasite_ctl(ctl, blob_type) \
do { \
memcpy(ctl->local_map, parasite_##blob_type##_blob, \
......
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