Add VM_LAST, a special last element in enum VM_GUEST and use it in CTASSERT
to ensure that vm_guest range is covered by vm_guest_sysctl_names. Suggested by: mjg
This commit is contained in:
parent
21d1f635ee
commit
903093ecec
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=258069
@ -156,6 +156,7 @@ static const char *const vm_guest_sysctl_names[] = {
|
|||||||
"hv",
|
"hv",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
CTASSERT(nitems(vm_guest_sysctl_names) - 1 == VM_LAST);
|
||||||
|
|
||||||
#ifndef XEN
|
#ifndef XEN
|
||||||
static const char *const vm_bnames[] = {
|
static const char *const vm_bnames[] = {
|
||||||
|
@ -72,7 +72,8 @@ extern int vm_guest; /* Running as virtual machine guest? */
|
|||||||
* ever implemented (e.g. vendor-specific paravirtualization features).
|
* ever implemented (e.g. vendor-specific paravirtualization features).
|
||||||
* Keep in sync with vm_guest_sysctl_names[].
|
* Keep in sync with vm_guest_sysctl_names[].
|
||||||
*/
|
*/
|
||||||
enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN, VM_GUEST_HV };
|
enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN, VM_GUEST_HV,
|
||||||
|
VM_LAST };
|
||||||
|
|
||||||
#if defined(WITNESS) || defined(INVARIANTS)
|
#if defined(WITNESS) || defined(INVARIANTS)
|
||||||
void kassert_panic(const char *fmt, ...) __printflike(1, 2);
|
void kassert_panic(const char *fmt, ...) __printflike(1, 2);
|
||||||
|
Loading…
Reference in New Issue
Block a user