summaryrefslogtreecommitdiffstats
path: root/sys/net/radix.h
diff options
context:
space:
mode:
authorhsu <hsu@FreeBSD.org>2003-02-08 01:44:09 +0000
committerhsu <hsu@FreeBSD.org>2003-02-08 01:44:09 +0000
commit7d8a20cfb408ed95a173c94b409ea9234af1ee1f (patch)
tree1c1d94baa562b374c44daa82b76e62b51604f0ff /sys/net/radix.h
parentd16e9e6edf003ccccf92dd21ef781d051906cad7 (diff)
downloadFreeBSD-src-7d8a20cfb408ed95a173c94b409ea9234af1ee1f.zip
FreeBSD-src-7d8a20cfb408ed95a173c94b409ea9234af1ee1f.tar.gz
Make the radix tree code compilable in userland. Requested by ru.
Some style fixes requested by bde.
Diffstat (limited to 'sys/net/radix.h')
-rw-r--r--sys/net/radix.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/sys/net/radix.h b/sys/net/radix.h
index 0f4b20c..81a3766 100644
--- a/sys/net/radix.h
+++ b/sys/net/radix.h
@@ -37,8 +37,10 @@
#ifndef _RADIX_H_
#define _RADIX_H_
-#include <sys/lock.h>
-#include <sys/mutex.h>
+#ifdef _KERNEL
+#include <sys/_lock.h>
+#include <sys/_mutex.h>
+#endif
#ifdef MALLOC_DECLARE
MALLOC_DECLARE(M_RTABLE);
@@ -141,7 +143,9 @@ struct radix_node_head {
void (*rnh_close) /* do something when the last ref drops */
(struct radix_node *rn, struct radix_node_head *head);
struct radix_node rnh_nodes[3]; /* empty tree for common case */
- struct mtx rnh_mtx;
+#ifdef _KERNEL
+ struct mtx rnh_mtx; /* locks entire radix tree */
+#endif
};
#ifndef _KERNEL
@@ -157,12 +161,11 @@ struct radix_node_head {
#define R_Malloc(p, t, n) (p = (t) malloc((unsigned long)(n), M_RTABLE, M_NOWAIT))
#define Free(p) free((caddr_t)p, M_RTABLE);
-
-#define RADIX_NODE_HEAD_LOCK_INIT(rnh) \
+#define RADIX_NODE_HEAD_LOCK_INIT(rnh) \
mtx_init(&(rnh)->rnh_mtx, "radix node head", NULL, MTX_DEF | MTX_RECURSE)
-#define RADIX_NODE_HEAD_LOCK(rnh) mtx_lock(&(rnh)->rnh_mtx)
-#define RADIX_NODE_HEAD_UNLOCK(rnh) mtx_unlock(&(rnh)->rnh_mtx)
-#define RADIX_NODE_HEAD_DESTROY(rnh) mtx_destroy(&(rnh)->rnh_mtx)
+#define RADIX_NODE_HEAD_LOCK(rnh) mtx_lock(&(rnh)->rnh_mtx)
+#define RADIX_NODE_HEAD_UNLOCK(rnh) mtx_unlock(&(rnh)->rnh_mtx)
+#define RADIX_NODE_HEAD_DESTROY(rnh) mtx_destroy(&(rnh)->rnh_mtx)
#define RADIX_NODE_HEAD_LOCK_ASSERT(rnh) mtx_assert(&(rnh)->rnh_mtx, MA_OWNED)
#endif /* _KERNEL */
@@ -178,5 +181,4 @@ struct radix_node
struct radix_node_head *head),
*rn_match(void *, struct radix_node_head *);
-
#endif /* _RADIX_H_ */
OpenPOWER on IntegriCloud