Add macros to define static instances of VNET_DEFINE and DPCPU_DEFINE.

This commit is contained in:
Dimitry Andric 2010-11-14 20:23:02 +00:00
parent 5f67450d3a
commit 47d46d92c2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=215316
2 changed files with 11 additions and 6 deletions

View File

@ -196,8 +196,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_PTR(b, n) (__typeof(VNET_NAME(n))*) \
((b) + (uintptr_t)&VNET_NAME(n))
#define STATIC_VNET_DEFINE(t, n) \
VNET_DEFINE(static t, n)
#define _VNET_PTR(b, n) \
(__typeof(VNET_NAME(n))*)((b) + (uintptr_t)&VNET_NAME(n))
#define _VNET(b, n) (*_VNET_PTR(b, n))
@ -374,6 +376,7 @@ do { \
#define VNET_NAME(n) n
#define VNET_DECLARE(t, n) extern t n
#define VNET_DEFINE(t, n) t n
#define STATIC_VNET_DEFINE(t, n) static t n
#define _VNET_PTR(b, n) &VNET_NAME(n)
/*

View File

@ -76,6 +76,8 @@ extern uintptr_t dpcpu_off[];
#define DPCPU_NAME(n) pcpu_entry_##n
#define DPCPU_DECLARE(t, n) extern t DPCPU_NAME(n)
#define DPCPU_DEFINE(t, n) t DPCPU_NAME(n) __section(DPCPU_SETNAME) __used
#define STATIC_DPCPU_DEFINE(t, n) \
DPCPU_DEFINE(static t, n)
/*
* Accessors with a given base.