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
This commit is contained in:
parent
399973c33d
commit
fceba23f93
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336674
@ -66,6 +66,10 @@
|
|||||||
.Fa "type" "name"
|
.Fa "type" "name"
|
||||||
.Fc
|
.Fc
|
||||||
.\"
|
.\"
|
||||||
|
.Fo VNET_DEFINE_STATIC
|
||||||
|
.Fa "type" "name"
|
||||||
|
.Fc
|
||||||
|
.\"
|
||||||
.Bd -literal
|
.Bd -literal
|
||||||
#define V_name VNET(name)
|
#define V_name VNET(name)
|
||||||
.Ed
|
.Ed
|
||||||
@ -208,11 +212,15 @@ Variables are virtualized by using the
|
|||||||
.Fn VNET_DEFINE
|
.Fn VNET_DEFINE
|
||||||
macro rather than writing them out as
|
macro rather than writing them out as
|
||||||
.Em type name .
|
.Em type name .
|
||||||
One can still use static initialization or storage class specifiers, e.g.,
|
One can still use static initialization, e.g.,
|
||||||
.Pp
|
.Pp
|
||||||
.Dl Li static VNET_DEFINE(int, foo) = 1;
|
.Dl Li VNET_DEFINE(int, foo) = 1;
|
||||||
or
|
.Pp
|
||||||
.Dl Li static VNET_DEFINE(SLIST_HEAD(, bar), bars);
|
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
|
.Pp
|
||||||
Static initialization is not possible when the virtualized variable
|
Static initialization is not possible when the virtualized variable
|
||||||
would need to be referenced, e.g., with
|
would need to be referenced, e.g., with
|
||||||
|
@ -93,6 +93,8 @@ struct vnet {
|
|||||||
|
|
||||||
#define VNET_PCPUSTAT_DEFINE(type, name) \
|
#define VNET_PCPUSTAT_DEFINE(type, name) \
|
||||||
VNET_DEFINE(counter_u64_t, name[sizeof(type) / sizeof(uint64_t)])
|
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) \
|
#define VNET_PCPUSTAT_ALLOC(name, wait) \
|
||||||
COUNTER_ARRAY_ALLOC(VNET(name), \
|
COUNTER_ARRAY_ALLOC(VNET(name), \
|
||||||
@ -268,7 +270,10 @@ extern struct sx vnet_sxlock;
|
|||||||
*/
|
*/
|
||||||
#define VNET_NAME(n) vnet_entry_##n
|
#define VNET_NAME(n) vnet_entry_##n
|
||||||
#define VNET_DECLARE(t, n) extern t VNET_NAME(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))*) \
|
#define _VNET_PTR(b, n) (__typeof(VNET_NAME(n))*) \
|
||||||
((b) + (uintptr_t)&VNET_NAME(n))
|
((b) + (uintptr_t)&VNET_NAME(n))
|
||||||
|
|
||||||
@ -400,7 +405,8 @@ do { \
|
|||||||
*/
|
*/
|
||||||
#define VNET_NAME(n) n
|
#define VNET_NAME(n) n
|
||||||
#define VNET_DECLARE(t, n) extern t 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)
|
#define _VNET_PTR(b, n) &VNET_NAME(n)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user