Deleted Added
full compact
vnet.h (195705) vnet.h (195727)
1/*-
2 * Copyright (c) 2009 Jeffrey Roberson <jeff@freebsd.org>
3 * Copyright (c) 2009 Robert N. M. Watson
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
1/*-
2 * Copyright (c) 2009 Jeffrey Roberson <jeff@freebsd.org>
3 * Copyright (c) 2009 Robert N. M. Watson
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/sys/net/vnet.h 195705 2009-07-15 00:56:15Z rwatson $
27 * $FreeBSD: head/sys/net/vnet.h 195727 2009-07-16 21:13:04Z rwatson $
28 */
29
30/*
31 * This is the virtual network stack memory allocator, which provides support
32 * for virtualized global variables via a special linker set, set_vnet. When
33 * "options VIMAGE" isn't defined, virtualized global variables are compiled
34 * as normal globals.
35 */

--- 12 unchanged lines hidden (view full) ---

48__asm__(".previous");
49
50#define VNET_NAME(n) vnet_entry_##n
51#define VNET_DECLARE(t, n) extern t VNET_NAME(n)
52#define VNET_DEFINE(t, n) t VNET_NAME(n) __section("set_vnet") __used
53#define _VNET_PTR(b, n) (__typeof(VNET_NAME(n))*) \
54 ((b) + (uintptr_t)&VNET_NAME(n))
55
28 */
29
30/*
31 * This is the virtual network stack memory allocator, which provides support
32 * for virtualized global variables via a special linker set, set_vnet. When
33 * "options VIMAGE" isn't defined, virtualized global variables are compiled
34 * as normal globals.
35 */

--- 12 unchanged lines hidden (view full) ---

48__asm__(".previous");
49
50#define VNET_NAME(n) vnet_entry_##n
51#define VNET_DECLARE(t, n) extern t VNET_NAME(n)
52#define VNET_DEFINE(t, n) t VNET_NAME(n) __section("set_vnet") __used
53#define _VNET_PTR(b, n) (__typeof(VNET_NAME(n))*) \
54 ((b) + (uintptr_t)&VNET_NAME(n))
55
56#define _VNET_GET(b, n) (*_VNET_PTR(b, n))
57#define _VNET_SET(b, n, v) (*_VNET_PTR(b, n) = v)
56#define _VNET(b, n) (*_VNET_PTR(b, n))
58
59/*
60 * Virtualized global variable accessor macros.
61 */
62#define VNET_VNET_PTR(vnet, n) _VNET_PTR((vnet)->vnet_data_base, n)
57
58/*
59 * Virtualized global variable accessor macros.
60 */
61#define VNET_VNET_PTR(vnet, n) _VNET_PTR((vnet)->vnet_data_base, n)
63#define VNET_VNET_GET(vnet, n) (*VNET_VNET_PTR((vnet), n))
64#define VNET_VNET_SET(vnet, n, v) ((*VNET_VNET_PTR((vnet), n)) = v)
62#define VNET_VNET(vnet, n) (*VNET_VNET_PTR((vnet), n))
65
66#define VNET_PTR(n) VNET_VNET_PTR(curvnet, n)
63
64#define VNET_PTR(n) VNET_VNET_PTR(curvnet, n)
67#define VNET_GET(n) VNET_VNET_GET(curvnet, n)
68#define VNET_SET(n, v) VNET_VNET_SET(curvnet, n, v)
65#define VNET(n) VNET_VNET(curvnet, n)
69
70/*
71 * Sysctl variants for vnet-virtualized global variables. Include
72 * <sys/sysctl.h> to expose these definitions.
73 *
74 * Note: SYSCTL_PROC() handler functions will need to resolve pointer
75 * arguments themselves, if required.
76 */

--- 61 unchanged lines hidden (view full) ---

138#define SYSCTL_VNET_UINT(parent, nbr, name, access, ptr, val, descr) \
139 SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr)
140#endif /* SYSCTL_OID */
141
142/*
143 * Virtualized global variable accessor macros.
144 */
145#define VNET_VNET_PTR(vnet, n) (&(n))
66
67/*
68 * Sysctl variants for vnet-virtualized global variables. Include
69 * <sys/sysctl.h> to expose these definitions.
70 *
71 * Note: SYSCTL_PROC() handler functions will need to resolve pointer
72 * arguments themselves, if required.
73 */

--- 61 unchanged lines hidden (view full) ---

135#define SYSCTL_VNET_UINT(parent, nbr, name, access, ptr, val, descr) \
136 SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr)
137#endif /* SYSCTL_OID */
138
139/*
140 * Virtualized global variable accessor macros.
141 */
142#define VNET_VNET_PTR(vnet, n) (&(n))
146#define VNET_VNET_GET(vnet, n) (n)
147#define VNET_VNET_SET(vnet, n, v) ((n) = (v))
143#define VNET_VNET(vnet, n) (n)
148
149#define VNET_PTR(n) (&(n))
144
145#define VNET_PTR(n) (&(n))
150#define VNET_GET(n) (n)
151#define VNET_SET(n, v) ((n) = (v))
146#define VNET(n) (n)
152
153#endif /* VIMAGE */
154
155#endif /* _KERNEL */
156
157#endif /* !_NET_VNET_H_ */
147
148#endif /* VIMAGE */
149
150#endif /* _KERNEL */
151
152#endif /* !_NET_VNET_H_ */