Page MenuHomeFreeBSD

D16147.id.diff
No OneTemporary

D16147.id.diff

Index: head/share/man/man9/vnet.9
===================================================================
--- head/share/man/man9/vnet.9
+++ head/share/man/man9/vnet.9
@@ -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 @@
.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
Index: head/sys/net/vnet.h
===================================================================
--- head/sys/net/vnet.h
+++ head/sys/net/vnet.h
@@ -93,6 +93,8 @@
#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 @@
*/
#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 @@
*/
#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)
/*

File Metadata

Mime Type
text/plain
Expires
Wed, May 20, 3:46 AM (2 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33336593
Default Alt Text
D16147.id.diff (2 KB)

Event Timeline