Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jul 2018 12:44:44 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r336902 - head/sys/net
Message-ID:  <201807301244.w6UCiiSn027483@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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))*)		\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807301244.w6UCiiSn027483>