From 24fb43d058b21ea44975b9d9797e579d7b2b4461 Mon Sep 17 00:00:00 2001 From: deraadt Date: Mon, 29 Nov 2021 05:17:35 +0000 Subject: [PATCH] mostly avoid sys/param.h with a local nitems() ok mlarkin --- usr.sbin/vmd/control.c | 4 ++-- usr.sbin/vmd/priv.c | 4 ++-- usr.sbin/vmd/vm.c | 4 ++-- usr.sbin/vmd/vmd.c | 6 +++--- usr.sbin/vmd/vmd.h | 5 +++-- usr.sbin/vmd/vmm.c | 5 ++--- 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 @@ -17,7 +17,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include /* nitems */ +#include #include #include #include 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 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include /* nitems */ +#include #include #include #include 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 @@ -16,6 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include /* PAGE_SIZE */ #include #include #include @@ -30,7 +31,6 @@ #include #include -#include #include #include #include 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 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include /* nitems */ +#include #include #include #include @@ -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 @@ -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 @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include /* nitems */ +#include #include #include #include @@ -29,7 +29,6 @@ #include #include -#include #include #include #include -- 2.20.1