summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2011-12-02 10:55:46 +0000
committerdlg <dlg@openbsd.org>2011-12-02 10:55:46 +0000
commit698d44cc7840c7dd7b1bc86f3d9a655015a498da (patch)
tree9157acca26d201cd70846e9ff4c2299a6320662b
parentreuse midi-control code to implement midi thru boxes and remove (diff)
downloadwireguard-openbsd-698d44cc7840c7dd7b1bc86f3d9a655015a498da.tar.xz
wireguard-openbsd-698d44cc7840c7dd7b1bc86f3d9a655015a498da.zip
dont put MAXMCLBYTES in the mclsizes array with a comment saying its 64k
when the macro can change without automatically fixing the comment. instead add a diagnostic that checks that the biggest cluster size is always MAXMCLBYTES. requested by and ok kettenis@
-rw-r--r--sys/kern/uipc_mbuf.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 07c70db8c63..4644de7674e 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_mbuf.c,v 1.164 2011/11/30 10:26:56 dlg Exp $ */
+/* $OpenBSD: uipc_mbuf.c,v 1.165 2011/12/02 10:55:46 dlg Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */
/*
@@ -108,7 +108,7 @@ u_int mclsizes[] = {
9 * 1024,
12 * 1024,
16 * 1024,
- MAXMCLBYTES /* 64k */
+ 64 * 1024
};
static char mclnames[MCLPOOLS][8];
struct pool mclpools[MCLPOOLS];
@@ -140,6 +140,11 @@ mbinit(void)
{
int i;
+#if DIAGNOSTIC
+ if (mclsizes[nitems(mclsizes) - 1] != MAXMCLBYTES)
+ panic("mbinit: the largest cluster size != MAXMCLBYTES");
+#endif
+
pool_init(&mbpool, MSIZE, 0, 0, 0, "mbpl", NULL);
pool_set_constraints(&mbpool, &kp_dma_contig);
pool_setlowat(&mbpool, mblowat);