/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 1989, 19934* The Regents of the University of California. All rights reserved.5*6* This code is derived from software contributed to Berkeley by7* Rick Macklem at The University of Guelph.8*9* Redistribution and use in source and binary forms, with or without10* modification, are permitted provided that the following conditions11* are met:12* 1. Redistributions of source code must retain the above copyright13* notice, this list of conditions and the following disclaimer.14* 2. Redistributions in binary form must reproduce the above copyright15* notice, this list of conditions and the following disclaimer in the16* documentation and/or other materials provided with the distribution.17* 3. Neither the name of the University nor the names of its contributors18* may be used to endorse or promote products derived from this software19* without specific prior written permission.20*21* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND22* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE23* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE24* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE25* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL26* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS27* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)28* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT29* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY30* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF31* SUCH DAMAGE.32*/3334#ifndef _NFSCLIENT_NFS_H_35#define _NFSCLIENT_NFS_H_3637#if defined(_KERNEL)3839#ifndef NFS_TPRINTF_INITIAL_DELAY40#define NFS_TPRINTF_INITIAL_DELAY 1241#endif4243#ifndef NFS_TPRINTF_DELAY44#define NFS_TPRINTF_DELAY 3045#endif4647/*48* Nfs version macros.49*/50#define NFS_ISV3(v) \51(VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV3)52#define NFS_ISV4(v) \53(VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV4)54#define NFS_ISV34(v) \55(VFSTONFS((v)->v_mount)->nm_flag & (NFSMNT_NFSV3 | NFSMNT_NFSV4))5657#ifdef NFS_DEBUG5859extern int nfs_debug;60#define NFS_DEBUG_ASYNCIO 1 /* asynchronous i/o */61#define NFS_DEBUG_WG 2 /* server write gathering */62#define NFS_DEBUG_RC 4 /* server request caching */6364#define NFS_DPF(cat, args) \65do { \66if (nfs_debug & NFS_DEBUG_##cat) printf args; \67} while (0)6869#else7071#define NFS_DPF(cat, args)7273#endif7475/*76* NFS iod threads can be in one of these three states once spawned.77* NFSIOD_NOT_AVAILABLE - Cannot be assigned an I/O operation at this time.78* NFSIOD_AVAILABLE - Available to be assigned an I/O operation.79* NFSIOD_CREATED_FOR_NFS_ASYNCIO - Newly created for nfs_asyncio() and80* will be used by the thread that called nfs_asyncio().81*/82enum nfsiod_state {83NFSIOD_NOT_AVAILABLE = 0,84NFSIOD_AVAILABLE = 1,85NFSIOD_CREATED_FOR_NFS_ASYNCIO = 2,86};8788/*89* Function prototypes.90*/91int ncl_meta_setsize(struct vnode *, struct thread *, u_quad_t);92int ncl_bioread(struct vnode *, struct uio *, int, struct ucred *);93int ncl_biowrite(struct vnode *, struct uio *, int, struct ucred *);94int ncl_vinvalbuf(struct vnode *, int, struct thread *, int);95int ncl_asyncio(struct nfsmount *, struct buf *, struct ucred *,96struct thread *);97int ncl_doio(struct vnode *, struct buf *, struct ucred *, struct thread *,98int);99void ncl_nhinit(void);100void ncl_nhuninit(void);101void ncl_nodelock(struct nfsnode *);102void ncl_nodeunlock(struct nfsnode *);103int ncl_getattrcache(struct vnode *, struct vattr *);104int ncl_readrpc(struct vnode *, struct uio *, struct ucred *);105int ncl_writerpc(struct vnode *, struct uio *, struct ucred *, int *, int *,106int, int);107int ncl_readlinkrpc(struct vnode *, struct uio *, struct ucred *);108int ncl_readdirrpc(struct vnode *, struct uio *, struct ucred *,109struct thread *);110int ncl_readdirplusrpc(struct vnode *, struct uio *, struct ucred *,111struct thread *);112int ncl_commit(struct vnode *, u_quad_t, int, struct ucred *, struct thread *);113void ncl_clearcommit(struct mount *);114int ncl_fsinfo(struct nfsmount *, struct vnode *, struct ucred *,115struct thread *);116int ncl_init(struct vfsconf *);117int ncl_uninit(struct vfsconf *);118void ncl_nfsiodnew(void);119void ncl_nfsiodnew_tq(__unused void *, int);120121#endif /* _KERNEL */122123#endif /* _NFSCLIENT_NFS_H_ */124125126