summaryrefslogtreecommitdiff
path: root/freebsd/sys
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/sys')
-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
-rw-r--r--freebsd/sys/fs/nfsclient/nfs.h3
-rw-r--r--freebsd/sys/fs/nfsclient/nfs_clbio.c53
-rw-r--r--freebsd/sys/fs/nfsclient/nfs_clcomsubs.c2
-rw-r--r--freebsd/sys/fs/nfsclient/nfs_clkdtrace.c4
-rw-r--r--freebsd/sys/fs/nfsclient/nfs_clkrpc.c5
-rw-r--r--freebsd/sys/fs/nfsclient/nfs_clnfsiod.c6
-rw-r--r--freebsd/sys/fs/nfsclient/nfs_clnode.c10
-rw-r--r--freebsd/sys/fs/nfsclient/nfs_clport.c46
-rw-r--r--freebsd/sys/fs/nfsclient/nfs_clrpcops.c67
-rw-r--r--freebsd/sys/fs/nfsclient/nfs_clstate.c3
-rw-r--r--freebsd/sys/fs/nfsclient/nfs_clsubs.c7
-rw-r--r--freebsd/sys/fs/nfsclient/nfs_clvfsops.c17
-rw-r--r--freebsd/sys/fs/nfsclient/nfs_clvnops.c98
-rw-r--r--freebsd/sys/nfs/bootp_subr.c8
-rw-r--r--freebsd/sys/nfs/krpc_subr.c2
-rw-r--r--freebsd/sys/nfs/nfs_fha.c2
-rw-r--r--freebsd/sys/nfs/nfs_lock.c14
-rw-r--r--freebsd/sys/nfs/nfs_nfssvc.c13
-rw-r--r--freebsd/sys/nfsclient/nfs.h2
-rw-r--r--freebsd/sys/nfsclient/nfsnode.h4
25 files changed, 364 insertions, 70 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))
diff --git a/freebsd/sys/fs/nfsclient/nfs.h b/freebsd/sys/fs/nfsclient/nfs.h
index ce1747a2..f76a60a7 100644
--- a/freebsd/sys/fs/nfsclient/nfs.h
+++ b/freebsd/sys/fs/nfsclient/nfs.h
@@ -96,7 +96,8 @@ void ncl_doio_directwrite(struct buf *);
int ncl_bioread(struct vnode *, struct uio *, int, struct ucred *);
int ncl_biowrite(struct vnode *, struct uio *, int, struct ucred *);
int ncl_vinvalbuf(struct vnode *, int, struct thread *, int);
-int ncl_asyncio(struct nfsmount *, struct buf *, struct ucred *,
+int ncl_asyncio(struct
+ nfsmount *, struct buf *, struct ucred *,
struct thread *);
int ncl_doio(struct vnode *, struct buf *, struct ucred *, struct thread *,
int);
diff --git a/freebsd/sys/fs/nfsclient/nfs_clbio.c b/freebsd/sys/fs/nfsclient/nfs_clbio.c
index 105ab258..cd157db6 100644
--- a/freebsd/sys/fs/nfsclient/nfs_clbio.c
+++ b/freebsd/sys/fs/nfsclient/nfs_clbio.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -53,7 +55,9 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_page.h>
#include <vm/vm_object.h>
#include <vm/vm_pager.h>
+#ifndef __rtems__
#include <vm/vnode_pager.h>
+#endif /* __rtems__ */
#include <fs/nfs/nfsport.h>
#include <fs/nfsclient/nfsmount.h>
@@ -173,10 +177,12 @@ ncl_getpages(struct vop_getpages_args *ap)
*
* XXXGL: is that true for NFS, where short read can occur???
*/
+#ifndef __rtems__
VM_OBJECT_WLOCK(object);
if (pages[npages - 1]->valid != 0 && --npages == 0)
goto out;
VM_OBJECT_WUNLOCK(object);
+#endif /* __rtems__*/
/*
* We use only the kva address for the buffer, but this is extremely
@@ -185,7 +191,9 @@ ncl_getpages(struct vop_getpages_args *ap)
bp = getpbuf(&ncl_pbuf_freecnt);
kva = (vm_offset_t) bp->b_data;
+#ifndef __rtems__
pmap_qenter(kva, pages, npages);
+#endif /* __rtems__*/
VM_CNT_INC(v_vnodein);
VM_CNT_ADD(v_vnodepgsin, npages);
@@ -194,14 +202,20 @@ ncl_getpages(struct vop_getpages_args *ap)
iov.iov_len = count;
uio.uio_iov = &iov;
uio.uio_iovcnt = 1;
+#ifndef __rtems__
uio.uio_offset = IDX_TO_OFF(pages[0]->pindex);
+#else /* __rtems__*/
+ uio.uio_offset = 0;
+#endif /* __rtems__*/
uio.uio_resid = count;
uio.uio_segflg = UIO_SYSSPACE;
uio.uio_rw = UIO_READ;
uio.uio_td = td;
error = ncl_readrpc(vp, &uio, cred);
+#ifndef __rtems__
pmap_qremove(kva, npages);
+#endif /* __rtems__*/
relpbuf(bp, &ncl_pbuf_freecnt);
@@ -221,6 +235,7 @@ ncl_getpages(struct vop_getpages_args *ap)
for (i = 0, toff = 0; i < npages; i++, toff = nextoff) {
vm_page_t m;
nextoff = toff + PAGE_SIZE;
+#ifndef __rtems__
m = pages[i];
if (nextoff <= size) {
@@ -250,8 +265,11 @@ ncl_getpages(struct vop_getpages_args *ap)
*/
;
}
+#endif /* __rtems__*/
}
+#ifndef __rtems__
out:
+#endif /* __rtems__ */
VM_OBJECT_WUNLOCK(object);
if (ap->a_rbehind)
*ap->a_rbehind = 0;
@@ -291,7 +309,11 @@ ncl_putpages(struct vop_putpages_args *ap)
count = ap->a_count;
rtvals = ap->a_rtvals;
npages = btoc(count);
+#ifndef __rtems__
offset = IDX_TO_OFF(pages[0]->pindex);
+#else /* __rtems__*/
+ offset = 0;
+#endif /* __rtems__*/
mtx_lock(&nmp->nm_mtx);
if ((nmp->nm_flag & NFSMNT_NFSV3) != 0 &&
@@ -334,14 +356,20 @@ ncl_putpages(struct vop_putpages_args *ap)
uio.uio_rw = UIO_WRITE;
uio.uio_td = td;
+#ifndef __rtems__
error = VOP_WRITE(vp, &uio, vnode_pager_putpages_ioflags(ap->a_sync),
cred);
+#else /* __rtems__*/
+ error = VOP_WRITE(vp, &uio, 0, cred);
+#endif /* __rtems__*/
crfree(cred);
+#ifndef __rtems__
if (error == 0 || !nfs_keep_dirty_on_error) {
vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid,
np->n_size - offset, npages * PAGE_SIZE);
}
+#endif /* __rtems__*/
return (rtvals[0]);
}
@@ -709,6 +737,7 @@ ncl_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred)
return (error);
}
+#ifdef __rtems__
/*
* The NFS write path cannot handle iovecs with len > 1. So we need to
* break up iovecs accordingly (restricting them to wsize).
@@ -855,6 +884,7 @@ err_free:
}
return (0);
}
+#endif /* __rtems__ */
/*
* Vnode op for write using bio
@@ -1044,7 +1074,9 @@ again:
NFSLOCKNODE(np);
np->n_size = uio->uio_offset + n;
np->n_flag |= NMODIFIED;
+#ifndef __rtems__
vnode_pager_setsize(vp, np->n_size);
+#endif /* __rems__ */
NFSUNLOCKNODE(np);
save = bp->b_flags & B_CACHE;
@@ -1073,7 +1105,9 @@ again:
if (uio->uio_offset + n > np->n_size) {
np->n_size = uio->uio_offset + n;
np->n_flag |= NMODIFIED;
+#ifndef __rtems__
vnode_pager_setsize(vp, np->n_size);
+#endif /* __rems__ */
}
NFSUNLOCKNODE(np);
}
@@ -1265,6 +1299,7 @@ again:
return (error);
}
+#ifdef __rtems__
/*
* Get an nfs cache block.
*
@@ -1309,6 +1344,7 @@ nfs_getcacheblk(struct vnode *vp, daddr_t bn, int size, struct thread *td)
bp->b_blkno = bn * (vp->v_bufobj.bo_bsize / DEV_BSIZE);
return (bp);
}
+#endif /* __rtems__ */
/*
* Flush and invalidate all dirty buffers. If another process is already
@@ -1345,9 +1381,11 @@ ncl_vinvalbuf(struct vnode *vp, int flags, struct thread *td, int intrflg)
*/
if ((flags & (V_SAVE | V_VMIO)) == V_SAVE &&
vp->v_bufobj.bo_object != NULL) {
+#ifndef __rtems__
VM_OBJECT_WLOCK(vp->v_bufobj.bo_object);
vm_object_page_clean(vp->v_bufobj.bo_object, 0, 0, OBJPC_SYNC);
VM_OBJECT_WUNLOCK(vp->v_bufobj.bo_object);
+#endif /* __rtems__*/
/*
* If the page clean was interrupted, fail the invalidation.
* Not doing so, we run the risk of losing dirty pages in the
@@ -1392,6 +1430,9 @@ out:
int
ncl_asyncio(struct nfsmount *nmp, struct buf *bp, struct ucred *cred, struct thread *td)
{
+#ifdef __rtems__
+ return (EOPNOTSUPP);
+#else /* __rtems__ */
int iod;
int gotiod;
int slpflag = 0;
@@ -1533,12 +1574,16 @@ again:
* force the caller to process the i/o synchronously.
*/
NFS_DPF(ASYNCIO, ("ncl_asyncio: no iods available, i/o is synchronous\n"));
+#endif /* __rtems__ */
return (EIO);
}
void
ncl_doio_directwrite(struct buf *bp)
{
+#ifdef __rtems__
+ panic("not supported in RTEMS");
+#else /* __rtems__ */
int iomode, must_commit;
struct uio *uiop = (struct uio *)bp->b_caller1;
char *iov_base = uiop->uio_iov->iov_base;
@@ -1572,6 +1617,7 @@ ncl_doio_directwrite(struct buf *bp)
}
bp->b_vp = NULL;
relpbuf(bp, &ncl_pbuf_freecnt);
+#endif /* __rtems__ */
}
/*
@@ -1643,9 +1689,13 @@ ncl_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td,
NFSLOCKNODE(np);
if (NFS_TIMESPEC_COMPARE(&np->n_mtime, &np->n_vattr.na_mtime)) {
NFSUNLOCKNODE(np);
+#ifndef __rtems__
PROC_LOCK(p);
killproc(p, "text file modification");
PROC_UNLOCK(p);
+#else /* __rtems__ */
+ panic("nfsclient: text file modification: want to killproc");
+#endif /* _-rtems__ */
} else
NFSUNLOCKNODE(np);
}
@@ -1867,8 +1917,9 @@ ncl_meta_setsize(struct vnode *vp, struct thread *td, u_quad_t nsize)
bp->b_flags |= B_RELBUF; /* don't leave garbage around */
brelse(bp);
} else {
+#ifndef __rtems__
vnode_pager_setsize(vp, nsize);
+#endif /* __rtems__ */
}
return(error);
}
-
diff --git a/freebsd/sys/fs/nfsclient/nfs_clcomsubs.c b/freebsd/sys/fs/nfsclient/nfs_clcomsubs.c
index 479a453a..47388dd6 100644
--- a/freebsd/sys/fs/nfsclient/nfs_clcomsubs.c
+++ b/freebsd/sys/fs/nfsclient/nfs_clcomsubs.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
diff --git a/freebsd/sys/fs/nfsclient/nfs_clkdtrace.c b/freebsd/sys/fs/nfsclient/nfs_clkdtrace.c
index 9e51c2f0..f4e27ba3 100644
--- a/freebsd/sys/fs/nfsclient/nfs_clkdtrace.c
+++ b/freebsd/sys/fs/nfsclient/nfs_clkdtrace.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
@@ -29,6 +31,7 @@
* SUCH DAMAGE.
*/
+#ifndef __rtems__
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -585,3 +588,4 @@ MODULE_DEPEND(dtnfscl, dtrace, 1, 1, 1);
MODULE_DEPEND(dtnfscl, opensolaris, 1, 1, 1);
MODULE_DEPEND(dtnfscl, nfscl, 1, 1, 1);
MODULE_DEPEND(dtnfscl, nfscommon, 1, 1, 1);
+#endif /* __rtems__ */
diff --git a/freebsd/sys/fs/nfsclient/nfs_clkrpc.c b/freebsd/sys/fs/nfsclient/nfs_clkrpc.c
index 6bdeaa7f..c3260ccf 100644
--- a/freebsd/sys/fs/nfsclient/nfs_clkrpc.c
+++ b/freebsd/sys/fs/nfsclient/nfs_clkrpc.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -36,7 +38,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_kgssapi.h"
+#include <rtems/bsd/local/opt_kgssapi.h>
#include <fs/nfs/nfsport.h>
@@ -296,4 +298,3 @@ nfsrvd_cbinit(int terminating)
NFSD_LOCK();
}
}
-
diff --git a/freebsd/sys/fs/nfsclient/nfs_clnfsiod.c b/freebsd/sys/fs/nfsclient/nfs_clnfsiod.c
index 3f0fb777..b24b905d 100644
--- a/freebsd/sys/fs/nfsclient/nfs_clnfsiod.c
+++ b/freebsd/sys/fs/nfsclient/nfs_clnfsiod.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -55,10 +57,12 @@ __FBSDID("$FreeBSD$");
#include <sys/domain.h>
#include <sys/protosw.h>
#include <sys/namei.h>
-#include <sys/unistd.h>
+#include <rtems/bsd/sys/unistd.h>
#include <sys/kthread.h>
#include <sys/fcntl.h>
+#ifndef __rtems__
#include <sys/lockf.h>
+#endif /* __rtems__ */
#include <sys/mutex.h>
#include <sys/taskqueue.h>
diff --git a/freebsd/sys/fs/nfsclient/nfs_clnode.c b/freebsd/sys/fs/nfsclient/nfs_clnode.c
index f41cb874..3f7a68ac 100644
--- a/freebsd/sys/fs/nfsclient/nfs_clnode.c
+++ b/freebsd/sys/fs/nfsclient/nfs_clnode.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -142,7 +144,11 @@ ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize, struct nfsnode **npp,
* destroy the mutex (in the case of the loser, or if hash_insert
* happened to return an error no special casing is needed).
*/
+#ifndef __rtems__
mtx_init(&np->n_mtx, "NEWNFSnode lock", NULL, MTX_DEF | MTX_DUPOK);
+#else /* __rtems__ */
+ mtx_init(&np->n_mtx, "NEWNFSnode lock", NULL, MTX_DEF | MTX_DUPOK | MTX_RECURSE);
+#endif /* __rtems__ */
lockinit(&np->n_excl, PVFS, "nfsupg", VLKTIMEOUT, LK_NOSHARE |
LK_CANRECURSE);
@@ -250,8 +256,10 @@ ncl_inactive(struct vop_inactive_args *ap)
*/
if (vp->v_object != NULL) {
VM_OBJECT_WLOCK(vp->v_object);
+#ifndef __rtems__
retv = vm_object_page_clean(vp->v_object, 0, 0,
OBJPC_SYNC);
+#endif /* __rtems__ */
VM_OBJECT_WUNLOCK(vp->v_object);
} else
retv = TRUE;
@@ -301,7 +309,9 @@ ncl_reclaim(struct vop_reclaim_args *ap)
/*
* Destroy the vm object and flush associated pages.
*/
+#ifndef __rtems__
vnode_destroy_vobject(vp);
+#endif /* __rtems__ */
if (NFS_ISV4(vp) && vp->v_type == VREG)
/*
diff --git a/freebsd/sys/fs/nfsclient/nfs_clport.c b/freebsd/sys/fs/nfsclient/nfs_clport.c
index 74320c9b..ed307700 100644
--- a/freebsd/sys/fs/nfsclient/nfs_clport.c
+++ b/freebsd/sys/fs/nfsclient/nfs_clport.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -36,8 +38,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_inet.h"
-#include "opt_inet6.h"
+#include <rtems/bsd/local/opt_inet.h>
+#include <rtems/bsd/local/opt_inet6.h>
#include <sys/capsicum.h>
@@ -232,7 +234,11 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, struct nfsfh *nfhp,
* destroy the mutex (in the case of the loser, or if hash_insert
* happened to return an error no special casing is needed).
*/
+#ifndef __rtems__
mtx_init(&np->n_mtx, "NEWNFSnode lock", NULL, MTX_DEF | MTX_DUPOK);
+#else /* __rtems__ */
+ mtx_init(&np->n_mtx, "NEWNFSnode lock", NULL, MTX_DEF | MTX_DUPOK | MTX_RECURSE);
+#endif /* __rtems__ */
lockinit(&np->n_excl, PVFS, "nfsupg", VLKTIMEOUT, LK_NOSHARE |
LK_CANRECURSE);
@@ -432,7 +438,11 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvattr *nap, void *nvaper,
if (vp->v_type != nvap->va_type) {
vp->v_type = nvap->va_type;
if (vp->v_type == VFIFO)
+#ifndef __rtems__
vp->v_op = &newnfs_fifoops;
+#else /* __rtems__ */
+ panic("no newnfs_fifoops");
+#endif /* __rtems__ */
np->n_mtime = nvap->va_mtime;
}
nmp = VFSTONFS(vp->v_mount);
@@ -596,16 +606,20 @@ ncl_pager_setsize(struct vnode *vp, u_quad_t *nsizep)
object = vp->v_object;
setnsize = false;
+#ifndef __rtems__
if (object != NULL && nsize != object->un_pager.vnp.vnp_size) {
if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE)
setnsize = true;
else
np->n_flag |= NVNSETSZSKIP;
}
+#endif /* __rtems__ */
if (nsizep == NULL) {
NFSUNLOCKNODE(np);
+#ifndef __rtems__
if (setnsize)
vnode_pager_setsize(vp, nsize);
+#endif /* __rtems__ */
setnsize = false;
} else {
*nsizep = nsize;
@@ -678,12 +692,20 @@ nfscl_filllockowner(void *id, u_int8_t *cp, int flags)
*cp++ = tl.cval[1];
*cp++ = tl.cval[2];
*cp++ = tl.cval[3];
+#ifndef __rtems__
tl.lval = p->p_stats->p_start.tv_sec;
+#else /* __rtems__ */
+ tl.lval = 0;
+#endif /* __rtems__ */
*cp++ = tl.cval[0];
*cp++ = tl.cval[1];
*cp++ = tl.cval[2];
*cp++ = tl.cval[3];
+#ifndef __rtems__
tl.lval = p->p_stats->p_start.tv_usec;
+#else /* __rtems__ */
+ tl.lval = 0;
+#endif /* __rtems__ */
*cp++ = tl.cval[0];
*cp++ = tl.cval[1];
*cp++ = tl.cval[2];
@@ -705,6 +727,7 @@ nfscl_filllockowner(void *id, u_int8_t *cp, int flags)
NFSPROC_T *
nfscl_getparent(struct thread *td)
{
+#ifndef __rtems__
struct proc *p;
struct thread *ptd;
@@ -718,6 +741,9 @@ nfscl_getparent(struct thread *td)
return (NULL);
ptd = TAILQ_FIRST(&p->p_threads);
return (ptd);
+#else /* __rtems__ */
+ return (NULL);
+#endif /* __rtems__ */
}
/*
@@ -730,7 +756,11 @@ start_nfscl(void *arg)
struct thread *td;
clp = (struct nfsclclient *)arg;
+#ifndef __rtems__
td = TAILQ_FIRST(&clp->nfsc_renewthread->p_threads);
+#else /* __rtems__ */
+ td = rtems_bsd_get_curthread_or_wait_forever();
+#endif /* __rtems__ */
nfscl_renewthread(clp, td);
kproc_exit(0);
}
@@ -971,7 +1001,11 @@ nfscl_getmyip(struct nfsmount *nmp, struct in6_addr *paddr, int *isinet6p)
#if defined(INET6) || defined(INET)
int error, fibnum;
+#ifndef __rtems__
fibnum = curthread->td_proc->p_fibnum;
+#else /* __rtems__ */
+ fibnum = 0;
+#endif /* __rtems__ */
#endif
#ifdef INET
if (nmp->nm_nam->sa_family == AF_INET) {
@@ -1052,6 +1086,9 @@ nfscl_init(void)
inited = 1;
nfscl_inited = 1;
ncl_pbuf_freecnt = nswbuf / 2 + 1;
+#ifdef __rtems__
+ ncl_pbuf_zone = pbuf_zsecond_create("nfspbuf", ncl_pbuf_freecnt);
+#endif /* __rtems__ */
}
/*
@@ -1173,6 +1210,7 @@ nfscl_procdoesntexist(u_int8_t *own)
pid_t pid;
int i, ret = 0;
+#ifndef __rtems__
/* For the single open_owner of all 0 bytes, just return 0. */
for (i = 0; i < NFSV4CL_LOCKNAMELEN; i++)
if (own[i] != 0)
@@ -1207,6 +1245,7 @@ nfscl_procdoesntexist(u_int8_t *own)
ret = 1;
}
PROC_UNLOCK(p);
+#endif /* __rtems__ */
return (ret);
}
@@ -1243,10 +1282,12 @@ nfssvc_nfscl(struct thread *td, struct nfssvc_args *uap)
cap_rights_init(&rights, CAP_SOCK_CLIENT), &fp);
if (error)
return (error);
+#ifndef __rtems__
if (fp->f_type != DTYPE_SOCKET) {
fdrop(fp, td);
return (EPERM);
}
+#endif /* __rtems__ */
error = nfscbd_addsock(fp);
fdrop(fp, td);
if (!error && nfscl_enablecallb == 0) {
@@ -1411,4 +1452,3 @@ MODULE_DEPEND(nfscl, nfscommon, 1, 1, 1);
MODULE_DEPEND(nfscl, krpc, 1, 1, 1);
MODULE_DEPEND(nfscl, nfssvc, 1, 1, 1);
MODULE_DEPEND(nfscl, nfslock, 1, 1, 1);
-
diff --git a/freebsd/sys/fs/nfsclient/nfs_clrpcops.c b/freebsd/sys/fs/nfsclient/nfs_clrpcops.c
index 8feb2a8b..e3101f76 100644
--- a/freebsd/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/freebsd/sys/fs/nfsclient/nfs_clrpcops.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -45,7 +47,7 @@ __FBSDID("$FreeBSD$");
*/
#ifndef APPLEKEXT
-#include "opt_inet6.h"
+#include <rtems/bsd/local/opt_inet6.h>
#include <fs/nfs/nfsport.h>
#include <sys/sysctl.h>
@@ -2959,41 +2961,57 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
return (error);
nd->nd_mrep = NULL;
dp = (struct dirent *)uio_iov_base(uiop);
+#ifndef __rtems__
dp->d_pad0 = dp->d_pad1 = 0;
+#endif /* __rtems__ */
dp->d_off = 0;
dp->d_type = DT_DIR;
dp->d_fileno = dotfileid;
dp->d_namlen = 1;
+#ifndef __rtems__
*((uint64_t *)dp->d_name) = 0; /* Zero pad it. */
+#else /* __rtems__ */
+ dp->d_name[1] = '\0';
+#endif /* __rtems__ */
dp->d_name[0] = '.';
dp->d_reclen = _GENERIC_DIRSIZ(dp) + NFSX_HYPER;
/*
* Just make these offset cookie 0.
*/
+#ifndef __rtems__
tl = (u_int32_t *)&dp->d_name[8];
*tl++ = 0;
*tl = 0;
+#endif /* __rtems__ */
blksiz += dp->d_reclen;
uio_uio_resid_add(uiop, -(dp->d_reclen));
uiop->uio_offset += dp->d_reclen;
uio_iov_base_add(uiop, dp->d_reclen);
uio_iov_len_add(uiop, -(dp->d_reclen));
dp = (struct dirent *)uio_iov_base(uiop);
+#ifndef __rtems__
dp->d_pad0 = dp->d_pad1 = 0;
+#endif /* __rtems__ */
dp->d_off = 0;
dp->d_type = DT_DIR;
dp->d_fileno = dotdotfileid;
dp->d_namlen = 2;
+#ifndef __rtems__
*((uint64_t *)dp->d_name) = 0;
+#else __rtems__
+ dp->d_name[2] = '\0';
+#endif /* __rtems__ */
dp->d_name[0] = '.';
dp->d_name[1] = '.';
dp->d_reclen = _GENERIC_DIRSIZ(dp) + NFSX_HYPER;
/*
* Just make these offset cookie 0.
*/
+#ifndef __rtems__
tl = (u_int32_t *)&dp->d_name[8];
*tl++ = 0;
*tl = 0;
+#endif /* __rtems__ */
blksiz += dp->d_reclen;
uio_uio_resid_add(uiop, -(dp->d_reclen));
uiop->uio_offset += dp->d_reclen;
@@ -3106,7 +3124,9 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
bigenough = 0;
if (bigenough) {
dp = (struct dirent *)uio_iov_base(uiop);
+#ifndef __rtems__
dp->d_pad0 = dp->d_pad1 = 0;
+#endif /* __rtems__ */
dp->d_off = 0;
dp->d_namlen = len;
dp->d_reclen = _GENERIC_DIRLEN(len) +
@@ -3127,6 +3147,10 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
NFSBZERO(cp, tlen);
cp += tlen; /* points to cookie storage */
tl2 = (u_int32_t *)cp;
+#ifdef __rtems__
+ tlen = dp->d_reclen -
+ (((char*) uio_iov_base(uiop) - (char*) dp) + NFSX_HYPER);
+#endif /* __rtems__ */
uio_iov_base_add(uiop, (tlen + NFSX_HYPER));
uio_iov_len_add(uiop, -(tlen + NFSX_HYPER));
uio_uio_resid_add(uiop, -(tlen + NFSX_HYPER));
@@ -3242,9 +3266,14 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
dp = (struct dirent *)uio_iov_base(uiop);
NFSBZERO(dp, DIRBLKSIZ);
dp->d_type = DT_UNKNOWN;
+#ifndef __rtems__
tl = (u_int32_t *)&dp->d_name[4];
*tl++ = cookie.lval[0];
*tl = cookie.lval[1];
+#else /* __rtems__ */
+ memcpy(&dp->d_name[8], &cookie.lval[0], sizeof(u_int32_t));
+ memcpy(&dp->d_name[8 + sizeof(u_int32_t)], &cookie.lval[1], sizeof(u_int32_t));
+#endif /* __rtems__ */
dp->d_reclen = DIRBLKSIZ;
uio_iov_base_add(uiop, DIRBLKSIZ);
uio_iov_len_add(uiop, -(DIRBLKSIZ));
@@ -3396,41 +3425,61 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
return (error);
nd->nd_mrep = NULL;
dp = (struct dirent *)uio_iov_base(uiop);
+#ifndef __rtems__
dp->d_pad0 = dp->d_pad1 = 0;
+#endif /* __rtems__ */
dp->d_off = 0;
dp->d_type = DT_DIR;
dp->d_fileno = dotfileid;
dp->d_namlen = 1;
+#ifndef __rtems__
*((uint64_t *)dp->d_name) = 0; /* Zero pad it. */
+#else /* __rtems__ */
+ dp->d_name[0] = dp->d_name[1] = dp->d_name[2] = dp->d_name[3] = '\0';
+#endif /* __rtems__ */
dp->d_name[0] = '.';
dp->d_reclen = _GENERIC_DIRSIZ(dp) + NFSX_HYPER;
/*
* Just make these offset cookie 0.
*/
+#ifndef __rtems__
tl = (u_int32_t *)&dp->d_name[8];
*tl++ = 0;
*tl = 0;
+#else /* __rtems__ */
+ memset(&dp->d_name[8], 0, 2 * sizeof(u_int32_t));
+#endif /* __rtems__ */
blksiz += dp->d_reclen;
uio_uio_resid_add(uiop, -(dp->d_reclen));
uiop->uio_offset += dp->d_reclen;
uio_iov_base_add(uiop, dp->d_reclen);
uio_iov_len_add(uiop, -(dp->d_reclen));
dp = (struct dirent *)uio_iov_base(uiop);
+#ifndef __rtems__
dp->d_pad0 = dp->d_pad1 = 0;
+#endif /* __rtems__ */
dp->d_off = 0;
dp->d_type = DT_DIR;
dp->d_fileno = dotdotfileid;
dp->d_namlen = 2;
+#ifndef __rtems__
*((uint64_t *)dp->d_name) = 0;
+#else /* __rtems__ */
+ dp->d_name[0] = dp->d_name[1] = dp->d_name[2] = dp->d_name[3] = '\0';
+#endif /* __rtems__ */
dp->d_name[0] = '.';
dp->d_name[1] = '.';
dp->d_reclen = _GENERIC_DIRSIZ(dp) + NFSX_HYPER;
/*
* Just make these offset cookie 0.
*/
+#ifndef __rtems__
tl = (u_int32_t *)&dp->d_name[8];
*tl++ = 0;
*tl = 0;
+#else /* __rtems__ */
+ memset(&dp->d_name[8], 0, 2 * sizeof(u_int32_t));
+#endif /* __rtems__ */
blksiz += dp->d_reclen;
uio_uio_resid_add(uiop, -(dp->d_reclen));
uiop->uio_offset += dp->d_reclen;
@@ -3524,7 +3573,9 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
bigenough = 0;
if (bigenough) {
dp = (struct dirent *)uio_iov_base(uiop);
+#ifndef __rtems__
dp->d_pad0 = dp->d_pad1 = 0;
+#endif /* __rtems__ */
dp->d_off = 0;
dp->d_namlen = len;
dp->d_reclen = _GENERIC_DIRLEN(len) +
@@ -3745,9 +3796,14 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
dp = (struct dirent *)uio_iov_base(uiop);
NFSBZERO(dp, DIRBLKSIZ);
dp->d_type = DT_UNKNOWN;
+#ifndef __rtems__
tl = (u_int32_t *)&dp->d_name[4];
*tl++ = cookie.lval[0];
*tl = cookie.lval[1];
+#else /* __rtems__ */
+ memcpy(&dp->d_name[8], &cookie.lval[0], sizeof(u_int32_t));
+ memcpy(&dp->d_name[8 + sizeof(u_int32_t)], &cookie.lval[1], sizeof(u_int32_t));
+#endif /* __rtems__ */
dp->d_reclen = DIRBLKSIZ;
uio_iov_base_add(uiop, DIRBLKSIZ);
uio_iov_len_add(uiop, -(DIRBLKSIZ));
@@ -4670,8 +4726,16 @@ nfsrpc_exchangeid(struct nfsmount *nmp, struct nfsclclient *clp,
/* Set the implementation id4 */
*tl = txdr_unsigned(1);
+#ifndef __rtems__
(void) nfsm_strtom(nd, "freebsd.org", strlen("freebsd.org"));
(void) nfsm_strtom(nd, version, strlen(version));
+#else /* __rtems__ */
+ {
+ const char* rv = rtems_version();
+ (void) nfsm_strtom(nd, "rtems.org", strlen("rtems.org"));
+ (void) nfsm_strtom(nd, rv, strlen(rv));
+ }
+#endif /* __rtems__ */
NFSM_BUILD(tl, uint32_t *, NFSX_V4TIME);
verstime.tv_sec = 1293840000; /* Jan 1, 2011 */
verstime.tv_nsec = 0;
@@ -7663,4 +7727,3 @@ out:
}
return (laystat);
}
-
diff --git a/freebsd/sys/fs/nfsclient/nfs_clstate.c b/freebsd/sys/fs/nfsclient/nfs_clstate.c
index 0a2e4bc7..6a93b183 100644
--- a/freebsd/sys/fs/nfsclient/nfs_clstate.c
+++ b/freebsd/sys/fs/nfsclient/nfs_clstate.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
@@ -5455,4 +5457,3 @@ tryagain:
NFSUNLOCKCLSTATE();
return (0);
}
-
diff --git a/freebsd/sys/fs/nfsclient/nfs_clsubs.c b/freebsd/sys/fs/nfsclient/nfs_clsubs.c
index 1c69d935..af0f3c62 100644
--- a/freebsd/sys/fs/nfsclient/nfs_clsubs.c
+++ b/freebsd/sys/fs/nfsclient/nfs_clsubs.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -57,7 +59,9 @@ __FBSDID("$FreeBSD$");
#include <sys/stat.h>
#include <sys/malloc.h>
#include <sys/sysent.h>
+#ifndef __rtems__
#include <sys/syscall.h>
+#endif /* __rtems__ */
#include <sys/sysproto.h>
#include <sys/taskqueue.h>
@@ -256,8 +260,10 @@ ncl_getattrcache(struct vnode *vp, struct vattr *vaper)
vaper->va_mtime = np->n_mtim;
}
NFSUNLOCKNODE(np);
+#ifndef __rtems__
if (setnsize)
vnode_pager_setsize(vp, nsize);
+#endif /* __rtems__ */
KDTRACE_NFS_ATTRCACHE_GET_HIT(vp, vap);
return (0);
}
@@ -388,4 +394,3 @@ ncl_init(struct vfsconf *vfsp)
return (0);
}
-
diff --git a/freebsd/sys/fs/nfsclient/nfs_clvfsops.c b/freebsd/sys/fs/nfsclient/nfs_clvfsops.c
index 348a64ab..70a897fe 100644
--- a/freebsd/sys/fs/nfsclient/nfs_clvfsops.c
+++ b/freebsd/sys/fs/nfsclient/nfs_clvfsops.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -38,8 +40,8 @@
__FBSDID("$FreeBSD$");
-#include "opt_bootp.h"
-#include "opt_nfsroot.h"
+#include <rtems/bsd/local/opt_bootp.h>
+#include <rtems/bsd/local/opt_nfsroot.h>
#include <sys/param.h>
#include <sys/systm.h>
@@ -49,7 +51,9 @@ __FBSDID("$FreeBSD$");
#include <sys/clock.h>
#include <sys/jail.h>
#include <sys/limits.h>
+#ifndef __rtems__
#include <sys/lock.h>
+#endif /* __rtems__ */
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/module.h>
@@ -446,6 +450,7 @@ nfs_mountroot(struct mount *mp)
error = ifioctl(so, SIOCAIFADDR, (caddr_t)&nd->myif, td);
if (error)
panic("nfs_mountroot: SIOCAIFADDR: %d", error);
+#ifndef __rtems__
if ((cp = kern_getenv("boot.netif.mtu")) != NULL) {
ir.ifr_mtu = strtol(cp, NULL, 10);
bcopy(nd->myif.ifra_name, ir.ifr_name, IFNAMSIZ);
@@ -454,6 +459,7 @@ nfs_mountroot(struct mount *mp)
if (error)
printf("nfs_mountroot: SIOCSIFMTU: %d", error);
}
+#endif /* __rtems__ */
soclose(so);
/*
@@ -506,7 +512,9 @@ nfs_mountroot(struct mount *mp)
strlcpy(prison0.pr_hostname, nd->my_hostnam,
sizeof(prison0.pr_hostname));
mtx_unlock(&prison0.pr_mtx);
+#ifndef __rtems__
inittodr(ntohl(nd->root_time));
+#endif /* __rtems__ */
return (0);
}
@@ -1178,7 +1186,11 @@ nfs_mount(struct mount *mp)
* "nfsreq".
*/
if (args.sotype == SOCK_DGRAM && nmp->nm_sotype == SOCK_STREAM)
+#ifndef __rtems__
tprintf(td->td_proc, LOG_WARNING,
+#else /* __rtems__ */
+ printf(
+#endif /* __rtems__ */
"Warning: mount -u that changes TCP->UDP can result in hung threads\n");
/*
@@ -2048,4 +2060,3 @@ void nfscl_retopts(struct nfsmount *nmp, char *buffer, size_t buflen)
nfscl_printoptval(nmp, nmp->nm_timeo, ",timeout", &buf, &blen);
nfscl_printoptval(nmp, nmp->nm_retry, ",retrans", &buf, &blen);
}
-
diff --git a/freebsd/sys/fs/nfsclient/nfs_clvnops.c b/freebsd/sys/fs/nfsclient/nfs_clvnops.c
index 478ee059..d52d1b28 100644
--- a/freebsd/sys/fs/nfsclient/nfs_clvnops.c
+++ b/freebsd/sys/fs/nfsclient/nfs_clvnops.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -41,7 +43,7 @@ __FBSDID("$FreeBSD$");
* vnode op calls for Sun NFS version 2, 3 and 4
*/
-#include "opt_inet.h"
+#include <rtems/bsd/local/opt_inet.h>
#include <sys/param.h>
#include <sys/kernel.h>
@@ -59,7 +61,9 @@ __FBSDID("$FreeBSD$");
#include <sys/vnode.h>
#include <sys/dirent.h>
#include <sys/fcntl.h>
+#ifndef __rtems__
#include <sys/lockf.h>
+#endif /* __rtems__ */
#include <sys/stat.h>
#include <sys/sysctl.h>
#include <sys/signalvar.h>
@@ -334,7 +338,9 @@ nfs_lock(struct vop_lock1_args *ap)
np->n_flag &= ~NVNSETSZSKIP;
nsize = np->n_size;
NFSUNLOCKNODE(np);
+#ifndef __rtems__
vnode_pager_setsize(vp, nsize);
+#endif /* __rtems__ */
downgrade:
if (lktype == LK_SHARED) {
ap->a_flags &= ~(LK_TYPE_MASK | LK_INTERLOCK);
@@ -683,7 +689,9 @@ nfs_open(struct vop_open_args *ap)
if (cred != NULL)
crfree(cred);
+#ifndef __rtems__
vnode_create_vobject(vp, vattr.va_size, ap->a_td);
+#endif /* __rtems__ */
/*
* If the text file has been mmap'd, flush any dirty pages to the
@@ -694,12 +702,14 @@ nfs_open(struct vop_open_args *ap)
* executing the text file to be terminated.
*/
if (vp->v_writecount <= -1) {
+#ifndef __rtems__
if ((obj = vp->v_object) != NULL &&
(obj->flags & OBJ_MIGHTBEDIRTY) != 0) {
VM_OBJECT_WLOCK(obj);
vm_object_page_clean(obj, 0, 0, OBJPC_SYNC);
VM_OBJECT_WUNLOCK(obj);
}
+#endif /* __rtems__ */
/* Now, flush the buffer cache. */
ncl_flush(vp, MNT_WAIT, curthread, 0, 0);
@@ -778,11 +788,13 @@ nfs_close(struct vop_close_args *ap)
* close, regardless of whether they were dirtied by
* mmap'ed writes or via write().
*/
+#ifndef __rtems__
if (nfs_clean_pages_on_close && vp->v_object) {
VM_OBJECT_WLOCK(vp->v_object);
vm_object_page_clean(vp->v_object, 0, 0, 0);
VM_OBJECT_WUNLOCK(vp->v_object);
}
+#endif /* __rtems__ */
NFSLOCKNODE(np);
if (np->n_flag & NMODIFIED) {
NFSUNLOCKNODE(np);
@@ -805,7 +817,7 @@ nfs_close(struct vop_close_args *ap)
int cm = newnfs_commit_on_close ? 1 : 0;
error = ncl_flush(vp, MNT_WAIT, ap->a_td, cm, 0);
/* np->n_flag &= ~NMODIFIED; */
- } else if (NFS_ISV4(vp)) {
+ } else if (NFS_ISV4(vp)) {
if (nfscl_mustflush(vp) != 0) {
int cm = newnfs_commit_on_close ? 1 : 0;
error = ncl_flush(vp, MNT_WAIT, ap->a_td,
@@ -821,10 +833,10 @@ nfs_close(struct vop_close_args *ap)
}
NFSLOCKNODE(np);
}
- /*
+ /*
* Invalidate the attribute cache in all cases.
* An open is going to fetch fresh attrs any way, other procs
- * on this node that have file open will be forced to do an
+ * on this node that have file open will be forced to do an
* otw attr fetch, but this is safe.
* --> A user found that their RPC count dropped by 20% when
* this was commented out and I can't see any requirement
@@ -879,7 +891,7 @@ nfs_close(struct vop_close_args *ap)
np->n_directio_asyncwr));
if (newnfs_directio_enable && (fmode & O_DIRECT) && (vp->v_type == VREG)) {
NFSLOCKNODE(np);
- KASSERT((np->n_directio_opens > 0),
+ KASSERT((np->n_directio_opens > 0),
("nfs_close: unexpectedly value (0) of n_directio_opens\n"));
np->n_directio_opens--;
if (np->n_directio_opens == 0)
@@ -1009,7 +1021,7 @@ nfs_setattr(struct vop_setattr_args *ap)
vap->va_mode == (mode_t)VNOVAL &&
vap->va_uid == (uid_t)VNOVAL &&
vap->va_gid == (gid_t)VNOVAL)
- return (0);
+ return (0);
vap->va_size = VNOVAL;
break;
default:
@@ -1036,7 +1048,9 @@ nfs_setattr(struct vop_setattr_args *ap)
error = ncl_vinvalbuf(vp, vap->va_size == 0 ?
0 : V_SAVE, td, 1);
if (error != 0) {
+#ifndef __rtems__
vnode_pager_setsize(vp, tsize);
+#endif /* __rtems__ */
return (error);
}
/*
@@ -1058,7 +1072,7 @@ nfs_setattr(struct vop_setattr_args *ap)
}
} else {
NFSLOCKNODE(np);
- if ((vap->va_mtime.tv_sec != VNOVAL || vap->va_atime.tv_sec != VNOVAL) &&
+ if ((vap->va_mtime.tv_sec != VNOVAL || vap->va_atime.tv_sec != VNOVAL) &&
(np->n_flag & NMODIFIED) && vp->v_type == VREG) {
NFSUNLOCKNODE(np);
error = ncl_vinvalbuf(vp, V_SAVE, td, 1);
@@ -1071,7 +1085,9 @@ nfs_setattr(struct vop_setattr_args *ap)
if (error && vap->va_size != VNOVAL) {
NFSLOCKNODE(np);
np->n_size = np->n_vattr.na_size = tsize;
+#ifndef __rtems__
vnode_pager_setsize(vp, tsize);
+#endif /* __rtems__ */
NFSUNLOCKNODE(np);
}
return (error);
@@ -1130,7 +1146,7 @@ nfs_lookup(struct vop_lookup_args *ap)
struct nfsvattr dnfsva, nfsva;
struct vattr vattr;
struct timespec nctime;
-
+
*vpp = NULLVP;
if ((flags & ISLASTCN) && (mp->mnt_flag & MNT_RDONLY) &&
(cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME))
@@ -1207,7 +1223,7 @@ nfs_lookup(struct vop_lookup_args *ap)
cache_purge(newvp);
if (dvp != newvp)
vput(newvp);
- else
+ else
vrele(newvp);
*vpp = NULLVP;
} else if (error == ENOENT) {
@@ -1363,7 +1379,7 @@ nfs_lookup(struct vop_lookup_args *ap)
(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
0, 1);
else if ((flags & (ISLASTCN | ISOPEN)) == (ISLASTCN | ISOPEN) &&
- !(np->n_flag & NMODIFIED)) {
+ !(np->n_flag & NMODIFIED)) {
/*
* Flush the attribute cache when opening a
* leaf node to ensure that fresh attributes
@@ -1695,7 +1711,7 @@ again:
/* try again without setting uid/gid */
vap->va_uid = (uid_t)VNOVAL;
vap->va_gid = (uid_t)VNOVAL;
- error = nfsrpc_setattr(newvp, vap, NULL,
+ error = nfsrpc_setattr(newvp, vap, NULL,
cnp->cn_cred, cnp->cn_thread, &nfsva,
&attrflag, NULL);
}
@@ -1883,7 +1899,7 @@ nfs_rename(struct vop_rename_args *ap)
* under NFSV3. NFSV2 does not have this problem because
* ( as far as I can tell ) it flushes dirty buffers more
* often.
- *
+ *
* Skip the rename operation if the fsync fails, this can happen
* due to the server's volume being full, when we pushed out data
* that was written back to our cache earlier. Not checking for
@@ -2295,10 +2311,10 @@ nfs_readdir(struct vop_readdir_args *ap)
ssize_t tresid, left;
int error = 0;
struct vattr vattr;
-
+
if (ap->a_eofflag != NULL)
*ap->a_eofflag = 0;
- if (vp->v_type != VDIR)
+ if (vp->v_type != VDIR)
return(EPERM);
/*
@@ -2342,7 +2358,7 @@ nfs_readdir(struct vop_readdir_args *ap)
if (ap->a_eofflag != NULL)
*ap->a_eofflag = 1;
}
-
+
/* Add the partial DIRBLKSIZ (left) back in. */
uio->uio_resid += left;
return (error);
@@ -2376,7 +2392,7 @@ ncl_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
cookie = *cookiep;
ncl_dircookie_unlock(dnp);
} else {
- ncl_dircookie_unlock(dnp);
+ ncl_dircookie_unlock(dnp);
return (NFSERR_BAD_COOKIE);
}
@@ -2494,18 +2510,22 @@ nfs_sillyrename(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
sp->s_dvp = dvp;
VREF(dvp);
- /*
+ /*
* Fudge together a funny name.
- * Changing the format of the funny name to accommodate more
+ * Changing the format of the funny name to accommodate more
* sillynames per directory.
- * The name is now changed to .nfs.<ticks>.<pid>.4, where ticks is
+ * The name is now changed to .nfs.<ticks>.<pid>.4, where ticks is
* CPU ticks since boot.
*/
+#ifndef __rtems__
pid = cnp->cn_thread->td_proc->p_pid;
+#else /* __rtems__ */
+ pid = 1;
+#endif /* __rtems__ */
lticks = (unsigned int)ticks;
for ( ; ; ) {
- sp->s_namlen = sprintf(sp->s_name,
- ".nfs.%08x.%04x4.4", lticks,
+ sp->s_namlen = sprintf(sp->s_name,
+ ".nfs.%08x.%04x4.4", lticks,
pid);
if (nfs_lookitup(dvp, sp->s_name, sp->s_namlen, sp->s_cred,
cnp->cn_thread, NULL))
@@ -3041,12 +3061,12 @@ loop:
while (np->n_directio_asyncwr > 0) {
np->n_flag |= NFSYNCWAIT;
error = newnfs_msleep(td, &np->n_directio_asyncwr,
- &np->n_mtx, slpflag | (PRIBIO + 1),
+ &np->n_mtx, slpflag | (PRIBIO + 1),
"nfsfsync", 0);
if (error) {
if (newnfs_sigintr(nmp, td)) {
NFSUNLOCKNODE(np);
- error = EINTR;
+ error = EINTR;
goto done;
}
}
@@ -3106,7 +3126,7 @@ nfs_advlock(struct vop_advlock_args *ap)
struct vattr va;
int ret, error = EOPNOTSUPP;
u_quad_t size;
-
+
ret = NFSVOPLOCK(vp, LK_SHARED);
if (ret != 0)
return (EBADF);
@@ -3115,9 +3135,11 @@ nfs_advlock(struct vop_advlock_args *ap)
NFSVOPUNLOCK(vp, 0);
return (EINVAL);
}
+#ifndef __rtems__
if ((ap->a_flags & F_POSIX) != 0)
cred = p->p_ucred;
else
+#endif /* __rtems__ */
cred = td->td_ucred;
NFSVOPLOCK(vp, LK_UPGRADE | LK_RETRY);
if (vp->v_iflag & VI_DOOMED) {
@@ -3198,6 +3220,7 @@ nfs_advlock(struct vop_advlock_args *ap)
NFSVOPUNLOCK(vp, 0);
return (0);
} else if (!NFS_ISV4(vp)) {
+#ifndef __rtems__
if ((VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NOLOCKD) != 0) {
size = VTONFS(vp)->n_size;
NFSVOPUNLOCK(vp, 0);
@@ -3220,6 +3243,10 @@ nfs_advlock(struct vop_advlock_args *ap)
NFSVOPUNLOCK(vp, 0);
}
}
+#else /* __rtems__ */
+ NFSVOPUNLOCK(vp, 0);
+ return (0);
+#endif /* __rtems__ */
} else
NFSVOPUNLOCK(vp, 0);
return (error);
@@ -3234,7 +3261,7 @@ nfs_advlockasync(struct vop_advlockasync_args *ap)
struct vnode *vp = ap->a_vp;
u_quad_t size;
int error;
-
+
if (NFS_ISV4(vp))
return (EOPNOTSUPP);
error = NFSVOPLOCK(vp, LK_SHARED);
@@ -3243,7 +3270,9 @@ nfs_advlockasync(struct vop_advlockasync_args *ap)
if ((VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NOLOCKD) != 0) {
size = VTONFS(vp)->n_size;
NFSVOPUNLOCK(vp, 0);
+#ifndef __rtems__
error = lf_advlockasync(ap, &(vp->v_lockf), size);
+#endif /* __rtems__ */
} else {
NFSVOPUNLOCK(vp, 0);
error = EOPNOTSUPP;
@@ -3262,8 +3291,10 @@ nfs_print(struct vop_print_args *ap)
printf("\tfileid %jd fsid 0x%jx", (uintmax_t)np->n_vattr.na_fileid,
(uintmax_t)np->n_vattr.na_fsid);
+#ifndef __rtems__
if (vp->v_type == VFIFO)
fifo_printinfo(vp);
+#endif /* __rtems__ */
printf("\n");
return (0);
}
@@ -3296,7 +3327,9 @@ ncl_writebp(struct buf *bp, int force __unused, struct thread *td)
bp->b_iocmd = BIO_WRITE;
bufobj_wref(bp->b_bufobj);
+#ifndef __rtems__
curthread->td_ru.ru_oublock++;
+#endif /* __rtems__ */
/*
* Note: to avoid loopback deadlocks, we do not
@@ -3364,6 +3397,7 @@ out:
static int
nfsfifo_read(struct vop_read_args *ap)
{
+#ifndef __rtems__
struct nfsnode *np = VTONFS(ap->a_vp);
int error;
@@ -3375,7 +3409,10 @@ nfsfifo_read(struct vop_read_args *ap)
vfs_timestamp(&np->n_atim);
NFSUNLOCKNODE(np);
error = fifo_specops.vop_read(ap);
- return error;
+ return error;
+#else /* __rtems__ */
+ return (EINVAL);
+#endif /* __rtems__ */
}
/*
@@ -3384,6 +3421,7 @@ nfsfifo_read(struct vop_read_args *ap)
static int
nfsfifo_write(struct vop_write_args *ap)
{
+#ifndef __rtems__
struct nfsnode *np = VTONFS(ap->a_vp);
/*
@@ -3394,6 +3432,9 @@ nfsfifo_write(struct vop_write_args *ap)
vfs_timestamp(&np->n_mtim);
NFSUNLOCKNODE(np);
return(fifo_specops.vop_write(ap));
+#else /* __rtems__ */
+ return (EINVAL);
+#endif /* __rtems__ */
}
/*
@@ -3404,6 +3445,7 @@ nfsfifo_write(struct vop_write_args *ap)
static int
nfsfifo_close(struct vop_close_args *ap)
{
+#ifndef __rtems__
struct vnode *vp = ap->a_vp;
struct nfsnode *np = VTONFS(vp);
struct vattr vattr;
@@ -3432,6 +3474,9 @@ nfsfifo_close(struct vop_close_args *ap)
NFSUNLOCKNODE(np);
out:
return (fifo_specops.vop_close(ap));
+#else /* __rtems__ */
+ return (EINVAL);
+#endif /* __rtems__ */
}
/*
@@ -3601,4 +3646,3 @@ nfs_pathconf(struct vop_pathconf_args *ap)
}
return (error);
}
-
diff --git a/freebsd/sys/nfs/bootp_subr.c b/freebsd/sys/nfs/bootp_subr.c
index 07418aff..d5c44ba8 100644
--- a/freebsd/sys/nfs/bootp_subr.c
+++ b/freebsd/sys/nfs/bootp_subr.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/*-
* SPDX-License-Identifier: BSD-4-Clause
*
@@ -45,9 +47,9 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_bootp.h"
-#include "opt_nfs.h"
-#include "opt_rootdevname.h"
+#include <rtems/bsd/local/opt_bootp.h>
+#include <rtems/bsd/local/opt_nfs.h>
+#include <rtems/bsd/local/opt_rootdevname.h>
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/freebsd/sys/nfs/krpc_subr.c b/freebsd/sys/nfs/krpc_subr.c
index 21e8e3ad..16fb6ac6 100644
--- a/freebsd/sys/nfs/krpc_subr.c
+++ b/freebsd/sys/nfs/krpc_subr.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/* $NetBSD: krpc_subr.c,v 1.12.4.1 1996/06/07 00:52:26 cgd Exp $ */
/*-
diff --git a/freebsd/sys/nfs/nfs_fha.c b/freebsd/sys/nfs/nfs_fha.c
index 8c5c144d..ac4d7f14 100644
--- a/freebsd/sys/nfs/nfs_fha.c
+++ b/freebsd/sys/nfs/nfs_fha.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
diff --git a/freebsd/sys/nfs/nfs_lock.c b/freebsd/sys/nfs/nfs_lock.c
index efa1e80b..e1d04336 100644
--- a/freebsd/sys/nfs/nfs_lock.c
+++ b/freebsd/sys/nfs/nfs_lock.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -41,7 +43,9 @@ __FBSDID("$FreeBSD$");
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/malloc.h>
+#ifndef __rtems__
#include <sys/lockf.h> /* for hz */ /* Must come after sys/malloc.h */
+#endif /* __rtems__ */
#include <sys/mbuf.h>
#include <sys/mount.h>
#include <sys/namei.h>
@@ -50,7 +54,7 @@ __FBSDID("$FreeBSD$");
#include <sys/resourcevar.h>
#include <sys/socket.h>
#include <sys/socket.h>
-#include <sys/unistd.h>
+#include <rtems/bsd/sys/unistd.h>
#include <sys/vnode.h>
#include <net/if.h>
@@ -286,7 +290,9 @@ nfs_dolock(struct vop_advlock_args *ap)
if (p->p_nlminfo == NULL) {
p->p_nlminfo = malloc(sizeof(struct nlminfo),
M_NLMINFO, M_WAITOK | M_ZERO);
+#ifndef __rtems__
p->p_nlminfo->pid_start = p->p_stats->p_start;
+#endif /* __rtems__ */
getboottime(&boottime);
timevaladd(&p->p_nlminfo->pid_start, &boottime);
}
@@ -337,7 +343,9 @@ nfs_dolock(struct vop_advlock_args *ap)
if (msg.lm_getlk && p->p_nlminfo->retcode == 0) {
if (p->p_nlminfo->set_getlk_pid) {
+#ifndef __rtems__
fl->l_sysid = 0; /* XXX */
+#endif /* __rtems__ */
fl->l_pid = p->p_nlminfo->getlk_pid;
} else {
fl->l_type = F_UNLCK;
@@ -364,9 +372,13 @@ nfslockdans(struct thread *td, struct lockd_ans *ansp)
if (ansp->la_vers != LOCKD_ANS_VERSION)
return (EINVAL);
+#ifndef __rtems__
/* Find the process, set its return errno and wake it up. */
if ((targetp = pfind(ansp->la_msg_ident.pid)) == NULL)
return (ESRCH);
+#else /* __rtems__ */
+ targetp = td->td_proc;
+#endif /* __rtems__ */
/* verify the pid hasn't been reused (if we can), and it isn't waiting
* for an answer from a more recent request. We return an EPIPE if
diff --git a/freebsd/sys/nfs/nfs_nfssvc.c b/freebsd/sys/nfs/nfs_nfssvc.c
index 19ac16a9..ce03773a 100644
--- a/freebsd/sys/nfs/nfs_nfssvc.c
+++ b/freebsd/sys/nfs/nfs_nfssvc.c
@@ -1,3 +1,5 @@
+#include <machine/rtems-bsd-kernel-space.h>
+
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -36,7 +38,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_nfs.h"
+#include <rtems/bsd/local/opt_nfs.h>
#include <sys/param.h>
#include <sys/systm.h>
@@ -49,17 +51,21 @@ __FBSDID("$FreeBSD$");
#include <sys/mutex.h>
#include <sys/module.h>
#include <sys/sysent.h>
+#ifndef __rtems__
#include <sys/syscall.h>
+#endif /* __rtems__ */
#include <sys/sysproto.h>
#include <security/audit/audit.h>
#include <nfs/nfssvc.h>
+#ifndef __rtems__
static struct syscall_helper_data nfssvc_syscalls[] = {
SYSCALL_INIT_HELPER(nfssvc),
SYSCALL_INIT_LAST
};
+#endif /* __rtems__ */
/*
* This tiny module simply handles the nfssvc() system call. The other
@@ -124,8 +130,10 @@ nfssvc_modevent(module_t mod, int type, void *data)
switch (type) {
case MOD_LOAD:
+#ifndef __rtems__
error = syscall_helper_register(nfssvc_syscalls,
SY_THR_STATIC_KLD);
+#endif /* __rtems__ */
break;
case MOD_UNLOAD:
@@ -134,7 +142,9 @@ nfssvc_modevent(module_t mod, int type, void *data)
error = EBUSY;
break;
}
+#ifndef __rtems__
syscall_helper_unregister(nfssvc_syscalls);
+#endif /* __rtems__ */
break;
default:
error = EOPNOTSUPP;
@@ -151,4 +161,3 @@ DECLARE_MODULE(nfssvc, nfssvc_mod, SI_SUB_VFS, SI_ORDER_ANY);
/* So that loader and kldload(2) can find us, wherever we are.. */
MODULE_VERSION(nfssvc, 1);
-
diff --git a/freebsd/sys/nfsclient/nfs.h b/freebsd/sys/nfsclient/nfs.h
index ab50d896..0662c3c9 100644
--- a/freebsd/sys/nfsclient/nfs.h
+++ b/freebsd/sys/nfsclient/nfs.h
@@ -39,7 +39,7 @@
#define _NFSCLIENT_NFS_H_
#ifdef _KERNEL
-#include "opt_nfs.h"
+#include <rtems/bsd/local/opt_nfs.h>
#endif
#include <nfsclient/nfsargs.h>
diff --git a/freebsd/sys/nfsclient/nfsnode.h b/freebsd/sys/nfsclient/nfsnode.h
index 3c6856dc..2ceeeda8 100644
--- a/freebsd/sys/nfsclient/nfsnode.h
+++ b/freebsd/sys/nfsclient/nfsnode.h
@@ -102,13 +102,17 @@ struct nfsnode {
u_quad_t n_size; /* Current size of file */
u_quad_t n_brev; /* Modify rev when cached */
u_quad_t n_lrev; /* Modify rev for lease */
+#ifndef __rtems__
struct vattr n_vattr; /* Vnode attribute cache */
+#endif /* __rtems__ */
time_t n_attrstamp; /* Attr. cache timestamp */
struct nfs_accesscache n_accesscache[NFS_ACCESSCACHESIZE];
struct timespec n_mtime; /* Prev modify time. */
nfsfh_t *n_fhp; /* NFS File Handle */
+#ifndef __rtems__
struct vnode *n_vnode; /* associated vnode */
struct vnode *n_dvp; /* parent vnode */
+#endif /* __rtems__ */
int n_error; /* Save write error value */
union {
struct timespec nf_atim; /* Special file times */