summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regress/sys/net/rtable/kern_compat.h16
-rw-r--r--regress/sys/net/rtable/srp_compat.h33
2 files changed, 33 insertions, 16 deletions
diff --git a/regress/sys/net/rtable/kern_compat.h b/regress/sys/net/rtable/kern_compat.h
index 5642702412f..fd2e7f4ead0 100644
--- a/regress/sys/net/rtable/kern_compat.h
+++ b/regress/sys/net/rtable/kern_compat.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_compat.h,v 1.3 2015/12/04 12:30:57 mpi Exp $ */
+/* $OpenBSD: kern_compat.h,v 1.4 2016/06/07 07:57:59 mpi Exp $ */
#ifndef _KERN_COMPAT_H_
#define _KERN_COMPAT_H_
@@ -6,6 +6,8 @@
#include <sys/socket.h>
#include <sys/domain.h>
#include <sys/queue.h>
+#include <sys/mutex.h>
+#include <sys/task.h>
#include <arpa/inet.h>
#include <assert.h>
@@ -38,6 +40,7 @@ struct pool {
};
#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)
@@ -50,9 +53,16 @@ struct pool {
#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
#endif
-#define rtref(_rt) ((_rt)->rt_refcnt++)
-#define rtfree(_rt) (assert(--(_rt)->rt_refcnt >= 0))
+#define rtref(_rt) ((_rt)->rt_refcnt++)
+#define rtfree(_rt) (assert(--(_rt)->rt_refcnt >= 0))
+
+#define mtx_enter(_mtx) /* nothing */
+#define mtx_leave(_mtx) /* nothing */
+
+#define task_add(_tq, _t) ((_t)->t_func((_t)->t_arg))
extern struct domain *domains[];
+#define IPL_SOFTNET 0
+
#endif /* _KERN_COMPAT_H_ */
diff --git a/regress/sys/net/rtable/srp_compat.h b/regress/sys/net/rtable/srp_compat.h
index d944aebad78..458575ca0ba 100644
--- a/regress/sys/net/rtable/srp_compat.h
+++ b/regress/sys/net/rtable/srp_compat.h
@@ -8,36 +8,43 @@
/*
* SRPL glue.
*/
-#define REFCNT_INITIALIZER() { .refs = 1 }
-#define SRP_GC_INITIALIZER(_d, _c) { (_d), (_c), REFCNT_INITIALIZER() }
-#define SRPL_RC_INITIALIZER(_r, _u, _c) { _r, SRP_GC_INITIALIZER(_u, _c) }
#define srp_get_locked(_s) ((_s)->ref)
-#define srp_enter(_s) srp_get_locked(_s)
-#define srp_leave(_s, _v) /* nothing */
+#define srp_enter(_sr, _s) srp_get_locked(_s)
+#define srp_leave(_sr) ((void)_sr)
#define srp_update_locked(_gc, _s, _v) do { \
void *ov; \
\
ov = (_s)->ref; \
- (_s)->ref = (_v); \
+ (_s)->ref = _v; \
+ \
if (ov != NULL) \
- (*(_gc)->srp_gc_dtor)((_gc)->srp_gc_cookie, ov); \
+ ((_gc)->srp_gc_dtor)((_gc)->srp_gc_cookie, ov); \
} while (0)
#define SRPL_INIT(_sl) SLIST_INIT(_sl)
#define SRPL_HEAD(name, entry) SLIST_HEAD(name, entry)
#define SRPL_ENTRY(type) SLIST_ENTRY(type)
-#define SRPL_ENTER(_sl, _si) SLIST_FIRST(_sl);(void)_si
-#define SRPL_NEXT(_si, _e, _ENTRY) SLIST_NEXT(_e, _ENTRY)
-#define SRPL_LEAVE(_si, _c) /* nothing */
+#define SRPL_ENTER(_sr, _sl) SLIST_FIRST(_sl);
+#define SRPL_NEXT(_sr, _e, _ENTRY) SLIST_NEXT(_e, _ENTRY)
+#define SRPL_LEAVE(_sr) ((void)_sr)
+#define SRPL_EMPTY_LOCKED(_sl) SLIST_EMPTY(_sl)
#define SRPL_FOREACH_SAFE_LOCKED(_c, _sl, _ENTRY, _tc) \
SLIST_FOREACH_SAFE(_c, _sl, _ENTRY, _tc)
-#define SRPL_REMOVE_LOCKED(_rc, _sl, _e, _type, _ENTRY) \
- SLIST_REMOVE(_sl, _e, _type, _ENTRY)
+
#define SRPL_INSERT_HEAD_LOCKED(_rc, _sl, _e, _ENTRY) \
- SLIST_INSERT_HEAD(_sl, _e, _ENTRY)
+ do { \
+ (_rc)->srpl_ref((_rc)->srpl_cookie, _e); \
+ SLIST_INSERT_HEAD(_sl, _e, _ENTRY); \
+ } while (0)
+
+#define SRPL_REMOVE_LOCKED(_rc, _sl, _e, _type, _ENTRY) \
+ do { \
+ SLIST_REMOVE(_sl, _e, _type, _ENTRY); \
+ ((_rc)->srpl_gc.srp_gc_dtor)((_rc)->srpl_gc.srp_gc_cookie, _e);\
+ } while (0)
#endif /* _SRP_COMPAT_H_ */