199767f8919635c4928607450d9e0abb932109ceToomas Soome/* $NetBSD: nfs.c,v 1.2 1998/01/24 12:43:09 drochner Exp $ */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (c) 1993 John Brezak
199767f8919635c4928607450d9e0abb932109ceToomas Soome * All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Redistribution and use in source and binary forms, with or without
199767f8919635c4928607450d9e0abb932109ceToomas Soome * modification, are permitted provided that the following conditions
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 1. Redistributions of source code must retain the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 2. Redistributions in binary form must reproduce the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer in the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * documentation and/or other materials provided with the distribution.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 3. The name of the author may not be used to endorse or promote products
199767f8919635c4928607450d9e0abb932109ceToomas Soome * derived from this software without specific prior written permission.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
199767f8919635c4928607450d9e0abb932109ceToomas Soome * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
199767f8919635c4928607450d9e0abb932109ceToomas Soome * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
199767f8919635c4928607450d9e0abb932109ceToomas Soome * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
199767f8919635c4928607450d9e0abb932109ceToomas Soome * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
199767f8919635c4928607450d9e0abb932109ceToomas Soome * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
199767f8919635c4928607450d9e0abb932109ceToomas Soome * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
199767f8919635c4928607450d9e0abb932109ceToomas Soome * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * POSSIBILITY OF SUCH DAMAGE.
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* Define our own NFS attributes without NQNFS stuff. */
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* Data part of nfs rpc reply (also the largest thing we receive) */
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct nfsv2_fattrs fa; /* all in network order */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#else /* !OLD_NFSV2 */
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* NFSv3 definitions */
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef struct {
199767f8919635c4928607450d9e0abb932109ceToomas Soome * For NFSv3, the file handle is variable in size, so most fixed sized
199767f8919635c4928607450d9e0abb932109ceToomas Soome * structures for arguments won't work. For most cases, a structure
199767f8919635c4928607450d9e0abb932109ceToomas Soome * that starts with any fixed size section is followed by an array
199767f8919635c4928607450d9e0abb932109ceToomas Soome * that covers the maximum size required.
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct nfsv3_fattrs fa; /* all in network order */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* OLD_NFSV2 */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * XXX interactions with tftp? See nfswrapper.c for a confusing
199767f8919635c4928607450d9e0abb932109ceToomas Soomeint nfs_open(const char *path, struct open_file *f);
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int nfs_read(struct open_file *f, void *buf, size_t size, size_t *resid);
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int nfs_write(struct open_file *f, void *buf, size_t size, size_t *resid);
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic off_t nfs_seek(struct open_file *f, off_t offset, int where);
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int nfs_stat(struct open_file *f, struct stat *sb);
199767f8919635c4928607450d9e0abb932109ceToomas Soomestatic int nfs_readdir(struct open_file *f, struct dirent *d);
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Fetch the root file handle (call mount daemon)
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Return zero or error number.
199767f8919635c4928607450d9e0abb932109ceToomas Soomenfs_getrootfh(struct iodesc *d, char *path, u_char *fhp)
199767f8919635c4928607450d9e0abb932109ceToomas Soome cc = rpc_call(d, RPCPROG_MNT, RPCMNT_VER1, RPCMNT_MOUNT,
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* errno was set by rpc_call */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Lookup a file. Store handle and attributes.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Return zero or error number.
199767f8919635c4928607450d9e0abb932109ceToomas Soomenfs_lookupfh(struct nfs_iodesc *d, const char *name, struct nfs_iodesc *newfd)
199767f8919635c4928607450d9e0abb932109ceToomas Soome cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER2, NFSPROC_LOOKUP,
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* saerrno.h now matches NFS error numbers. */
199767f8919635c4928607450d9e0abb932109ceToomas Soome bcopy( repl->fh, &newfd->fh, sizeof(newfd->fh));
199767f8919635c4928607450d9e0abb932109ceToomas Soome bcopy(&repl->fa, &newfd->fa, sizeof(newfd->fa));
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Get the destination of a symbolic link.
199767f8919635c4928607450d9e0abb932109ceToomas Soome cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER2, NFSPROC_READLINK,
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Read data from a file.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Return transfer count or -1 (and set errno)
199767f8919635c4928607450d9e0abb932109ceToomas Soomenfs_readdata(struct nfs_iodesc *d, off_t off, void *addr, size_t len)
199767f8919635c4928607450d9e0abb932109ceToomas Soome cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER2, NFSPROC_READ,
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* errno was already set by rpc_call */
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (-1);
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (-1);
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (-1);
199767f8919635c4928607450d9e0abb932109ceToomas Soome printf("nfsread: short packet, %d < %ld\n", rlen, x);
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Open a file.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * return zero or error number
199767f8919635c4928607450d9e0abb932109ceToomas Soomenfs_open(const char *upath, struct open_file *f)
199767f8919635c4928607450d9e0abb932109ceToomas Soome printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath);
199767f8919635c4928607450d9e0abb932109ceToomas Soome * This is silly - we should look at dv_type but that value is
199767f8919635c4928607450d9e0abb932109ceToomas Soome * arch dependant and we can't use it here.
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (!(desc = socktodesc(*(int *)(f->f_devdata))))
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* Bind to a reserved port. */
199767f8919635c4928607450d9e0abb932109ceToomas Soome if ((error = nfs_getrootfh(desc, rootpath, nfs_root_node.fh)))
199767f8919635c4928607450d9e0abb932109ceToomas Soome setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* Allocate file system specific data structure */
199767f8919635c4928607450d9e0abb932109ceToomas Soome bcopy(&nfs_root_node, currfd, sizeof(*currfd));
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Remove extra separators
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Check that current node is a directory.
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* allocate file system specific data structure */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Get next component of path name.
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* lookup a file handle */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Check for symbolic link
199767f8919635c4928607450d9e0abb932109ceToomas Soome * If absolute pathname, restart at root.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * If relative pathname, restart at parent directory.
199767f8919635c4928607450d9e0abb932109ceToomas Soome bcopy(&nfs_root_node, currfd, sizeof(*currfd));
199767f8919635c4928607450d9e0abb932109ceToomas Soome error = nfs_lookupfh(&nfs_root_node, upath, currfd);
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
199767f8919635c4928607450d9e0abb932109ceToomas Soome f->f_fsdata = (void *)0;
199767f8919635c4928607450d9e0abb932109ceToomas Soome * read a portion of a file
199767f8919635c4928607450d9e0abb932109ceToomas Soomenfs_read(struct open_file *f, void *buf, size_t size, size_t *resid)
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
199767f8919635c4928607450d9e0abb932109ceToomas Soome printf("nfs_read: size=%lu off=%d\n", (u_long)size,
199767f8919635c4928607450d9e0abb932109ceToomas Soome while ((int)size > 0) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome cc = nfs_readdata(fp, fp->off, (void *)addr, size);
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* XXX maybe should retry on certain errors */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Not implemented.
199767f8919635c4928607450d9e0abb932109ceToomas Soomenfs_write(struct open_file *f, void *buf, size_t size, size_t *resid)
199767f8919635c4928607450d9e0abb932109ceToomas Soomenfs_seek(struct open_file *f, off_t offset, int where)
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct nfs_iodesc *d = (struct nfs_iodesc *)f->f_fsdata;
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (-1);
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (d->off);
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* NFNON=0, NFREG=1, NFDIR=2, NFBLK=3, NFCHR=4, NFLNK=5 */
199767f8919635c4928607450d9e0abb932109ceToomas Soome 0, S_IFREG, S_IFDIR, S_IFBLK, S_IFCHR, S_IFLNK, 0 };
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
199767f8919635c4928607450d9e0abb932109ceToomas Soomenfs_readdir(struct open_file *f, struct dirent *d)
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
199767f8919635c4928607450d9e0abb932109ceToomas Soome static struct {
199767f8919635c4928607450d9e0abb932109ceToomas Soome cc = rpc_call(fp->iodesc, NFS_PROG, NFS_VER2, NFSPROC_READDIR,
199767f8919635c4928607450d9e0abb932109ceToomas Soome buf += (sizeof(struct nfs_readdir_data) + roundup(htonl(rd->len),4));
199767f8919635c4928607450d9e0abb932109ceToomas Soome#else /* !OLD_NFSV2 */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Fetch the root file handle (call mount daemon)
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Return zero or error number.
199767f8919635c4928607450d9e0abb932109ceToomas Soomenfs_getrootfh(struct iodesc *d, char *path, uint32_t *fhlenp, u_char *fhp)
199767f8919635c4928607450d9e0abb932109ceToomas Soome len = sizeof(uint32_t) + roundup(len, sizeof(uint32_t));
199767f8919635c4928607450d9e0abb932109ceToomas Soome cc = rpc_call(d, RPCPROG_MNT, RPCMNT_VER3, RPCMNT_MOUNT,
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* errno was set by rpc_call */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Lookup a file. Store handle and attributes.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Return zero or error number.
199767f8919635c4928607450d9e0abb932109ceToomas Soomenfs_lookupfh(struct nfs_iodesc *d, const char *name, struct nfs_iodesc *newfd)
199767f8919635c4928607450d9e0abb932109ceToomas Soome (NFS_V3MAXFHSIZE + FNAME_SIZE) / sizeof(uint32_t)];
199767f8919635c4928607450d9e0abb932109ceToomas Soome sizeof(struct nfsv3_fattrs))) / sizeof(uint32_t)];
199767f8919635c4928607450d9e0abb932109ceToomas Soome pos = roundup(d->fhsize, sizeof(uint32_t)) / sizeof(uint32_t);
199767f8919635c4928607450d9e0abb932109ceToomas Soome len = sizeof(uint32_t) + pos * sizeof(uint32_t) +
199767f8919635c4928607450d9e0abb932109ceToomas Soome cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER3, NFSPROCV3_LOOKUP,
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* saerrno.h now matches NFS error numbers. */
199767f8919635c4928607450d9e0abb932109ceToomas Soome bcopy(repl->fhplusattr, &newfd->fh, newfd->fhsize);
199767f8919635c4928607450d9e0abb932109ceToomas Soome pos = roundup(newfd->fhsize, sizeof(uint32_t)) / sizeof(uint32_t);
199767f8919635c4928607450d9e0abb932109ceToomas Soome bcopy(&repl->fhplusattr[pos], &newfd->fa, sizeof(newfd->fa));
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Get the destination of a symbolic link.
199767f8919635c4928607450d9e0abb932109ceToomas Soome cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER3, NFSPROCV3_READLINK,
199767f8919635c4928607450d9e0abb932109ceToomas Soome args, sizeof(uint32_t) + roundup(d->fhsize, sizeof(uint32_t)),
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Read data from a file.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Return transfer count or -1 (and set errno)
199767f8919635c4928607450d9e0abb932109ceToomas Soomenfs_readdata(struct nfs_iodesc *d, off_t off, void *addr, size_t len)
199767f8919635c4928607450d9e0abb932109ceToomas Soome uint32_t fhoffcnt[NFS_V3MAXFHSIZE / sizeof(uint32_t) + 3];
199767f8919635c4928607450d9e0abb932109ceToomas Soome pos = roundup(d->fhsize, sizeof(uint32_t)) / sizeof(uint32_t);
199767f8919635c4928607450d9e0abb932109ceToomas Soome cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER3, NFSPROCV3_READ,
199767f8919635c4928607450d9e0abb932109ceToomas Soome args, 4 * sizeof(uint32_t) + roundup(d->fhsize, sizeof(uint32_t)),
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* errno was already set by rpc_call */
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (-1);
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (-1);
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (-1);
199767f8919635c4928607450d9e0abb932109ceToomas Soome printf("nfsread: short packet, %d < %ld\n", rlen, x);
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (-1);
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Open a file.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * return zero or error number
199767f8919635c4928607450d9e0abb932109ceToomas Soomenfs_open(const char *upath, struct open_file *f)
199767f8919635c4928607450d9e0abb932109ceToomas Soome printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath);
199767f8919635c4928607450d9e0abb932109ceToomas Soome * This is silly - we should look at dv_type but that value is
199767f8919635c4928607450d9e0abb932109ceToomas Soome * arch dependant and we can't use it here.
199767f8919635c4928607450d9e0abb932109ceToomas Soome if (!(desc = socktodesc(*(int *)(f->f_devdata))))
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* Bind to a reserved port. */
199767f8919635c4928607450d9e0abb932109ceToomas Soome if ((error = nfs_getrootfh(desc, rootpath, &nfs_root_node.fhsize,
199767f8919635c4928607450d9e0abb932109ceToomas Soome for (i = 0; i < nfs_root_node.fhsize; i++, cp += 2)
199767f8919635c4928607450d9e0abb932109ceToomas Soome setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* Allocate file system specific data structure */
199767f8919635c4928607450d9e0abb932109ceToomas Soome bcopy(&nfs_root_node, currfd, sizeof(*currfd));
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Remove extra separators
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Check that current node is a directory.
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* allocate file system specific data structure */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Get next component of path name.
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* lookup a file handle */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Check for symbolic link
199767f8919635c4928607450d9e0abb932109ceToomas Soome * If absolute pathname, restart at root.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * If relative pathname, restart at parent directory.
199767f8919635c4928607450d9e0abb932109ceToomas Soome bcopy(&nfs_root_node, currfd, sizeof(*currfd));
199767f8919635c4928607450d9e0abb932109ceToomas Soome error = nfs_lookupfh(&nfs_root_node, upath, currfd);
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
199767f8919635c4928607450d9e0abb932109ceToomas Soome f->f_fsdata = (void *)0;
199767f8919635c4928607450d9e0abb932109ceToomas Soome * read a portion of a file
199767f8919635c4928607450d9e0abb932109ceToomas Soomenfs_read(struct open_file *f, void *buf, size_t size, size_t *resid)
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
199767f8919635c4928607450d9e0abb932109ceToomas Soome printf("nfs_read: size=%lu off=%d\n", (u_long)size,
199767f8919635c4928607450d9e0abb932109ceToomas Soome while ((int)size > 0) {
199767f8919635c4928607450d9e0abb932109ceToomas Soome cc = nfs_readdata(fp, fp->off, (void *)addr, size);
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* XXX maybe should retry on certain errors */
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Not implemented.
199767f8919635c4928607450d9e0abb932109ceToomas Soomenfs_write(struct open_file *f, void *buf, size_t size, size_t *resid)
199767f8919635c4928607450d9e0abb932109ceToomas Soomenfs_seek(struct open_file *f, off_t offset, int where)
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct nfs_iodesc *d = (struct nfs_iodesc *)f->f_fsdata;
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (-1);
199767f8919635c4928607450d9e0abb932109ceToomas Soome return (d->off);
199767f8919635c4928607450d9e0abb932109ceToomas Soome/* NFNON=0, NFREG=1, NFDIR=2, NFBLK=3, NFCHR=4, NFLNK=5, NFSOCK=6, NFFIFO=7 */
199767f8919635c4928607450d9e0abb932109ceToomas Soome 0, S_IFREG, S_IFDIR, S_IFBLK, S_IFCHR, S_IFLNK, S_IFSOCK, S_IFIFO, 0 };
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
199767f8919635c4928607450d9e0abb932109ceToomas Soomenfs_readdir(struct open_file *f, struct dirent *d)
199767f8919635c4928607450d9e0abb932109ceToomas Soome struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
199767f8919635c4928607450d9e0abb932109ceToomas Soome static struct {
199767f8919635c4928607450d9e0abb932109ceToomas Soome pos = roundup(fp->fhsize, sizeof(uint32_t)) / sizeof(uint32_t);
199767f8919635c4928607450d9e0abb932109ceToomas Soome args->fhpluscookie[pos++] = htonl(fp->off >> 32);
199767f8919635c4928607450d9e0abb932109ceToomas Soome args->fhpluscookie[pos++] = htonl(fp->cookie >> 32);
199767f8919635c4928607450d9e0abb932109ceToomas Soome args->fhpluscookie[pos] = htonl(NFS_READDIRSIZE);
199767f8919635c4928607450d9e0abb932109ceToomas Soome cc = rpc_call(fp->iodesc, NFS_PROG, NFS_VER3, NFSPROCV3_READDIR,
199767f8919635c4928607450d9e0abb932109ceToomas Soome fp->cookie = ((uint64_t)ntohl(repl->cookiev0) << 32) |
199767f8919635c4928607450d9e0abb932109ceToomas Soome /* fid0 is actually eof */
199767f8919635c4928607450d9e0abb932109ceToomas Soome pos = roundup(d->d_namlen, sizeof(uint32_t)) / sizeof(uint32_t);
199767f8919635c4928607450d9e0abb932109ceToomas Soome fp->off = cookie = ((uint64_t)ntohl(rent->nameplus[pos]) << 32) |
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* OLD_NFSV2 */