Date: Mon, 8 Dec 2008 17:28:51 GMT From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 154345 for review Message-ID: <200812081728.mB8HSpAB094931@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=154345 Change 154345 by bz@bz_dumpster on 2008/12/08 17:28:30 - Whitepsace. - Move vnet_net_0 to if.c where the varsyms for vnet.h members are iniatlized as well. - correctly initialize vnets for one_pass which was moved to vinet. - explicitly include lock.h/rwlock.h for the files including ip_fw.h instead of polluting the namespace/userland. Reviewed by: zec Affected files ... .. //depot/projects/vimage-commit2/src/sys/kern/kern_linker.c#7 edit .. //depot/projects/vimage-commit2/src/sys/kern/kern_vimage.c#5 edit .. //depot/projects/vimage-commit2/src/sys/net/if.c#29 edit .. //depot/projects/vimage-commit2/src/sys/net/if_bridge.c#12 edit .. //depot/projects/vimage-commit2/src/sys/net/if_ethersubr.c#17 edit .. //depot/projects/vimage-commit2/src/sys/net/route.c#24 edit .. //depot/projects/vimage-commit2/src/sys/netgraph/ng_bridge.c#9 edit .. //depot/projects/vimage-commit2/src/sys/netgraph/ng_ipfw.c#8 edit .. //depot/projects/vimage-commit2/src/sys/netinet/ip_divert.c#20 edit .. //depot/projects/vimage-commit2/src/sys/netinet/ip_dummynet.c#6 edit .. //depot/projects/vimage-commit2/src/sys/netinet/ip_fw.h#15 edit .. //depot/projects/vimage-commit2/src/sys/netinet/ip_fw2.c#30 edit .. //depot/projects/vimage-commit2/src/sys/netinet/ip_fw_nat.c#9 edit .. //depot/projects/vimage-commit2/src/sys/netinet/ip_fw_pfil.c#11 edit .. //depot/projects/vimage-commit2/src/sys/netinet/ip_input.c#24 edit .. //depot/projects/vimage-commit2/src/sys/netinet/libalias/alias_db.c#4 edit .. //depot/projects/vimage-commit2/src/sys/netinet/raw_ip.c#20 edit .. //depot/projects/vimage-commit2/src/sys/netinet/vinet.h#22 edit .. //depot/projects/vimage-commit2/src/sys/sys/sysctl.h#13 edit .. //depot/projects/vimage-commit2/src/sys/sys/vimage.h#25 edit Differences ... ==== //depot/projects/vimage-commit2/src/sys/kern/kern_linker.c#7 (text+ko) ==== @@ -1304,8 +1304,8 @@ } #ifndef VIMAGE_GLOBALS /* - * If the symbol is not found in global namespace, look up - * for it in the current vimage. + * If the symbol is not found in global namespace, + * try to look it up in the current vimage namespace. */ if (lf == NULL) { CURVNET_SET(TD_TO_VNET(td)); ==== //depot/projects/vimage-commit2/src/sys/kern/kern_vimage.c#5 (text+ko) ==== @@ -29,8 +29,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: $" -); +__FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/types.h> @@ -51,10 +50,10 @@ { struct vnet_modlink *vml, *vml_iter; - /* Do not register the same module instance more than once */ + /* Do not register the same module instance more than once. */ TAILQ_FOREACH(vml_iter, &vnet_modlink_head, vml_mod_le) if (vml_iter->vml_modinfo == vmi) - panic("vnet_mod_register: %s", vmi->vmi_name); + panic("%s: %s", __func__, vmi->vmi_name); vml = malloc(sizeof(struct vnet_modlink), M_VIMAGE, M_NOWAIT); vml->vml_modinfo = vmi; TAILQ_INSERT_TAIL(&vnet_modlink_head, vml, vml_mod_le); @@ -70,13 +69,11 @@ vi_symlookup(struct kld_sym_lookup *lookup, char *symstr) { struct vnet_modlink *vml; + struct vnet_symmap *mapentry; TAILQ_FOREACH(vml, &vnet_modlink_head, vml_mod_le) { - struct vnet_symmap *mapentry; - if (vml->vml_modinfo->vmi_symmap == NULL) continue; - for (mapentry = vml->vml_modinfo->vmi_symmap; mapentry->name != NULL; mapentry++) { if (strcmp(symstr, mapentry->name) == 0) { @@ -86,7 +83,6 @@ } } } - return (ENOENT); } ==== //depot/projects/vimage-commit2/src/sys/net/if.c#29 (text+ko) ==== @@ -88,6 +88,12 @@ #include <security/mac/mac_framework.h> +#ifndef VIMAGE +#ifndef VIMAGE_GLOBALS +struct vnet_net vnet_net_0; +#endif +#endif + SYSCTL_NODE(_net, PF_LINK, link, CTLFLAG_RW, 0, "Link layers"); SYSCTL_NODE(_net_link, 0, generic, CTLFLAG_RW, 0, "Generic link-management"); ==== //depot/projects/vimage-commit2/src/sys/net/if_bridge.c#12 (text+ko) ==== @@ -100,6 +100,7 @@ #include <sys/proc.h> #include <sys/lock.h> #include <sys/mutex.h> +#include <sys/rwlock.h> #include <sys/vimage.h> #include <net/bpf.h> @@ -3041,7 +3042,7 @@ } if (IPFW_LOADED && pfil_ipfw != 0 && dir == PFIL_OUT && ifp != NULL) { - INIT_VNET_IPFW(curvnet); + INIT_VNET_INET(curvnet); error = -1; args.rule = ip_dn_claim_rule(*mp); ==== //depot/projects/vimage-commit2/src/sys/net/if_ethersubr.c#17 (text+ko) ==== @@ -42,10 +42,12 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> +#include <sys/lock.h> #include <sys/malloc.h> #include <sys/module.h> #include <sys/mbuf.h> #include <sys/random.h> +#include <sys/rwlock.h> #include <sys/socket.h> #include <sys/sockio.h> #include <sys/sysctl.h> @@ -427,7 +429,7 @@ ether_ipfw_chk(struct mbuf **m0, struct ifnet *dst, struct ip_fw **rule, int shared) { - INIT_VNET_NET(dst->if_vnet); + INIT_VNET_INET(dst->if_vnet); struct ether_header *eh; struct ether_header save_eh; struct mbuf *m; ==== //depot/projects/vimage-commit2/src/sys/net/route.c#24 (text+ko) ==== @@ -65,12 +65,6 @@ #include <vm/uma.h> -#ifndef VIMAGE -#ifndef VIMAGE_GLOBALS -struct vnet_net vnet_net_0; -#endif -#endif - u_int rt_numfibs = RT_NUMFIBS; SYSCTL_INT(_net, OID_AUTO, fibs, CTLFLAG_RD, &rt_numfibs, 0, ""); /* ==== //depot/projects/vimage-commit2/src/sys/netgraph/ng_bridge.c#9 (text+ko) ==== @@ -61,9 +61,11 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> +#include <sys/lock.h> #include <sys/malloc.h> #include <sys/mbuf.h> #include <sys/errno.h> +#include <sys/rwlock.h> #include <sys/syslog.h> #include <sys/socket.h> #include <sys/ctype.h> ==== //depot/projects/vimage-commit2/src/sys/netgraph/ng_ipfw.c#8 (text+ko) ==== @@ -29,10 +29,12 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> +#include <sys/lock.h> #include <sys/mbuf.h> #include <sys/malloc.h> #include <sys/ctype.h> #include <sys/errno.h> +#include <sys/rwlock.h> #include <sys/socket.h> #include <sys/syslog.h> ==== //depot/projects/vimage-commit2/src/sys/netinet/ip_divert.c#20 (text+ko) ==== @@ -52,6 +52,7 @@ #include <sys/priv.h> #include <sys/proc.h> #include <sys/protosw.h> +#include <sys/rwlock.h> #include <sys/signalvar.h> #include <sys/socket.h> #include <sys/socketvar.h> ==== //depot/projects/vimage-commit2/src/sys/netinet/ip_dummynet.c#6 (text+ko) ==== @@ -62,9 +62,11 @@ #include <sys/malloc.h> #include <sys/mbuf.h> #include <sys/kernel.h> +#include <sys/lock.h> #include <sys/module.h> #include <sys/priv.h> #include <sys/proc.h> +#include <sys/rwlock.h> #include <sys/socket.h> #include <sys/socketvar.h> #include <sys/time.h> ==== //depot/projects/vimage-commit2/src/sys/netinet/ip_fw.h#15 (text+ko) ==== @@ -28,8 +28,6 @@ #ifndef _IPFW2_H #define _IPFW2_H -#include <sys/rwlock.h> - /* * The default rule number. By the design of ip_fw, the default rule * is the last one, so its number can also serve as the highest number ==== //depot/projects/vimage-commit2/src/sys/netinet/ip_fw2.c#30 (text+ko) ==== @@ -4527,10 +4527,10 @@ int error; V_fw_debug = 1; - V_autoinc_step = 100; /* bounded to 1..1000 in add_rule() */ + V_autoinc_step = 100; /* bounded to 1..1000 in add_rule() */ V_ipfw_dyn_v = NULL; - V_dyn_buckets = 256; /* must be power of 2 */ + V_dyn_buckets = 256; /* must be power of 2 */ V_curr_dyn_buckets = 256; /* must be power of 2 */ V_dyn_ack_lifetime = 300; ==== //depot/projects/vimage-commit2/src/sys/netinet/ip_fw_nat.c#9 (text+ko) ==== ==== //depot/projects/vimage-commit2/src/sys/netinet/ip_fw_pfil.c#11 (text+ko) ==== @@ -43,6 +43,8 @@ #include <sys/mbuf.h> #include <sys/module.h> #include <sys/kernel.h> +#include <sys/lock.h> +#include <sys/rwlock.h> #include <sys/socket.h> #include <sys/socketvar.h> #include <sys/sysctl.h> ==== //depot/projects/vimage-commit2/src/sys/netinet/ip_input.c#24 (text+ko) ==== @@ -49,6 +49,8 @@ #include <sys/socket.h> #include <sys/time.h> #include <sys/kernel.h> +#include <sys/lock.h> +#include <sys/rwlock.h> #include <sys/syslog.h> #include <sys/sysctl.h> #include <sys/vimage.h> ==== //depot/projects/vimage-commit2/src/sys/netinet/libalias/alias_db.c#4 (text+ko) ==== @@ -146,7 +146,9 @@ #include <machine/stdarg.h> #include <sys/param.h> #include <sys/kernel.h> +#include <sys/lock.h> #include <sys/module.h> +#include <sys/rwlock.h> #include <sys/syslog.h> #else #include <stdarg.h> ==== //depot/projects/vimage-commit2/src/sys/netinet/raw_ip.c#20 (text+ko) ==== @@ -46,6 +46,7 @@ #include <sys/priv.h> #include <sys/proc.h> #include <sys/protosw.h> +#include <sys/rwlock.h> #include <sys/signalvar.h> #include <sys/socket.h> #include <sys/socketvar.h> ==== //depot/projects/vimage-commit2/src/sys/netinet/vinet.h#22 (text+ko) ==== @@ -220,7 +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_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) @@ -339,6 +339,6 @@ #define V_udpstat VNET_INET(udpstat) #define V_useloopback VNET_INET(useloopback) -#define ip_newid() (V_ip_do_randomid != 0 ? ip_randomid() : htons(V_ip_id++)) +#define ip_newid() ((V_ip_do_randomid != 0) ? ip_randomid() : htons(V_ip_id++)) #endif /* !_NETINET_VINET_H_ */ ==== //depot/projects/vimage-commit2/src/sys/sys/sysctl.h#13 (text+ko) ==== @@ -227,7 +227,7 @@ #ifdef VIMAGE #define SYSCTL_V_OID(subs, mod, parent, nbr, name, kind, a1, a2, \ - handler, fmt, descr) \ + handler, fmt, descr) \ static struct sysctl_oid sysctl__##parent##_##name = { \ &sysctl_##parent##_children, { 0 }, nbr, kind, \ (void *) offsetof(struct mod, _##a1), a2, #name, \ ==== //depot/projects/vimage-commit2/src/sys/sys/vimage.h#25 (text+ko) ==== @@ -35,12 +35,8 @@ #include <sys/queue.h> -struct vnet_modinfo; struct kld_sym_lookup; -int vi_symlookup(struct kld_sym_lookup *, char *); -void vnet_mod_register(const struct vnet_modinfo *); - struct vnet_symmap { char *name; void *base; @@ -67,8 +63,12 @@ #ifdef VIMAGE_GLOBALS #define VSYM(base, sym) (sym) #else +#ifdef VIMAGE +#error "No option VIMAGE yet!" +#else #define VSYM(base, sym) (base ## _0._ ## sym) #endif +#endif #define VNET_SYMMAP(mod, name) \ { #name, &(vnet_ ## mod ## _0._ ## name), \ @@ -105,4 +105,7 @@ #define G_hostname VPROCG(hostname) /* global hostname */ #define V_domainname VPROCG(domainname) +int vi_symlookup(struct kld_sym_lookup *, char *); +void vnet_mod_register(const struct vnet_modinfo *); + #endif /* !_SYS_VIMAGE_H_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812081728.mB8HSpAB094931>