summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2021-11-29 05:17:36 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2021-11-29 05:17:36 +0000
commit1d10bcf1b200483de0412e5705bdf212e2ac86c0 (patch)
tree6383f35321cbfcfd36b864c5cc1e46d4f9ec2348
parent7f4778788c43f6e30f4b1ade04890a01ff00b8bc (diff)
mostly avoid sys/param.h with a local nitems()
ok mlarkin
-rw-r--r--usr.sbin/vmd/control.c4
-rw-r--r--usr.sbin/vmd/priv.c4
-rw-r--r--usr.sbin/vmd/vm.c4
-rw-r--r--usr.sbin/vmd/vmd.c6
-rw-r--r--usr.sbin/vmd/vmd.h5
-rw-r--r--usr.sbin/vmd/vmm.c5
6 files changed, 14 insertions, 14 deletions
diff --git a/usr.sbin/vmd/control.c b/usr.sbin/vmd/control.c
index 7a1f453be4e..d9043d0ccf5 100644
--- a/usr.sbin/vmd/control.c
+++ b/usr.sbin/vmd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.37 2021/06/16 16:55:02 dv Exp $ */
+/* $OpenBSD: control.c,v 1.38 2021/11/29 05:17:35 deraadt Exp $ */
/*
* Copyright (c) 2010-2015 Reyk Floeter <reyk@openbsd.org>
@@ -17,7 +17,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h> /* nitems */
+#include <sys/types.h>
#include <sys/queue.h>
#include <sys/stat.h>
#include <sys/socket.h>
diff --git a/usr.sbin/vmd/priv.c b/usr.sbin/vmd/priv.c
index 94002d43b41..2074de3b05f 100644
--- a/usr.sbin/vmd/priv.c
+++ b/usr.sbin/vmd/priv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: priv.c,v 1.18 2021/11/10 20:49:04 sthen Exp $ */
+/* $OpenBSD: priv.c,v 1.19 2021/11/29 05:17:35 deraadt Exp $ */
/*
* Copyright (c) 2016 Reyk Floeter <reyk@openbsd.org>
@@ -16,7 +16,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h> /* nitems */
+#include <sys/types.h>
#include <sys/queue.h>
#include <sys/stat.h>
#include <sys/socket.h>
diff --git a/usr.sbin/vmd/vm.c b/usr.sbin/vmd/vm.c
index 6323ecc3465..b59e960454c 100644
--- a/usr.sbin/vmd/vm.c
+++ b/usr.sbin/vmd/vm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm.c,v 1.65 2021/09/01 11:08:21 dv Exp $ */
+/* $OpenBSD: vm.c,v 1.66 2021/11/29 05:17:35 deraadt Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -16,6 +16,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/param.h> /* PAGE_SIZE */
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/queue.h>
@@ -30,7 +31,6 @@
#include <dev/isa/isareg.h>
#include <dev/pci/pcireg.h>
-#include <machine/param.h>
#include <machine/psl.h>
#include <machine/pte.h>
#include <machine/specialreg.h>
diff --git a/usr.sbin/vmd/vmd.c b/usr.sbin/vmd/vmd.c
index 423a6991228..f2c419f12d2 100644
--- a/usr.sbin/vmd/vmd.c
+++ b/usr.sbin/vmd/vmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmd.c,v 1.126 2021/07/18 11:55:45 dv Exp $ */
+/* $OpenBSD: vmd.c,v 1.127 2021/11/29 05:17:35 deraadt Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -16,7 +16,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h> /* nitems */
+#include <sys/types.h>
#include <sys/queue.h>
#include <sys/wait.h>
#include <sys/cdefs.h>
@@ -966,7 +966,7 @@ vmd_configure(void)
if (!(env->vmd_cfg.cfg_flags & VMD_CFG_STAGGERED_START)) {
env->vmd_cfg.delay.tv_sec = VMD_DEFAULT_STAGGERED_START_DELAY;
- if (sysctl(ncpu_mib, NELEM(ncpu_mib), &ncpus, &ncpus_sz, NULL, 0) == -1)
+ if (sysctl(ncpu_mib, nitems(ncpu_mib), &ncpus, &ncpus_sz, NULL, 0) == -1)
ncpus = 1;
env->vmd_cfg.parallelism = ncpus;
log_debug("%s: setting staggered start configuration to "
diff --git a/usr.sbin/vmd/vmd.h b/usr.sbin/vmd/vmd.h
index 824c48a4fc0..0f66bdb53bc 100644
--- a/usr.sbin/vmd/vmd.h
+++ b/usr.sbin/vmd/vmd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmd.h,v 1.106 2021/09/01 11:08:21 dv Exp $ */
+/* $OpenBSD: vmd.h,v 1.107 2021/11/29 05:17:35 deraadt Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -39,7 +39,8 @@
#define SET(_v, _m) ((_v) |= (_m))
#define CLR(_v, _m) ((_v) &= ~(_m))
#define ISSET(_v, _m) ((_v) & (_m))
-#define NELEM(a) (sizeof(a) / sizeof((a)[0]))
+
+#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
#define VMD_USER "_vmd"
#define VMD_CONF "/etc/vm.conf"
diff --git a/usr.sbin/vmd/vmm.c b/usr.sbin/vmd/vmm.c
index 65cac6e18fb..6a2d55db527 100644
--- a/usr.sbin/vmd/vmm.c
+++ b/usr.sbin/vmd/vmm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmm.c,v 1.101 2021/04/26 22:58:27 dv Exp $ */
+/* $OpenBSD: vmm.c,v 1.102 2021/11/29 05:17:35 deraadt Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -16,7 +16,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h> /* nitems */
+#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/queue.h>
#include <sys/wait.h>
@@ -29,7 +29,6 @@
#include <dev/isa/isareg.h>
#include <dev/pci/pcireg.h>
-#include <machine/param.h>
#include <machine/psl.h>
#include <machine/specialreg.h>
#include <machine/vmmvar.h>