Date: Sun, 14 Nov 2010 20:23:02 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r215316 - in head/sys: net sys Message-ID: <201011142023.oAEKN2qB092721@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Sun Nov 14 20:23:02 2010 New Revision: 215316 URL: http://svn.freebsd.org/changeset/base/215316 Log: Add macros to define static instances of VNET_DEFINE and DPCPU_DEFINE. Modified: head/sys/net/vnet.h head/sys/sys/pcpu.h Modified: head/sys/net/vnet.h ============================================================================== --- head/sys/net/vnet.h Sun Nov 14 20:14:25 2010 (r215315) +++ head/sys/net/vnet.h Sun Nov 14 20:23:02 2010 (r215316) @@ -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)) @@ -371,10 +373,11 @@ do { \ * Versions of the VNET macros that compile to normal global variables and * standard sysctl definitions. */ -#define VNET_NAME(n) n -#define VNET_DECLARE(t, n) extern t n -#define VNET_DEFINE(t, n) t n -#define _VNET_PTR(b, n) &VNET_NAME(n) +#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) /* * Virtualized global variable accessor macros. Modified: head/sys/sys/pcpu.h ============================================================================== --- head/sys/sys/pcpu.h Sun Nov 14 20:14:25 2010 (r215315) +++ head/sys/sys/pcpu.h Sun Nov 14 20:23:02 2010 (r215316) @@ -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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011142023.oAEKN2qB092721>