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