Make <vm/vm_extern.h> more self-contained.

Add a nested include of <sys/systm.h> for recently added assertions.
Without this, existing code (such as in drm-kmod) needs to be patched
to add the newly required header.

While here, rewrite the assertions using KASSERT().

Reviewed by:	dougm, alc, imp, kib
Differential Revision:	https://reviews.freebsd.org/D34070
This commit is contained in:
John Baldwin 2022-01-28 13:14:03 -08:00
parent 2e8d1a5525
commit 29d481ae6a

View File

@ -42,6 +42,8 @@ struct vnode;
struct vmem;
#ifdef _KERNEL
#include <sys/systm.h>
struct cdev;
struct cdevsw;
struct domainset;
@ -140,11 +142,8 @@ u_int vm_wait_count(void);
static inline bool
vm_addr_align_ok(vm_paddr_t pa, u_long alignment)
{
#ifdef INVARIANTS
if (!powerof2(alignment))
panic("%s: alignment is not a power of 2: %#lx",
__func__, alignment);
#endif
KASSERT(powerof2(alignment), ("%s: alignment is not a power of 2: %#lx",
__func__, alignment));
return ((pa & (alignment - 1)) == 0);
}
@ -155,11 +154,8 @@ vm_addr_align_ok(vm_paddr_t pa, u_long alignment)
static inline bool
vm_addr_bound_ok(vm_paddr_t pa, vm_paddr_t size, vm_paddr_t boundary)
{
#ifdef INVARIANTS
if (!powerof2(boundary))
panic("%s: boundary is not a power of 2: %#jx",
__func__, (uintmax_t)boundary);
#endif
KASSERT(powerof2(boundary), ("%s: boundary is not a power of 2: %#jx",
__func__, (uintmax_t)boundary));
return (((pa ^ (pa + size - 1)) & -boundary) == 0);
}