nfs.h revision 1.1.1.1.12.1 1 1.1.1.1.12.1 skrll /* $NetBSD: nfs.h,v 1.1.1.1.12.1 2016/12/05 10:55:25 skrll 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.1.1.1.12.1 skrll * FreeBSD: head/sys/fs/nfsclient/nfs.h 276140 2014-12-23 14:24:36Z rmacklem
34 1.1.1.1.12.1 skrll * $NetBSD: nfs.h,v 1.1.1.1.12.1 2016/12/05 10:55:25 skrll 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.1.1.1.12.1 skrll #ifdef NFS_DEBUG
61 1.1.1.1.12.1 skrll
62 1.1.1.1.12.1 skrll extern int nfs_debug;
63 1.1.1.1.12.1 skrll #define NFS_DEBUG_ASYNCIO 1 /* asynchronous i/o */
64 1.1.1.1.12.1 skrll #define NFS_DEBUG_WG 2 /* server write gathering */
65 1.1.1.1.12.1 skrll #define NFS_DEBUG_RC 4 /* server request caching */
66 1.1.1.1.12.1 skrll
67 1.1.1.1.12.1 skrll #define NFS_DPF(cat, args) \
68 1.1.1.1.12.1 skrll do { \
69 1.1.1.1.12.1 skrll if (nfs_debug & NFS_DEBUG_##cat) printf args; \
70 1.1.1.1.12.1 skrll } while (0)
71 1.1.1.1.12.1 skrll
72 1.1.1.1.12.1 skrll #else
73 1.1.1.1.12.1 skrll
74 1.1.1.1.12.1 skrll #define NFS_DPF(cat, args)
75 1.1.1.1.12.1 skrll
76 1.1.1.1.12.1 skrll #endif
77 1.1.1.1.12.1 skrll
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.1 dholland int ncl_meta_setsize(struct vnode *, struct ucred *, struct thread *,
95 1.1 dholland u_quad_t);
96 1.1 dholland void ncl_doio_directwrite(struct buf *);
97 1.1 dholland int ncl_bioread(struct vnode *, struct uio *, int, struct ucred *);
98 1.1 dholland int ncl_biowrite(struct vnode *, struct uio *, int, struct ucred *);
99 1.1 dholland int ncl_vinvalbuf(struct vnode *, int, struct thread *, int);
100 1.1 dholland int ncl_asyncio(struct nfsmount *, struct buf *, struct ucred *,
101 1.1 dholland struct thread *);
102 1.1 dholland int ncl_doio(struct vnode *, struct buf *, struct ucred *, struct thread *,
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.1 dholland int ncl_readrpc(struct vnode *, struct uio *, struct ucred *);
110 1.1 dholland int ncl_writerpc(struct vnode *, struct uio *, struct ucred *, int *, int *,
111 1.1 dholland int);
112 1.1 dholland int ncl_readlinkrpc(struct vnode *, struct uio *, struct ucred *);
113 1.1 dholland int ncl_readdirrpc(struct vnode *, struct uio *, struct ucred *,
114 1.1 dholland struct thread *);
115 1.1 dholland int ncl_readdirplusrpc(struct vnode *, struct uio *, struct ucred *,
116 1.1 dholland struct thread *);
117 1.1 dholland int ncl_writebp(struct buf *, int, struct thread *);
118 1.1 dholland int ncl_commit(struct vnode *, u_quad_t, int, struct ucred *, struct thread *);
119 1.1 dholland void ncl_clearcommit(struct mount *);
120 1.1 dholland int ncl_fsinfo(struct nfsmount *, struct vnode *, struct ucred *,
121 1.1 dholland struct thread *);
122 1.1 dholland int ncl_init(struct vfsconf *);
123 1.1 dholland int ncl_uninit(struct vfsconf *);
124 1.1 dholland void ncl_nfsiodnew(void);
125 1.1 dholland void ncl_nfsiodnew_tq(__unused void *, int);
126 1.1 dholland
127 1.1 dholland #endif /* _KERNEL */
128 1.1 dholland
129 1.1 dholland #endif /* _NFSCLIENT_NFS_H_ */
130