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