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
337932e49d
commit
ab417c0aca
@ -156,6 +156,7 @@ static const char *const vm_guest_sysctl_names[] = {
|
||||
"hv",
|
||||
NULL
|
||||
};
|
||||
CTASSERT(nitems(vm_guest_sysctl_names) - 1 == VM_LAST);
|
||||
|
||||
#ifndef XEN
|
||||
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).
|
||||
* 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)
|
||||
void kassert_panic(const char *fmt, ...) __printflike(1, 2);
|
||||
|
Loading…
Reference in New Issue
Block a user