PERFORCE change 160695 for review
Marko Zec
zec at FreeBSD.org
Thu Apr 16 06:51:47 PDT 2009
http://perforce.freebsd.org/chv.cgi?CH=160695
Change 160695 by zec at 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 <sys/sysctl.h>
#include <sys/uio.h>
#include <sys/jail.h>
+#include <sys/vimage.h>
#include <security/mac/mac_framework.h>
@@ -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)
More information about the p4-projects
mailing list