svn commit: r336674 - in head: share/man/man9 sys/net

Andrew Turner andrew at FreeBSD.org
Tue Jul 24 16:31:18 UTC 2018


Author: andrew
Date: Tue Jul 24 16:31:16 2018
New Revision: 336674
URL: https://svnweb.freebsd.org/changeset/base/336674

Log:
  As with DPCPU create VNET_DEFINE_STATIC for when a variable needs to be
  declaired static. This will allow us to change the definition on arm64
  as it has the same issues described in r336349.
  
  Reviewed by:	bz
  Sponsored by:	DARPA, AFRL
  Differential Revision:	https://reviews.freebsd.org/D16147

Modified:
  head/share/man/man9/vnet.9
  head/sys/net/vnet.h

Modified: head/share/man/man9/vnet.9
==============================================================================
--- head/share/man/man9/vnet.9	Tue Jul 24 15:42:23 2018	(r336673)
+++ head/share/man/man9/vnet.9	Tue Jul 24 16:31:16 2018	(r336674)
@@ -66,6 +66,10 @@
 .Fa "type" "name"
 .Fc
 .\"
+.Fo VNET_DEFINE_STATIC
+.Fa "type" "name"
+.Fc
+.\"
 .Bd -literal
 #define	V_name	VNET(name)
 .Ed
@@ -208,11 +212,15 @@ Variables are virtualized by using the
 .Fn VNET_DEFINE
 macro rather than writing them out as
 .Em type name .
-One can still use static initialization or storage class specifiers, e.g.,
+One can still use static initialization, e.g.,
 .Pp
-.Dl Li static VNET_DEFINE(int, foo) = 1;
-or
-.Dl Li static VNET_DEFINE(SLIST_HEAD(, bar), bars);
+.Dl Li VNET_DEFINE(int, foo) = 1;
+.Pp
+Variables declared with the static keyword can use the
+.Fn VNET_DEFINE_STATIC
+macro, e.g.,
+.Pp
+.Dl Li VNET_DEFINE_STATIC(SLIST_HEAD(, bar), bars);
 .Pp
 Static initialization is not possible when the virtualized variable
 would need to be referenced, e.g., with

Modified: head/sys/net/vnet.h
==============================================================================
--- head/sys/net/vnet.h	Tue Jul 24 15:42:23 2018	(r336673)
+++ head/sys/net/vnet.h	Tue Jul 24 16:31:16 2018	(r336674)
@@ -93,6 +93,8 @@ struct vnet {
 
 #define	VNET_PCPUSTAT_DEFINE(type, name)	\
     VNET_DEFINE(counter_u64_t, name[sizeof(type) / sizeof(uint64_t)])
+#define	VNET_PCPUSTAT_DEFINE_STATIC(type, name)	\
+    VNET_DEFINE_STATIC(counter_u64_t, name[sizeof(type) / sizeof(uint64_t)])
 
 #define	VNET_PCPUSTAT_ALLOC(name, wait)	\
     COUNTER_ARRAY_ALLOC(VNET(name), \
@@ -268,7 +270,10 @@ extern struct sx vnet_sxlock;
  */
 #define	VNET_NAME(n)		vnet_entry_##n
 #define	VNET_DECLARE(t, n)	extern t VNET_NAME(n)
-#define	VNET_DEFINE(t, n)	t VNET_NAME(n) __section(VNET_SETNAME) __used
+#define	VNET_DEFINE(t, n)	\
+    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))*)		\
 				    ((b) + (uintptr_t)&VNET_NAME(n))
 
@@ -400,7 +405,8 @@ do {									\
  */
 #define	VNET_NAME(n)		n
 #define	VNET_DECLARE(t, n)	extern t n
-#define	VNET_DEFINE(t, n)	t n
+#define	VNET_DEFINE(t, n)	struct _hack; t n
+#define	VNET_DEFINE_STATIC(t, n)	static t n
 #define	_VNET_PTR(b, n)		&VNET_NAME(n)
 
 /*


More information about the svn-src-all mailing list