libvmm: clean up vmmapi.h

struct checkpoint_op, enum checkpoint_opcodes, and
MAX_SNAPSHOT_VMNAME are not vmm specific, move them out of the vmmapi
header.

They are used for the save/restore functionality that bhyve(8)
provides and are better suited in usr.sbin/bhyve/snapshot.h

Since bhyvectl(8) requires these, the Makefile for bhyvectl has been
modified to include usr.sbin/bhyve/snapshot.h

Reviewed by:    kevans, grehan
Differential Revision:  https://reviews.freebsd.org/D28410
This commit is contained in:
Robert Wing 2021-01-28 23:30:31 -09:00
parent 24fd63e097
commit 4f4065e0a2
4 changed files with 20 additions and 13 deletions

View file

@ -255,19 +255,6 @@ void vm_setup_freebsd_gdt(uint64_t *gdtr);
/*
* Save and restore
*/
#define MAX_SNAPSHOT_VMNAME 100
enum checkpoint_opcodes {
START_CHECKPOINT = 0,
START_SUSPEND = 1,
};
struct checkpoint_op {
unsigned int op;
char snapshot_filename[MAX_SNAPSHOT_VMNAME];
};
int vm_snapshot_req(struct vm_snapshot_meta *meta);
int vm_restore_time(struct vmctx *ctx);

View file

@ -42,6 +42,8 @@
#include <libxo/xo.h>
#include <ucl.h>
#define MAX_SNAPSHOT_VMNAME 100
struct vmctx;
struct restore_state {
@ -57,6 +59,16 @@ struct restore_state {
ucl_object_t *meta_root_obj;
};
enum checkpoint_opcodes {
START_CHECKPOINT = 0,
START_SUSPEND = 1,
};
struct checkpoint_op {
unsigned int op;
char snapshot_filename[MAX_SNAPSHOT_VMNAME];
};
struct checkpoint_thread_info {
struct vmctx *ctx;
int socket_fd;

View file

@ -18,6 +18,10 @@ CFLAGS+= -I${SRCTOP}/sys/amd64/vmm
.if ${MK_BHYVE_SNAPSHOT} != "no"
CFLAGS+= -DBHYVE_SNAPSHOT
# usr.sbin/bhyve/snapshot.h needs ucl header
CFLAGS+= -I${SRCTOP}/contrib/libucl/include
CFLAGS+= -I${SRCTOP}/usr.sbin/bhyve
.endif
.include <bsd.prog.mk>

View file

@ -63,6 +63,10 @@ __FBSDID("$FreeBSD$");
#include "amd/vmcb.h"
#include "intel/vmcs.h"
#ifdef BHYVE_SNAPSHOT
#include "snapshot.h"
#endif
#define MB (1UL << 20)
#define GB (1UL << 30)