aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2011-04-25 22:22:51 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2011-04-25 22:22:51 +0000
commit7c208ed659437ef984f2bb98bdc20fa5cfdebefc (patch)
tree215ddd2770caab91450f1ffc0936448f7790351a /sys
parentd1bb976989e4407c9ec88c49543ba9f412352b72 (diff)
downloadsrc-7c208ed659437ef984f2bb98bdc20fa5cfdebefc.tar.gz
src-7c208ed659437ef984f2bb98bdc20fa5cfdebefc.zip
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
Notes
Notes: svn path=/head/; revision=221032
Diffstat (limited to 'sys')
-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 585f27449d81..aba790d0bd5e 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 5cf94cc1a6ad..a23ff56342db 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 523b194fabc4..5ae90029fba9 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 7b95932c364d..46fa3278d8a0 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 0ce3d41592f5..94d473b930db 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 9fcd03f1fb19..ca90089d02f5 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 44b84e019fb1..44b84e019fb1 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 0639b6c79e05..18e0f9b67609 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 b574945e7d16..fad6ef023498 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 aa2bc043c924..aa2bc043c924 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 1f6ba8c2954b..0f2974036ae5 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");