Changeset View
Changeset View
Standalone View
Standalone View
sys/net/vnet.h
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | |||||
#if defined(_KERNEL) || defined(_WANT_VNET) | #if defined(_KERNEL) || defined(_WANT_VNET) | ||||
#include <sys/queue.h> | #include <sys/queue.h> | ||||
struct vnet { | struct vnet { | ||||
LIST_ENTRY(vnet) vnet_le; /* all vnets list */ | LIST_ENTRY(vnet) vnet_le; /* all vnets list */ | ||||
u_int vnet_magic_n; | u_int vnet_magic_n; | ||||
u_int vnet_ifcnt; | u_int vnet_ifcnt; | ||||
u_int vnet_sockcnt; | u_int vnet_sockcnt; | ||||
u_int vnet_state; /* SI_SUB_* */ | u_int vnet_state; /* SI_SUB_* */ | ||||
bz: The reason you get the state is that it is massively helpful for debugging dependency panics… | |||||
void *vnet_data_mem; | void *vnet_data_mem; | ||||
uintptr_t vnet_data_base; | uintptr_t vnet_data_base; | ||||
}; | }; | ||||
#define VNET_MAGIC_N 0x3e0d8f29 | #define VNET_MAGIC_N 0x3e0d8f29 | ||||
/* | /* | ||||
* These two virtual network stack allocator definitions are also required | * These two virtual network stack allocator definitions are also required | ||||
* for libkvm so that it can evaluate virtualized global variables. | * for libkvm so that it can evaluate virtualized global variables. | ||||
▲ Show 20 Lines • Show All 260 Lines • ▼ Show 20 Lines | static struct vnet_sysinit ident ## _vnet_uninit = { \ | ||||
(arg) \ | (arg) \ | ||||
}; \ | }; \ | ||||
SYSINIT(vnet_uninit_ ## ident, subsystem, order, \ | SYSINIT(vnet_uninit_ ## ident, subsystem, order, \ | ||||
vnet_register_sysuninit, &ident ## _vnet_uninit); \ | vnet_register_sysuninit, &ident ## _vnet_uninit); \ | ||||
SYSUNINIT(vnet_uninit_ ## ident, subsystem, order, \ | SYSUNINIT(vnet_uninit_ ## ident, subsystem, order, \ | ||||
vnet_deregister_sysuninit, &ident ## _vnet_uninit) | vnet_deregister_sysuninit, &ident ## _vnet_uninit) | ||||
/* | /* | ||||
* Check if VNET is ready. | |||||
*/ | |||||
bool vnet_is_running(struct vnet *); | |||||
/* | |||||
* Run per-vnet sysinits or sysuninits during vnet creation/destruction. | * Run per-vnet sysinits or sysuninits during vnet creation/destruction. | ||||
*/ | */ | ||||
void vnet_sysinit(void); | void vnet_sysinit(void); | ||||
void vnet_sysuninit(void); | void vnet_sysuninit(void); | ||||
/* | /* | ||||
* Interfaces for managing per-vnet constructors and destructors. | * Interfaces for managing per-vnet constructors and destructors. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |
The reason you get the state is that it is massively helpful for debugging dependency panics (say interfaces, firewalls, stack) and having a way to get it from the crashdump can tell you that you tried to use something which you haven't initialized yet.