Author: rwatson
Date: Sun Jul 19 17:40:45 2009
New Revision: 195769
URL: http://svn.freebsd.org/changeset/base/195769

Log:
  Normalize field naming for struct vnet, fix two debugging printfs that
  print them.
  
  Reviewed by:  bz
  Approved by:  re (kensmith, kib)

Modified:
  head/sys/kern/kern_vimage.c
  head/sys/kern/uipc_socket.c
  head/sys/net/if.c
  head/sys/sys/vimage.h

Modified: head/sys/kern/kern_vimage.c
==============================================================================
--- head/sys/kern/kern_vimage.c Sun Jul 19 17:35:23 2009        (r195768)
+++ head/sys/kern/kern_vimage.c Sun Jul 19 17:40:45 2009        (r195769)
@@ -333,7 +333,8 @@ vnet_destroy(struct vnet *vnet)
        struct ifnet *ifp, *nifp;
        struct vnet_modlink *vml;
 
-       KASSERT(vnet->sockcnt == 0, ("%s: vnet still has sockets", __func__));
+       KASSERT(vnet->vnet_sockcnt == 0,
+           ("%s: vnet still has sockets", __func__));
 
        VNET_LIST_WLOCK();
        LIST_REMOVE(vnet, vnet_le);
@@ -426,14 +427,13 @@ DB_SHOW_COMMAND(vnets, db_show_vnets)
        VNET_ITERATOR_DECL(vnet_iter);
 
 #if SIZE_MAX == UINT32_MAX /* 32-bit arch */
-       db_printf("      vnet ifs socks");
+       db_printf("      vnet ifs socks\n");
 #else /* 64-bit arch, most probaly... */
-       db_printf("              vnet ifs socks");
+       db_printf("              vnet ifs socks\n");
 #endif
        VNET_FOREACH(vnet_iter) {
-               db_printf("%p %3d %5d",
-                   vnet_iter, vnet_iter->ifcnt, vnet_iter->sockcnt);
-               db_printf("\n");
+               db_printf("%p %3d %5d\n", vnet_iter, vnet_iter->vnet_ifcnt,
+                   vnet_iter->vnet_sockcnt);
        }
 }
 #endif

Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c Sun Jul 19 17:35:23 2009        (r195768)
+++ head/sys/kern/uipc_socket.c Sun Jul 19 17:40:45 2009        (r195769)
@@ -285,7 +285,7 @@ soalloc(struct vnet *vnet)
        so->so_gencnt = ++so_gencnt;
        ++numopensockets;
 #ifdef VIMAGE
-       ++vnet->sockcnt;        /* Locked with so_global_mtx. */
+       vnet->vnet_sockcnt++;
        so->so_vnet = vnet;
 #endif
        mtx_unlock(&so_global_mtx);
@@ -308,7 +308,7 @@ sodealloc(struct socket *so)
        so->so_gencnt = ++so_gencnt;
        --numopensockets;       /* Could be below, but faster here. */
 #ifdef VIMAGE
-       --so->so_vnet->sockcnt;
+       so->so_vnet->vnet_sockcnt--;
 #endif
        mtx_unlock(&so_global_mtx);
        if (so->so_rcv.sb_hiwat)

Modified: head/sys/net/if.c
==============================================================================
--- head/sys/net/if.c   Sun Jul 19 17:35:23 2009        (r195768)
+++ head/sys/net/if.c   Sun Jul 19 17:40:45 2009        (r195769)
@@ -593,7 +593,7 @@ if_attach_internal(struct ifnet *ifp, in
        IFNET_WLOCK();
        TAILQ_INSERT_TAIL(&V_ifnet, ifp, if_link);
 #ifdef VIMAGE
-       curvnet->ifcnt++;
+       curvnet->vnet_ifcnt++;
 #endif
        IFNET_WUNLOCK();
 
@@ -758,7 +758,7 @@ if_detach_internal(struct ifnet *ifp, in
                }
 #ifdef VIMAGE
        if (found)
-               curvnet->ifcnt--;
+               curvnet->vnet_ifcnt--;
 #endif
        IFNET_WUNLOCK();
        if (!found) {

Modified: head/sys/sys/vimage.h
==============================================================================
--- head/sys/sys/vimage.h       Sun Jul 19 17:35:23 2009        (r195768)
+++ head/sys/sys/vimage.h       Sun Jul 19 17:40:45 2009        (r195769)
@@ -44,8 +44,8 @@
 struct vnet {
        LIST_ENTRY(vnet)         vnet_le;       /* all vnets list */
        u_int                    vnet_magic_n;
-       u_int                    ifcnt;
-       u_int                    sockcnt;
+       u_int                    vnet_ifcnt;
+       u_int                    vnet_sockcnt;
        void                    *vnet_data_mem;
        uintptr_t                vnet_data_base;
 };
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to