From owner-p4-projects@FreeBSD.ORG Sat May 16 00:21:38 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 598F91065675; Sat, 16 May 2009 00:21:38 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E65D1065670 for ; Sat, 16 May 2009 00:21:38 +0000 (UTC) (envelope-from zec@fer.hr) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id E5D998FC12 for ; Sat, 16 May 2009 00:21:37 +0000 (UTC) (envelope-from zec@fer.hr) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n4G0Lbrp095041 for ; Sat, 16 May 2009 00:21:37 GMT (envelope-from zec@fer.hr) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n4G0Lb9J095039 for perforce@freebsd.org; Sat, 16 May 2009 00:21:37 GMT (envelope-from zec@fer.hr) Date: Sat, 16 May 2009 00:21:37 GMT Message-Id: <200905160021.n4G0Lb9J095039@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to zec@fer.hr using -f From: Marko Zec To: Perforce Change Reviews Cc: Subject: PERFORCE change 162139 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: Sat, 16 May 2009 00:21:40 -0000 http://perforce.freebsd.org/chv.cgi?CH=162139 Change 162139 by zec@zec_tpx32 on 2009/05/16 00:21:31 Reduce diff against svn. Affected files ... .. //depot/projects/vimage-commit2/src/sys/kern/kern_vimage.c#42 edit .. //depot/projects/vimage-commit2/src/sys/net/if.c#63 edit .. //depot/projects/vimage-commit2/src/sys/net/if_clone.c#9 edit .. //depot/projects/vimage-commit2/src/sys/net/if_loop.c#30 edit .. //depot/projects/vimage-commit2/src/sys/sys/vimage.h#61 edit Differences ... ==== //depot/projects/vimage-commit2/src/sys/kern/kern_vimage.c#42 (text+ko) ==== @@ -150,12 +150,6 @@ if (ifp == NULL) return (ENXIO); -#if 0 - /* Abort if driver did not provide a if_reassign() method */ - if (ifp->if_reassign == NULL) - return (ENODEV); -#endif - /* * Check for naming clashes in target vnet. Not locked so races * are possible. @@ -621,20 +615,10 @@ vi_alloc(struct vimage *parent, char *name) { struct vimage *vip; + struct vprocg *vprocg; struct vnet *vnet; - struct vprocg *vprocg; struct vnet_modlink *vml; - /* - * XXX don't forget the locking - */ - - /* A brute force check whether there's enough mem for a new vimage */ - vip = malloc(512*1024, M_VIMAGE, M_NOWAIT); /* XXX aaaargh... */ - if (vip == NULL) - goto vi_alloc_done; - free(vip, M_VIMAGE); - vip = malloc(sizeof(struct vimage), M_VIMAGE, M_NOWAIT | M_ZERO); if (vip == NULL) panic("vi_alloc: malloc failed for vimage \"%s\"\n", name); ==== //depot/projects/vimage-commit2/src/sys/net/if.c#63 (text+ko) ==== @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -765,7 +766,7 @@ IFNET_WLOCK(); TAILQ_INSERT_TAIL(&V_ifnet, ifp, if_link); #ifdef VIMAGE - ++curvnet->ifcnt; + curvnet->ifcnt++; #endif IFNET_WUNLOCK(); @@ -932,7 +933,7 @@ } #ifdef VIMAGE if (found) - --curvnet->ifcnt; + curvnet->ifcnt--; #endif IFNET_WUNLOCK(); if (!found) { ==== //depot/projects/vimage-commit2/src/sys/net/if_clone.c#9 (text+ko) ==== @@ -352,6 +352,7 @@ KASSERT(LIST_EMPTY(&ifc->ifc_iflist), ("%s: ifc_iflist not empty", __func__)); + IF_CLONE_LOCK_DESTROY(ifc); free(ifc->ifc_units, M_CLONE); } ==== //depot/projects/vimage-commit2/src/sys/net/if_loop.c#30 (text+ko) ==== @@ -111,8 +111,6 @@ struct ifnet *loif; /* Used externally */ #endif -IFC_SIMPLE_DECLARE(lo, 1); - #ifdef VIMAGE MALLOC_DEFINE(M_LO_CLONER, "lo_cloner", "lo_cloner"); #endif @@ -126,6 +124,8 @@ }; #endif /* !VIMAGE_GLOBALS */ +IFC_SIMPLE_DECLARE(lo, 1); + static void lo_clone_destroy(struct ifnet *ifp) { ==== //depot/projects/vimage-commit2/src/sys/sys/vimage.h#61 (text+ko) ==== @@ -81,6 +81,7 @@ typedef int vnet_detach_fn(const void *); #ifndef VIMAGE_GLOBALS + struct vnet_symmap { char *name; size_t offset; @@ -233,7 +234,6 @@ #endif #endif - #define curvnet curthread->td_vnet #define VNET_MAGIC_N 0x3e0d8f29