summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrmacklem <rmacklem@FreeBSD.org>2011-04-25 22:22:51 +0000
committerrmacklem <rmacklem@FreeBSD.org>2011-04-25 22:22:51 +0000
commit8d09f5854972630dec5ac9a3362d13b2b014aed7 (patch)
tree215ddd2770caab91450f1ffc0936448f7790351a
parentf8e844f47e956bc96fd494f89344c3dfc5b214e3 (diff)
downloadFreeBSD-src-8d09f5854972630dec5ac9a3362d13b2b014aed7.zip
FreeBSD-src-8d09f5854972630dec5ac9a3362d13b2b014aed7.tar.gz
Fix the experimental NFS client so that it does not bogusly
set the f_flags field of "struct statfs". This had the interesting effect of making the NFSv4 mounts "disappear" after r221014, since NFSMNT_NFSV4 and MNT_IGNORE became the same bit. Move the files used for a diskless NFS root from sys/nfsclient to sys/nfs in preparation for them to be used by both NFS clients. Also, move the declaration of the three global data structures from sys/nfsclient/nfs_vfsops.c to sys/nfs/nfs_diskless.c so that they are defined when either client uses them. Reviewed by: jhb MFC after: 2 weeks
-rw-r--r--sys/amd64/amd64/genassym.c2
-rw-r--r--sys/conf/files6
-rw-r--r--sys/i386/i386/genassym.c2
-rw-r--r--sys/modules/nfscl/Makefile34
-rw-r--r--sys/modules/nfsclient/Makefile2
-rw-r--r--sys/nfs/bootp_subr.c (renamed from sys/nfsclient/bootp_subr.c)4
-rw-r--r--sys/nfs/krpc.h (renamed from sys/nfsclient/krpc.h)0
-rw-r--r--sys/nfs/krpc_subr.c (renamed from sys/nfsclient/krpc_subr.c)2
-rw-r--r--sys/nfs/nfs_diskless.c (renamed from sys/nfsclient/nfs_diskless.c)11
-rw-r--r--sys/nfs/nfsdiskless.h (renamed from sys/nfsclient/nfsdiskless.h)0
-rw-r--r--sys/nfsclient/nfs_vfsops.c11
11 files changed, 53 insertions, 21 deletions
diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c
index 585f274..aba790d 100644
--- a/sys/amd64/amd64/genassym.c
+++ b/sys/amd64/amd64/genassym.c
@@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$");
#include <netinet/in.h>
#include <nfs/nfsproto.h>
#include <nfsclient/nfs.h>
-#include <nfsclient/nfsdiskless.h>
+#include <nfs/nfsdiskless.h>
#include <x86/apicreg.h>
#include <machine/cpu.h>
#include <machine/pcb.h>
diff --git a/sys/conf/files b/sys/conf/files
index 5cf94cc..a23ff56 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -2822,12 +2822,12 @@ netsmb/smb_smb.c optional netsmb
netsmb/smb_subr.c optional netsmb
netsmb/smb_trantcp.c optional netsmb
netsmb/smb_usr.c optional netsmb
+nfs/bootp_subr.c optional bootp nfsclient | bootp nfscl
+nfs/krpc_subr.c optional bootp nfsclient | bootp nfscl
nfs/nfs_common.c optional nfsclient | nfsserver
+nfs/nfs_diskless.c optional nfsclient nfs_root | nfscl nfs_root
nfs/nfs_lock.c optional nfsclient | nfscl | nfslockd | nfsd
-nfsclient/bootp_subr.c optional bootp nfsclient
-nfsclient/krpc_subr.c optional bootp nfsclient
nfsclient/nfs_bio.c optional nfsclient
-nfsclient/nfs_diskless.c optional nfsclient nfs_root
nfsclient/nfs_node.c optional nfsclient
nfsclient/nfs_krpc.c optional nfsclient
nfsclient/nfs_subs.c optional nfsclient
diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c
index 523b194..5ae9002 100644
--- a/sys/i386/i386/genassym.c
+++ b/sys/i386/i386/genassym.c
@@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$");
#include <netinet/in.h>
#include <nfs/nfsproto.h>
#include <nfsclient/nfs.h>
-#include <nfsclient/nfsdiskless.h>
+#include <nfs/nfsdiskless.h>
#ifdef DEV_APIC
#include <x86/apicreg.h>
#endif
diff --git a/sys/modules/nfscl/Makefile b/sys/modules/nfscl/Makefile
index 7b95932..46fa327 100644
--- a/sys/modules/nfscl/Makefile
+++ b/sys/modules/nfscl/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.PATH: ${.CURDIR}/../../fs/nfsclient
+.PATH: ${.CURDIR}/../../fs/nfsclient ${.CURDIR}/../../nfs
KMOD= nfscl
SRCS= vnode_if.h \
nfs_clrpcops.c \
@@ -22,4 +22,36 @@ SRCS= vnode_if.h \
opt_ufs.h \
opt_kgssapi.h
+.if !defined(KERNBUILDDIR)
+NFS_INET?= 1 # 0/1 - requires INET to be configured in kernel
+NFS_INET6?= 1 # 0/1 - requires INET6 to be configured in kernel
+NFS_ROOT?= 1 # 0/1 - requires NFS_ROOT to be configured in kernel
+
+.if ${NFS_INET} > 0
+opt_inet.h:
+ echo "#define INET 1" > ${.TARGET}
+.endif
+
+.if ${NFS_INET6} > 0
+opt_inet6.h:
+ echo "#define INET6 1" > ${.TARGET}
+.endif
+
+.if ${NFS_ROOT} > 0
+opt_nfsroot.h:
+ echo "#define NFS_ROOT 1" > ${.TARGET}
+.endif
+.else
+OPT_NFS_ROOT!= cat ${KERNBUILDDIR}/opt_nfsroot.h
+.if empty(OPT_NFS_ROOT)
+NFS_ROOT= 0
+.else
+NFS_ROOT= 1
+.endif
+.endif
+
+.if ${NFS_ROOT} > 0
+SRCS+= nfs_diskless.c
+.endif
+
.include <bsd.kmod.mk>
diff --git a/sys/modules/nfsclient/Makefile b/sys/modules/nfsclient/Makefile
index 0ce3d41..94d473b 100644
--- a/sys/modules/nfsclient/Makefile
+++ b/sys/modules/nfsclient/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.PATH: ${.CURDIR}/../../nfsclient ${.CURDIR}/../../rpc
+.PATH: ${.CURDIR}/../../nfsclient ${.CURDIR}/../../nfs ${.CURDIR}/../../rpc
KMOD= nfsclient
SRCS= vnode_if.h \
diff --git a/sys/nfsclient/bootp_subr.c b/sys/nfs/bootp_subr.c
index 9fcd03f..ca90089 100644
--- a/sys/nfsclient/bootp_subr.c
+++ b/sys/nfs/bootp_subr.c
@@ -69,8 +69,8 @@ __FBSDID("$FreeBSD$");
#include <nfs/nfsproto.h>
#include <nfsclient/nfs.h>
-#include <nfsclient/nfsdiskless.h>
-#include <nfsclient/krpc.h>
+#include <nfs/nfsdiskless.h>
+#include <nfs/krpc.h>
#include <nfs/xdr_subs.h>
diff --git a/sys/nfsclient/krpc.h b/sys/nfs/krpc.h
index 44b84e0..44b84e0 100644
--- a/sys/nfsclient/krpc.h
+++ b/sys/nfs/krpc.h
diff --git a/sys/nfsclient/krpc_subr.c b/sys/nfs/krpc_subr.c
index 0639b6c..18e0f9b 100644
--- a/sys/nfsclient/krpc_subr.c
+++ b/sys/nfs/krpc_subr.c
@@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$");
#include <rpc/types.h>
#include <rpc/auth.h>
#include <rpc/rpc_msg.h>
-#include <nfsclient/krpc.h>
+#include <nfs/krpc.h>
#include <nfs/xdr_subs.h>
/*
diff --git a/sys/nfsclient/nfs_diskless.c b/sys/nfs/nfs_diskless.c
index b574945..fad6ef0 100644
--- a/sys/nfsclient/nfs_diskless.c
+++ b/sys/nfs/nfs_diskless.c
@@ -55,13 +55,22 @@ __FBSDID("$FreeBSD$");
#include <netinet/in.h>
#include <nfs/nfsproto.h>
#include <nfsclient/nfs.h>
-#include <nfsclient/nfsdiskless.h>
+#include <nfs/nfsdiskless.h>
static int inaddr_to_sockaddr(char *ev, struct sockaddr_in *sa);
static int hwaddr_to_sockaddr(char *ev, struct sockaddr_dl *sa);
static int decode_nfshandle(char *ev, u_char *fh, int maxfh);
/*
+ * This structure must be filled in by a primary bootstrap or bootstrap
+ * server for a diskless/dataless machine. It is initialized below just
+ * to ensure that it is allocated to initialized data (.data not .bss).
+ */
+struct nfs_diskless nfs_diskless = { { { 0 } } };
+struct nfsv3_diskless nfsv3_diskless = { { { 0 } } };
+int nfs_diskless_valid = 0;
+
+/*
* Validate/sanity check a rsize/wsize parameter.
*/
static int
diff --git a/sys/nfsclient/nfsdiskless.h b/sys/nfs/nfsdiskless.h
index aa2bc04..aa2bc04 100644
--- a/sys/nfsclient/nfsdiskless.h
+++ b/sys/nfs/nfsdiskless.h
diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c
index 1f6ba8c..0f29740 100644
--- a/sys/nfsclient/nfs_vfsops.c
+++ b/sys/nfsclient/nfs_vfsops.c
@@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$");
#include <nfsclient/nfsmount.h>
#include <nfs/xdr_subs.h>
#include <nfsclient/nfsm_subs.h>
-#include <nfsclient/nfsdiskless.h>
+#include <nfs/nfsdiskless.h>
FEATURE(nfsclient, "NFS client");
@@ -164,15 +164,6 @@ static struct nfs_rpcops nfs_rpcops = {
nfs_commit,
};
-/*
- * This structure must be filled in by a primary bootstrap or bootstrap
- * server for a diskless/dataless machine. It is initialized below just
- * to ensure that it is allocated to initialized data (.data not .bss).
- */
-struct nfs_diskless nfs_diskless = { { { 0 } } };
-struct nfsv3_diskless nfsv3_diskless = { { { 0 } } };
-int nfs_diskless_valid = 0;
-
SYSCTL_INT(_vfs_nfs, OID_AUTO, diskless_valid, CTLFLAG_RD,
&nfs_diskless_valid, 0,
"Has the diskless struct been filled correctly");
OpenPOWER on IntegriCloud