Date: Wed, 25 Jul 2007 23:20:37 GMT From: Marko Zec <zec@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 124103 for review Message-ID: <200707252320.l6PNKbjo098633@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=124103 Change 124103 by zec@zec_tca51 on 2007/07/25 23:20:21 Introduce a macro for checking whether a vnet is the default vnet (vnet_0) or not. This change will probably start making more sense once vnet_0 gets nuked (soon). Affected files ... .. //depot/projects/vimage/src/sys/kern/kern_vimage.c#26 edit .. //depot/projects/vimage/src/sys/kern/uipc_usrreq.c#9 edit .. //depot/projects/vimage/src/sys/net/if.c#15 edit .. //depot/projects/vimage/src/sys/net/if_loop.c#14 edit .. //depot/projects/vimage/src/sys/netgraph/ng_base.c#10 edit .. //depot/projects/vimage/src/sys/netinet/igmp.c#9 edit .. //depot/projects/vimage/src/sys/netinet/ip_input.c#17 edit .. //depot/projects/vimage/src/sys/netinet/tcp_hostcache.c#14 edit .. //depot/projects/vimage/src/sys/netinet/tcp_subr.c#21 edit .. //depot/projects/vimage/src/sys/netinet/tcp_timewait.c#8 edit .. //depot/projects/vimage/src/sys/netinet/udp_usrreq.c#16 edit .. //depot/projects/vimage/src/sys/netinet6/frag6.c#7 edit .. //depot/projects/vimage/src/sys/netinet6/in6_src.c#10 edit .. //depot/projects/vimage/src/sys/netinet6/ip6_input.c#15 edit .. //depot/projects/vimage/src/sys/netinet6/scope6.c#9 edit .. //depot/projects/vimage/src/sys/netipsec/ipsec.c#10 edit .. //depot/projects/vimage/src/sys/netipsec/key.c#9 edit .. //depot/projects/vimage/src/sys/netipsec/xform_ah.c#7 edit .. //depot/projects/vimage/src/sys/netipsec/xform_esp.c#6 edit .. //depot/projects/vimage/src/sys/netipsec/xform_ipcomp.c#5 edit .. //depot/projects/vimage/src/sys/netipsec/xform_ipip.c#7 edit .. //depot/projects/vimage/src/sys/sys/vimage.h#24 edit Differences ... ==== //depot/projects/vimage/src/sys/kern/kern_vimage.c#26 (text+ko) ==== @@ -601,9 +601,7 @@ TAILQ_INIT(&vnet_modlink_head); - /* - * We MUST clear curvnet in vi_init_done before going SMP. - */ + /* We MUST clear curvnet in vi_init_done before going SMP. */ curvnet = &vnet_0; } ==== //depot/projects/vimage/src/sys/kern/uipc_usrreq.c#9 (text+ko) ==== @@ -1654,7 +1654,7 @@ { #ifdef VIMAGE - if (curvnet != &vnet_0) + if (!IS_VNET_0(curvnet)) return; #endif unp_zone = uma_zcreate("unpcb", sizeof(struct unpcb), NULL, NULL, ==== //depot/projects/vimage/src/sys/net/if.c#15 (text+ko) ==== @@ -335,7 +335,7 @@ #endif IFNET_LOCK_INIT(); #ifdef VIMAGE - if (curvnet == &vnet_0) { + if (IS_VNET_0(curvnet)) { INIT_VNET_NET(curvnet); #endif ifdev_byindex(0) = make_dev(&net_cdevsw, 0, @@ -353,7 +353,7 @@ #ifdef VIMAGE struct vnet_net *vnet_net; - if (curvnet == &vnet_0) { + if (IS_VNET_0(curvnet)) { vnet_net = &vnet_net_0; } else { vnet_net = malloc(sizeof(struct vnet_net), @@ -422,7 +422,7 @@ int s; #ifdef VIMAGE - if (curvnet != &vnet_0) + if (!IS_VNET_0(curvnet)) panic("if_check() called for a non-default vimage!?!"); #endif @@ -590,7 +590,7 @@ #endif #ifdef VIMAGE - if (curvnet == &vnet_0) { + if (IS_VNET_0(curvnet)) { #endif ifdev_byindex(ifp->if_index) = make_dev(&net_cdevsw, unit2minor(ifp->if_index), @@ -843,7 +843,7 @@ */ ifp->if_addr = NULL; #ifdef VIMAGE - if (curvnet == &vnet_0) { + if (IS_VNET_0(curvnet)) { #endif destroy_dev(ifdev_byindex(ifp->if_index)); #ifdef VIMAGE ==== //depot/projects/vimage/src/sys/net/if_loop.c#14 (text+ko) ==== @@ -196,7 +196,7 @@ LIST_INIT(&V_lo_list); #ifdef VIMAGE - if (curvnet == &vnet_0) + if (IS_VNET_0(curvnet)) if_clone_attach(&lo_cloner); else lo_cloner.ifc_attach(&lo_cloner); ==== //depot/projects/vimage/src/sys/netgraph/ng_base.c#10 (text+ko) ==== @@ -3215,7 +3215,7 @@ #ifdef VIMAGE struct vnet_netgraph *vnet_netgraph; - if (curvnet == &vnet_0) { + if (IS_VNET_0(curvnet)) { vnet_netgraph = &vnet_netgraph_0; } else { vnet_netgraph = malloc(sizeof(struct vnet_netgraph), ==== //depot/projects/vimage/src/sys/netinet/igmp.c#9 (text+ko) ==== @@ -125,7 +125,7 @@ struct ipoption *ra; #ifdef VIMAGE - if (curvnet == &vnet_0) { + if (IS_VNET_0(curvnet)) { #endif /* * To avoid byte-swapping the same value over and over again. ==== //depot/projects/vimage/src/sys/netinet/ip_input.c#17 (text+ko) ==== @@ -243,7 +243,7 @@ #ifdef VIMAGE struct vnet_inet *vnet_inet; - if (curvnet == &vnet_0) { + if (IS_VNET_0(curvnet)) { vnet_mod_register(&vnet_inet_modinfo); vnet_inet = &vnet_inet_0; } else { @@ -299,11 +299,8 @@ V_ip_checkinterface = 0; #ifdef VIMAGE - /* - * Skip global initialization stuff - * for non-default instances. - */ - if (curvnet != &vnet_0) + /* Skip initialization of globals for non-default instances. */ + if (!IS_VNET_0(curvnet)) return; #endif ==== //depot/projects/vimage/src/sys/netinet/tcp_hostcache.c#14 (text+ko) ==== @@ -223,7 +223,7 @@ uma_zone_set_max(V_tcp_hostcache.zone, V_tcp_hostcache.cache_limit); #ifdef VIMAGE - if (curvnet != &vnet_0) + if (!IS_VNET_0(curvnet)) return; #endif ==== //depot/projects/vimage/src/sys/netinet/tcp_subr.c#21 (text+ko) ==== @@ -268,7 +268,7 @@ INIT_VNET_INET(curvnet); #ifdef VIMAGE - if (curvnet == &vnet_0) { + if (IS_VNET_0(curvnet)) { #endif tcp_ipi_zone = uma_zcreate("inpcb", sizeof(struct inpcb), NULL, NULL, tcp_inpcb_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); @@ -363,7 +363,7 @@ tcp_hc_init(); #ifdef VIMAGE - if (curvnet != &vnet_0) + if (!IS_VNET_0(curvnet)) return; #endif ==== //depot/projects/vimage/src/sys/netinet/tcp_timewait.c#8 (text+ko) ==== @@ -170,7 +170,7 @@ TAILQ_INIT(&V_twq_2msl); #ifdef VIMAGE - if (curvnet != &vnet_0) + if (!IS_VNET_0(curvnet)) return; #endif ==== //depot/projects/vimage/src/sys/netinet/udp_usrreq.c#16 (text+ko) ==== @@ -174,7 +174,7 @@ INIT_VNET_INET(curvnet); #ifdef VIMAGE - if (curvnet == &vnet_0) { + if (IS_VNET_0(curvnet)) { #endif udp_ipi_zone = uma_zcreate("udpcb", sizeof(struct inpcb), NULL, NULL, udp_inpcb_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); ==== //depot/projects/vimage/src/sys/netinet6/frag6.c#7 (text+ko) ==== @@ -108,7 +108,7 @@ V_ip6q.ip6q_next = V_ip6q.ip6q_prev = &V_ip6q; #ifdef VIMAGE - if (curvnet != &vnet_0) + if (!IS_VNET_0(curvnet)) return; #endif ip6_maxfragpackets = nmbclusters / 4; ==== //depot/projects/vimage/src/sys/netinet6/in6_src.c#10 (text+ko) ==== @@ -855,7 +855,7 @@ V_defaultaddrpolicy.label = ADDR_LABEL_NOTAPP; #ifdef VIMAGE - if (curvnet != &vnet_0) + if (!IS_VNET_0(curvnet)) return; #endif ==== //depot/projects/vimage/src/sys/netinet6/ip6_input.c#15 (text+ko) ==== @@ -176,7 +176,7 @@ #ifdef VIMAGE struct vnet_inet6 *vnet_inet6; - if (curvnet == &vnet_0) { + if (IS_VNET_0(curvnet)) { vnet_mod_register(&vnet_inet6_modinfo); vnet_inet6 = &vnet_inet6_0; } else { @@ -199,7 +199,7 @@ * Skip global initialization stuff * for non-default instances. */ - if (curvnet != &vnet_0) + if (!IS_VNET_0(curvnet)) return; #endif ==== //depot/projects/vimage/src/sys/netinet6/scope6.c#9 (text+ko) ==== @@ -82,7 +82,7 @@ bzero(&V_sid_default, sizeof(V_sid_default)); #ifdef VIMAGE - if (curvnet != &vnet_0) + if (!IS_VNET_0(curvnet)) return; #endif ==== //depot/projects/vimage/src/sys/netipsec/ipsec.c#10 (text+ko) ==== @@ -2004,7 +2004,7 @@ #ifdef VIMAGE struct vnet_ipsec *vnet_ipsec; - if (curvnet == &vnet_0) { + if (IS_VNET_0(curvnet)) { vnet_ipsec = &vnet_ipsec_0; } else { vnet_ipsec = malloc(sizeof(struct vnet_ipsec), ==== //depot/projects/vimage/src/sys/netipsec/key.c#9 (text+ko) ==== @@ -7173,7 +7173,7 @@ V_ipsec_esp_auth = 0; V_ipsec_ah_keymin = 128; #ifdef VIMAGE - if (curvnet == &vnet_0) { + if (!IS_VNET_0(curvnet)) { #endif SPTREE_LOCK_INIT(); REGTREE_LOCK_INIT(); @@ -7200,12 +7200,9 @@ #ifndef IPSEC_DEBUG2 #ifdef VIMAGE - if (curvnet == &vnet_0) { + if (IS_VNET_0(curvnet)) #endif timeout((void *)key_timehandler, (void *)0, hz); -#ifdef VIMAGE - } -#endif #endif /*IPSEC_DEBUG2*/ /* initialize key statistics */ ==== //depot/projects/vimage/src/sys/netipsec/xform_ah.c#7 (text+ko) ==== @@ -1254,12 +1254,9 @@ V_ah_cleartos = 1; /* clear ip_tos when doing AH calc */ #ifdef VIMAGE - if (curvnet == &vnet_0) { + if (IS_VNET_0(curvnet)) #endif xform_register(&ah_xformsw); -#ifdef VIMAGE - } -#endif return 0; } ==== //depot/projects/vimage/src/sys/netipsec/xform_esp.c#6 (text+ko) ==== @@ -1039,12 +1039,9 @@ MAXIV(enc_xform_camellia); /* SADB_X_EALG_CAMELLIACBC */ #ifdef VIMAGE - if (curvnet == &vnet_0) { + if (IS_VNET_0(curvnet)) #endif xform_register(&esp_xformsw); -#ifdef VIMAGE - } -#endif #undef MAXIV return 0; ==== //depot/projects/vimage/src/sys/netipsec/xform_ipcomp.c#5 (text+ko) ==== @@ -633,12 +633,10 @@ V_ipcomp_enable = 0; #ifdef VIMAGE - if (curvnet == &vnet_0) { + if (IS_VNET_0(curvnet)) #endif xform_register(&ipcomp_xformsw); -#ifdef VIMAGE - } -#endif + return 0; } ==== //depot/projects/vimage/src/sys/netipsec/xform_ipip.c#7 (text+ko) ==== @@ -709,7 +709,7 @@ V_ipip_allow = 0; #ifdef VIMAGE - if (curvnet == &vnet_0) { + if (IS_VNET_0(curvnet)) { #endif xform_register(&ipe4_xformsw); /* attach to encapsulation framework */ ==== //depot/projects/vimage/src/sys/sys/vimage.h#24 (text+ko) ==== @@ -292,6 +292,7 @@ LIST_HEAD(vnet_list_head, vnet); extern struct vnet_list_head vnet_head; +#define IS_VNET_0(arg) ((arg) == &vnet_0 ? 1 : 0) /* * XXX The stuff bellow needs a major cleanup / rewrite from scratch.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707252320.l6PNKbjo098633>