aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Wing <rew@FreeBSD.org>2021-01-29 08:30:31 +0000
committerRobert Wing <rew@FreeBSD.org>2021-02-18 02:46:42 +0000
commit4f4065e0a220a57afa03420d4f8fa97dbcb5644c (patch)
treed67f0b62d00f7d2dbb1526b171cc4554c4b13a1d
parent24fd63e0970f91189dd2acde987bd2e4c8c04a50 (diff)
downloadsrc-4f4065e0a220a57afa03420d4f8fa97dbcb5644c.tar.gz
src-4f4065e0a220a57afa03420d4f8fa97dbcb5644c.zip
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
-rw-r--r--lib/libvmmapi/vmmapi.h13
-rw-r--r--usr.sbin/bhyve/snapshot.h12
-rw-r--r--usr.sbin/bhyvectl/Makefile4
-rw-r--r--usr.sbin/bhyvectl/bhyvectl.c4
4 files changed, 20 insertions, 13 deletions
diff --git a/lib/libvmmapi/vmmapi.h b/lib/libvmmapi/vmmapi.h
index 2fe2bf7906a4..9dc44f391d2c 100644
--- a/lib/libvmmapi/vmmapi.h
+++ b/lib/libvmmapi/vmmapi.h
@@ -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);
diff --git a/usr.sbin/bhyve/snapshot.h b/usr.sbin/bhyve/snapshot.h
index f9ea3d573089..eba46c497ab2 100644
--- a/usr.sbin/bhyve/snapshot.h
+++ b/usr.sbin/bhyve/snapshot.h
@@ -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;
diff --git a/usr.sbin/bhyvectl/Makefile b/usr.sbin/bhyvectl/Makefile
index 58eaf49dae3a..12fdb706cadb 100644
--- a/usr.sbin/bhyvectl/Makefile
+++ b/usr.sbin/bhyvectl/Makefile
@@ -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>
diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c
index c54aa1f33dc1..b404f9f3c255 100644
--- a/usr.sbin/bhyvectl/bhyvectl.c
+++ b/usr.sbin/bhyvectl/bhyvectl.c
@@ -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)