Deleted Added
sdiff udiff text old ( 215318 ) new ( 215701 )
full compact
1/*-
2 * Copyright (c) 2006-2009 University of Zagreb
3 * Copyright (c) 2006-2009 FreeBSD Foundation
4 * All rights reserved.
5 *
6 * This software was developed by the University of Zagreb and the
7 * FreeBSD Foundation under sponsorship by the Stichting NLnet and the
8 * FreeBSD Foundation.

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

27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * $FreeBSD: head/sys/net/vnet.h 215318 2010-11-14 20:40:55Z dim $
36 */
37
38/*-
39 * This header file defines several sets of interfaces supporting virtualized
40 * network stacks:
41 *
42 * - Definition of 'struct vnet' and functions and macros to allocate/free/
43 * manipulate it.

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

90#include <sys/proc.h> /* for struct thread */
91#include <sys/rwlock.h>
92#include <sys/sx.h>
93
94/*
95 * Location of the kernel's 'set_vnet' linker set.
96 */
97extern uintptr_t *__start_set_vnet;
98extern uintptr_t *__stop_set_vnet;
99
100#define VNET_START (uintptr_t)&__start_set_vnet
101#define VNET_STOP (uintptr_t)&__stop_set_vnet
102
103/*
104 * Functions to allocate and destroy virtual network stacks.
105 */
106struct vnet *vnet_alloc(void);

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

188#define VNET_FOREACH(arg) LIST_FOREACH((arg), &vnet_head, vnet_le)
189
190/*
191 * Virtual network stack memory allocator, which allows global variables to
192 * be automatically instantiated for each network stack instance.
193 */
194#define VNET_NAME(n) vnet_entry_##n
195#define VNET_DECLARE(t, n) extern t VNET_NAME(n)
196#define VNET_DEFINE(t, n) \
197 __GLOBL("__start_" VNET_SETNAME); \
198 __GLOBL("__stop_" VNET_SETNAME); \
199 t VNET_NAME(n) __section(VNET_SETNAME) __used
200#define STATIC_VNET_DEFINE(t, n) \
201 VNET_DEFINE(static t, n)
202#define _VNET_PTR(b, n) \
203 (__typeof(VNET_NAME(n))*)((b) + (uintptr_t)&VNET_NAME(n))
204
205#define _VNET(b, n) (*_VNET_PTR(b, n))
206
207/*
208 * Virtualized global variable accessor macros.
209 */
210#define VNET_VNET_PTR(vnet, n) _VNET_PTR((vnet)->vnet_data_base, n)
211#define VNET_VNET(vnet, n) (*VNET_VNET_PTR((vnet), n))

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

369#define CRED_TO_VNET(cr) NULL
370#define TD_TO_VNET(td) NULL
371#define P_TO_VNET(p) NULL
372
373/*
374 * Versions of the VNET macros that compile to normal global variables and
375 * standard sysctl definitions.
376 */
377#define VNET_NAME(n) n
378#define VNET_DECLARE(t, n) extern t n
379#define VNET_DEFINE(t, n) t n
380#define STATIC_VNET_DEFINE(t, n) static t n
381#define _VNET_PTR(b, n) &VNET_NAME(n)
382
383/*
384 * Virtualized global variable accessor macros.
385 */
386#define VNET_VNET_PTR(vnet, n) (&(n))
387#define VNET_VNET(vnet, n) (n)
388
389#define VNET_PTR(n) (&(n))

--- 45 unchanged lines hidden ---