Author: rwatson
Date: Sat Aug  1 20:24:45 2009
New Revision: 196020
URL: http://svn.freebsd.org/changeset/base/196020

Log:
  Remove vnet_foreach() utility function, which previously allowed
  vnet.c to iterate virtual network stacks without being aware of
  the implementation details previously hidden in kern_vimage.c.
  Now they are in the same file, so remove this added complexity.
  
  Reviewed by:  bz
  Approved by:  re (vimage blanket)

Modified:
  head/sys/net/vnet.c

Modified: head/sys/net/vnet.c
==============================================================================
--- head/sys/net/vnet.c Sat Aug  1 19:26:27 2009        (r196019)
+++ head/sys/net/vnet.c Sat Aug  1 20:24:45 2009        (r196020)
@@ -261,17 +261,6 @@ vnet_destroy(struct vnet *vnet)
        free(vnet, M_VNET);
 }
 
-static void
-vnet_foreach(void (*vnet_foreach_fn)(struct vnet *, void *), void *arg)
-{
-       struct vnet *vnet;
-
-       VNET_LIST_RLOCK();
-       LIST_FOREACH(vnet, &vnet_head, vnet_le)
-               vnet_foreach_fn(vnet, arg);
-       VNET_LIST_RUNLOCK();
-}
-
 /*
  * Boot time initialization and allocation of virtual network stacks.
  */
@@ -443,20 +432,6 @@ vnet_data_free(void *start_arg, int size
        sx_xunlock(&vnet_data_free_lock);
 }
 
-struct vnet_data_copy_fn_arg {
-       void    *start;
-       int      size;
-};
-
-static void
-vnet_data_copy_fn(struct vnet *vnet, void *arg)
-{
-       struct vnet_data_copy_fn_arg *varg = arg;
-
-       memcpy((void *)((uintptr_t)vnet->vnet_data_base +
-           (uintptr_t)varg->start), varg->start, varg->size);
-}
-
 /*
  * When a new virtualized global variable has been allocated, propagate its
  * initial value to each already-allocated virtual network stack instance.
@@ -464,11 +439,13 @@ vnet_data_copy_fn(struct vnet *vnet, voi
 void
 vnet_data_copy(void *start, int size)
 {
-       struct vnet_data_copy_fn_arg varg;
+       struct vnet *vnet;
 
-       varg.start = start;
-       varg.size = size;
-       vnet_foreach(vnet_data_copy_fn, &varg);
+       VNET_LIST_RLOCK();
+       LIST_FOREACH(vnet, &vnet_head, vnet_le)
+               memcpy((void *)((uintptr_t)vnet->vnet_data_base +
+                   (uintptr_t)start), start, size);
+       VNET_LIST_RUNLOCK();
 }
 
 /*
_______________________________________________
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