git: 733a66841d70 - main - Fix up the vm_guest_sysctl_names size assert.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 06 Nov 2023 15:39:27 UTC
The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=733a66841d70c6934f073d227db10678d6ef5226 commit 733a66841d70c6934f073d227db10678d6ef5226 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2023-11-06 15:38:06 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2023-11-06 15:39:17 +0000 Fix up the vm_guest_sysctl_names size assert. As VM_LAST was included in the array, the size check had to always pass. While here modernize the assert itself. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/kern/subr_param.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c index b7dbf606f492..933bc8d645be 100644 --- a/sys/kern/subr_param.c +++ b/sys/kern/subr_param.c @@ -158,9 +158,9 @@ static const char *const vm_guest_sysctl_names[] = { [VM_GUEST_BHYVE] = "bhyve", [VM_GUEST_VBOX] = "vbox", [VM_GUEST_PARALLELS] = "parallels", - [VM_LAST] = NULL }; -CTASSERT(nitems(vm_guest_sysctl_names) - 1 == VM_LAST); +_Static_assert(nitems(vm_guest_sysctl_names) == VM_LAST, + "new vm guest type not added to vm_guest_sysctl_names"); /* * Boot time overrides that are not scaled against main memory