diff options
author | rwatson <rwatson@FreeBSD.org> | 2009-08-01 20:24:45 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2009-08-01 20:24:45 +0000 |
commit | e3917e768dd62864bffbab302c81220b6903a864 (patch) | |
tree | 387b80b629199725784bedbf837948860c366cc3 /sys/net/vnet.c | |
parent | fb9ffed6504601ed9da2c6b9a620b133c838964c (diff) | |
download | FreeBSD-src-e3917e768dd62864bffbab302c81220b6903a864.zip FreeBSD-src-e3917e768dd62864bffbab302c81220b6903a864.tar.gz |
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)
Diffstat (limited to 'sys/net/vnet.c')
-rw-r--r-- | sys/net/vnet.c | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/sys/net/vnet.c b/sys/net/vnet.c index a34270a..a7b23b1 100644 --- a/sys/net/vnet.c +++ b/sys/net/vnet.c @@ -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, void *arg) 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(); } /* |