xref: /illumos-gate/usr/src/compat/bhyve/sys/param.h (revision c21bd51d7acbaf77116c4cc3a23dfc6d16c637c2)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2014 Pluribus Networks Inc.
14  * Copyright 2017 Joyent, Inc.
15  */
16 
17 #ifndef _COMPAT_FREEBSD_SYS_PARAM_H_
18 #define	_COMPAT_FREEBSD_SYS_PARAM_H_
19 
20 #ifndef	_KERNEL
21 #define	MAXCOMLEN	16
22 /* default value of the kernel tunable 'maxphys' in i86pc */
23 #define	MAXPHYS		(56 * 1024)
24 #endif
25 #define	MAXHOSTNAMELEN	256
26 #define	SPECNAMELEN	255
27 
28 #ifdef	_KERNEL
29 #include <sys/time.h>
30 
31 #ifndef	FALSE
32 #define	FALSE	0
33 #endif
34 #ifndef	TRUE
35 #define	TRUE	1
36 #endif
37 #endif
38 
39 #include <machine/param.h>
40 
41 #define	nitems(x)	(sizeof((x)) / sizeof((x)[0]))
42 #define	rounddown(x,y)	(((x)/(y))*(y))
43 #define	rounddown2(x, y) ((x)&(~((y)-1)))   /* if y is power of two */
44 #define	roundup(x, y)	((((x)+((y)-1))/(y))*(y))  /* to any y */
45 #define	roundup2(x,y)	(((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
46 #define	powerof2(x)	((((x)-1)&(x))==0)
47 
48 /* Macros for min/max. */
49 #define	MIN(a,b) (((a)<(b))?(a):(b))
50 #define	MAX(a,b) (((a)>(b))?(a):(b))
51 
52 #define	trunc_page(x)	((unsigned long)(x) & ~(PAGE_MASK))
53 #define	ptoa(x)		((unsigned long)(x) << PAGE_SHIFT)
54 
55 #include_next <sys/param.h>
56 
57 #endif	/* _COMPAT_FREEBSD_SYS_PARAM_H_ */
58