freebsd-dev/sys/netgraph
Marko Zec 385195c062 Conditionally compile out V_ globals while instantiating the appropriate
container structures, depending on VIMAGE_GLOBALS compile time option.

Make VIMAGE_GLOBALS a new compile-time option, which by default will not
be defined, resulting in instatiations of global variables selected for
V_irtualization (enclosed in #ifdef VIMAGE_GLOBALS blocks) to be
effectively compiled out.  Instantiate new global container structures
to hold V_irtualized variables: vnet_net_0, vnet_inet_0, vnet_inet6_0,
vnet_ipsec_0, vnet_netgraph_0, and vnet_gif_0.

Update the VSYM() macro so that depending on VIMAGE_GLOBALS the V_
macros resolve either to the original globals, or to fields inside
container structures, i.e. effectively

#ifdef VIMAGE_GLOBALS
#define V_rt_tables rt_tables
#else
#define V_rt_tables vnet_net_0._rt_tables
#endif

Update SYSCTL_V_*() macros to operate either on globals or on fields
inside container structs.

Extend the internal kldsym() lookups with the ability to resolve
selected fields inside the virtualization container structs.  This
applies only to the fields which are explicitly registered for kldsym()
visibility via VNET_MOD_DECLARE() and vnet_mod_register(), currently
this is done only in sys/net/if.c.

Fix a few broken instances of MODULE_GLOBAL() macro use in SCTP code,
and modify the MODULE_GLOBAL() macro to resolve to V_ macros, which in
turn result in proper code being generated depending on VIMAGE_GLOBALS.

De-virtualize local static variables in sys/contrib/pf/net/pf_subr.c
which were prematurely V_irtualized by automated V_ prepending scripts
during earlier merging steps.  PF virtualization will be done
separately, most probably after next PF import.

Convert a few variable initializations at instantiation to
initialization in init functions, most notably in ipfw.  Also convert
TUNABLE_INT() initializers for V_ variables to TUNABLE_FETCH_INT() in
initializer functions.

Discussed at:	devsummit Strassburg
Reviewed by:	bz, julian
Approved by:	julian (mentor)
Obtained from:	//depot/projects/vimage-commit2/...
X-MFC after:	never
Sponsored by:	NLnet Foundation, The FreeBSD Foundation
2008-12-10 23:12:39 +00:00
..
atm Rather than using hidden includes (with cicular dependencies), 2008-12-02 21:37:28 +00:00
bluetooth Fix a number of style issues in the MALLOC / FREE commit. I've tried to 2008-10-23 20:26:15 +00:00
netflow Fix a number of style issues in the MALLOC / FREE commit. I've tried to 2008-10-23 20:26:15 +00:00
netgraph.h Conditionally compile out V_ globals while instantiating the appropriate 2008-12-10 23:12:39 +00:00
ng_async.c Fix a number of style issues in the MALLOC / FREE commit. I've tried to 2008-10-23 20:26:15 +00:00
ng_async.h
ng_atmllc.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_atmllc.h
ng_base.c Conditionally compile out V_ globals while instantiating the appropriate 2008-12-10 23:12:39 +00:00
ng_bpf.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_bpf.h
ng_bridge.c Conditionally compile out V_ globals while instantiating the appropriate 2008-12-10 23:12:39 +00:00
ng_bridge.h
ng_car.c - Account all node stats at the shape mode. 2008-03-30 07:53:51 +00:00
ng_car.h Add option to set packets per second limits instead of default 2007-12-19 22:50:14 +00:00
ng_cisco.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_cisco.h
ng_deflate.c
ng_deflate.h
ng_device.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_device.h
ng_echo.c
ng_echo.h
ng_eiface.c Conditionally compile out V_ globals while instantiating the appropriate 2008-12-10 23:12:39 +00:00
ng_eiface.h
ng_etf.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_etf.h
ng_ether.c Rather than using hidden includes (with cicular dependencies), 2008-12-02 21:37:28 +00:00
ng_ether.h
ng_fec.c Fix a number of style issues in the MALLOC / FREE commit. I've tried to 2008-10-23 20:26:15 +00:00
ng_fec.h
ng_frame_relay.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_frame_relay.h
ng_gif_demux.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_gif_demux.h
ng_gif.c Rather than using hidden includes (with cicular dependencies), 2008-12-02 21:37:28 +00:00
ng_gif.h
ng_hole.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_hole.h
ng_hub.c
ng_hub.h
ng_iface.c Conditionally compile out V_ globals while instantiating the appropriate 2008-12-10 23:12:39 +00:00
ng_iface.h
ng_ip_input.c Back out r180370. It was not discussed with subsystem maintainers. 2008-07-08 20:19:43 +00:00
ng_ip_input.h
ng_ipfw.c Conditionally compile out V_ globals while instantiating the appropriate 2008-12-10 23:12:39 +00:00
ng_ipfw.h
ng_ksocket.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_ksocket.h
ng_l2tp.c Fix typo. Clear session stats instead of config and part of stats. 2008-11-22 16:40:12 +00:00
ng_l2tp.h
ng_lmi.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_lmi.h
ng_message.h Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_mppc.c Carefully handle memory errors to keep peers compression/encryption state 2008-12-06 23:00:48 +00:00
ng_mppc.h
ng_nat.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_nat.h Fix incorrect field name. 2008-03-04 11:10:54 +00:00
ng_one2many.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_one2many.h
ng_parse.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_parse.h
ng_pipe.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_pipe.h Add Marko's pipe node. 2008-09-03 18:17:45 +00:00
ng_ppp.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_ppp.h Add 64bit statistic counters to the ng_ppp node. 2007-08-01 20:49:35 +00:00
ng_pppoe.c Use more compact LIST instead of TAILQ for session hash. 2008-03-03 19:36:03 +00:00
ng_pppoe.h Remove some prehistoric never used defines. 2007-12-26 19:15:07 +00:00
ng_pptpgre.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_pptpgre.h Rewrite node to support multiple hooks, alike to ng_l2tp, to use one pair 2008-03-24 22:55:22 +00:00
ng_pred1.c Slightly simplify code. 2008-01-27 02:04:12 +00:00
ng_pred1.h
ng_rfc1490.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_rfc1490.h
ng_sample.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_sample.h
ng_socket.c Remove unused variable. 2008-11-22 16:55:55 +00:00
ng_socket.h
ng_socketvar.h
ng_source.c Fix error message content. 2008-09-21 07:33:33 +00:00
ng_source.h
ng_split.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_split.h
ng_sppp.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_sppp.h
ng_tag.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_tag.h
ng_tcpmss.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_tcpmss.h
ng_tee.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_tee.h
ng_tty.c Don't use curthread to resolve file descriptor. Request may be queued, so 2008-11-08 06:25:57 +00:00
ng_tty.h Assign new cookie to the node to reflect API change. 2008-11-08 02:05:41 +00:00
ng_UI.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_UI.h
ng_vjc.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_vjc.h
ng_vlan.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
ng_vlan.h
NOTES