git: e12b6aaf0d51 - main - vmm: Move compat ioctl definitions to vmm_dev.c

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 26 Aug 2024 18:58:34 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=e12b6aaf0d515dede86001c544024e791a968707

commit e12b6aaf0d515dede86001c544024e791a968707
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-08-26 18:42:13 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-08-26 18:42:13 +0000

    vmm: Move compat ioctl definitions to vmm_dev.c
    
    There is no reason to keep them in vmm_dev.h.  No functional change
    intended.
    
    Reviewed by:    corvink, jhb
    Differential Revision:  https://reviews.freebsd.org/D46432
---
 sys/amd64/include/vmm_dev.h | 11 -----------
 sys/dev/vmm/vmm_dev.c       | 14 ++++++++++++++
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/sys/amd64/include/vmm_dev.h b/sys/amd64/include/vmm_dev.h
index a007ce5515a5..5f347e46b9c4 100644
--- a/sys/amd64/include/vmm_dev.h
+++ b/sys/amd64/include/vmm_dev.h
@@ -54,13 +54,6 @@ struct vm_memseg {
 	char		name[VM_MAX_SUFFIXLEN + 1];
 };
 
-struct vm_memseg_fbsd12 {
-	int		segid;
-	size_t		len;
-	char		name[64];
-};
-_Static_assert(sizeof(struct vm_memseg_fbsd12) == 80, "COMPAT_FREEBSD12 ABI");
-
 struct vm_register {
 	int		cpuid;
 	int		regnum;		/* enum vm_reg_name */
@@ -349,12 +342,8 @@ enum {
 	_IOW('v', IOCNUM_SUSPEND, struct vm_suspend)
 #define	VM_REINIT	\
 	_IO('v', IOCNUM_REINIT)
-#define	VM_ALLOC_MEMSEG_FBSD12	\
-	_IOW('v', IOCNUM_ALLOC_MEMSEG, struct vm_memseg_fbsd12)
 #define	VM_ALLOC_MEMSEG	\
 	_IOW('v', IOCNUM_ALLOC_MEMSEG, struct vm_memseg)
-#define	VM_GET_MEMSEG_FBSD12	\
-	_IOWR('v', IOCNUM_GET_MEMSEG, struct vm_memseg_fbsd12)
 #define	VM_GET_MEMSEG	\
 	_IOWR('v', IOCNUM_GET_MEMSEG, struct vm_memseg)
 #define	VM_MMAP_MEMSEG	\
diff --git a/sys/dev/vmm/vmm_dev.c b/sys/dev/vmm/vmm_dev.c
index 554583358168..db3e2c992f3b 100644
--- a/sys/dev/vmm/vmm_dev.c
+++ b/sys/dev/vmm/vmm_dev.c
@@ -28,6 +28,20 @@
 #include <dev/vmm/vmm_dev.h>
 #include <dev/vmm/vmm_stat.h>
 
+#if defined(__amd64__) && defined(COMPAT_FREEBSD12)
+struct vm_memseg_fbsd12 {
+	int		segid;
+	size_t		len;
+	char		name[64];
+};
+_Static_assert(sizeof(struct vm_memseg_fbsd12) == 80, "COMPAT_FREEBSD12 ABI");
+
+#define	VM_ALLOC_MEMSEG_FBSD12	\
+	_IOW('v', IOCNUM_ALLOC_MEMSEG, struct vm_memseg_fbsd12)
+#define	VM_GET_MEMSEG_FBSD12	\
+	_IOWR('v', IOCNUM_GET_MEMSEG, struct vm_memseg_fbsd12)
+#endif
+
 static int devmem_create_cdev(const char *vmname, int id, char *devmem);
 
 struct devmem_softc {