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