diff options
author | bz <bz@FreeBSD.org> | 2008-08-17 23:27:27 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2008-08-17 23:27:27 +0000 |
commit | 1021d43b569bfc8d2c5544bde2f540fa432b011f (patch) | |
tree | 1496da534aec03cf2f9d2d0735d80e4c1e3b5715 /sys/nfsclient | |
parent | 7fc341305a3e341fca7f202fc1219358f8d9dbbd (diff) | |
download | FreeBSD-src-1021d43b569bfc8d2c5544bde2f540fa432b011f.zip FreeBSD-src-1021d43b569bfc8d2c5544bde2f540fa432b011f.tar.gz |
Commit step 1 of the vimage project, (network stack)
virtualization work done by Marko Zec (zec@).
This is the first in a series of commits over the course
of the next few weeks.
Mark all uses of global variables to be virtualized
with a V_ prefix.
Use macros to map them back to their global names for
now, so this is a NOP change only.
We hope to have caught at least 85-90% of what is needed
so we do not invalidate a lot of outstanding patches again.
Obtained from: //depot/projects/vimage-commit2/...
Reviewed by: brooks, des, ed, mav, julian,
jamie, kris, rwatson, zec, ...
(various people I forgot, different versions)
md5 (with a bit of help)
Sponsored by: NLnet Foundation, The FreeBSD Foundation
X-MFC after: never
V_Commit_Message_Reviewed_By: more people than the patch
Diffstat (limited to 'sys/nfsclient')
-rw-r--r-- | sys/nfsclient/bootp_subr.c | 17 | ||||
-rw-r--r-- | sys/nfsclient/nfs_diskless.c | 3 | ||||
-rw-r--r-- | sys/nfsclient/nfs_vfsops.c | 7 | ||||
-rw-r--r-- | sys/nfsclient/nfs_vnops.c | 5 |
4 files changed, 18 insertions, 14 deletions
diff --git a/sys/nfsclient/bootp_subr.c b/sys/nfsclient/bootp_subr.c index 7f65fe2..1274da0 100644 --- a/sys/nfsclient/bootp_subr.c +++ b/sys/nfsclient/bootp_subr.c @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include <sys/socketvar.h> #include <sys/sysctl.h> #include <sys/uio.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/route.h> @@ -374,9 +375,9 @@ bootpboot_p_rtlist(void) { printf("Routing table:\n"); - RADIX_NODE_LOCK(rt_tables[AF_INET]); /* could sleep XXX */ - bootpboot_p_tree(rt_tables[AF_INET]->rnh_treetop); - RADIX_NODE_UNLOCK(rt_tables[AF_INET]); + RADIX_NODE_LOCK(V_rt_tables[AF_INET]); /* could sleep XXX */ + bootpboot_p_tree(V_rt_tables[AF_INET]->rnh_treetop); + RADIX_NODE_UNLOCK(V_rt_tables[AF_INET]); } void @@ -401,7 +402,7 @@ bootpboot_p_iflist(void) printf("Interface list:\n"); IFNET_RLOCK(); /* could sleep, but okay for debugging XXX */ - for (ifp = TAILQ_FIRST(&ifnet); + for (ifp = TAILQ_FIRST(&V_ifnet); ifp != NULL; ifp = TAILQ_NEXT(ifp, if_link)) { for (ifa = TAILQ_FIRST(&ifp->if_addrhead); @@ -1570,8 +1571,8 @@ bootpc_decode_reply(struct nfsv3_diskless *nd, struct bootpc_ifcontext *ifctx, } else { strcpy(nd->my_hostnam, p); mtx_lock(&hostname_mtx); - strcpy(hostname, p); - printf("hostname %s ", hostname); + strcpy(G_hostname, p); + printf("hostname %s ", G_hostname); mtx_unlock(&hostname_mtx); gctx->sethostname = ifctx; } @@ -1644,7 +1645,7 @@ bootpc_init(void) * attaches and wins the race, it won't be eligible for bootp. */ IFNET_RLOCK(); - for (ifp = TAILQ_FIRST(&ifnet), ifcnt = 0; + for (ifp = TAILQ_FIRST(&V_ifnet), ifcnt = 0; ifp != NULL; ifp = TAILQ_NEXT(ifp, if_link)) { if ((ifp->if_flags & @@ -1661,7 +1662,7 @@ bootpc_init(void) #endif IFNET_RLOCK(); - for (ifp = TAILQ_FIRST(&ifnet), ifctx = gctx->interfaces; + for (ifp = TAILQ_FIRST(&V_ifnet), ifctx = gctx->interfaces; ifp != NULL && ifctx != NULL; ifp = TAILQ_NEXT(ifp, if_link)) { strlcpy(ifctx->ireq.ifr_name, ifp->if_xname, diff --git a/sys/nfsclient/nfs_diskless.c b/sys/nfsclient/nfs_diskless.c index 58e99ee..be5f934 100644 --- a/sys/nfsclient/nfs_diskless.c +++ b/sys/nfsclient/nfs_diskless.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include <sys/mount.h> #include <sys/socket.h> +#include <sys/vimage.h> #include <net/if.h> #include <net/if_dl.h> #include <net/if_types.h> @@ -176,7 +177,7 @@ nfs_setup_diskless(void) } ifa = NULL; IFNET_RLOCK(); - TAILQ_FOREACH(ifp, &ifnet, if_link) { + TAILQ_FOREACH(ifp, &V_ifnet, if_link) { TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family == AF_LINK) { sdl = (struct sockaddr_dl *)ifa->ifa_addr; diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index d068ab3..e7e3f12 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include <sys/sysctl.h> #include <sys/vnode.h> #include <sys/signalvar.h> +#include <sys/vimage.h> #include <vm/vm.h> #include <vm/vm_extern.h> @@ -509,10 +510,10 @@ nfs_mountroot(struct mount *mp, struct thread *td) * mount the right /var based upon its preset value. */ mtx_lock(&hostname_mtx); - bcopy(nd->my_hostnam, hostname, MAXHOSTNAMELEN); - hostname[MAXHOSTNAMELEN - 1] = '\0'; + bcopy(nd->my_hostnam, V_hostname, MAXHOSTNAMELEN); + V_hostname[MAXHOSTNAMELEN - 1] = '\0'; for (i = 0; i < MAXHOSTNAMELEN; i++) - if (hostname[i] == '\0') + if (V_hostname[i] == '\0') break; mtx_unlock(&hostname_mtx); inittodr(ntohl(nd->root_time)); diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index 3711165..affc5bd 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include <sys/stat.h> #include <sys/sysctl.h> #include <sys/signalvar.h> +#include <sys/vimage.h> #include <vm/vm.h> #include <vm/vm_object.h> @@ -1393,8 +1394,8 @@ again: *tl = txdr_unsigned(NFSV3CREATE_EXCLUSIVE); tl = nfsm_build(u_int32_t *, NFSX_V3CREATEVERF); #ifdef INET - if (!TAILQ_EMPTY(&in_ifaddrhead)) - *tl++ = IA_SIN(TAILQ_FIRST(&in_ifaddrhead))->sin_addr.s_addr; + if (!TAILQ_EMPTY(&V_in_ifaddrhead)) + *tl++ = IA_SIN(TAILQ_FIRST(&V_in_ifaddrhead))->sin_addr.s_addr; else #endif *tl++ = create_verf; |