diff options
Diffstat (limited to 'freebsd/sys/fs/nfsclient')
-rw-r--r-- | freebsd/sys/fs/nfsclient/nfs.h | 3 | ||||
-rw-r--r-- | freebsd/sys/fs/nfsclient/nfs_clbio.c | 53 | ||||
-rw-r--r-- | freebsd/sys/fs/nfsclient/nfs_clcomsubs.c | 2 | ||||
-rw-r--r-- | freebsd/sys/fs/nfsclient/nfs_clkdtrace.c | 4 | ||||
-rw-r--r-- | freebsd/sys/fs/nfsclient/nfs_clkrpc.c | 5 | ||||
-rw-r--r-- | freebsd/sys/fs/nfsclient/nfs_clnfsiod.c | 6 | ||||
-rw-r--r-- | freebsd/sys/fs/nfsclient/nfs_clnode.c | 10 | ||||
-rw-r--r-- | freebsd/sys/fs/nfsclient/nfs_clport.c | 46 | ||||
-rw-r--r-- | freebsd/sys/fs/nfsclient/nfs_clrpcops.c | 67 | ||||
-rw-r--r-- | freebsd/sys/fs/nfsclient/nfs_clstate.c | 3 | ||||
-rw-r--r-- | freebsd/sys/fs/nfsclient/nfs_clsubs.c | 7 | ||||
-rw-r--r-- | freebsd/sys/fs/nfsclient/nfs_clvfsops.c | 17 | ||||
-rw-r--r-- | freebsd/sys/fs/nfsclient/nfs_clvnops.c | 98 |
13 files changed, 279 insertions, 42 deletions
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); } - |