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
This commit is contained in:
Rick Macklem 2011-04-25 22:22:51 +00:00
parent d1bb976989
commit 7c208ed659
11 changed files with 53 additions and 21 deletions

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -1,6 +1,6 @@
# $FreeBSD$
.PATH: ${.CURDIR}/../../nfsclient ${.CURDIR}/../../rpc
.PATH: ${.CURDIR}/../../nfsclient ${.CURDIR}/../../nfs ${.CURDIR}/../../rpc
KMOD= nfsclient
SRCS= vnode_if.h \

View File

@ -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>

View File

@ -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>
/*

View File

@ -55,12 +55,21 @@ __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.
*/

View File

@ -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");