FreeBSD/Linux Kernel Cross Reference
sys/nfs4client/nfs4.h
1 /* $FreeBSD$ */
2 /* $Id: nfs4.h,v 1.25 2003/11/05 14:58:58 rees Exp $ */
3
4 /*-
5 * copyright (c) 2003
6 * the regents of the university of michigan
7 * all rights reserved
8 *
9 * permission is granted to use, copy, create derivative works and redistribute
10 * this software and such derivative works for any purpose, so long as the name
11 * of the university of michigan is not used in any advertising or publicity
12 * pertaining to the use or distribution of this software without specific,
13 * written prior authorization. if the above copyright notice or any other
14 * identification of the university of michigan is included in any copy of any
15 * portion of this software, then the disclaimer below must also be included.
16 *
17 * this software is provided as is, without representation from the university
18 * of michigan as to its fitness for any purpose, and without warranty by the
19 * university of michigan of any kind, either express or implied, including
20 * without limitation the implied warranties of merchantability and fitness for
21 * a particular purpose. the regents of the university of michigan shall not be
22 * liable for any damages, including special, indirect, incidental, or
23 * consequential damages, with respect to any claim arising out of or in
24 * connection with the use of the software, even if it has been or is hereafter
25 * advised of the possibility of such damages.
26 */
27
28 #ifndef _NFS4CLIENT_NFS4_H
29 #define _NFS4CLIENT_NFS4_H
30
31 #define NFS4_USE_RPCCLNT
32
33 #define NFS4_MINOR_VERSION 0
34 #define NFS_PORT 2049
35 #define NFS4_DEF_FILE_IO_BUFFER_SIZE 4096
36 #define NFS4_MAX_FILE_IO_BUFFER_SIZE 32768
37 #define NFS4_DEF_MAXFILESIZE 0xffffffff
38 #define NFS4_SUPER_MAGIC 0xF00BA4
39
40 #define NFS4FS_SILLY_RENAME 1
41 #define NFS4FS_STRICT_LOCKING 1
42 #define NFS4FS_RETRY_OLD_STATEID 1
43 #define NFS4FS_MIN_LEASE (1 * hz)
44 #define NFS4FS_DEFAULT_LEASE (30 * hz)
45 #define NFS4FS_MAX_LEASE (120 * hz)
46 #define NFS4FS_RETRY_MIN_DELAY (hz >> 4)
47 #define NFS4FS_RETRY_MAX_DELAY (hz << 3)
48 #define NFS4FS_SEMAPHORE_DELAY (hz >> 4)
49 #define NFS4FS_GRACE_DELAY (hz * 5)
50 #define NFS4FS_OLD_STATEID_DELAY (hz >> 3)
51 #define NFS4FS_OP_MAX 10
52
53
54 #define NFS4_BUFSIZE 8192
55 #define NFS4FS_MAX_IOV 10
56 #define NFS4_SETCLIENTID_MAXTRIES 5
57 #define NFS4_READDIR_MAXTRIES 5
58 #define NFS4_MAXIO 4
59 #define NFS4_MAX_REQUEST_SOFT 192
60 #define NFS4_MAX_REQUEST_HARD 256
61 #define NFS4_MAXCOMMIT 64
62 #define NFS4_READ_DELAY (2 * HZ)
63 #define NFS4_WRITEBACK_DELAY (5 * HZ)
64 #define NFS4_WRITEBACK_LOCKDELAY (60 * HZ)
65 #define NFS4_COMMIT_DELAY (5 * HZ)
66 #define RPC_SLACK_SPACE 512
67
68
69 struct nfs4_compound {
70 char *tag;
71
72 int req_nops;
73 uint32_t *req_nopsp;
74 uint32_t *req_seqidp;
75 uint32_t *req_stateidp[NFS4_MAXIO];
76 uint32_t req_nstateid;
77
78 u_int seqidused;
79
80 int rep_status;
81 int rep_nops;
82
83 struct nfs4_fctx *fcp;
84
85 struct vnode *curvp;
86 struct vnode *savevp;
87
88 struct nfsmount *nmp;
89 };
90
91 struct nfs4_fdata {
92 struct nfsnode *fd_n;
93 pid_t fd_pid;
94 };
95
96 struct nfs4_oparg_putfh {
97 /* filled in by caller */
98 /* struct dentry *dentry;*/
99
100 /* filled in by setup routine */
101 /* nfs_opnum4 op;*/
102 uint32_t fh_len;
103 nfsfh_t fh_val;
104 int nlookups;
105 };
106
107 struct nfs4_oparg_getattr {
108 struct vnode *vp;
109 nfsv4bitmap *bm;
110 struct nfsv4_fattr fa;
111 };
112
113 struct nfs4_oparg_getfh {
114 uint32_t fh_len;
115 nfsfh_t fh_val;
116 struct vnode *vp;
117 };
118
119 struct nfs4_oparg_lookup {
120 const char *name;
121 uint32_t namelen;
122 struct vnode *vp;
123 };
124
125 struct nfs4_oparg_setclientid {
126 struct nfsmount *np;
127 uint32_t namelen;
128 char *name;
129 char *cb_netid;
130 uint32_t cb_netidlen;
131 char *cb_univaddr;
132 uint32_t cb_univaddrlen;
133 uint32_t cb_prog;
134
135 uint64_t clientid;
136 u_char verf[NFSX_V4VERF];
137 };
138
139 struct nfs4_oparg_access {
140 uint32_t mode;
141 uint32_t rmode;
142 uint32_t supported;
143 };
144
145 struct nfs4_oparg_open {
146 uint32_t flags;
147 uint32_t rflags;
148
149 nfsv4cltype ctype;
150 struct vattr *vap;
151 struct componentname *cnp;
152
153 struct nfs4_fctx *fcp;
154
155 char stateid[NFSX_V4STATEID];
156 };
157
158 struct nfs4_oparg_read {
159 uint64_t off;
160 uint32_t maxcnt;
161 uint32_t eof;
162 uint32_t retlen;
163 struct uio *uiop;
164 struct nfs4_fctx *fcp;
165 };
166
167 struct nfs4_oparg_write {
168 uint64_t off;
169 uint32_t stable;
170 uint32_t cnt;
171 uint32_t retlen;
172 uint32_t committed;
173 struct uio *uiop;
174 u_char wverf[NFSX_V4VERF];
175 struct nfs4_fctx *fcp;
176 };
177
178 struct nfs4_oparg_commit {
179 uint32_t len;
180 off_t start;
181
182 u_char verf[NFSX_V4VERF];
183 };
184
185 struct nfs4_oparg_readdir {
186 uint32_t cnt;
187 nfsv4bitmap *bm;
188 uint64_t cookie;
189 u_char verf[NFSX_V4VERF];
190 };
191
192 struct nfs4_oparg_create {
193 nfstype type;
194 char *linktext;
195 char *name;
196 uint32_t namelen;
197 struct vattr *vap;
198 };
199
200 struct nfs4_oparg_rename {
201 const char *fname;
202 uint32_t fnamelen;
203 const char *tname;
204 uint32_t tnamelen;
205 };
206
207 struct nfs4_oparg_link {
208 const char *name;
209 uint32_t namelen;
210 };
211
212 /*
213 * Lockowner
214 */
215 struct nfs4_lowner {
216 uint32_t lo_cnt;
217 uint32_t lo_seqid;
218 uint32_t lo_id;
219 };
220
221 #define NFS4_SEQIDMUTATINGERROR(err) \
222 (((err) != NFSERR_STALE_CLIENTID) && \
223 ((err) != NFSERR_BAD_SEQID) && \
224 ((err) != NFSERR_STALE_STATEID) && \
225 ((err) != NFSERR_BAD_STATEID))
226
227 /* Standard bitmasks */
228 extern nfsv4bitmap nfsv4_fsinfobm;
229 extern nfsv4bitmap nfsv4_fsattrbm;
230 extern nfsv4bitmap nfsv4_getattrbm;
231 extern nfsv4bitmap nfsv4_readdirbm;
232
233 vfs_init_t nfs4_init;
234 vfs_uninit_t nfs4_uninit;
235
236 uint32_t nfs_v4fileid4_to_fileid(uint64_t);
237
238 int nfs4_readrpc(struct vnode *, struct uio *, struct ucred *);
239 int nfs4_writerpc(struct vnode *, struct uio *, struct ucred *, int *,
240 int *);
241 int nfs4_commit(struct vnode *vp, u_quad_t offset, int cnt,
242 struct ucred *cred, struct thread *td);
243 int nfs4_readdirrpc(struct vnode *, struct uio *, struct ucred *);
244 int nfs4_readlinkrpc(struct vnode *, struct uio *, struct ucred *);
245 int nfs4_sigintr(struct nfsmount *, struct nfsreq *, struct thread *);
246 int nfs4_writebp(struct buf *, int, struct thread *);
247 int nfs4_request(struct vnode *, struct mbuf *, int, struct thread *,
248 struct ucred *, struct mbuf **, struct mbuf **, caddr_t *);
249 int nfs4_request_mnt(struct nfsmount *, struct mbuf *, int, struct thread *,
250 struct ucred *, struct mbuf **, struct mbuf **, caddr_t *);
251 int nfs4_connect(struct nfsmount *);
252 void nfs4_disconnect(struct nfsmount *);
253 void nfs4_safedisconnect(struct nfsmount *);
254 int nfs4_nmcancelreqs(struct nfsmount *);
255
256 void nfs_v4initcompound(struct nfs4_compound *);
257 int nfs_v4postop(struct nfs4_compound *, int);
258 int nfs_v4handlestatus(int, struct nfs4_compound *);
259
260 #endif /* _NFS4CLIENT_NFS4_H */
Cache object: 72445415bc337a3c862d498686ab2d93
|