1 1.2 pgoyette /* $NetBSD: nfs.h,v 1.2 2016/12/13 22:54:24 pgoyette Exp $ */ 2 1.1 dholland /*- 3 1.1 dholland * Copyright (c) 1989, 1993 4 1.1 dholland * The Regents of the University of California. All rights reserved. 5 1.1 dholland * 6 1.1 dholland * This code is derived from software contributed to Berkeley by 7 1.1 dholland * Rick Macklem at The University of Guelph. 8 1.1 dholland * 9 1.1 dholland * Redistribution and use in source and binary forms, with or without 10 1.1 dholland * modification, are permitted provided that the following conditions 11 1.1 dholland * are met: 12 1.1 dholland * 1. Redistributions of source code must retain the above copyright 13 1.1 dholland * notice, this list of conditions and the following disclaimer. 14 1.1 dholland * 2. Redistributions in binary form must reproduce the above copyright 15 1.1 dholland * notice, this list of conditions and the following disclaimer in the 16 1.1 dholland * documentation and/or other materials provided with the distribution. 17 1.1 dholland * 4. Neither the name of the University nor the names of its contributors 18 1.1 dholland * may be used to endorse or promote products derived from this software 19 1.1 dholland * without specific prior written permission. 20 1.1 dholland * 21 1.1 dholland * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 1.1 dholland * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 1.1 dholland * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 1.1 dholland * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 1.1 dholland * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 1.1 dholland * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 1.1 dholland * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 1.1 dholland * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 1.1 dholland * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 1.1 dholland * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 1.1 dholland * SUCH DAMAGE. 32 1.1 dholland * 33 1.2 pgoyette * FreeBSD: head/sys/fs/nfsclient/nfs.h 276140 2014-12-23 14:24:36Z rmacklem 34 1.2 pgoyette * $NetBSD: nfs.h,v 1.2 2016/12/13 22:54:24 pgoyette Exp $ 35 1.1 dholland */ 36 1.1 dholland 37 1.1 dholland #ifndef _NFSCLIENT_NFS_H_ 38 1.1 dholland #define _NFSCLIENT_NFS_H_ 39 1.1 dholland 40 1.1 dholland #if defined(_KERNEL) 41 1.1 dholland 42 1.1 dholland #ifndef NFS_TPRINTF_INITIAL_DELAY 43 1.1 dholland #define NFS_TPRINTF_INITIAL_DELAY 12 44 1.1 dholland #endif 45 1.1 dholland 46 1.1 dholland #ifndef NFS_TPRINTF_DELAY 47 1.1 dholland #define NFS_TPRINTF_DELAY 30 48 1.1 dholland #endif 49 1.1 dholland 50 1.1 dholland /* 51 1.1 dholland * Nfs version macros. 52 1.1 dholland */ 53 1.1 dholland #define NFS_ISV3(v) \ 54 1.1 dholland (VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV3) 55 1.1 dholland #define NFS_ISV4(v) \ 56 1.1 dholland (VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV4) 57 1.1 dholland #define NFS_ISV34(v) \ 58 1.1 dholland (VFSTONFS((v)->v_mount)->nm_flag & (NFSMNT_NFSV3 | NFSMNT_NFSV4)) 59 1.1 dholland 60 1.2 pgoyette #ifdef NFS_DEBUG 61 1.2 pgoyette 62 1.2 pgoyette extern int nfs_debug; 63 1.2 pgoyette #define NFS_DEBUG_ASYNCIO 1 /* asynchronous i/o */ 64 1.2 pgoyette #define NFS_DEBUG_WG 2 /* server write gathering */ 65 1.2 pgoyette #define NFS_DEBUG_RC 4 /* server request caching */ 66 1.2 pgoyette 67 1.2 pgoyette #define NFS_DPF(cat, args) \ 68 1.2 pgoyette do { \ 69 1.2 pgoyette if (nfs_debug & NFS_DEBUG_##cat) printf args; \ 70 1.2 pgoyette } while (0) 71 1.2 pgoyette 72 1.2 pgoyette #else 73 1.2 pgoyette 74 1.2 pgoyette #define NFS_DPF(cat, args) 75 1.2 pgoyette 76 1.2 pgoyette #endif 77 1.2 pgoyette 78 1.1 dholland /* 79 1.1 dholland * NFS iod threads can be in one of these three states once spawned. 80 1.1 dholland * NFSIOD_NOT_AVAILABLE - Cannot be assigned an I/O operation at this time. 81 1.1 dholland * NFSIOD_AVAILABLE - Available to be assigned an I/O operation. 82 1.1 dholland * NFSIOD_CREATED_FOR_NFS_ASYNCIO - Newly created for nfs_asyncio() and 83 1.1 dholland * will be used by the thread that called nfs_asyncio(). 84 1.1 dholland */ 85 1.1 dholland enum nfsiod_state { 86 1.1 dholland NFSIOD_NOT_AVAILABLE = 0, 87 1.1 dholland NFSIOD_AVAILABLE = 1, 88 1.1 dholland NFSIOD_CREATED_FOR_NFS_ASYNCIO = 2, 89 1.1 dholland }; 90 1.1 dholland 91 1.1 dholland /* 92 1.1 dholland * Function prototypes. 93 1.1 dholland */ 94 1.2 pgoyette int ncl_meta_setsize(struct vnode *, struct kauth_cred *, struct lwp *, 95 1.1 dholland u_quad_t); 96 1.1 dholland void ncl_doio_directwrite(struct buf *); 97 1.2 pgoyette int ncl_bioread(struct vnode *, struct uio *, int, struct kauth_cred *); 98 1.2 pgoyette int ncl_biowrite(struct vnode *, struct uio *, int, struct kauth_cred *); 99 1.2 pgoyette int ncl_vinvalbuf(struct vnode *, int, struct kauth_cred *, int); 100 1.2 pgoyette int ncl_asyncio(struct nfsmount *, struct buf *, struct kauth_cred *, 101 1.2 pgoyette struct lwp *); 102 1.2 pgoyette int ncl_doio(struct vnode *, struct buf *, struct kauth_cred *, struct lwp *, 103 1.1 dholland int); 104 1.1 dholland void ncl_nhinit(void); 105 1.1 dholland void ncl_nhuninit(void); 106 1.1 dholland void ncl_nodelock(struct nfsnode *); 107 1.1 dholland void ncl_nodeunlock(struct nfsnode *); 108 1.1 dholland int ncl_getattrcache(struct vnode *, struct vattr *); 109 1.2 pgoyette int ncl_readrpc(struct vnode *, struct uio *, struct kauth_cred *); 110 1.2 pgoyette int ncl_writerpc(struct vnode *, struct uio *, struct kauth_cred *, int *, 111 1.2 pgoyette int *, int); 112 1.2 pgoyette int ncl_readlinkrpc(struct vnode *, struct uio *, struct kauth_cred *); 113 1.2 pgoyette int ncl_readdirrpc(struct vnode *, struct uio *, struct kauth_cred *, 114 1.2 pgoyette struct lwp *); 115 1.2 pgoyette int ncl_readdirplusrpc(struct vnode *, struct uio *, struct kauth_cred *, 116 1.2 pgoyette struct lwp *); 117 1.2 pgoyette int ncl_writebp(struct buf *, int, struct lwp *); 118 1.2 pgoyette int ncl_commit(struct vnode *, u_quad_t, int, struct kauth_cred *, 119 1.2 pgoyette struct lwp *); 120 1.1 dholland void ncl_clearcommit(struct mount *); 121 1.2 pgoyette int ncl_fsinfo(struct nfsmount *, struct vnode *, struct kauth_cred *, 122 1.2 pgoyette struct lwp *); 123 1.1 dholland int ncl_init(struct vfsconf *); 124 1.1 dholland int ncl_uninit(struct vfsconf *); 125 1.1 dholland void ncl_nfsiodnew(void); 126 1.1 dholland void ncl_nfsiodnew_tq(__unused void *, int); 127 1.1 dholland 128 1.1 dholland #endif /* _KERNEL */ 129 1.1 dholland 130 1.1 dholland #endif /* _NFSCLIENT_NFS_H_ */ 131