Date: Sun, 21 Jan 2007 10:02:27 GMT From: Marko Zec <zec@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 113246 for review Message-ID: <200701211002.l0LA2Rwx082844@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=113246 Change 113246 by zec@zec_tpx32 on 2007/01/21 10:02:25 Provide access to the virtualized "ifnet" symbol in several linux compatibility routines. Affected files ... .. //depot/projects/vimage/src/sys/compat/linprocfs/linprocfs.c#2 edit .. //depot/projects/vimage/src/sys/compat/linux/linux_ioctl.c#2 edit Differences ... ==== //depot/projects/vimage/src/sys/compat/linprocfs/linprocfs.c#2 (text+ko) ==== @@ -42,6 +42,9 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.101 2006/11/27 21:10:55 jkim Exp $"); +#include "opt_compat.h" +#include "opt_vimage.h" + #include <sys/param.h> #include <sys/queue.h> #include <sys/blist.h> @@ -68,7 +71,9 @@ #include <sys/user.h> #include <sys/vmmeter.h> #include <sys/vnode.h> +#include <sys/vimage.h> +#include <net/vnet.h> #include <net/if.h> #include <vm/vm.h> @@ -85,7 +90,6 @@ #include <machine/md_var.h> #endif /* __i386__ || __amd64__ */ -#include "opt_compat.h" #ifdef COMPAT_LINUX32 /* XXX */ #include <machine/../linux32/linux.h> #else @@ -902,6 +906,7 @@ static int linprocfs_donetdev(PFS_FILL_ARGS) { + INIT_VNET_NET(curthread->td_vimage->v_vnetb); char ifname[16]; /* XXX LINUX_IFNAMSIZ */ struct ifnet *ifp; @@ -911,7 +916,7 @@ "bytes packets errs drop fifo frame compressed"); IFNET_RLOCK(); - TAILQ_FOREACH(ifp, &ifnet, if_link) { + TAILQ_FOREACH(ifp, &V_ifnet, if_link) { linux_ifname(ifp, ifname, sizeof ifname); sbuf_printf(sb, "%6.6s:", ifname); sbuf_printf(sb, "%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu ", ==== //depot/projects/vimage/src/sys/compat/linux/linux_ioctl.c#2 (text+ko) ==== @@ -29,6 +29,9 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/compat/linux/linux_ioctl.c,v 1.137 2006/07/06 21:42:36 jhb Exp $"); +#include "opt_vimage.h" +#include "opt_compat.h" + #include <sys/param.h> #include <sys/systm.h> #include <sys/sysproto.h> @@ -56,12 +59,13 @@ #include <sys/sx.h> #include <sys/tty.h> #include <sys/uio.h> +#include <sys/vimage.h> + +#include <net/vnet.h> #include <net/if.h> #include <net/if_dl.h> #include <net/if_types.h> -#include "opt_compat.h" - #ifdef COMPAT_LINUX32 #include <machine/../linux32/linux.h> #include <machine/../linux32/linux32_proto.h> @@ -2028,6 +2032,7 @@ int linux_ifname(struct ifnet *ifp, char *buffer, size_t buflen) { + INIT_VNET_NET(ifp->if_vnetb); struct ifnet *ifscan; int ethno; @@ -2038,7 +2043,7 @@ /* Determine the (relative) unit number for ethernet interfaces */ ethno = 0; IFNET_RLOCK(); - TAILQ_FOREACH(ifscan, &ifnet, if_link) { + TAILQ_FOREACH(ifscan, &V_ifnet, if_link) { if (ifscan == ifp) { IFNET_RUNLOCK(); return (snprintf(buffer, buflen, "eth%d", ethno)); @@ -2061,6 +2066,7 @@ static struct ifnet * ifname_linux_to_bsd(const char *lxname, char *bsdname) { + INIT_VNET_NET(curthread->td_vimage->v_vnetb); struct ifnet *ifp; int len, unit; char *ep; @@ -2077,7 +2083,7 @@ index = 0; is_eth = (len == 3 && !strncmp(lxname, "eth", len)) ? 1 : 0; IFNET_RLOCK(); - TAILQ_FOREACH(ifp, &ifnet, if_link) { + TAILQ_FOREACH(ifp, &V_ifnet, if_link) { /* * Allow Linux programs to use FreeBSD names. Don't presume * we never have an interface named "eth", so don't make @@ -2101,6 +2107,7 @@ static int linux_ifconf(struct thread *td, struct ifconf *uifc) { + INIT_VNET_NET(td->td_vimage->v_vnetb); #ifdef COMPAT_LINUX32 struct l_ifconf ifc; #else @@ -2121,7 +2128,7 @@ /* handle the 'request buffer size' case */ if (ifc.ifc_buf == PTROUT(NULL)) { ifc.ifc_len = 0; - TAILQ_FOREACH(ifp, &ifnet, if_link) { + TAILQ_FOREACH(ifp, &V_ifnet, if_link) { TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa = ifa->ifa_addr; if (sa->sa_family == AF_INET) @@ -2148,7 +2155,7 @@ /* Return all AF_INET addresses of all interfaces */ IFNET_RLOCK(); /* could sleep XXX */ - TAILQ_FOREACH(ifp, &ifnet, if_link) { + TAILQ_FOREACH(ifp, &V_ifnet, if_link) { int addrs = 0; bzero(&ifr, sizeof(ifr));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701211002.l0LA2Rwx082844>