PERFORCE change 153806 for review
Marko Zec
zec at FreeBSD.org
Sun Nov 30 08:29:52 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=153806
Change 153806 by zec at zec_tpx32 on 2008/11/30 01:34:59
Instantiate vnet_* container structures, make VIMAGE_GLOBALS
a compile-time option defaulting to off, and switch the VSYM()
macro to resolve to struct vnet_ fields instead of globals,
unless VIMAGE_GLOBALS is set.
So far both GENERIC and LINT with nooptions SCTP build fine,
though I have no clue yet whether either of them boots at all.
Affected files ...
.. //depot/projects/vimage-commit2/src/sys/conf/options#16 edit
.. //depot/projects/vimage-commit2/src/sys/contrib/pf/net/pf_subr.c#7 edit
.. //depot/projects/vimage-commit2/src/sys/net/if_ethersubr.c#14 edit
.. //depot/projects/vimage-commit2/src/sys/net/if_gif.c#14 edit
.. //depot/projects/vimage-commit2/src/sys/net/if_gif.h#6 edit
.. //depot/projects/vimage-commit2/src/sys/net/route.c#21 edit
.. //depot/projects/vimage-commit2/src/sys/net/vnet.h#8 edit
.. //depot/projects/vimage-commit2/src/sys/netgraph/netgraph.h#17 edit
.. //depot/projects/vimage-commit2/src/sys/netgraph/ng_base.c#17 edit
.. //depot/projects/vimage-commit2/src/sys/netgraph/ng_eiface.c#14 edit
.. //depot/projects/vimage-commit2/src/sys/netgraph/ng_iface.c#12 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/ip_divert.c#18 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/ip_fw.h#12 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/ip_fw2.c#26 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/ip_fw_nat.c#8 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/ip_fw_pfil.c#10 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/ip_input.c#21 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/tcp_sack.c#14 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/tcp_subr.c#33 edit
.. //depot/projects/vimage-commit2/src/sys/netinet/vinet.h#19 edit
.. //depot/projects/vimage-commit2/src/sys/netinet6/icmp6.c#19 edit
.. //depot/projects/vimage-commit2/src/sys/netinet6/in6_proto.c#14 edit
.. //depot/projects/vimage-commit2/src/sys/netinet6/ip6_input.c#14 edit
.. //depot/projects/vimage-commit2/src/sys/netinet6/nd6.c#18 edit
.. //depot/projects/vimage-commit2/src/sys/netinet6/nd6_rtr.c#16 edit
.. //depot/projects/vimage-commit2/src/sys/netinet6/vinet6.h#15 edit
.. //depot/projects/vimage-commit2/src/sys/netipsec/ipsec.c#20 edit
.. //depot/projects/vimage-commit2/src/sys/netipsec/vipsec.h#14 edit
.. //depot/projects/vimage-commit2/src/sys/sys/sysctl.h#11 edit
.. //depot/projects/vimage-commit2/src/sys/sys/vimage.h#23 edit
Differences ...
==== //depot/projects/vimage-commit2/src/sys/conf/options#16 (text+ko) ====
@@ -415,6 +415,7 @@
TCP_OFFLOAD_DISABLE opt_inet.h #Disable code to dispatch tcp offloading
TCP_SIGNATURE opt_inet.h
VLAN_ARRAY opt_vlan.h
+VIMAGE_GLOBALS opt_global.h
XBONEHACK
#
==== //depot/projects/vimage-commit2/src/sys/contrib/pf/net/pf_subr.c#7 (text+ko) ====
@@ -115,10 +115,13 @@
#define ISN_STATIC_INCREMENT 4096
#define ISN_RANDOM_INCREMENT (4096 - 1)
+#ifdef VIMAGE_GLOBALS
+/* XXX WARNING WARNING clash with netinet/tcp_subr.c - REVISIT !!! */
static u_char isn_secret[32];
static int isn_last_reseed;
static u_int32_t isn_offset;
static MD5_CTX isn_ctx;
+#endif
u_int32_t
pf_new_isn(struct pf_state *s)
==== //depot/projects/vimage-commit2/src/sys/net/if_ethersubr.c#14 (text+ko) ====
@@ -425,7 +425,7 @@
ether_ipfw_chk(struct mbuf **m0, struct ifnet *dst,
struct ip_fw **rule, int shared)
{
- INIT_VNET_IPFW(dst->if_vnet);
+ INIT_VNET_NET(dst->if_vnet);
struct ether_header *eh;
struct ether_header save_eh;
struct mbuf *m;
==== //depot/projects/vimage-commit2/src/sys/net/if_gif.c#14 (text+ko) ====
@@ -95,6 +95,10 @@
static struct mtx gif_mtx;
static MALLOC_DEFINE(M_GIF, "gif", "Generic Tunnel Interface");
+#ifndef VIMAGE_GLOBALS
+struct vnet_gif vnet_gif_0;
+#endif
+
#ifdef VIMAGE_GLOBALS
static LIST_HEAD(, gif_softc) gif_softc_list;
static int max_gif_nesting;
==== //depot/projects/vimage-commit2/src/sys/net/if_gif.h#6 (text+ko) ====
@@ -113,7 +113,7 @@
/*
* Virtualization support
*/
-#ifdef VIMAGE
+
struct vnet_gif {
LIST_HEAD(, gif_softc) _gif_softc_list;
int _max_gif_nesting;
@@ -121,6 +121,9 @@
int _ip_gif_ttl;
int _ip6_gif_hlim;
};
+
+#ifndef VIMAGE_GLOBALS
+extern struct vnet_gif vnet_gif_0;
#endif
#define INIT_VNET_GIF(vnet) \
==== //depot/projects/vimage-commit2/src/sys/net/route.c#21 (text+ko) ====
@@ -63,6 +63,10 @@
#include <vm/uma.h>
+#ifndef VIMAGE_GLOBALS
+struct vnet_net vnet_net_0;
+#endif
+
u_int rt_numfibs = RT_NUMFIBS;
SYSCTL_INT(_net, OID_AUTO, fibs, CTLFLAG_RD, &rt_numfibs, 0, "");
/*
==== //depot/projects/vimage-commit2/src/sys/net/vnet.h#8 (text+ko) ====
@@ -67,6 +67,10 @@
int _ether_ipfw;
};
+#ifndef VIMAGE_GLOBALS
+extern struct vnet_net vnet_net_0;
+#endif
+
/*
* Symbol translation macros
*/
==== //depot/projects/vimage-commit2/src/sys/netgraph/netgraph.h#17 (text+ko) ====
@@ -1205,6 +1205,10 @@
struct unrhdr *_ng_wormhole_unit;
};
+#ifndef VIMAGE_GLOBALS
+extern struct vnet_netgraph vnet_netgraph_0;
+#endif
+
/* Symbol translation macros */
#define V_nextID VNET_NETGRAPH(nextID)
#define V_ng_ID_hash VNET_NETGRAPH(ng_ID_hash)
==== //depot/projects/vimage-commit2/src/sys/netgraph/ng_base.c#17 (text+ko) ====
@@ -72,6 +72,10 @@
MODULE_VERSION(netgraph, NG_ABI_VERSION);
+#ifndef VIMAGE_GLOBALS
+struct vnet_netgraph vnet_netgraph_0;
+#endif
+
/* Mutex to protect topology events. */
static struct mtx ng_topo_mtx;
@@ -167,7 +171,9 @@
/* Hash related definitions */
/* XXX Don't need to initialise them because it's a LIST */
+#ifdef VIMAGE_GLOBALS
static LIST_HEAD(, ng_node) ng_ID_hash[NG_ID_HASH_SIZE];
+#endif
static struct mtx ng_idhash_mtx;
/* Method to find a node.. used twice so do it here */
#define NG_IDHASH_FN(ID) ((ID) % (NG_ID_HASH_SIZE))
@@ -183,7 +189,9 @@
} \
} while (0)
+#ifdef VIMAGE_GLOBALS
static LIST_HEAD(, ng_node) ng_name_hash[NG_NAME_HASH_SIZE];
+#endif
static struct mtx ng_namehash_mtx;
#define NG_NAMEHASH(NAME, HASH) \
do { \
@@ -348,7 +356,9 @@
#define TRAP_ERROR()
#endif
+#ifdef VIMAGE_GLOBALS
static ng_ID_t nextID = 1;
+#endif
#ifdef INVARIANTS
#define CHECK_DATA_MBUF(m) do { \
==== //depot/projects/vimage-commit2/src/sys/netgraph/ng_eiface.c#14 (text+ko) ====
@@ -112,7 +112,9 @@
};
NETGRAPH_INIT(eiface, &typestruct);
+#ifdef VIMAGE_GLOBALS
static struct unrhdr *ng_eiface_unit;
+#endif
/************************************************************************
INTERFACE STUFF
==== //depot/projects/vimage-commit2/src/sys/netgraph/ng_iface.c#12 (text+ko) ====
@@ -208,7 +208,9 @@
};
NETGRAPH_INIT(iface, &typestruct);
+#ifdef VIMAGE_GLOBALS
static struct unrhdr *ng_iface_unit;
+#endif
/************************************************************************
HELPER STUFF
==== //depot/projects/vimage-commit2/src/sys/netinet/ip_divert.c#18 (text+ko) ====
@@ -166,7 +166,7 @@
V_divcbinfo.ipi_zone = uma_zcreate("divcb", sizeof(struct inpcb),
NULL, NULL, div_inpcb_init, div_inpcb_fini, UMA_ALIGN_PTR,
UMA_ZONE_NOFREE);
- uma_zone_set_max(divcbinfo.ipi_zone, maxsockets);
+ uma_zone_set_max(V_divcbinfo.ipi_zone, maxsockets);
EVENTHANDLER_REGISTER(maxsockets_change, div_zone_change,
NULL, EVENTHANDLER_PRI_ANY);
}
==== //depot/projects/vimage-commit2/src/sys/netinet/ip_fw.h#12 (text+ko) ====
@@ -650,8 +650,6 @@
extern ip_fw_chk_t *ip_fw_chk_ptr;
#define IPFW_LOADED (ip_fw_chk_ptr != NULL)
-#ifdef IPFW_INTERNAL
-
struct ip_fw_chain {
struct ip_fw *rules; /* list of rules */
struct ip_fw *reap; /* list of rules to reap */
@@ -659,6 +657,9 @@
struct radix_node_head *tables[IPFW_TABLES_MAX];
struct rwlock rwmtx;
};
+
+#ifdef IPFW_INTERNAL
+
#define IPFW_LOCK_INIT(_chain) \
rw_init(&(_chain)->rwmtx, "IPFW static rules")
#define IPFW_LOCK_DESTROY(_chain) rw_destroy(&(_chain)->rwmtx)
@@ -684,9 +685,7 @@
/*
* Stack virtualization support.
*/
-#ifdef VIMAGE
struct vnet_ipfw {
- int _fw_one_pass;
int _fw_enable;
int _fw6_enable;
u_int32_t _set_disable;
@@ -716,6 +715,9 @@
struct callout _ipfw_timeout;
eventhandler_tag _ifaddr_event_tag;
};
+
+#ifndef VIMAGE_GLOBALS
+extern struct vnet_ipfw vnet_ipfw_0;
#endif
/*
@@ -726,7 +728,6 @@
#define VNET_IPFW(sym) VSYM(vnet_ipfw, sym)
-#define V_fw_one_pass VNET_IPFW(fw_one_pass)
#define V_fw_enable VNET_IPFW(fw_enable)
#define V_fw6_enable VNET_IPFW(fw6_enable)
#define V_set_disable VNET_IPFW(set_disable)
==== //depot/projects/vimage-commit2/src/sys/netinet/ip_fw2.c#26 (text+ko) ====
@@ -107,6 +107,10 @@
#include <security/mac/mac_framework.h>
+#ifndef VIMAGE_GLOBALS
+struct vnet_ipfw vnet_ipfw_0;
+#endif
+
/*
* set_disable contains one bit per set value (0..31).
* If the bit is set, all rules with the corresponding set
@@ -115,12 +119,13 @@
* and CANNOT be disabled.
* Rules in set RESVD_SET can only be deleted explicitly.
*/
+#ifdef VIMAGE_GLOBALS
static u_int32_t set_disable;
-
static int fw_verbose;
+static struct callout ipfw_timeout;
+#endif
static int verbose_limit;
-static struct callout ipfw_timeout;
static uma_zone_t ipfw_dyn_rule_zone;
/*
@@ -156,8 +161,11 @@
u_int32_t value;
};
+#ifdef VIMAGE_GLOBALS
+/* XXX revisit init on instantiation !!! */
static int fw_debug = 1;
static int autoinc_step = 100; /* bounded to 1..1000 in add_rule() */
+#endif
extern int ipfw_chg_hook(SYSCTL_HANDLER_ARGS);
@@ -168,7 +176,7 @@
ipfw_chg_hook, "I", "Enable ipfw");
SYSCTL_V_INT(V_NET, vnet_ipfw, _net_inet_ip_fw, OID_AUTO, autoinc_step,
CTLFLAG_RW, autoinc_step, 0, "Rule number autincrement step");
-SYSCTL_V_INT(V_NET, vnet_ipfw, _net_inet_ip_fw, OID_AUTO, one_pass,
+SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip_fw, OID_AUTO, one_pass,
CTLFLAG_RW | CTLFLAG_SECURE3, fw_one_pass, 0,
"Only do a single pass through ipfw when using dummynet(4)");
SYSCTL_V_INT(V_NET, vnet_ipfw, _net_inet_ip_fw, OID_AUTO, debug, CTLFLAG_RW,
@@ -219,9 +227,12 @@
* obey the 'randomized match', and we do not do multiple
* passes through the firewall. XXX check the latter!!!
*/
+#ifdef VIMAGE_GLOBALS
+/* XXX revisit init on instantiation !!! */
static ipfw_dyn_rule **ipfw_dyn_v = NULL;
static u_int32_t dyn_buckets = 256; /* must be power of 2 */
static u_int32_t curr_dyn_buckets = 256; /* must be power of 2 */
+#endif
static struct mtx ipfw_dyn_mtx; /* mutex guarding dynamic rules */
#define IPFW_DYN_LOCK_INIT() \
@@ -234,6 +245,8 @@
/*
* Timeouts for various events in handing dynamic rules.
*/
+#ifdef VIMAGE_GLOBALS
+/* XXX revisit init on instantiation !!! */
static u_int32_t dyn_ack_lifetime = 300;
static u_int32_t dyn_syn_lifetime = 20;
static u_int32_t dyn_fin_lifetime = 1;
@@ -257,6 +270,7 @@
static u_int32_t static_len; /* size in bytes of static rules */
static u_int32_t dyn_count; /* # of dynamic rules */
static u_int32_t dyn_max = 4096; /* max # of dynamic rules */
+#endif /* VIMAGE_GLOBALS */
SYSCTL_V_INT(V_NET, vnet_ipfw, _net_inet_ip_fw, OID_AUTO, dyn_buckets,
CTLFLAG_RW, dyn_buckets, 0, "Number of dyn. buckets");
@@ -296,9 +310,11 @@
#endif /* INET6 */
#endif /* SYSCTL_NODE */
+#ifdef VIMAGE_GLOBALS
+/* XXX revisit init on instantiation !!! */
static int fw_deny_unknown_exthdrs = 1;
+#endif
-
/*
* L3HDR maps an ipv4 pointer into a layer3 header pointer of type T
* Other macros just cast void * into the appropriate type
@@ -745,7 +761,9 @@
#endif /* INET6 */
+#ifdef VIMAGE_GLOBALS
static u_int64_t norule_counter; /* counter for ipfw_log(NULL...) */
+#endif
#define SNPARGS(buf, len) buf + len, sizeof(buf) > len ? sizeof(buf) - len : 0
#define SNP(buf) buf, sizeof(buf)
==== //depot/projects/vimage-commit2/src/sys/netinet/ip_fw_nat.c#8 (text+ko) ====
@@ -71,7 +71,9 @@
extern struct ip_fw_chain layer3_chain;
+#ifdef VIMAGE_GLOBALS
static eventhandler_tag ifaddr_event_tag;
+#endif
extern ipfw_nat_t *ipfw_nat_ptr;
extern ipfw_nat_cfg_t *ipfw_nat_cfg_ptr;
==== //depot/projects/vimage-commit2/src/sys/netinet/ip_fw_pfil.c#10 (text+ko) ====
==== //depot/projects/vimage-commit2/src/sys/netinet/ip_input.c#21 (text+ko) ====
@@ -89,6 +89,10 @@
CTASSERT(sizeof(struct ip) == 20);
#endif
+#ifndef VIMAGE_GLOBALS
+struct vnet_inet vnet_inet_0;
+#endif
+
#ifdef VIMAGE_GLOBALS
static int ipsendredirects;
static int ip_checkinterface;
@@ -168,7 +172,9 @@
SYSCTL_V_STRUCT(V_NET, vnet_inet, _net_inet_ip, IPCTL_STATS, stats, CTLFLAG_RW,
ipstat, ipstat, "IP statistics (struct ipstat, netinet/ip_var.h)");
+#ifdef VIMAGE_GLOBALS
static uma_zone_t ipq_zone;
+#endif
static struct mtx ipqlock;
#define IPQ_LOCK() mtx_lock(&ipqlock)
@@ -205,7 +211,9 @@
*/
ip_fw_chk_t *ip_fw_chk_ptr = NULL;
ip_dn_io_t *ip_dn_io_ptr = NULL;
-int fw_one_pass = 1;
+#ifdef VIMAGE_GLOBALS
+int fw_one_pass;
+#endif
static void ip_freef(struct ipqhead *, struct ipq *);
@@ -244,6 +252,8 @@
V_ipport_randomtime = 45; /* user controlled via sysctl */
V_ipport_stoprandom = 0; /* toggled by ipport_tick */
+ V_fw_one_pass = 1;
+
#ifdef NOTYET
/* XXX global static but not instantiated in this file */
V_ipfastforward_active = 0;
==== //depot/projects/vimage-commit2/src/sys/netinet/tcp_sack.c#14 (text+ko) ====
@@ -134,7 +134,10 @@
SYSCTL_NODE(_net_inet_tcp, OID_AUTO, sack, CTLFLAG_RW, 0, "TCP SACK");
SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp_sack, OID_AUTO, enable,
CTLFLAG_RW, tcp_do_sack, 0, "Enable/Disable TCP SACK support");
+#ifdef VIMAGE_GLOBALS
+/* XXX REVISIT THIS !!! */
TUNABLE_INT("net.inet.tcp.sack.enable", &tcp_do_sack);
+#endif
SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp_sack, OID_AUTO, maxholes,
CTLFLAG_RW, tcp_sack_maxholes, 0,
==== //depot/projects/vimage-commit2/src/sys/netinet/tcp_subr.c#33 (text+ko) ====
@@ -1479,6 +1479,7 @@
#define ISN_RANDOM_INCREMENT (4096 - 1)
#ifdef VIMAGE_GLOBALS
+/* XXX WARNING WARNING clash with contrib/pf/net/pf_subr.c - REVISIT !!! */
static u_char isn_secret[32];
static int isn_last_reseed;
static u_int32_t isn_offset, isn_offset_old;
==== //depot/projects/vimage-commit2/src/sys/netinet/vinet.h#19 (text+ko) ====
@@ -196,8 +196,14 @@
int _icmp_rfi;
int _icmp_quotelen;
int _icmpbmcastecho;
+
+ int _fw_one_pass;
};
+#ifndef VIMAGE_GLOBALS
+extern struct vnet_inet vnet_inet_0;
+#endif
+
/*
* Symbol translation macros
*/
@@ -214,6 +220,7 @@
#define V_divcbinfo VNET_INET(divcbinfo)
#define V_drop_redirect VNET_INET(drop_redirect)
#define V_drop_synfin VNET_INET(drop_synfin)
+#define V_fw_one_pass VNET_INET(fw_one_pass)
#define V_icmp_may_rst VNET_INET(icmp_may_rst)
#define V_icmp_quotelen VNET_INET(icmp_quotelen)
#define V_icmp_rfi VNET_INET(icmp_rfi)
==== //depot/projects/vimage-commit2/src/sys/netinet6/icmp6.c#19 (text+ko) ====
==== //depot/projects/vimage-commit2/src/sys/netinet6/in6_proto.c#14 (text+ko) ====
@@ -517,7 +517,8 @@
sysctl_ip6_tempvltime, "I", "");
SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_V6ONLY,
v6only, CTLFLAG_RW, ip6_v6only, 0, "");
-#ifndef VIMAGE
+#ifdef VIMAGE_GLOBALS
+/* XXX REVISIT THIS ! */
TUNABLE_INT("net.inet6.ip6.auto_linklocal", &ip6_auto_linklocal);
#endif
SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_AUTO_LINKLOCAL,
==== //depot/projects/vimage-commit2/src/sys/netinet6/ip6_input.c#14 (text+ko) ====
@@ -117,6 +117,10 @@
u_char ip6_protox[IPPROTO_MAX];
static struct ifqueue ip6intrq;
+#ifndef VIMAGE_GLOBALS
+struct vnet_inet6 vnet_inet6_0;
+#endif
+
#ifdef VIMAGE_GLOBALS
static int ip6qmaxlen;
struct in6_ifaddr *in6_ifaddr;
==== //depot/projects/vimage-commit2/src/sys/netinet6/nd6.c#18 (text+ko) ====
@@ -164,10 +164,10 @@
V_llinfo_nd6.ln_prev = &V_llinfo_nd6;
LIST_INIT(&V_nd_prefix);
- ip6_use_tempaddr = 0;
- ip6_temp_preferred_lifetime = DEF_TEMP_PREFERRED_LIFETIME;
- ip6_temp_valid_lifetime = DEF_TEMP_VALID_LIFETIME;
- ip6_temp_regen_advance = TEMPADDR_REGEN_ADVANCE;
+ V_ip6_use_tempaddr = 0;
+ V_ip6_temp_preferred_lifetime = DEF_TEMP_PREFERRED_LIFETIME;
+ V_ip6_temp_valid_lifetime = DEF_TEMP_VALID_LIFETIME;
+ V_ip6_temp_regen_advance = TEMPADDR_REGEN_ADVANCE;
all1_sa.sin6_family = AF_INET6;
all1_sa.sin6_len = sizeof(struct sockaddr_in6);
==== //depot/projects/vimage-commit2/src/sys/netinet6/nd6_rtr.c#16 (text+ko) ====
==== //depot/projects/vimage-commit2/src/sys/netinet6/vinet6.h#15 (text+ko) ====
@@ -87,7 +87,7 @@
int _dad_init;
int _icmp6errpps_count;
- int _icmp6errppslim_last;
+ struct timeval _icmp6errppslim_last;
int _ip6_forwarding;
int _ip6_sendredirects;
@@ -154,6 +154,10 @@
struct ip6_pktopts _ip6_opts;
};
+#ifndef VIMAGE_GLOBALS
+extern struct vnet_inet6 vnet_inet6_0;
+#endif
+
#define INIT_VNET_INET6(vnet) \
INIT_FROM_VNET(vnet, VNET_MOD_INET6, struct vnet_inet6, vnet_inet6)
==== //depot/projects/vimage-commit2/src/sys/netipsec/ipsec.c#20 (text+ko) ====
@@ -97,6 +97,10 @@
#include <opencrypto/cryptodev.h>
+#ifndef VIMAGE_GLOBALS
+struct vnet_ipsec vnet_ipsec_0;
+#endif
+
#ifdef VIMAGE_GLOBALS
/* NB: name changed so netstat doesn't use it */
struct ipsecstat ipsec4stat;
==== //depot/projects/vimage-commit2/src/sys/netipsec/vipsec.h#14 (text+ko) ====
@@ -112,6 +112,10 @@
LIST_HEAD(, secspacq) _spacqtree;
};
+#ifndef VIMAGE_GLOBALS
+extern struct vnet_ipsec vnet_ipsec_0;
+#endif
+
/*
* Symbol translation macros
*/
==== //depot/projects/vimage-commit2/src/sys/sys/sysctl.h#11 (text+ko) ====
@@ -234,9 +234,16 @@
handler, fmt, 0, __DESCR(descr), subs, V_MOD_##mod }; \
DATA_SET(sysctl_set, sysctl__##parent##_##name)
#else
+#ifdef VIMAGE_GLOBALS
#define SYSCTL_V_OID(subs, mod, parent, nbr, name, kind, a1, a2, \
handler, fmt, descr) \
SYSCTL_OID(parent, nbr, name, kind, &a1, a2, handler, fmt, descr)
+#else
+#define SYSCTL_V_OID(subs, mod, parent, nbr, name, kind, a1, a2, \
+ handler, fmt, descr) \
+ SYSCTL_OID(parent, nbr, name, kind, & mod ## _0._ ## a1, a2, \
+ handler, fmt, descr)
+#endif
#endif
#define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
@@ -262,9 +269,15 @@
SYSCTL_V_OID(subs, mod, parent, nbr, name, CTLTYPE_STRING|(access), \
sym, len, sysctl_handle_v_string, "A", descr)
#else
+#ifdef VIMAGE_GLOBALS
#define SYSCTL_V_STRING(subs, mod, parent, nbr, name, access, sym, len, descr) \
SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access), \
&sym, len, sysctl_handle_string, "A", descr)
+#else
+#define SYSCTL_V_STRING(subs, mod, parent, nbr, name, access, sym, len, descr) \
+ SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access), \
+ & mod ## _0._ ## sym, len, sysctl_handle_string, "A", descr)
+#endif
#endif
#define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr) \
@@ -281,9 +294,15 @@
SYSCTL_V_OID(subs, mod, parent, nbr, name, CTLTYPE_INT|(access), \
sym, val, sysctl_handle_v_int, "I", descr)
#else
+#ifdef VIMAGE_GLOBALS
#define SYSCTL_V_INT(subs, mod, parent, nbr, name, access, sym, val, descr) \
SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|(access), \
&sym, val, sysctl_handle_int, "I", descr)
+#else
+#define SYSCTL_V_INT(subs, mod, parent, nbr, name, access, sym, val, descr) \
+ SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|(access), \
+ & mod ## _0._ ## sym, val, sysctl_handle_int, "I", descr)
+#endif
#endif
#define SYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr) \
@@ -300,9 +319,15 @@
SYSCTL_V_OID(subs, mod, parent, nbr, name, CTLTYPE_UINT|(access), \
sym, val, sysctl_handle_v_int, "IU", descr)
#else
+#ifdef VIMAGE_GLOBALS
#define SYSCTL_V_UINT(subs, mod, parent, nbr, name, access, sym, val, descr) \
SYSCTL_OID(parent, nbr, name, CTLTYPE_UINT|(access), \
&sym, val, sysctl_handle_int, "IU", descr)
+#else
+#define SYSCTL_V_UINT(subs, mod, parent, nbr, name, access, sym, val, descr) \
+ SYSCTL_OID(parent, nbr, name, CTLTYPE_UINT|(access), \
+ & mod ## _0._ ## sym, val, sysctl_handle_int, "IU", descr)
+#endif
#endif
#define SYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr) \
@@ -374,11 +399,19 @@
sym, sizeof(struct type), sysctl_handle_v_opaque, \
"S," #type, descr)
#else
+#ifdef VIMAGE_GLOBALS
#define SYSCTL_V_STRUCT(subs, mod, parent, nbr, name, access, sym, \
type, descr) \
SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \
&sym, sizeof(struct type), sysctl_handle_opaque, \
"S," #type, descr)
+#else
+#define SYSCTL_V_STRUCT(subs, mod, parent, nbr, name, access, sym, \
+ type, descr) \
+ SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \
+ & mod ## _0._ ## sym, sizeof(struct type), \
+ sysctl_handle_opaque, "S," #type, descr)
+#endif
#endif
#define SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \
==== //depot/projects/vimage-commit2/src/sys/sys/vimage.h#23 (text+ko) ====
@@ -33,14 +33,17 @@
#ifndef _SYS_VIMAGE_H_
#define _SYS_VIMAGE_H_
-#define VIMAGE_GLOBALS 1
+#ifdef VIMAGE_GLOBALS
+#define VSYM(base, sym) (sym)
+#else
+#define VSYM(base, sym) (base ## _0._ ## sym)
+#endif
/* Non-VIMAGE null-macros */
#define CURVNET_SET(arg)
#define CURVNET_SET_QUIET(arg)
#define CURVNET_RESTORE()
#define VNET_ASSERT(condition)
-#define VSYM(base, sym) (sym)
#define INIT_FROM_VNET(vnet, modindex, modtype, sym)
#define VNET_ITERATOR_DECL(arg)
#define VNET_FOREACH(arg)
@@ -58,11 +61,11 @@
#define P_TO_VCPU(p)
/* XXX those defines bellow should probably go into vprocg.h and vcpu.h */
-#define VPROCG(sym) VSYM(vprocg, sym)
-#define VCPU(sym) VSYM(vcpu, sym)
+#define VPROCG(sym) (sym)
+#define VCPU(sym) (sym)
#define V_hostname VPROCG(hostname)
-#define G_hostname VSYM(basevprocg, hostname) /* global hostname */
+#define G_hostname VPROCG(hostname) /* global hostname */
#define V_domainname VPROCG(domainname)
#endif /* !_SYS_VIMAGE_H_ */
More information about the p4-projects
mailing list