xref: /freebsd/sys/dev/vmware/vmci/vmci_kernel_defs.h (revision 1b10e191f341111fad7be32ead11484dfd09b800)
1 /*-
2  * Copyright (c) 2018 VMware, Inc.
3  *
4  * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0)
5  *
6  * $FreeBSD$
7  */
8 
9 /* Some common utilities used by the VMCI kernel module. */
10 
11 #ifndef _VMCI_KERNEL_DEFS_H_
12 #define _VMCI_KERNEL_DEFS_H_
13 
14 #include <sys/param.h>
15 #include <sys/systm.h>
16 
17 typedef uint32_t PPN;
18 
19 #define ASSERT(cond)		KASSERT(cond, ("%s", #cond))
20 #define ASSERT_ON_COMPILE(e)	_Static_assert(e, #e);
21 
22 #define LIKELY(_exp)		__predict_true(_exp)
23 #define UNLIKELY(_exp)		__predict_false(_exp)
24 
25 #define CONST64U(c)		UINT64_C(c)
26 
27 #define ARRAYSIZE(a)		nitems(a)
28 
29 #define ROUNDUP(x, y)		roundup(x, y)
30 #define CEILING(x, y)		howmany(x, y)
31 
32 #endif /* !_VMCI_KERNEL_DEFS_H_ */
33