summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/fs/nfs
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2021-07-29 15:49:52 +1000
committerChris Johns <chrisj@rtems.org>2021-08-31 18:38:48 +1000
commit882425fe547f73a1a77caa4938dec369cfd1063d (patch)
treeafcd61607284dcba2be4defbad655e16b138d429 /freebsd/sys/fs/nfs
parentkern/sys: Import NFS and NFS file system client (diff)
downloadrtems-libbsd-882425fe547f73a1a77caa4938dec369cfd1063d.tar.bz2
kern/sys: Add NFSv4 client
Update #4475
Diffstat (limited to 'freebsd/sys/fs/nfs')
-rw-r--r--freebsd/sys/fs/nfs/nfs_commonacl.c2
-rw-r--r--freebsd/sys/fs/nfs/nfs_commonkrpc.c37
-rw-r--r--freebsd/sys/fs/nfs/nfs_commonport.c3
-rw-r--r--freebsd/sys/fs/nfs/nfs_commonsubs.c9
-rw-r--r--freebsd/sys/fs/nfs/nfsport.h17
5 files changed, 47 insertions, 21 deletions
diff --git a/freebsd/sys/fs/nfs/nfs_commonacl.c b/freebsd/sys/fs/nfs/nfs_commonacl.c
index 3e8cfe20..31b18ead 100644
--- a/freebsd/sys/fs/nfs/nfs_commonacl.c
+++ b/freebsd/sys/fs/nfs/nfs_commonacl.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
diff --git a/freebsd/sys/fs/nfs/nfs_commonkrpc.c b/freebsd/sys/fs/nfs/nfs_commonkrpc.c
index f85121f3..8ddcc6bb 100644
--- a/freebsd/sys/fs/nfs/nfs_commonkrpc.c
+++ b/freebsd/sys/fs/nfs/nfs_commonkrpc.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -40,8 +42,8 @@ __FBSDID("$FreeBSD$");
* Socket operations for use by nfs
*/
-#include "opt_kgssapi.h"
-#include "opt_nfs.h"
+#include <rtems/bsd/local/opt_kgssapi.h>
+#include <rtems/bsd/local/opt_nfs.h>
#include <sys/param.h>
#include <sys/systm.h>
@@ -62,7 +64,9 @@ __FBSDID("$FreeBSD$");
#include <rpc/rpc.h>
#include <rpc/krpc.h>
+#ifndef __rtems__
#include <kgssapi/krb5/kcrypto.h>
+#endif /* __rtems__ */
#include <fs/nfs/nfsport.h>
@@ -215,7 +219,7 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp,
nconf = getnetconfigent("udp6");
else
nconf = getnetconfigent("tcp6");
-
+
pktscale = nfs_bufpackets;
if (pktscale < 2)
pktscale = 2;
@@ -233,7 +237,7 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp,
*/
so = NULL;
saddr = NFSSOCKADDR(nrp->nr_nam, struct sockaddr *);
- error = socreate(saddr->sa_family, &so, nrp->nr_sotype,
+ error = socreate(saddr->sa_family, &so, nrp->nr_sotype,
nrp->nr_soproto, td->td_ucred, td);
if (error) {
td->td_ucred = origcred;
@@ -387,7 +391,7 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp,
/*
* For UDP, there are 2 timeouts:
* - CLSET_RETRY_TIMEOUT sets the initial timeout for the timer
- * that does a retransmit of an RPC request using the same
+ * that does a retransmit of an RPC request using the same
* socket and xid. This is what you normally want to do,
* since NFS servers depend on "same xid" for their
* Duplicate Request Cache.
@@ -737,7 +741,7 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp,
if (dtrace_nfscl_nfs234_start_probe != NULL) {
uint32_t probe_id;
int probe_procnum;
-
+
if (nd->nd_flag & ND_NFSV4) {
probe_id =
nfscl_nfs4_start_probes[nd->nd_procnum];
@@ -1139,9 +1143,9 @@ tryagain:
j != NFSERR_STALESTATEID &&
j != NFSERR_BADSTATEID &&
j != NFSERR_BADSEQID &&
- j != NFSERR_BADXDR &&
+ j != NFSERR_BADXDR &&
j != NFSERR_RESOURCE &&
- j != NFSERR_NOFILEHANDLE)))
+ j != NFSERR_NOFILEHANDLE)))
nd->nd_flag |= ND_INCRSEQID;
}
/*
@@ -1260,13 +1264,13 @@ static int
nfs_sig_pending(sigset_t set)
{
int i;
-
+
for (i = 0 ; i < nitems(newnfs_sig_set); i++)
if (SIGISMEMBER(set, newnfs_sig_set[i]))
return (1);
return (0);
}
-
+
/*
* The set/restore sigmask functions are used to (temporarily) overwrite
* the thread td_sigmask during an RPC call (for example). These are also
@@ -1275,10 +1279,11 @@ nfs_sig_pending(sigset_t set)
void
newnfs_set_sigmask(struct thread *td, sigset_t *oldset)
{
+#ifndef __rtems__
sigset_t newset;
int i;
struct proc *p;
-
+
SIGFILLSET(newset);
if (td == NULL)
td = curthread; /* XXX */
@@ -1301,14 +1306,17 @@ newnfs_set_sigmask(struct thread *td, sigset_t *oldset)
kern_sigprocmask(td, SIG_SETMASK, &newset, oldset,
SIGPROCMASK_PROC_LOCKED);
PROC_UNLOCK(p);
+#endif /* __rtems__ */
}
void
newnfs_restore_sigmask(struct thread *td, sigset_t *set)
{
+#ifndef __rtems__
if (td == NULL)
td = curthread; /* XXX */
kern_sigprocmask(td, SIG_SETMASK, set, NULL, 0);
+#endif /* __rtems__ */
}
/*
@@ -1338,9 +1346,10 @@ newnfs_msleep(struct thread *td, void *ident, struct mtx *mtx, int priority, cha
int
newnfs_sigintr(struct nfsmount *nmp, struct thread *td)
{
+#ifndef __rtems__
struct proc *p;
sigset_t tmpset;
-
+
/* Terminate all requests while attempting a forced unmount. */
if (NFSCL_FORCEDISM(nmp->nm_mountp))
return (EIO);
@@ -1362,6 +1371,7 @@ newnfs_sigintr(struct nfsmount *nmp, struct thread *td)
return (EINTR);
}
PROC_UNLOCK(p);
+#endif /* __rtems__ */
return (0);
}
@@ -1423,7 +1433,7 @@ nfs_up(struct nfsmount *nmp, struct thread *td, const char *msg,
VQ_NOTRESP, 1);
} else
mtx_unlock(&nmp->nm_mtx);
-
+
mtx_lock(&nmp->nm_mtx);
if ((flags & NFSSTA_LOCKTIMEO) && (nmp->nm_state & NFSSTA_LOCKTIMEO)) {
nmp->nm_state &= ~NFSSTA_LOCKTIMEO;
@@ -1433,4 +1443,3 @@ nfs_up(struct nfsmount *nmp, struct thread *td, const char *msg,
} else
mtx_unlock(&nmp->nm_mtx);
}
-
diff --git a/freebsd/sys/fs/nfs/nfs_commonport.c b/freebsd/sys/fs/nfs/nfs_commonport.c
index 1a1e64cd..80648a13 100644
--- a/freebsd/sys/fs/nfs/nfs_commonport.c
+++ b/freebsd/sys/fs/nfs/nfs_commonport.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -816,4 +818,3 @@ DECLARE_MODULE(nfscommon, nfscommon_mod, SI_SUB_VFS, SI_ORDER_ANY);
MODULE_VERSION(nfscommon, 1);
MODULE_DEPEND(nfscommon, nfssvc, 1, 1, 1);
MODULE_DEPEND(nfscommon, krpc, 1, 1, 1);
-
diff --git a/freebsd/sys/fs/nfs/nfs_commonsubs.c b/freebsd/sys/fs/nfs/nfs_commonsubs.c
index 9214674b..f7c93ce0 100644
--- a/freebsd/sys/fs/nfs/nfs_commonsubs.c
+++ b/freebsd/sys/fs/nfs/nfs_commonsubs.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -42,8 +44,8 @@ __FBSDID("$FreeBSD$");
* copy data between mbuf chains and uio lists.
*/
#ifndef APPLEKEXT
-#include "opt_inet.h"
-#include "opt_inet6.h"
+#include <rtems/bsd/local/opt_inet.h>
+#include <rtems/bsd/local/opt_inet6.h>
#include <fs/nfs/nfsport.h>
@@ -3814,8 +3816,10 @@ nfssvc_idname(struct nfsd_idargs *nidp)
cr->cr_uid = cr->cr_ruid = cr->cr_svuid = nidp->nid_uid;
crsetgroups(cr, nidp->nid_ngroup, grps);
cr->cr_rgid = cr->cr_svgid = cr->cr_groups[0];
+#ifndef __rtems__
cr->cr_prison = &prison0;
prison_hold(cr->cr_prison);
+#endif /* __rtems__ */
#ifdef MAC
mac_cred_associate_nfsd(cr);
#endif
@@ -4766,4 +4770,3 @@ nfsv4_findmirror(struct nfsmount *nmp)
}
return (ds);
}
-
diff --git a/freebsd/sys/fs/nfs/nfsport.h b/freebsd/sys/fs/nfs/nfsport.h
index 8abb6a5d..6eb530ac 100644
--- a/freebsd/sys/fs/nfs/nfsport.h
+++ b/freebsd/sys/fs/nfs/nfsport.h
@@ -42,7 +42,7 @@
* to be the cleanest way to handle #include files for the ports.
*/
#ifdef _KERNEL
-#include <sys/unistd.h>
+#include <rtems/bsd/sys/unistd.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
@@ -53,7 +53,9 @@
#include <sys/filedesc.h>
#include <sys/jail.h>
#include <sys/kernel.h>
+#ifndef __rtems__
#include <sys/lockf.h>
+#endif /* __rtems__ */
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/mount.h>
@@ -77,7 +79,9 @@
#include <sys/acl.h>
#include <sys/module.h>
#include <sys/sysent.h>
+#ifndef __rtems__
#include <sys/syscall.h>
+#endif /* __rtems__ */
#include <sys/priv.h>
#include <sys/kthread.h>
#include <sys/syscallsubr.h>
@@ -108,6 +112,7 @@
* (This is always defined as nil otherwise.)
*/
#define APPLESTATIC
+#ifndef __rtems__
#include <ufs/ufs/dir.h>
#include <ufs/ufs/quota.h>
#include <ufs/ufs/inode.h>
@@ -117,9 +122,10 @@
#include <vm/vm.h>
#include <vm/vm_object.h>
#include <vm/vm_extern.h>
+#endif /* __rtems__ */
#include <nfs/nfssvc.h>
-#include "opt_nfs.h"
-#include "opt_ufs.h"
+#include <rtems/bsd/local/opt_nfs.h>
+#include <rtems/bsd/local/opt_ufs.h>
/*
* These types must be defined before the nfs includes.
@@ -697,8 +703,13 @@ void nfsrvd_rcv(struct socket *, void *, int);
#define NFSASSERTIOD() mtx_assert(&ncl_iod_mutex, MA_OWNED)
#define NFSLOCKREQUEST(r) mtx_lock(&((r)->r_mtx))
#define NFSUNLOCKREQUEST(r) mtx_unlock(&((r)->r_mtx))
+#ifndef __rtems__
#define NFSPROCLISTLOCK() sx_slock(&allproc_lock)
#define NFSPROCLISTUNLOCK() sx_sunlock(&allproc_lock)
+#else /* __rtems__ */
+#define NFSPROCLISTLOCK()
+#define NFSPROCLISTUNLOCK()
+#endif /* __rtems__ */
#define NFSLOCKSOCKREQ(r) mtx_lock(&((r)->nr_mtx))
#define NFSUNLOCKSOCKREQ(r) mtx_unlock(&((r)->nr_mtx))
#define NFSLOCKDS(d) mtx_lock(&((d)->nfsclds_mtx))