diff options
Diffstat (limited to 'regress/sys/net')
-rw-r--r-- | regress/sys/net/rtable/delete/main.c | 4 | ||||
-rw-r--r-- | regress/sys/net/rtable/srp_compat.h | 34 |
2 files changed, 30 insertions, 8 deletions
diff --git a/regress/sys/net/rtable/delete/main.c b/regress/sys/net/rtable/delete/main.c index b0dfb7b46bd..7e17a9b9350 100644 --- a/regress/sys/net/rtable/delete/main.c +++ b/regress/sys/net/rtable/delete/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.3 2015/12/03 15:15:04 mpi Exp $ */ +/* $OpenBSD: main.c,v 1.4 2016/07/19 10:52:56 mpi Exp $ */ /* * Copyright (c) 2015 Martin Pieuchot @@ -68,7 +68,7 @@ main(int argc, char *argv[]) struct art_root *ar; ar = rtable_get(0, AF_INET6); assert(ar != NULL); - assert(ar->ar_root == NULL); + assert(ar->ar_root.ref == NULL); #endif /* ART */ return (0); diff --git a/regress/sys/net/rtable/srp_compat.h b/regress/sys/net/rtable/srp_compat.h index 458575ca0ba..27cf38bdcfd 100644 --- a/regress/sys/net/rtable/srp_compat.h +++ b/regress/sys/net/rtable/srp_compat.h @@ -6,23 +6,42 @@ #include <sys/queue.h> /* - * SRPL glue. + * SRP glue. */ -#define srp_get_locked(_s) ((_s)->ref) -#define srp_enter(_sr, _s) srp_get_locked(_s) -#define srp_leave(_sr) ((void)_sr) +#define srp_enter(_sr, _s) ((_s)->ref) +#define srp_follow(_sr, _s) ((_s)->ref) +#define srp_leave(_sr) do { } while (0) +#define srp_swap(_srp, _v) srp_swap_locked((_srp), (_v)) +#define srp_update(_gc, _srp, _v) srp_update_locked((_gc), (_srp), (_v)) +#define srp_finalize(_v, _wchan) ((void)0) + +#define srp_get_locked(_s) ((_s)->ref) + +static inline void * +srp_swap_locked(struct srp *srp, void *nv) +{ + void *ov; + + ov = srp->ref; + srp->ref = nv; + + return (ov); +} #define srp_update_locked(_gc, _s, _v) do { \ void *ov; \ \ - ov = (_s)->ref; \ - (_s)->ref = _v; \ + ov = srp_swap_locked(_s, _v); \ \ if (ov != NULL) \ ((_gc)->srp_gc_dtor)((_gc)->srp_gc_cookie, ov); \ } while (0) +/* + * SRPL glue. + */ + #define SRPL_INIT(_sl) SLIST_INIT(_sl) #define SRPL_HEAD(name, entry) SLIST_HEAD(name, entry) #define SRPL_ENTRY(type) SLIST_ENTRY(type) @@ -31,6 +50,9 @@ #define SRPL_NEXT(_sr, _e, _ENTRY) SLIST_NEXT(_e, _ENTRY) #define SRPL_LEAVE(_sr) ((void)_sr) +#define SRPL_FOREACH(_c, _srp, _sl, _ENTRY) \ + SLIST_FOREACH(_c, _sl, _ENTRY) + #define SRPL_EMPTY_LOCKED(_sl) SLIST_EMPTY(_sl) #define SRPL_FOREACH_SAFE_LOCKED(_c, _sl, _ENTRY, _tc) \ SLIST_FOREACH_SAFE(_c, _sl, _ENTRY, _tc) |