svn commit: r336902 - head/sys/net

Andrew Turner andrew at FreeBSD.org
Mon Jul 30 12:44:45 UTC 2018


Author: andrew
Date: Mon Jul 30 12:44:44 2018
New Revision: 336902
URL: https://svnweb.freebsd.org/changeset/base/336902

Log:
  As with DPCPU_DEFINE make it a compile error to use static with VNET_DEFINE.
  There is the VNET_DEFINE_STATIC macro for that.

Modified:
  head/sys/net/vnet.h

Modified: head/sys/net/vnet.h
==============================================================================
--- head/sys/net/vnet.h	Mon Jul 30 12:38:08 2018	(r336901)
+++ head/sys/net/vnet.h	Mon Jul 30 12:44:44 2018	(r336902)
@@ -270,8 +270,9 @@ extern struct sx vnet_sxlock;
  */
 #define	VNET_NAME(n)		vnet_entry_##n
 #define	VNET_DECLARE(t, n)	extern t VNET_NAME(n)
+/* struct _hack is to stop this from being used with static data */
 #define	VNET_DEFINE(t, n)	\
-    t VNET_NAME(n) __section(VNET_SETNAME) __used
+    struct _hack; t VNET_NAME(n) __section(VNET_SETNAME) __used
 #define	VNET_DEFINE_STATIC(t, n) \
     static t VNET_NAME(n) __section(VNET_SETNAME) __used
 #define	_VNET_PTR(b, n)		(__typeof(VNET_NAME(n))*)		\


More information about the svn-src-all mailing list