From owner-p4-projects@FreeBSD.ORG Thu Apr 16 13:51:46 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5C0F610656C9; Thu, 16 Apr 2009 13:51:45 +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 1257610656C2 for ; Thu, 16 Apr 2009 13:51:45 +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 00FD48FC08 for ; Thu, 16 Apr 2009 13:51:45 +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 n3GDpi7L010990 for ; Thu, 16 Apr 2009 13:51:44 GMT (envelope-from zec@fer.hr) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n3GDpicO010988 for perforce@freebsd.org; Thu, 16 Apr 2009 13:51:44 GMT (envelope-from zec@fer.hr) Date: Thu, 16 Apr 2009 13:51:44 GMT Message-Id: <200904161351.n3GDpicO010988@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 160695 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: Thu, 16 Apr 2009 13:51:47 -0000 http://perforce.freebsd.org/chv.cgi?CH=160695 Change 160695 by zec@zec_amdx2 on 2009/04/16 13:50:57 Small steps towards booting VIMAGE. Affected files ... .. //depot/projects/vimage-commit2/src/sys/kern/uipc_socket.c#14 edit .. //depot/projects/vimage-commit2/src/sys/net/if.c#44 edit .. //depot/projects/vimage-commit2/src/sys/netinet6/in6_rmx.c#27 edit .. //depot/projects/vimage-commit2/src/sys/netinet6/nd6.c#26 edit .. //depot/projects/vimage-commit2/src/sys/sys/vimage.h#40 edit Differences ... ==== //depot/projects/vimage-commit2/src/sys/kern/uipc_socket.c#14 (text+ko) ==== @@ -130,6 +130,7 @@ #include #include #include +#include #include @@ -284,6 +285,9 @@ mtx_lock(&so_global_mtx); so->so_gencnt = ++so_gencnt; ++numopensockets; +#ifdef VIMAGE + so->so_vnet = curvnet; +#endif mtx_unlock(&so_global_mtx); return (so); } ==== //depot/projects/vimage-commit2/src/sys/net/if.c#44 (text+ko) ==== @@ -598,6 +598,10 @@ panic ("%s: BUG: if_attach called without if_alloc'd input()\n", ifp->if_xname); +#ifdef VIMAGE + ifp->if_vnet = curvnet; +#endif + TASK_INIT(&ifp->if_linktask, 0, do_link_state_change, ifp); IF_AFDATA_LOCK_INIT(ifp); ifp->if_afdata_initialized = 0; @@ -911,6 +915,9 @@ knlist_destroy(&ifp->if_klist); ifq_detach(&ifp->if_snd); IF_AFDATA_DESTROY(ifp); +#ifdef VIMAGE + ifp->if_vnet = NULL; +#endif splx(s); } @@ -920,7 +927,10 @@ int if_addgroup(struct ifnet *ifp, const char *groupname) { +printf("%s #0 ifp->if_vnet=%p\n", __FUNCTION__, ifp); +printf("%s #1 ifp->if_vnet=%p\n", __FUNCTION__, ifp->if_vnet); INIT_VNET_NET(ifp->if_vnet); +printf("%s #2 ifp->if_vnet=%p\n", __FUNCTION__, ifp->if_vnet); struct ifg_list *ifgl; struct ifg_group *ifg = NULL; struct ifg_member *ifgm; ==== //depot/projects/vimage-commit2/src/sys/netinet6/in6_rmx.c#27 (text+ko) ==== @@ -288,8 +288,8 @@ static void in6_rtqtimo(void *rock) { - CURVNET_SET_QUIET((struct vnet *) rock); - INIT_VNET_INET6((struct vnet *) rock); + CURVNET_SET_QUIET((struct vnet *) rock); /* XXX revisit ! */ + INIT_VNET_INET6(curvnet); /* XXX revisit ! */ struct radix_node_head *rnh = rock; struct rtqk_arg arg; struct timeval atv; @@ -375,8 +375,8 @@ static void in6_mtutimo(void *rock) { - CURVNET_SET_QUIET((struct vnet *) rock); - INIT_VNET_INET6((struct vnet *) rock); + CURVNET_SET_QUIET((struct vnet *) rock); /* XXX revisit! */ + INIT_VNET_INET6(curvnet); /* XXX revisit! */ struct radix_node_head *rnh = rock; struct mtuex_arg arg; struct timeval atv; ==== //depot/projects/vimage-commit2/src/sys/netinet6/nd6.c#26 (text+ko) ==== @@ -592,8 +592,8 @@ void nd6_timer(void *arg) { - CURVNET_SET_QUIET((struct vnet *) arg); - INIT_VNET_INET6((struct vnet *) arg); + CURVNET_SET_QUIET((struct vnet *) arg); /* XXX revisit! */ + INIT_VNET_INET6(curvnet); /* XXX revisit! */ int s; struct nd_defrouter *dr; struct nd_prefix *pr; ==== //depot/projects/vimage-commit2/src/sys/sys/vimage.h#40 (text+ko) ==== @@ -39,6 +39,10 @@ #error "You cannot have both option VIMAGE and option VIMAGE_GLOBALS!" #endif +#ifdef INVARIANTS +#define VNET_DEBUG +#endif + typedef int vnet_attach_fn(const void *); typedef int vnet_detach_fn(const void *); @@ -157,15 +161,15 @@ #ifdef VIMAGE #ifdef VNET_DEBUG -#define INIT_FROM_VNET(vnet, modindex, modtype, sym) \ - if (vnet != curvnet) \ - panic("in %s:%d %s()\n vnet=%p curvnet=%p", \ - __FILE__, __LINE__, __FUNCTION__, \ - vnet, curvnet); \ - modtype *sym = (vnet)->mod_data[modindex]; +#define INIT_FROM_VNET(vnet, modindex, modtype, sym) \ + if (vnet == NULL || vnet != curvnet) \ + panic("in %s:%d %s()\n vnet=%p curvnet=%p", \ + __FILE__, __LINE__, __FUNCTION__, \ + vnet, curvnet); \ + modtype *sym = (vnet)->mod_data[modindex]; #else /* !VNET_DEBUG */ -#define INIT_FROM_VNET(vnet, modindex, modtype, sym) \ - modtype *sym = (vnet)->mod_data[modindex]; +#define INIT_FROM_VNET(vnet, modindex, modtype, sym) \ + modtype *sym = (vnet)->mod_data[modindex]; #endif /* !VNET_DEBUG */ #else /* !VIMAGE */ #define INIT_FROM_VNET(vnet, modindex, modtype, sym)