Deleted Added
full compact
nfs.h (138458) nfs.h (138496)
1/*
2 * Copyright (c) 1989, 1993, 1995
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Rick Macklem at The University of Guelph.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 4. Neither the name of the University nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * @(#)nfs.h 8.4 (Berkeley) 5/1/95
1/*
2 * Copyright (c) 1989, 1993, 1995
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Rick Macklem at The University of Guelph.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 4. Neither the name of the University nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * @(#)nfs.h 8.4 (Berkeley) 5/1/95
33 * $FreeBSD: head/sys/nfsclient/nfs.h 138458 2004-12-06 16:11:25Z rwatson $
33 * $FreeBSD: head/sys/nfsclient/nfs.h 138496 2004-12-06 21:11:15Z ps $
34 */
35
36#ifndef _NFSCLIENT_NFS_H_
37#define _NFSCLIENT_NFS_H_
38
39#ifdef _KERNEL
40#include "opt_nfs.h"
41#endif
42
43#include <nfsclient/nfsargs.h>
44
45/*
46 * Tunable constants for nfs
47 */
48
49#define NFS_TICKINTVL 10 /* Desired time for a tick (msec) */
50#define NFS_HZ (hz / nfs_ticks) /* Ticks/sec */
51#define NFS_TIMEO (1 * NFS_HZ) /* Default timeout = 1 second */
52#define NFS_MINTIMEO (1 * NFS_HZ) /* Min timeout to use */
53#define NFS_MAXTIMEO (60 * NFS_HZ) /* Max timeout to backoff to */
54#define NFS_MINIDEMTIMEO (5 * NFS_HZ) /* Min timeout for non-idempotent ops*/
55#define NFS_MAXREXMIT 100 /* Stop counting after this many */
56#define NFS_RETRANS 10 /* Num of retrans for soft mounts */
57#define NFS_MAXGRPS 16 /* Max. size of groups list */
58#ifndef NFS_MINATTRTIMO
59#define NFS_MINATTRTIMO 3 /* VREG attrib cache timeout in sec */
60#endif
61#ifndef NFS_MAXATTRTIMO
62#define NFS_MAXATTRTIMO 60
63#endif
64#ifndef NFS_MINDIRATTRTIMO
65#define NFS_MINDIRATTRTIMO 30 /* VDIR attrib cache timeout in sec */
66#endif
67#ifndef NFS_MAXDIRATTRTIMO
68#define NFS_MAXDIRATTRTIMO 60
69#endif
70#define NFS_WSIZE 8192 /* Def. write data size <= 8192 */
71#define NFS_RSIZE 8192 /* Def. read data size <= 8192 */
72#define NFS_READDIRSIZE 8192 /* Def. readdir size */
73#define NFS_DEFRAHEAD 1 /* Def. read ahead # blocks */
74#define NFS_MAXRAHEAD 4 /* Max. read ahead # blocks */
75#define NFS_MAXASYNCDAEMON 64 /* Max. number async_daemons runnable */
76#define NFS_DIRBLKSIZ 4096 /* Must be a multiple of DIRBLKSIZ */
77#ifdef _KERNEL
78#define DIRBLKSIZ 512 /* XXX we used to use ufs's DIRBLKSIZ */
79#endif
80#define NFS_MAXDEADTHRESH 9 /* How long till we say 'server not responding' */
81
82/*
83 * Oddballs
84 */
85#define NFS_CMPFH(n, f, s) \
86 ((n)->n_fhsize == (s) && !bcmp((caddr_t)(n)->n_fhp, (caddr_t)(f), (s)))
87#define NFS_ISV3(v) (VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV3)
88
89#define NFSSTA_HASWRITEVERF 0x00040000 /* Has write verifier for V3 */
90#define NFSSTA_GOTFSINFO 0x00100000 /* Got the V3 fsinfo */
91#define NFSSTA_SNDLOCK 0x01000000 /* Send socket lock */
92#define NFSSTA_WANTSND 0x02000000 /* Want above */
34 */
35
36#ifndef _NFSCLIENT_NFS_H_
37#define _NFSCLIENT_NFS_H_
38
39#ifdef _KERNEL
40#include "opt_nfs.h"
41#endif
42
43#include <nfsclient/nfsargs.h>
44
45/*
46 * Tunable constants for nfs
47 */
48
49#define NFS_TICKINTVL 10 /* Desired time for a tick (msec) */
50#define NFS_HZ (hz / nfs_ticks) /* Ticks/sec */
51#define NFS_TIMEO (1 * NFS_HZ) /* Default timeout = 1 second */
52#define NFS_MINTIMEO (1 * NFS_HZ) /* Min timeout to use */
53#define NFS_MAXTIMEO (60 * NFS_HZ) /* Max timeout to backoff to */
54#define NFS_MINIDEMTIMEO (5 * NFS_HZ) /* Min timeout for non-idempotent ops*/
55#define NFS_MAXREXMIT 100 /* Stop counting after this many */
56#define NFS_RETRANS 10 /* Num of retrans for soft mounts */
57#define NFS_MAXGRPS 16 /* Max. size of groups list */
58#ifndef NFS_MINATTRTIMO
59#define NFS_MINATTRTIMO 3 /* VREG attrib cache timeout in sec */
60#endif
61#ifndef NFS_MAXATTRTIMO
62#define NFS_MAXATTRTIMO 60
63#endif
64#ifndef NFS_MINDIRATTRTIMO
65#define NFS_MINDIRATTRTIMO 30 /* VDIR attrib cache timeout in sec */
66#endif
67#ifndef NFS_MAXDIRATTRTIMO
68#define NFS_MAXDIRATTRTIMO 60
69#endif
70#define NFS_WSIZE 8192 /* Def. write data size <= 8192 */
71#define NFS_RSIZE 8192 /* Def. read data size <= 8192 */
72#define NFS_READDIRSIZE 8192 /* Def. readdir size */
73#define NFS_DEFRAHEAD 1 /* Def. read ahead # blocks */
74#define NFS_MAXRAHEAD 4 /* Max. read ahead # blocks */
75#define NFS_MAXASYNCDAEMON 64 /* Max. number async_daemons runnable */
76#define NFS_DIRBLKSIZ 4096 /* Must be a multiple of DIRBLKSIZ */
77#ifdef _KERNEL
78#define DIRBLKSIZ 512 /* XXX we used to use ufs's DIRBLKSIZ */
79#endif
80#define NFS_MAXDEADTHRESH 9 /* How long till we say 'server not responding' */
81
82/*
83 * Oddballs
84 */
85#define NFS_CMPFH(n, f, s) \
86 ((n)->n_fhsize == (s) && !bcmp((caddr_t)(n)->n_fhp, (caddr_t)(f), (s)))
87#define NFS_ISV3(v) (VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV3)
88
89#define NFSSTA_HASWRITEVERF 0x00040000 /* Has write verifier for V3 */
90#define NFSSTA_GOTFSINFO 0x00100000 /* Got the V3 fsinfo */
91#define NFSSTA_SNDLOCK 0x01000000 /* Send socket lock */
92#define NFSSTA_WANTSND 0x02000000 /* Want above */
93#define NFSSTA_RCVLOCK 0x04000000 /* Rcv socket lock */
94#define NFSSTA_WANTRCV 0x08000000 /* Want above */
95#define NFSSTA_TIMEO 0x10000000 /* Experiencing a timeout */
96
97
98/*
99 * XXX to allow amd to include nfs.h without nfsproto.h
100 */
101#ifdef NFS_NPROCS
102#include <nfsclient/nfsstats.h>
103#endif
104
105/*
106 * vfs.nfs sysctl(3) identifiers
107 */
108#define NFS_NFSSTATS 1 /* struct: struct nfsstats */
109
110/*
111 * File context information for nfsv4. Currently, there is only one
112 * lockowner for the whole machine "0."
113 */
114struct nfs4_fctx {
115 TAILQ_ENTRY(nfs4_fstate) next;
116 uint32_t refcnt;
117 struct nfs4_lowner *lop;
118 struct nfsnode *np;
119 char stateid[NFSX_V4STATEID];
120};
121
122#ifdef _KERNEL
123
124#ifdef MALLOC_DECLARE
125MALLOC_DECLARE(M_NFSREQ);
126MALLOC_DECLARE(M_NFSDIROFF);
127MALLOC_DECLARE(M_NFSBIGFH);
128MALLOC_DECLARE(M_NFSHASH);
129#endif
130
131extern struct uma_zone *nfsmount_zone;
132
133extern struct callout nfs_callout;
134extern struct nfsstats nfsstats;
135
136extern int nfs_numasync;
137extern unsigned int nfs_iodmax;
138extern int nfs_pbuf_freecnt;
139extern int nfs_ticks;
140
141/* Data constants in XDR form */
142extern u_int32_t nfs_true, nfs_false, nfs_xdrneg1;
143extern u_int32_t rpc_reply, rpc_msgdenied, rpc_mismatch, rpc_vers;
144extern u_int32_t rpc_auth_unix, rpc_msgaccepted, rpc_call, rpc_autherr;
145
146extern int nfsv3_procid[NFS_NPROCS];
147
148struct uio;
149struct buf;
150struct vattr;
151struct nameidata;
152
153/*
93#define NFSSTA_TIMEO 0x10000000 /* Experiencing a timeout */
94
95
96/*
97 * XXX to allow amd to include nfs.h without nfsproto.h
98 */
99#ifdef NFS_NPROCS
100#include <nfsclient/nfsstats.h>
101#endif
102
103/*
104 * vfs.nfs sysctl(3) identifiers
105 */
106#define NFS_NFSSTATS 1 /* struct: struct nfsstats */
107
108/*
109 * File context information for nfsv4. Currently, there is only one
110 * lockowner for the whole machine "0."
111 */
112struct nfs4_fctx {
113 TAILQ_ENTRY(nfs4_fstate) next;
114 uint32_t refcnt;
115 struct nfs4_lowner *lop;
116 struct nfsnode *np;
117 char stateid[NFSX_V4STATEID];
118};
119
120#ifdef _KERNEL
121
122#ifdef MALLOC_DECLARE
123MALLOC_DECLARE(M_NFSREQ);
124MALLOC_DECLARE(M_NFSDIROFF);
125MALLOC_DECLARE(M_NFSBIGFH);
126MALLOC_DECLARE(M_NFSHASH);
127#endif
128
129extern struct uma_zone *nfsmount_zone;
130
131extern struct callout nfs_callout;
132extern struct nfsstats nfsstats;
133
134extern int nfs_numasync;
135extern unsigned int nfs_iodmax;
136extern int nfs_pbuf_freecnt;
137extern int nfs_ticks;
138
139/* Data constants in XDR form */
140extern u_int32_t nfs_true, nfs_false, nfs_xdrneg1;
141extern u_int32_t rpc_reply, rpc_msgdenied, rpc_mismatch, rpc_vers;
142extern u_int32_t rpc_auth_unix, rpc_msgaccepted, rpc_call, rpc_autherr;
143
144extern int nfsv3_procid[NFS_NPROCS];
145
146struct uio;
147struct buf;
148struct vattr;
149struct nameidata;
150
151/*
154 * The set of signals that interrupt an I/O in progress for NFSMNT_INT mounts.
155 * What should be in this set is open to debate, but I believe that since
156 * I/O system calls on ufs are never interrupted by signals the set should
157 * be minimal. My reasoning is that many current programs that use signals
158 * such as SIGALRM will not expect file I/O system calls to be interrupted
159 * by them and break.
160 */
161#define NFSINT_SIGMASK(set) \
162 (SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) || \
163 SIGISMEMBER(set, SIGHUP) || SIGISMEMBER(set, SIGKILL) || \
164 SIGISMEMBER(set, SIGQUIT))
165
166/*
167 * Socket errors ignored for connectionless sockets??
168 * For now, ignore them all
169 */
170#define NFSIGNORE_SOERROR(s, e) \
171 ((e) != EINTR && (e) != EIO && \
172 (e) != ERESTART && (e) != EWOULDBLOCK && \
173 ((s) & PR_CONNREQUIRED) == 0)
174
175/*
176 * Nfs outstanding request list element
177 */
178struct nfsreq {
179 TAILQ_ENTRY(nfsreq) r_chain;
180 struct mbuf *r_mreq;
181 struct mbuf *r_mrep;
182 struct mbuf *r_md;
183 caddr_t r_dpos;
184 struct nfsmount *r_nmp;
185 struct vnode *r_vp;
186 u_int32_t r_xid;
187 int r_flags; /* flags on request, see below */
188 int r_retry; /* max retransmission count */
189 int r_rexmit; /* current retrans count */
190 int r_timer; /* tick counter on reply */
191 u_int32_t r_procnum; /* NFS procedure number */
192 int r_rtt; /* RTT for rpc */
193 int r_lastmsg; /* last tprintf */
194 struct thread *r_td; /* Proc that did I/O system call */
195};
196
197/*
198 * Queue head for nfsreq's
199 */
200extern TAILQ_HEAD(nfs_reqq, nfsreq) nfs_reqq;
201
202/* Flag values for r_flags */
203#define R_TIMING 0x01 /* timing request (in mntp) */
204#define R_SENT 0x02 /* request has been sent */
205#define R_SOFTTERM 0x04 /* soft mnt, too many retries */
206#define R_RESENDERR 0x08 /* Resend failed */
207#define R_SOCKERR 0x10 /* Fatal error on socket */
208#define R_TPRINTFMSG 0x20 /* Did a tprintf msg. */
209#define R_MUSTRESEND 0x40 /* Must resend request */
210#define R_GETONEREP 0x80 /* Probe for one reply only */
211
212/*
213 * Pointers to ops that differ from v3 to v4
214 */
215struct nfs_rpcops {
216 int (*nr_readrpc)(struct vnode *vp, struct uio *uiop, struct ucred *cred);
217 int (*nr_writerpc)(struct vnode *vp, struct uio *uiop, struct ucred *cred,
218 int *iomode, int *must_commit);
219 int (*nr_writebp)(struct buf *bp, int force, struct thread *td);
220 int (*nr_readlinkrpc)(struct vnode *vp, struct uio *uiop, struct ucred *cred);
221 void (*nr_invaldir)(struct vnode *vp);
222 int (*nr_commit)(struct vnode *vp, u_quad_t offset, int cnt,
223 struct ucred *cred, struct thread *td);
224};
225
226/*
227 * Defines for WebNFS
228 */
229
230#define WEBNFS_ESC_CHAR '%'
231#define WEBNFS_SPECCHAR_START 0x80
232
233#define WEBNFS_NATIVE_CHAR 0x80
234/*
235 * ..
236 * Possibly more here in the future.
237 */
238
239/*
240 * Macro for converting escape characters in WebNFS pathnames.
241 * Should really be in libkern.
242 */
243
244#define HEXTOC(c) \
245 ((c) >= 'a' ? ((c) - ('a' - 10)) : \
246 ((c) >= 'A' ? ((c) - ('A' - 10)) : ((c) - '0')))
247#define HEXSTRTOI(p) \
248 ((HEXTOC(p[0]) << 4) + HEXTOC(p[1]))
249
250/* nfs_sigintr() helper, when 'rep' has all we need */
251#define NFS_SIGREP(rep) nfs_sigintr((rep)->r_nmp, (rep), (rep)->r_td)
252
253#ifdef NFS_DEBUG
254
255extern int nfs_debug;
256#define NFS_DEBUG_ASYNCIO 1 /* asynchronous i/o */
257#define NFS_DEBUG_WG 2 /* server write gathering */
258#define NFS_DEBUG_RC 4 /* server request caching */
259
260#define NFS_DPF(cat, args) \
261 do { \
262 if (nfs_debug & NFS_DEBUG_##cat) printf args; \
263 } while (0)
264
265#else
266
267#define NFS_DPF(cat, args)
268
269#endif
270
271vfs_init_t nfs_init;
272vfs_uninit_t nfs_uninit;
273int nfs_mountroot(struct mount *mp, struct thread *td);
274
275#ifndef NFS4_USE_RPCCLNT
276int nfs_send(struct socket *, struct sockaddr *, struct mbuf *,
277 struct nfsreq *);
278int nfs_sndlock(struct nfsreq *);
279void nfs_sndunlock(struct nfsreq *);
280#endif /* ! NFS4_USE_RPCCLNT */
281
282int nfs_vinvalbuf(struct vnode *, int, struct ucred *, struct thread *,
283 int);
284int nfs_readrpc(struct vnode *, struct uio *, struct ucred *);
285int nfs_writerpc(struct vnode *, struct uio *, struct ucred *, int *,
286 int *);
287int nfs_commit(struct vnode *vp, u_quad_t offset, int cnt,
288 struct ucred *cred, struct thread *td);
289int nfs_readdirrpc(struct vnode *, struct uio *, struct ucred *);
290int nfs_nfsiodnew(void);
291int nfs_asyncio(struct nfsmount *, struct buf *, struct ucred *, struct thread *);
292int nfs_doio(struct vnode *, struct buf *, struct ucred *, struct thread *);
293void nfs_up(struct nfsreq *, struct nfsmount *, struct thread *,
294 const char *, int);
295void nfs_down(struct nfsreq *, struct nfsmount *, struct thread *,
296 const char *, int, int);
297int nfs_readlinkrpc(struct vnode *, struct uio *, struct ucred *);
298int nfs_sigintr(struct nfsmount *, struct nfsreq *, struct thread *);
299int nfs_readdirplusrpc(struct vnode *, struct uio *, struct ucred *);
300int nfs_request(struct vnode *, struct mbuf *, int, struct thread *,
301 struct ucred *, struct mbuf **, struct mbuf **, caddr_t *);
302int nfs_loadattrcache(struct vnode **, struct mbuf **, caddr_t *,
303 struct vattr *, int);
304int nfsm_mbuftouio(struct mbuf **, struct uio *, int, caddr_t *);
305void nfs_nhinit(void);
306void nfs_nhuninit(void);
307int nfs_nmcancelreqs(struct nfsmount *);
308void nfs_timer(void*);
309
310int nfs_connect(struct nfsmount *, struct nfsreq *);
311void nfs_disconnect(struct nfsmount *);
312void nfs_safedisconnect(struct nfsmount *);
313int nfs_getattrcache(struct vnode *, struct vattr *);
314int nfsm_strtmbuf(struct mbuf **, char **, const char *, long);
315int nfs_bioread(struct vnode *, struct uio *, int, struct ucred *);
316int nfsm_uiotombuf(struct uio *, struct mbuf **, int, caddr_t *);
317void nfs_clearcommit(struct mount *);
318int nfs_writebp(struct buf *, int, struct thread *);
319int nfs_fsinfo(struct nfsmount *, struct vnode *, struct ucred *,
320 struct thread *);
321int nfs_meta_setsize (struct vnode *, struct ucred *,
322 struct thread *, u_quad_t);
323
152 * Socket errors ignored for connectionless sockets??
153 * For now, ignore them all
154 */
155#define NFSIGNORE_SOERROR(s, e) \
156 ((e) != EINTR && (e) != EIO && \
157 (e) != ERESTART && (e) != EWOULDBLOCK && \
158 ((s) & PR_CONNREQUIRED) == 0)
159
160/*
161 * Nfs outstanding request list element
162 */
163struct nfsreq {
164 TAILQ_ENTRY(nfsreq) r_chain;
165 struct mbuf *r_mreq;
166 struct mbuf *r_mrep;
167 struct mbuf *r_md;
168 caddr_t r_dpos;
169 struct nfsmount *r_nmp;
170 struct vnode *r_vp;
171 u_int32_t r_xid;
172 int r_flags; /* flags on request, see below */
173 int r_retry; /* max retransmission count */
174 int r_rexmit; /* current retrans count */
175 int r_timer; /* tick counter on reply */
176 u_int32_t r_procnum; /* NFS procedure number */
177 int r_rtt; /* RTT for rpc */
178 int r_lastmsg; /* last tprintf */
179 struct thread *r_td; /* Proc that did I/O system call */
180};
181
182/*
183 * Queue head for nfsreq's
184 */
185extern TAILQ_HEAD(nfs_reqq, nfsreq) nfs_reqq;
186
187/* Flag values for r_flags */
188#define R_TIMING 0x01 /* timing request (in mntp) */
189#define R_SENT 0x02 /* request has been sent */
190#define R_SOFTTERM 0x04 /* soft mnt, too many retries */
191#define R_RESENDERR 0x08 /* Resend failed */
192#define R_SOCKERR 0x10 /* Fatal error on socket */
193#define R_TPRINTFMSG 0x20 /* Did a tprintf msg. */
194#define R_MUSTRESEND 0x40 /* Must resend request */
195#define R_GETONEREP 0x80 /* Probe for one reply only */
196
197/*
198 * Pointers to ops that differ from v3 to v4
199 */
200struct nfs_rpcops {
201 int (*nr_readrpc)(struct vnode *vp, struct uio *uiop, struct ucred *cred);
202 int (*nr_writerpc)(struct vnode *vp, struct uio *uiop, struct ucred *cred,
203 int *iomode, int *must_commit);
204 int (*nr_writebp)(struct buf *bp, int force, struct thread *td);
205 int (*nr_readlinkrpc)(struct vnode *vp, struct uio *uiop, struct ucred *cred);
206 void (*nr_invaldir)(struct vnode *vp);
207 int (*nr_commit)(struct vnode *vp, u_quad_t offset, int cnt,
208 struct ucred *cred, struct thread *td);
209};
210
211/*
212 * Defines for WebNFS
213 */
214
215#define WEBNFS_ESC_CHAR '%'
216#define WEBNFS_SPECCHAR_START 0x80
217
218#define WEBNFS_NATIVE_CHAR 0x80
219/*
220 * ..
221 * Possibly more here in the future.
222 */
223
224/*
225 * Macro for converting escape characters in WebNFS pathnames.
226 * Should really be in libkern.
227 */
228
229#define HEXTOC(c) \
230 ((c) >= 'a' ? ((c) - ('a' - 10)) : \
231 ((c) >= 'A' ? ((c) - ('A' - 10)) : ((c) - '0')))
232#define HEXSTRTOI(p) \
233 ((HEXTOC(p[0]) << 4) + HEXTOC(p[1]))
234
235/* nfs_sigintr() helper, when 'rep' has all we need */
236#define NFS_SIGREP(rep) nfs_sigintr((rep)->r_nmp, (rep), (rep)->r_td)
237
238#ifdef NFS_DEBUG
239
240extern int nfs_debug;
241#define NFS_DEBUG_ASYNCIO 1 /* asynchronous i/o */
242#define NFS_DEBUG_WG 2 /* server write gathering */
243#define NFS_DEBUG_RC 4 /* server request caching */
244
245#define NFS_DPF(cat, args) \
246 do { \
247 if (nfs_debug & NFS_DEBUG_##cat) printf args; \
248 } while (0)
249
250#else
251
252#define NFS_DPF(cat, args)
253
254#endif
255
256vfs_init_t nfs_init;
257vfs_uninit_t nfs_uninit;
258int nfs_mountroot(struct mount *mp, struct thread *td);
259
260#ifndef NFS4_USE_RPCCLNT
261int nfs_send(struct socket *, struct sockaddr *, struct mbuf *,
262 struct nfsreq *);
263int nfs_sndlock(struct nfsreq *);
264void nfs_sndunlock(struct nfsreq *);
265#endif /* ! NFS4_USE_RPCCLNT */
266
267int nfs_vinvalbuf(struct vnode *, int, struct ucred *, struct thread *,
268 int);
269int nfs_readrpc(struct vnode *, struct uio *, struct ucred *);
270int nfs_writerpc(struct vnode *, struct uio *, struct ucred *, int *,
271 int *);
272int nfs_commit(struct vnode *vp, u_quad_t offset, int cnt,
273 struct ucred *cred, struct thread *td);
274int nfs_readdirrpc(struct vnode *, struct uio *, struct ucred *);
275int nfs_nfsiodnew(void);
276int nfs_asyncio(struct nfsmount *, struct buf *, struct ucred *, struct thread *);
277int nfs_doio(struct vnode *, struct buf *, struct ucred *, struct thread *);
278void nfs_up(struct nfsreq *, struct nfsmount *, struct thread *,
279 const char *, int);
280void nfs_down(struct nfsreq *, struct nfsmount *, struct thread *,
281 const char *, int, int);
282int nfs_readlinkrpc(struct vnode *, struct uio *, struct ucred *);
283int nfs_sigintr(struct nfsmount *, struct nfsreq *, struct thread *);
284int nfs_readdirplusrpc(struct vnode *, struct uio *, struct ucred *);
285int nfs_request(struct vnode *, struct mbuf *, int, struct thread *,
286 struct ucred *, struct mbuf **, struct mbuf **, caddr_t *);
287int nfs_loadattrcache(struct vnode **, struct mbuf **, caddr_t *,
288 struct vattr *, int);
289int nfsm_mbuftouio(struct mbuf **, struct uio *, int, caddr_t *);
290void nfs_nhinit(void);
291void nfs_nhuninit(void);
292int nfs_nmcancelreqs(struct nfsmount *);
293void nfs_timer(void*);
294
295int nfs_connect(struct nfsmount *, struct nfsreq *);
296void nfs_disconnect(struct nfsmount *);
297void nfs_safedisconnect(struct nfsmount *);
298int nfs_getattrcache(struct vnode *, struct vattr *);
299int nfsm_strtmbuf(struct mbuf **, char **, const char *, long);
300int nfs_bioread(struct vnode *, struct uio *, int, struct ucred *);
301int nfsm_uiotombuf(struct uio *, struct mbuf **, int, caddr_t *);
302void nfs_clearcommit(struct mount *);
303int nfs_writebp(struct buf *, int, struct thread *);
304int nfs_fsinfo(struct nfsmount *, struct vnode *, struct ucred *,
305 struct thread *);
306int nfs_meta_setsize (struct vnode *, struct ucred *,
307 struct thread *, u_quad_t);
308
309void nfs_set_sigmask __P((struct thread *td, sigset_t *oldset));
310void nfs_restore_sigmask __P((struct thread *td, sigset_t *set));
311int nfs_tsleep __P((struct thread *td, void *ident, int priority, char *wmesg,
312 int timo));
313int nfs_msleep __P((struct thread *td, void *ident, struct mtx *mtx, int priority,
314 char *wmesg, int timo));
315
324#endif /* _KERNEL */
325
326#endif
316#endif /* _KERNEL */
317
318#endif