summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2011-02-11 14:17:58 +0000
committerbz <bz@FreeBSD.org>2011-02-11 14:17:58 +0000
commit1289b7e264c2b134bc69706013963774e3040774 (patch)
tree41ceeb17039f640700ead0b42496210cd2ce3cd8 /sys/net
parentcdb2fb57b761af40b142545a9354a31de3363331 (diff)
downloadFreeBSD-src-1289b7e264c2b134bc69706013963774e3040774.zip
FreeBSD-src-1289b7e264c2b134bc69706013963774e3040774.tar.gz
Mfp4 CH=177255:
Resort the CURVNET_SET* macros in the non-VNET_DEBUG case to match the call order of the VNET_DEBUG case. Add the VNET_ASSERT() to the non-VNET_DEBUG case as well so that INVARIANTS will still catch problems. Sponsored by: The FreeBSD Foundation Sponsored by: CK Software GmbH Reviewed by: jhb MFC after: 2 weeks
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/vnet.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/net/vnet.h b/sys/net/vnet.h
index 74bffb3..6bdf163 100644
--- a/sys/net/vnet.h
+++ b/sys/net/vnet.h
@@ -156,14 +156,23 @@ void vnet_log_recursion(struct vnet *, const char *, int);
curthread->td_vnet_lpush = saved_vnet_lpush;
#else /* !VNET_DEBUG */
-#define CURVNET_SET(arg) \
+#define CURVNET_SET_QUIET(arg) \
+ VNET_ASSERT((arg) != NULL && (arg)->vnet_magic_n == VNET_MAGIC_N, \
+ ("CURVNET_SET at %s:%d %s() curvnet=%p vnet=%p", \
+ __FILE__, __LINE__, __func__, curvnet, (arg))); \
struct vnet *saved_vnet = curvnet; \
curvnet = arg;
-#define CURVNET_SET_VERBOSE(arg) CURVNET_SET(arg)
-#define CURVNET_SET_QUIET(arg) CURVNET_SET(arg)
+#define CURVNET_SET_VERBOSE(arg) \
+ CURVNET_SET_QUIET(arg)
+
+#define CURVNET_SET(arg) CURVNET_SET_VERBOSE(arg)
#define CURVNET_RESTORE() \
+ VNET_ASSERT(curvnet != NULL && (saved_vnet == NULL || \
+ saved_vnet->vnet_magic_n == VNET_MAGIC_N), \
+ ("CURVNET_RESTORE at %s:%d %s() curvnet=%p saved_vnet=%p", \
+ __FILE__, __LINE__, __func__, curvnet, saved_vnet)); \
curvnet = saved_vnet;
#endif /* VNET_DEBUG */
OpenPOWER on IntegriCloud