Date: Wed, 28 Aug 2024 19:12:47 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: a852dc580c1c - main - vmm: Harmonize compat ioctl definitions Message-ID: <202408281912.47SJCl4M059232@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a852dc580c1c261bc50fd9788b52abca0004661b commit a852dc580c1c261bc50fd9788b52abca0004661b Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2024-08-28 18:57:43 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-08-28 19:12:32 +0000 vmm: Harmonize compat ioctl definitions For compat ioctls and structures, we use a mix of suffixes: _old, _fbsd<version>, _<version>. Standardize on _<version> to make things more consistent. No functional change intended. Reported by: jhb Reviewed by: corvink, jhb Differential Revision: https://reviews.freebsd.org/D46449 --- sys/amd64/vmm/vmm_dev_machdep.c | 34 +++++++++++++++++----------------- sys/dev/vmm/vmm_dev.c | 24 ++++++++++++------------ 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/sys/amd64/vmm/vmm_dev_machdep.c b/sys/amd64/vmm/vmm_dev_machdep.c index 792807568212..2d0ceadaedfe 100644 --- a/sys/amd64/vmm/vmm_dev_machdep.c +++ b/sys/amd64/vmm/vmm_dev_machdep.c @@ -59,16 +59,16 @@ #include "io/vrtc.h" #ifdef COMPAT_FREEBSD13 -struct vm_stats_old { +struct vm_stats_13 { int cpuid; /* in */ int num_entries; /* out */ struct timeval tv; uint64_t statbuf[MAX_VM_STATS]; }; -#define VM_STATS_OLD _IOWR('v', IOCNUM_VM_STATS, struct vm_stats_old) +#define VM_STATS_13 _IOWR('v', IOCNUM_VM_STATS, struct vm_stats_13) -struct vm_snapshot_meta_old { +struct vm_snapshot_meta_13 { void *ctx; /* unused */ void *dev_data; const char *dev_name; /* identify userspace devices */ @@ -79,8 +79,8 @@ struct vm_snapshot_meta_old { enum vm_snapshot_op op; }; -#define VM_SNAPSHOT_REQ_OLD \ - _IOWR('v', IOCNUM_SNAPSHOT_REQ, struct vm_snapshot_meta_old) +#define VM_SNAPSHOT_REQ_13 \ + _IOWR('v', IOCNUM_SNAPSHOT_REQ, struct vm_snapshot_meta_13) struct vm_exit_ipi_13 { uint32_t mode; @@ -131,14 +131,14 @@ const struct vmmdev_ioctl vmmdev_machdep_ioctls[] = { VMMDEV_IOCTL(VM_UNMAP_PPTDEV_MMIO, VMMDEV_IOCTL_LOCK_ALL_VCPUS), #ifdef BHYVE_SNAPSHOT #ifdef COMPAT_FREEBSD13 - VMMDEV_IOCTL(VM_SNAPSHOT_REQ_OLD, VMMDEV_IOCTL_LOCK_ALL_VCPUS), + VMMDEV_IOCTL(VM_SNAPSHOT_REQ_13, VMMDEV_IOCTL_LOCK_ALL_VCPUS), #endif VMMDEV_IOCTL(VM_SNAPSHOT_REQ, VMMDEV_IOCTL_LOCK_ALL_VCPUS), VMMDEV_IOCTL(VM_RESTORE_TIME, VMMDEV_IOCTL_LOCK_ALL_VCPUS), #endif #ifdef COMPAT_FREEBSD13 - VMMDEV_IOCTL(VM_STATS_OLD, VMMDEV_IOCTL_LOCK_ONE_VCPU), + VMMDEV_IOCTL(VM_STATS_13, VMMDEV_IOCTL_LOCK_ONE_VCPU), #endif VMMDEV_IOCTL(VM_INJECT_NMI, VMMDEV_IOCTL_LOCK_ONE_VCPU), VMMDEV_IOCTL(VM_LAPIC_IRQ, VMMDEV_IOCTL_LOCK_ONE_VCPU), @@ -196,7 +196,7 @@ vmmdev_machdep_ioctl(struct vm *vm, struct vcpu *vcpu, u_long cmd, caddr_t data, #ifdef BHYVE_SNAPSHOT struct vm_snapshot_meta *snapshot_meta; #ifdef COMPAT_FREEBSD13 - struct vm_snapshot_meta_old *snapshot_old; + struct vm_snapshot_meta_13 *snapshot_13; #endif #endif int error; @@ -270,13 +270,13 @@ vmmdev_machdep_ioctl(struct vm *vm, struct vcpu *vcpu, u_long cmd, caddr_t data, } break; } - case VM_STATS_OLD: { - struct vm_stats_old *vmstats_old; + case VM_STATS_13: { + struct vm_stats_13 *vmstats_13; - vmstats_old = (struct vm_stats_old *)data; - getmicrotime(&vmstats_old->tv); - error = vmm_stat_copy(vcpu, 0, nitems(vmstats_old->statbuf), - &vmstats_old->num_entries, vmstats_old->statbuf); + vmstats_13 = (struct vm_stats_13 *)data; + getmicrotime(&vmstats_13->tv); + error = vmm_stat_copy(vcpu, 0, nitems(vmstats_13->statbuf), + &vmstats_13->num_entries, vmstats_13->statbuf); break; } #endif @@ -502,14 +502,14 @@ vmmdev_machdep_ioctl(struct vm *vm, struct vcpu *vcpu, u_long cmd, caddr_t data, error = vm_snapshot_req(vm, snapshot_meta); break; #ifdef COMPAT_FREEBSD13 - case VM_SNAPSHOT_REQ_OLD: + case VM_SNAPSHOT_REQ_13: /* * The old structure just has an additional pointer at * the start that is ignored. */ - snapshot_old = (struct vm_snapshot_meta_old *)data; + snapshot_13 = (struct vm_snapshot_meta_13 *)data; snapshot_meta = - (struct vm_snapshot_meta *)&snapshot_old->dev_data; + (struct vm_snapshot_meta *)&snapshot_13->dev_data; error = vm_snapshot_req(vm, snapshot_meta); break; #endif diff --git a/sys/dev/vmm/vmm_dev.c b/sys/dev/vmm/vmm_dev.c index fa9357b3b566..f43429de4d4c 100644 --- a/sys/dev/vmm/vmm_dev.c +++ b/sys/dev/vmm/vmm_dev.c @@ -29,17 +29,17 @@ #include <dev/vmm/vmm_stat.h> #if defined(__amd64__) && defined(COMPAT_FREEBSD12) -struct vm_memseg_fbsd12 { +struct vm_memseg_12 { int segid; size_t len; char name[64]; }; -_Static_assert(sizeof(struct vm_memseg_fbsd12) == 80, "COMPAT_FREEBSD12 ABI"); +_Static_assert(sizeof(struct vm_memseg_12) == 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) +#define VM_ALLOC_MEMSEG_12 \ + _IOW('v', IOCNUM_ALLOC_MEMSEG, struct vm_memseg_12) +#define VM_GET_MEMSEG_12 \ + _IOWR('v', IOCNUM_GET_MEMSEG, struct vm_memseg_12) #endif struct devmem_softc { @@ -339,7 +339,7 @@ static const struct vmmdev_ioctl vmmdev_ioctls[] = { VMMDEV_IOCTL(VM_STATS, VMMDEV_IOCTL_LOCK_ONE_VCPU), #if defined(__amd64__) && defined(COMPAT_FREEBSD12) - VMMDEV_IOCTL(VM_ALLOC_MEMSEG_FBSD12, + VMMDEV_IOCTL(VM_ALLOC_MEMSEG_12, VMMDEV_IOCTL_XLOCK_MEMSEGS | VMMDEV_IOCTL_LOCK_ALL_VCPUS), #endif VMMDEV_IOCTL(VM_ALLOC_MEMSEG, @@ -352,7 +352,7 @@ static const struct vmmdev_ioctl vmmdev_ioctls[] = { VMMDEV_IOCTL_XLOCK_MEMSEGS | VMMDEV_IOCTL_LOCK_ALL_VCPUS), #if defined(__amd64__) && defined(COMPAT_FREEBSD12) - VMMDEV_IOCTL(VM_GET_MEMSEG_FBSD12, VMMDEV_IOCTL_SLOCK_MEMSEGS), + VMMDEV_IOCTL(VM_GET_MEMSEG_12, VMMDEV_IOCTL_SLOCK_MEMSEGS), #endif VMMDEV_IOCTL(VM_GET_MEMSEG, VMMDEV_IOCTL_SLOCK_MEMSEGS), VMMDEV_IOCTL(VM_MMAP_GETNEXT, VMMDEV_IOCTL_SLOCK_MEMSEGS), @@ -489,13 +489,13 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, break; } #if defined(__amd64__) && defined(COMPAT_FREEBSD12) - case VM_ALLOC_MEMSEG_FBSD12: + case VM_ALLOC_MEMSEG_12: error = alloc_memseg(sc, (struct vm_memseg *)data, - sizeof(((struct vm_memseg_fbsd12 *)0)->name)); + sizeof(((struct vm_memseg_12 *)0)->name)); break; - case VM_GET_MEMSEG_FBSD12: + case VM_GET_MEMSEG_12: error = get_memseg(sc, (struct vm_memseg *)data, - sizeof(((struct vm_memseg_fbsd12 *)0)->name)); + sizeof(((struct vm_memseg_12 *)0)->name)); break; #endif case VM_ALLOC_MEMSEG:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202408281912.47SJCl4M059232>