git: 4f4065e0a220 - main - libvmm: clean up vmmapi.h
Robert Wing
rew at FreeBSD.org
Thu Feb 18 02:54:32 UTC 2021
The branch main has been updated by rew:
URL: https://cgit.FreeBSD.org/src/commit/?id=4f4065e0a220a57afa03420d4f8fa97dbcb5644c
commit 4f4065e0a220a57afa03420d4f8fa97dbcb5644c
Author: Robert Wing <rew at FreeBSD.org>
AuthorDate: 2021-01-29 08:30:31 +0000
Commit: Robert Wing <rew at FreeBSD.org>
CommitDate: 2021-02-18 02:46:42 +0000
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
---
lib/libvmmapi/vmmapi.h | 13 -------------
usr.sbin/bhyve/snapshot.h | 12 ++++++++++++
usr.sbin/bhyvectl/Makefile | 4 ++++
usr.sbin/bhyvectl/bhyvectl.c | 4 ++++
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)
More information about the dev-commits-src-all
mailing list