In preparation for turning on options VIMAGE in next commits,

rearrange / replace / adjust several INIT_VNET_* initializer
macros, all of which currently resolve to whitespace.

Reviewed by:	bz (an older version of the patch)
Approved by:	julian (mentor)
This commit is contained in:
Marko Zec 2009-04-26 22:06:42 +00:00
parent dc7bf546c8
commit 093f25f8c8
17 changed files with 64 additions and 51 deletions

View File

@ -584,7 +584,9 @@ static int
linux_socket(struct thread *td, struct linux_socket_args *args)
{
#ifdef INET6
#ifndef KLD_MODULE
INIT_VNET_INET6(curvnet);
#endif
#endif
struct socket_args /* {
int domain;

View File

@ -213,6 +213,7 @@ char *s;
int ipfattach()
{
INIT_VNET_INET(curvnet);
#ifdef USE_SPL
int s;
#endif
@ -264,6 +265,7 @@ int ipfattach()
*/
int ipfdetach()
{
INIT_VNET_INET(curvnet);
#ifdef USE_SPL
int s;
#endif
@ -646,6 +648,7 @@ static int fr_send_ip(fin, m, mpp)
fr_info_t *fin;
mb_t *m, **mpp;
{
INIT_VNET_INET(curvnet);
fr_info_t fnew;
ip_t *ip, *oip;
int hlen;

View File

@ -174,7 +174,6 @@ static int vnet_loif_iattach(const void *unused __unused)
static int
loop_modevent(module_t mod, int type, void *data)
{
INIT_VNET_NET(curvnet);
switch (type) {
case MOD_LOAD:

View File

@ -178,7 +178,7 @@ route_init(void)
static int vnet_route_iattach(const void *unused __unused)
{
INIT_VNET_INET(curvnet);
INIT_VNET_NET(curvnet);
int table;
struct domain *dom;
int fam;

View File

@ -1206,7 +1206,6 @@ rt_ifannouncemsg(struct ifnet *ifp, int what)
static void
rt_dispatch(struct mbuf *m, const struct sockaddr *sa)
{
INIT_VNET_NET(curvnet);
struct m_tag *tag;
/*

View File

@ -141,13 +141,8 @@ static int sysctl_igmp_default_version(SYSCTL_HANDLER_ARGS);
static int sysctl_igmp_gsr(SYSCTL_HANDLER_ARGS);
static int sysctl_igmp_ifinfo(SYSCTL_HANDLER_ARGS);
#ifdef VIMAGE
static vnet_attach_fn vnet_igmp_iattach;
static vnet_detach_fn vnet_igmp_idetach;
#else
static int vnet_igmp_iattach(const void *);
static int vnet_igmp_idetach(const void *);
#endif /* VIMAGE */
/*
* System-wide globals.
@ -333,6 +328,7 @@ igmp_restore_context(struct mbuf *m)
static int
sysctl_igmp_default_version(SYSCTL_HANDLER_ARGS)
{
INIT_VNET_INET(curvnet);
int error;
int new;
@ -372,6 +368,7 @@ sysctl_igmp_default_version(SYSCTL_HANDLER_ARGS)
static int
sysctl_igmp_gsr(SYSCTL_HANDLER_ARGS)
{
INIT_VNET_INET(curvnet);
int error;
int i;
@ -413,6 +410,7 @@ static int
sysctl_igmp_ifinfo(SYSCTL_HANDLER_ARGS)
{
INIT_VNET_NET(curvnet);
INIT_VNET_INET(curvnet);
int *name;
int error;
u_int namelen;
@ -498,6 +496,7 @@ igmp_dispatch_queue(struct ifqueue *ifq, int limit, const int loop)
static __inline int
igmp_isgroupreported(const struct in_addr addr)
{
INIT_VNET_INET(curvnet);
if (in_allhosts(addr) ||
((!V_igmp_sendlocal && IN_LOCAL_GROUP(ntohl(addr.s_addr)))))
@ -560,6 +559,7 @@ igmp_domifattach(struct ifnet *ifp)
static struct igmp_ifinfo *
igi_alloc_locked(/*const*/ struct ifnet *ifp)
{
INIT_VNET_INET(ifp->if_vnet);
struct igmp_ifinfo *igi;
IGMP_LOCK_ASSERT();
@ -679,6 +679,7 @@ igmp_domifdetach(struct ifnet *ifp)
static void
igi_delete_locked(const struct ifnet *ifp)
{
INIT_VNET_INET(ifp->if_vnet);
struct igmp_ifinfo *igi, *tigi;
CTR3(KTR_IGMPV3, "%s: freeing igmp_ifinfo for ifp %p(%s)",
@ -803,6 +804,7 @@ static int
igmp_input_v2_query(struct ifnet *ifp, const struct ip *ip,
const struct igmp *igmp)
{
INIT_VNET_INET(ifp->if_vnet);
struct ifmultiaddr *ifma;
struct igmp_ifinfo *igi;
struct in_multi *inm;
@ -895,6 +897,7 @@ igmp_input_v2_query(struct ifnet *ifp, const struct ip *ip,
static void
igmp_v2_update_group(struct in_multi *inm, const int timer)
{
INIT_VNET_INET(curvnet);
CTR4(KTR_IGMPV3, "%s: %s/%s timer=%d", __func__,
inet_ntoa(inm->inm_addr), inm->inm_ifp->if_xname, timer);
@ -942,6 +945,7 @@ static int
igmp_input_v3_query(struct ifnet *ifp, const struct ip *ip,
/*const*/ struct igmpv3 *igmpv3)
{
INIT_VNET_INET(ifp->if_vnet);
struct igmp_ifinfo *igi;
struct in_multi *inm;
uint32_t maxresp, nsrc, qqi;
@ -1086,6 +1090,7 @@ static int
igmp_input_v3_group_query(struct in_multi *inm, struct igmp_ifinfo *igi,
int timer, /*const*/ struct igmpv3 *igmpv3)
{
INIT_VNET_INET(curvnet);
int retval;
uint16_t nsrc;
@ -1188,6 +1193,7 @@ static int
igmp_input_v1_report(struct ifnet *ifp, /*const*/ struct ip *ip,
/*const*/ struct igmp *igmp)
{
INIT_VNET_INET(ifp->if_vnet);
struct in_ifaddr *ia;
struct in_multi *inm;
@ -1294,6 +1300,7 @@ static int
igmp_input_v2_report(struct ifnet *ifp, /*const*/ struct ip *ip,
/*const*/ struct igmp *igmp)
{
INIT_VNET_INET(ifp->if_vnet);
struct in_ifaddr *ia;
struct in_multi *inm;
@ -1579,21 +1586,15 @@ igmp_input(struct mbuf *m, int off)
void
igmp_fasttimo(void)
{
#ifdef VIMAGE
VNET_ITERATOR_DECL(vnet_iter);
VNET_LIST_RLOCK();
VNET_FOREACH(vnet_iter) {
CURVNET_SET(vnet_iter);
INIT_VNET_INET(vnet_iter);
igmp_fasttimo_vnet();
CURVNET_RESTORE();
}
VNET_LIST_RUNLOCK();
#else /* !VIMAGE */
igmp_fasttimo_vnet();
#endif /* VIMAGE */
}
/*
@ -1605,6 +1606,7 @@ igmp_fasttimo(void)
static void
igmp_fasttimo_vnet(void)
{
INIT_VNET_INET(curvnet);
struct ifqueue scq; /* State-change packets */
struct ifqueue qrq; /* Query response packets */
struct ifnet *ifp;
@ -1727,6 +1729,7 @@ igmp_fasttimo_vnet(void)
static void
igmp_v1v2_process_group_timer(struct in_multi *inm, const int version)
{
INIT_VNET_INET(curvnet);
int report_timer_expired;
IN_MULTI_LOCK_ASSERT();
@ -1775,6 +1778,7 @@ igmp_v3_process_group_timers(struct igmp_ifinfo *igi,
struct ifqueue *qrq, struct ifqueue *scq,
struct in_multi *inm, const int uri_fasthz)
{
INIT_VNET_INET(curvnet);
int query_response_timer_expired;
int state_change_retransmit_timer_expired;
@ -1964,6 +1968,7 @@ igmp_set_version(struct igmp_ifinfo *igi, const int version)
static void
igmp_v3_cancel_link_timers(struct igmp_ifinfo *igi)
{
INIT_VNET_INET(curvnet);
struct ifmultiaddr *ifma;
struct ifnet *ifp;
struct in_multi *inm;
@ -2039,6 +2044,7 @@ igmp_v3_cancel_link_timers(struct igmp_ifinfo *igi)
static void
igmp_v1v2_process_querier_timers(struct igmp_ifinfo *igi)
{
INIT_VNET_INET(curvnet);
IGMP_LOCK_ASSERT();
@ -2115,20 +2121,15 @@ igmp_v1v2_process_querier_timers(struct igmp_ifinfo *igi)
void
igmp_slowtimo(void)
{
#ifdef VIMAGE
VNET_ITERATOR_DECL(vnet_iter);
VNET_LIST_RLOCK();
VNET_FOREACH(vnet_iter) {
CURVNET_SET(vnet_iter);
INIT_VNET_INET(vnet_iter);
igmp_slowtimo_vnet();
CURVNET_RESTORE();
}
VNET_LIST_RUNLOCK();
#else /* !VIMAGE */
igmp_slowtimo_vnet();
#endif /* VIMAGE */
}
/*
@ -2137,6 +2138,7 @@ igmp_slowtimo(void)
static void
igmp_slowtimo_vnet(void)
{
INIT_VNET_INET(curvnet);
struct igmp_ifinfo *igi;
IGMP_LOCK();
@ -2164,9 +2166,6 @@ igmp_v1v2_queue_report(struct in_multi *inm, const int type)
IGMP_LOCK_ASSERT();
ifp = inm->inm_ifp;
/* XXX are these needed ? */
INIT_VNET_NET(ifp->if_vnet);
INIT_VNET_INET(ifp->if_vnet);
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL)
@ -2304,6 +2303,7 @@ igmp_change_state(struct in_multi *inm)
static int
igmp_initial_join(struct in_multi *inm, struct igmp_ifinfo *igi)
{
INIT_VNET_INET(curvnet);
struct ifnet *ifp;
struct ifqueue *ifq;
int error, retval, syncstates;
@ -2432,6 +2432,7 @@ igmp_initial_join(struct in_multi *inm, struct igmp_ifinfo *igi)
static int
igmp_handle_state_change(struct in_multi *inm, struct igmp_ifinfo *igi)
{
INIT_VNET_INET(curvnet);
struct ifnet *ifp;
int retval;
@ -2491,6 +2492,7 @@ igmp_handle_state_change(struct in_multi *inm, struct igmp_ifinfo *igi)
static void
igmp_final_leave(struct in_multi *inm, struct igmp_ifinfo *igi)
{
INIT_VNET_INET(curvnet);
int syncstates;
syncstates = 1;
@ -3276,6 +3278,7 @@ igmp_v3_merge_state_changes(struct in_multi *inm, struct ifqueue *ifscq)
static void
igmp_v3_dispatch_general_query(struct igmp_ifinfo *igi)
{
INIT_VNET_INET(curvnet);
struct ifmultiaddr *ifma, *tifma;
struct ifnet *ifp;
struct in_multi *inm;
@ -3357,12 +3360,14 @@ igmp_intr(struct mbuf *m)
CTR2(KTR_IGMPV3, "%s: transmit %p", __func__, m);
/*
* Restore VNET image pointer from enqueued mbuf chain
* Set VNET image pointer from enqueued mbuf chain
* before doing anything else. Whilst we use interface
* indexes to guard against interface detach, they are
* unique to each VIMAGE and must be retrieved.
*/
CURVNET_SET(m->m_pkthdr.header);
INIT_VNET_NET(curvnet);
INIT_VNET_INET(curvnet);
ifindex = igmp_restore_context(m);
/*
@ -3444,7 +3449,6 @@ igmp_intr(struct mbuf *m)
static struct mbuf *
igmp_v3_encap_report(struct ifnet *ifp, struct mbuf *m)
{
INIT_VNET_NET(curvnet);
INIT_VNET_INET(curvnet);
struct igmp_report *igmp;
struct ip *ip;
@ -3616,15 +3620,15 @@ vnet_igmp_idetach(const void *unused __unused)
return (0);
}
#ifdef VIMAGE
static struct vnet_symmap vnet_igmp_symmap[] = {
VNET_SYMMAP(igmp, igi_head),
VNET_SYMMAP(igmp, igmpstat),
VNET_SYMMAP_END
#ifndef VIMAGE_GLOBALS
static vnet_modinfo_t vnet_igmp_modinfo = {
.vmi_id = VNET_MOD_IGMP,
.vmi_name = "igmp",
.vmi_dependson = VNET_MOD_INET,
.vmi_iattach = vnet_igmp_iattach,
.vmi_idetach = vnet_igmp_idetach
};
VNET_MOD_DECLARE(IGMP, igmp, vnet_igmp_iattach, vnet_igmp_idetach,
vnet_igmp_symmap);
#endif /* VIMAGE */
#endif
static int
igmp_modevent(module_t mod, int type, void *unused __unused)
@ -3633,22 +3637,20 @@ igmp_modevent(module_t mod, int type, void *unused __unused)
switch (type) {
case MOD_LOAD:
igmp_sysinit();
#ifdef VIMAGE
#ifndef VIMAGE_GLOBALS
vnet_mod_register(&vnet_igmp_modinfo);
#else
(void)vnet_igmp_iattach(NULL);
#endif /* VIMAGE */
vnet_igmp_iattach(NULL);
#endif
break;
case MOD_UNLOAD:
#ifdef VIMAGE
/*
* TODO: Allow module unload if any VIMAGE instances
* are using this module.
*/
return (EBUSY);
#ifndef VIMAGE_GLOBALS
#ifdef NOTYET
vnet_mod_deregister(&vnet_igmp_modinfo);
#endif
#else
(void)vnet_igmp_idetach(NULL);
#endif /* VIMAGE */
vnet_igmp_idetach(NULL);
#endif
igmp_sysuninit();
break;
default:

View File

@ -1100,7 +1100,6 @@ in_ifdetach(struct ifnet *ifp)
static void
in_purgemaddrs(struct ifnet *ifp)
{
INIT_VNET_INET(ifp->if_vnet);
LIST_HEAD(,in_multi) purgeinms;
struct in_multi *inm, *tinm;
struct ifmultiaddr *ifma;

View File

@ -392,7 +392,6 @@ static int
in_getmulti(struct ifnet *ifp, const struct in_addr *group,
struct in_multi **pinm)
{
INIT_VNET_INET(ifp->if_vnet);
struct sockaddr_in gsin;
struct ifmultiaddr *ifma;
struct in_ifinfo *ii;
@ -1808,6 +1807,7 @@ static struct ifnet *
inp_lookup_mcast_ifp(const struct inpcb *inp,
const struct sockaddr_in *gsin, const struct in_addr ina)
{
INIT_VNET_INET(curvnet);
struct ifnet *ifp;
KASSERT(gsin->sin_family == AF_INET, ("%s: not AF_INET", __func__));
@ -1853,7 +1853,6 @@ static int
inp_join_group(struct inpcb *inp, struct sockopt *sopt)
{
INIT_VNET_NET(curvnet);
INIT_VNET_INET(curvnet);
struct group_source_req gsr;
sockunion_t *gsa, *ssa;
struct ifnet *ifp;
@ -2306,6 +2305,7 @@ static int
inp_set_multicast_if(struct inpcb *inp, struct sockopt *sopt)
{
INIT_VNET_NET(curvnet);
INIT_VNET_INET(curvnet);
struct in_addr addr;
struct ip_mreqn mreqn;
struct ifnet *ifp;

View File

@ -250,6 +250,8 @@ static void in_rtqtimo_one(void *rock);
static void
in_rtqtimo(void *rock)
{
INIT_VNET_NET(curvnet);
INIT_VNET_INET(curvnet);
int fibnum;
void *newrock;
struct timeval atv;

View File

@ -132,6 +132,7 @@ static u_long div_recvspace = DIVRCVQ; /* XXX sysctl ? */
static void
div_zone_change(void *tag)
{
INIT_VNET_INET(curvnet);
uma_zone_set_max(V_divcbinfo.ipi_zone, maxsockets);
}
@ -723,6 +724,7 @@ struct protosw div_protosw = {
static int
div_modevent(module_t mod, int type, void *unused)
{
INIT_VNET_INET(curvnet); /* XXX move to iattach - revisit!!! */
int err = 0;
int n;

View File

@ -1818,7 +1818,6 @@ static int
add_table_entry(struct ip_fw_chain *ch, uint16_t tbl, in_addr_t addr,
uint8_t mlen, uint32_t value)
{
INIT_VNET_IPFW(curvnet);
struct radix_node_head *rnh;
struct table_entry *ent;
struct radix_node *rn;
@ -4535,6 +4534,7 @@ struct ip_fw *ip_fw_default_rule;
static void
ipfw_tick(void * __unused unused)
{
INIT_VNET_IPFW(curvnet);
struct mbuf *m0, *m, *mnext, **mtailp;
int i;
ipfw_dyn_rule *q;
@ -4718,6 +4718,7 @@ ipfw_init(void)
void
ipfw_destroy(void)
{
INIT_VNET_IPFW(curvnet);
struct ip_fw *reap;
ip_fw_chk_ptr = NULL;

View File

@ -1709,6 +1709,7 @@ X_ip_rsvp_force_done(struct socket *so __unused)
static void
X_rsvp_input(struct mbuf *m, int off __unused)
{
INIT_VNET_INET(curvnet);
if (!V_rsvp_on)
m_freem(m);

View File

@ -288,6 +288,7 @@ static struct mtx isn_mtx;
static void
tcp_zone_change(void *tag)
{
INIT_VNET_INET(curvnet);
uma_zone_set_max(V_tcbinfo.ipi_zone, maxsockets);
uma_zone_set_max(V_tcpcb_zone, maxsockets);

View File

@ -132,6 +132,7 @@ tcptw_auto_size(void)
static int
sysctl_maxtcptw(SYSCTL_HANDLER_ARGS)
{
INIT_VNET_INET(curvnet);
int error, new;
if (maxtcptw == 0)
@ -158,6 +159,7 @@ SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_tcp, OID_AUTO, nolocaltimewait,
void
tcp_tw_zone_change(void)
{
INIT_VNET_INET(curvnet);
if (maxtcptw == 0)
uma_zone_set_max(V_tcptw_zone, tcptw_auto_size());

View File

@ -155,6 +155,7 @@ static int udp_output(struct inpcb *, struct mbuf *, struct sockaddr *,
static void
udp_zone_change(void *tag)
{
INIT_VNET_INET(curvnet);
uma_zone_set_max(V_udbinfo.ipi_zone, maxsockets);
}

View File

@ -289,8 +289,7 @@ static void
in6_rtqtimo(void *rock)
{
CURVNET_SET_QUIET((struct vnet *) rock);
INIT_VNET_NET((struct vnet *) rock);
INIT_VNET_INET6((struct vnet *) rock);
INIT_VNET_INET6(curvnet);
struct radix_node_head *rnh = rock;
struct rtqk_arg arg;
struct timeval atv;
@ -377,8 +376,7 @@ static void
in6_mtutimo(void *rock)
{
CURVNET_SET_QUIET((struct vnet *) rock);
INIT_VNET_NET((struct vnet *) rock);
INIT_VNET_INET6((struct vnet *) rock);
INIT_VNET_INET6(curvnet);
struct radix_node_head *rnh = rock;
struct mtuex_arg arg;
struct timeval atv;

View File

@ -1549,6 +1549,7 @@ pfxlist_onlink_check()
int
nd6_prefix_onlink(struct nd_prefix *pr)
{
INIT_VNET_NET(curvnet);
INIT_VNET_INET6(curvnet);
struct ifaddr *ifa;
struct ifnet *ifp = pr->ndpr_ifp;