From owner-p4-projects@FreeBSD.ORG Sun Jan 21 10:02:28 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id CB3A316A51D; Sun, 21 Jan 2007 10:02:28 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 71DF916A4EB for ; Sun, 21 Jan 2007 10:02:28 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 6279D13C45A for ; Sun, 21 Jan 2007 10:02:28 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id l0LA2Scf082850 for ; Sun, 21 Jan 2007 10:02:28 GMT (envelope-from zec@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l0LA2Rwx082844 for perforce@freebsd.org; Sun, 21 Jan 2007 10:02:27 GMT (envelope-from zec@FreeBSD.org) Date: Sun, 21 Jan 2007 10:02:27 GMT Message-Id: <200701211002.l0LA2Rwx082844@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to zec@FreeBSD.org using -f From: Marko Zec To: Perforce Change Reviews Cc: Subject: PERFORCE change 113246 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jan 2007 10:02:29 -0000 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 __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 #include #include @@ -68,7 +71,9 @@ #include #include #include +#include +#include #include #include @@ -85,7 +90,6 @@ #include #endif /* __i386__ || __amd64__ */ -#include "opt_compat.h" #ifdef COMPAT_LINUX32 /* XXX */ #include #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 __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 #include #include @@ -56,12 +59,13 @@ #include #include #include +#include + +#include #include #include #include -#include "opt_compat.h" - #ifdef COMPAT_LINUX32 #include #include @@ -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));