FreeBSD/sys/fs/nfsserver/nfs_nfsdport.c
/*
 * Called from nfssvc() to update the exports list. Just call
 * vfs_export(). This has to be done, since the v4 root fake fs isn't
 * in the mount list.
 */
Called from nfssvc() to update the exports list.
Called from nfssvc () to update the exports list .
int
nfsrv_v4rootexport(void *argp, struct ucred *cred, struct thread *p)
{
	struct nfsex_args *nfsexargp = (struct nfsex_args *)argp;
	int error = 0;
	struct nameidata nd;
	fhandle_t fh;
	error = vfs_export(&nfsv4root_mnt, &nfsexargp->export);
	if ((nfsexargp->export.ex_flags & MNT_DELEXPORT) != 0)
		nfs_rootfhset = 0;
	else if (error == 0) {
		if (nfsexargp->fspec == NULL) {
			error = EPERM;
			goto out;
		}
		NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE,
		    nfsexargp->fspec, p);
		if ((error = namei(&nd)) != 0)
			goto out;
		error = nfsvno_getfh(nd.ni_vp, &fh, p);
		vrele(nd.ni_vp);
		if (!error) {
			nfs_rootfh.nfsrvfh_len = NFSX_MYFH;
			NFSBCOPY((caddr_t)&fh,
			    nfs_rootfh.nfsrvfh_data,
			    sizeof (fhandle_t));
			nfs_rootfhset = 1;
		}
	}
out:
	NFSEXITCODE(error);
	return (error);
}
int nfsrv_v4rootexport ( void * argp , struct ucred * cred , struct thread * p ) { struct nfsex_args * nfsexargp = ( struct nfsex_args * ) argp ; int error = 0 ; struct nameidata nd ; fhandle_t fh ; error = vfs_export ( & nfsv4root_mnt , & nfsexargp -> export ) ; if ( ( nfsexargp -> export . ex_flags & MNT_DELEXPORT ) != 0 ) nfs_rootfhset = 0 ; else if ( error == 0 ) { if ( nfsexargp -> fspec == NULL ) { error = EPERM ; goto out ; } NDINIT ( & nd , LOOKUP , FOLLOW , UIO_USERSPACE , nfsexargp -> fspec , p ) ; if ( ( error = namei ( & nd ) ) != 0 ) goto out ; error = nfsvno_getfh ( nd . ni_vp , & fh , p ) ; vrele ( nd . ni_vp ) ; if ( ! error ) { nfs_rootfh . nfsrvfh_len = NFSX_MYFH ; NFSBCOPY ( ( caddr_t ) & fh , nfs_rootfh . nfsrvfh_data , sizeof ( fhandle_t ) ) ; nfs_rootfhset = 1 ; } } out : NFSEXITCODE ( error ) ; return ( error ) ; }
Called from nfssvc() to update the exports list.
Called from nfssvc () to update the exports list .
/*
		 * If fspec != NULL, this is the v4root path.
		 */