From a98d2d9e7dd554a5d9eb9cd2616a4d629c2d7baf Mon Sep 17 00:00:00 2001 From: dlg Date: Sun, 17 Aug 2014 09:48:55 +0000 Subject: [PATCH] i broke the userland shim used for the extent regress test when i made it so struct pool was only visible to _KERNEL. tedu broke it too when he added the size argument to the kernel free functions. this fixes both issues. the main change is to provide a local version of struct pool with just the bit (pr_size) needed for extent to run. if extents take advantage of more malloc/pool features (eg, {M,PR}_ZERO then this will need to be updated again. found by and based on a diff from Theo Buehler ok mpi@ --- sys/kern/subr_extent.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/sys/kern/subr_extent.c b/sys/kern/subr_extent.c index 52e130e891f..3ff5210e6c3 100644 --- a/sys/kern/subr_extent.c +++ b/sys/kern/subr_extent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_extent.c,v 1.51 2014/07/12 18:43:32 tedu Exp $ */ +/* $OpenBSD: subr_extent.c,v 1.52 2014/08/17 09:48:55 dlg Exp $ */ /* $NetBSD: subr_extent.c,v 1.7 1996/11/21 18:46:34 cgd Exp $ */ /*- @@ -49,23 +49,30 @@ * user-land definitions, so it can fit into a testing harness. */ #include -#include #include #include #include +#include #include #include #include #define malloc(s, t, flags) malloc(s) -#define free(p, t) free(p) +#define free(p, t, s) free(p) + #define tsleep(chan, pri, str, timo) (EWOULDBLOCK) #define wakeup(chan) ((void)0) -#define pool_get(pool, flags) malloc((pool)->pr_size, 0, 0) -#define pool_init(a, b, c, d, e, f, g) (a)->pr_size = (b) -#define pool_setipl(pool, ipl) /* nothing */ -#define pool_put(pool, rp) free((rp), 0) -#define panic printf + +struct pool { + size_t pr_size; +}; + +#define pool_init(a, b, c, d, e, f, g) do { (a)->pr_size = (b); } while (0) +#define pool_setipl(pp, ipl) /* nothing */ +#define pool_get(pp, flags) malloc((pp)->pr_size, 0, 0) +#define pool_put(pp, rp) free((rp), 0, 0) + +#define panic(...) do { warnx(__VA_ARGS__); abort(); } while (0) #endif #if defined(DIAGNOSTIC) || defined(DDB) -- 2.20.1