nfs.h revision 1.1.1.1.6.2 1 1.1.1.1.6.2 yamt /* $NetBSD: nfs.h,v 1.1.1.1.6.2 2014/05/22 11:41:00 yamt Exp $ */
2 1.1.1.1.6.2 yamt /*-
3 1.1.1.1.6.2 yamt * Copyright (c) 1989, 1993
4 1.1.1.1.6.2 yamt * The Regents of the University of California. All rights reserved.
5 1.1.1.1.6.2 yamt *
6 1.1.1.1.6.2 yamt * This code is derived from software contributed to Berkeley by
7 1.1.1.1.6.2 yamt * Rick Macklem at The University of Guelph.
8 1.1.1.1.6.2 yamt *
9 1.1.1.1.6.2 yamt * Redistribution and use in source and binary forms, with or without
10 1.1.1.1.6.2 yamt * modification, are permitted provided that the following conditions
11 1.1.1.1.6.2 yamt * are met:
12 1.1.1.1.6.2 yamt * 1. Redistributions of source code must retain the above copyright
13 1.1.1.1.6.2 yamt * notice, this list of conditions and the following disclaimer.
14 1.1.1.1.6.2 yamt * 2. Redistributions in binary form must reproduce the above copyright
15 1.1.1.1.6.2 yamt * notice, this list of conditions and the following disclaimer in the
16 1.1.1.1.6.2 yamt * documentation and/or other materials provided with the distribution.
17 1.1.1.1.6.2 yamt * 4. Neither the name of the University nor the names of its contributors
18 1.1.1.1.6.2 yamt * may be used to endorse or promote products derived from this software
19 1.1.1.1.6.2 yamt * without specific prior written permission.
20 1.1.1.1.6.2 yamt *
21 1.1.1.1.6.2 yamt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 1.1.1.1.6.2 yamt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 1.1.1.1.6.2 yamt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 1.1.1.1.6.2 yamt * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 1.1.1.1.6.2 yamt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 1.1.1.1.6.2 yamt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 1.1.1.1.6.2 yamt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 1.1.1.1.6.2 yamt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 1.1.1.1.6.2 yamt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 1.1.1.1.6.2 yamt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 1.1.1.1.6.2 yamt * SUCH DAMAGE.
32 1.1.1.1.6.2 yamt *
33 1.1.1.1.6.2 yamt * FreeBSD: head/sys/fs/nfs/nfs.h 254925 2013-08-26 18:16:05Z jhb
34 1.1.1.1.6.2 yamt * $NetBSD: nfs.h,v 1.1.1.1.6.2 2014/05/22 11:41:00 yamt Exp $
35 1.1.1.1.6.2 yamt */
36 1.1.1.1.6.2 yamt
37 1.1.1.1.6.2 yamt #ifndef _NFS_NFS_H_
38 1.1.1.1.6.2 yamt #define _NFS_NFS_H_
39 1.1.1.1.6.2 yamt /*
40 1.1.1.1.6.2 yamt * Tunable constants for nfs
41 1.1.1.1.6.2 yamt */
42 1.1.1.1.6.2 yamt
43 1.1.1.1.6.2 yamt #define NFS_MAXIOVEC 34
44 1.1.1.1.6.2 yamt #define NFS_TICKINTVL 500 /* Desired time for a tick (msec) */
45 1.1.1.1.6.2 yamt #define NFS_HZ (hz / nfscl_ticks) /* Ticks/sec */
46 1.1.1.1.6.2 yamt #define NFS_TIMEO (1 * NFS_HZ) /* Default timeout = 1 second */
47 1.1.1.1.6.2 yamt #define NFS_MINTIMEO (1 * NFS_HZ) /* Min timeout to use */
48 1.1.1.1.6.2 yamt #define NFS_MAXTIMEO (60 * NFS_HZ) /* Max timeout to backoff to */
49 1.1.1.1.6.2 yamt #define NFS_TCPTIMEO 300 /* TCP timeout */
50 1.1.1.1.6.2 yamt #define NFS_MAXRCVTIMEO 60 /* 1 minute in seconds */
51 1.1.1.1.6.2 yamt #define NFS_MINIDEMTIMEO (5 * NFS_HZ) /* Min timeout for non-idempotent ops*/
52 1.1.1.1.6.2 yamt #define NFS_MAXREXMIT 100 /* Stop counting after this many */
53 1.1.1.1.6.2 yamt #define NFSV4_CALLBACKTIMEO (2 * NFS_HZ) /* Timeout in ticks */
54 1.1.1.1.6.2 yamt #define NFSV4_CALLBACKRETRY 5 /* Number of retries before failure */
55 1.1.1.1.6.2 yamt #define NFSV4_CBSLOTS 8 /* Number of slots for session */
56 1.1.1.1.6.2 yamt #define NFSV4_CBRETRYCNT 4 /* # of CBRecall retries upon err */
57 1.1.1.1.6.2 yamt #define NFSV4_UPCALLTIMEO (15 * NFS_HZ) /* Timeout in ticks for upcalls */
58 1.1.1.1.6.2 yamt /* to gssd or nfsuserd */
59 1.1.1.1.6.2 yamt #define NFSV4_UPCALLRETRY 4 /* Number of retries before failure */
60 1.1.1.1.6.2 yamt #define NFS_MAXWINDOW 1024 /* Max number of outstanding requests */
61 1.1.1.1.6.2 yamt #define NFS_RETRANS 10 /* Num of retrans for soft mounts */
62 1.1.1.1.6.2 yamt #define NFS_RETRANS_TCP 2 /* Num of retrans for TCP soft mounts */
63 1.1.1.1.6.2 yamt #define NFS_MAXGRPS 16 /* Max. size of groups list */
64 1.1.1.1.6.2 yamt #define NFS_TRYLATERDEL 15 /* Maximum delay timeout (sec) */
65 1.1.1.1.6.2 yamt #ifndef NFS_REMOVETIMEO
66 1.1.1.1.6.2 yamt #define NFS_REMOVETIMEO 15 /* # sec to wait for delegret in local syscall */
67 1.1.1.1.6.2 yamt #endif
68 1.1.1.1.6.2 yamt #ifndef NFS_MINATTRTIMO
69 1.1.1.1.6.2 yamt #define NFS_MINATTRTIMO 5 /* Attribute cache timeout in sec */
70 1.1.1.1.6.2 yamt #endif
71 1.1.1.1.6.2 yamt #ifndef NFS_MAXATTRTIMO
72 1.1.1.1.6.2 yamt #define NFS_MAXATTRTIMO 60
73 1.1.1.1.6.2 yamt #endif
74 1.1.1.1.6.2 yamt #define NFS_WSIZE 8192 /* Def. write data size <= 8192 */
75 1.1.1.1.6.2 yamt #define NFS_RSIZE 8192 /* Def. read data size <= 8192 */
76 1.1.1.1.6.2 yamt #define NFS_READDIRSIZE 8192 /* Def. readdir size */
77 1.1.1.1.6.2 yamt #define NFS_DEFRAHEAD 1 /* Def. read ahead # blocks */
78 1.1.1.1.6.2 yamt #define NFS_MAXRAHEAD 16 /* Max. read ahead # blocks */
79 1.1.1.1.6.2 yamt #define NFS_MAXASYNCDAEMON 64 /* Max. number async_daemons runnable */
80 1.1.1.1.6.2 yamt #define NFS_MAXUIDHASH 64 /* Max. # of hashed uid entries/mp */
81 1.1.1.1.6.2 yamt #ifndef NFSRV_LEASE
82 1.1.1.1.6.2 yamt #define NFSRV_LEASE 120 /* Lease time in seconds for V4 */
83 1.1.1.1.6.2 yamt #endif /* assigned to nfsrv_lease */
84 1.1.1.1.6.2 yamt #ifndef NFSRV_STALELEASE
85 1.1.1.1.6.2 yamt #define NFSRV_STALELEASE (5 * nfsrv_lease)
86 1.1.1.1.6.2 yamt #endif
87 1.1.1.1.6.2 yamt #ifndef NFSRV_MOULDYLEASE
88 1.1.1.1.6.2 yamt #define NFSRV_MOULDYLEASE 604800 /* One week (in sec) */
89 1.1.1.1.6.2 yamt #endif
90 1.1.1.1.6.2 yamt #ifndef NFSCLIENTHASHSIZE
91 1.1.1.1.6.2 yamt #define NFSCLIENTHASHSIZE 20 /* Size of server client hash table */
92 1.1.1.1.6.2 yamt #endif
93 1.1.1.1.6.2 yamt #ifndef NFSLOCKHASHSIZE
94 1.1.1.1.6.2 yamt #define NFSLOCKHASHSIZE 20 /* Size of server nfslock hash table */
95 1.1.1.1.6.2 yamt #endif
96 1.1.1.1.6.2 yamt #define NFSSTATEHASHSIZE 10 /* Size of server stateid hash table */
97 1.1.1.1.6.2 yamt #ifndef NFSUSERHASHSIZE
98 1.1.1.1.6.2 yamt #define NFSUSERHASHSIZE 30 /* Size of user id hash table */
99 1.1.1.1.6.2 yamt #endif
100 1.1.1.1.6.2 yamt #ifndef NFSGROUPHASHSIZE
101 1.1.1.1.6.2 yamt #define NFSGROUPHASHSIZE 5 /* Size of group id hash table */
102 1.1.1.1.6.2 yamt #endif
103 1.1.1.1.6.2 yamt #ifndef NFSCLDELEGHIGHWATER
104 1.1.1.1.6.2 yamt #define NFSCLDELEGHIGHWATER 10000 /* limit for client delegations */
105 1.1.1.1.6.2 yamt #endif
106 1.1.1.1.6.2 yamt #ifndef NFSCLLAYOUTHIGHWATER
107 1.1.1.1.6.2 yamt #define NFSCLLAYOUTHIGHWATER 10000 /* limit for client pNFS layouts */
108 1.1.1.1.6.2 yamt #endif
109 1.1.1.1.6.2 yamt #ifndef NFSNOOPEN /* Inactive open owner (sec) */
110 1.1.1.1.6.2 yamt #define NFSNOOPEN 120
111 1.1.1.1.6.2 yamt #endif
112 1.1.1.1.6.2 yamt #define NFSRV_LEASEDELTA 15 /* # of seconds to delay beyond lease */
113 1.1.1.1.6.2 yamt #define NFS_IDMAXSIZE 4 /* max sizeof (in_addr_t) */
114 1.1.1.1.6.2 yamt #ifndef NFSRVCACHE_UDPTIMEOUT
115 1.1.1.1.6.2 yamt #define NFSRVCACHE_UDPTIMEOUT 30 /* # of sec to hold cached rpcs(udp) */
116 1.1.1.1.6.2 yamt #endif
117 1.1.1.1.6.2 yamt #ifndef NFSRVCACHE_UDPHIGHWATER
118 1.1.1.1.6.2 yamt #define NFSRVCACHE_UDPHIGHWATER 500 /* Max # of udp cache entries */
119 1.1.1.1.6.2 yamt #endif
120 1.1.1.1.6.2 yamt #ifndef NFSRVCACHE_TCPTIMEOUT
121 1.1.1.1.6.2 yamt #define NFSRVCACHE_TCPTIMEOUT (3600*12) /*#of sec to hold cached rpcs(tcp) */
122 1.1.1.1.6.2 yamt #endif
123 1.1.1.1.6.2 yamt #ifndef NFSRVCACHE_FLOODLEVEL
124 1.1.1.1.6.2 yamt #define NFSRVCACHE_FLOODLEVEL 16384 /* Very high water mark for cache */
125 1.1.1.1.6.2 yamt #endif
126 1.1.1.1.6.2 yamt #ifndef NFSRV_CLIENTHIGHWATER
127 1.1.1.1.6.2 yamt #define NFSRV_CLIENTHIGHWATER 1000
128 1.1.1.1.6.2 yamt #endif
129 1.1.1.1.6.2 yamt #ifndef NFSRV_MAXDUMPLIST
130 1.1.1.1.6.2 yamt #define NFSRV_MAXDUMPLIST 10000
131 1.1.1.1.6.2 yamt #endif
132 1.1.1.1.6.2 yamt #ifndef NFS_ACCESSCACHESIZE
133 1.1.1.1.6.2 yamt #define NFS_ACCESSCACHESIZE 8
134 1.1.1.1.6.2 yamt #endif
135 1.1.1.1.6.2 yamt #define NFSV4_CBPORT 7745 /* Callback port for testing */
136 1.1.1.1.6.2 yamt
137 1.1.1.1.6.2 yamt /*
138 1.1.1.1.6.2 yamt * This macro defines the high water mark for issuing V4 delegations.
139 1.1.1.1.6.2 yamt * (It is currently set at a conservative 20% of NFSRV_V4STATELIMIT. This
140 1.1.1.1.6.2 yamt * may want to increase when clients can make more effective use of
141 1.1.1.1.6.2 yamt * delegations.)
142 1.1.1.1.6.2 yamt */
143 1.1.1.1.6.2 yamt #define NFSRV_V4DELEGLIMIT(c) (((c) * 5) > NFSRV_V4STATELIMIT)
144 1.1.1.1.6.2 yamt
145 1.1.1.1.6.2 yamt #define NFS_READDIRBLKSIZ DIRBLKSIZ /* Minimal nm_readdirsize */
146 1.1.1.1.6.2 yamt
147 1.1.1.1.6.2 yamt /*
148 1.1.1.1.6.2 yamt * Oddballs
149 1.1.1.1.6.2 yamt */
150 1.1.1.1.6.2 yamt #define NFS_CMPFH(n, f, s) \
151 1.1.1.1.6.2 yamt ((n)->n_fhp->nfh_len == (s) && !NFSBCMP((n)->n_fhp->nfh_fh, (caddr_t)(f), (s)))
152 1.1.1.1.6.2 yamt #define NFSRV_CMPFH(nf, ns, f, s) \
153 1.1.1.1.6.2 yamt ((ns) == (s) && !NFSBCMP((caddr_t)(nf), (caddr_t)(f), (s)))
154 1.1.1.1.6.2 yamt #define NFS_CMPTIME(t1, t2) \
155 1.1.1.1.6.2 yamt ((t1).tv_sec == (t2).tv_sec && (t1).tv_nsec == (t2).tv_nsec)
156 1.1.1.1.6.2 yamt #define NFS_SETTIME(t) do { \
157 1.1.1.1.6.2 yamt (t).tv_sec = time.tv_sec; (t).tv_nsec = 1000 * time.tv_usec; } while (0)
158 1.1.1.1.6.2 yamt #define NFS_SRVMAXDATA(n) \
159 1.1.1.1.6.2 yamt (((n)->nd_flag & (ND_NFSV3 | ND_NFSV4)) ? \
160 1.1.1.1.6.2 yamt NFS_MAXDATA : NFS_V2MAXDATA)
161 1.1.1.1.6.2 yamt #define NFS64BITSSET 0xffffffffffffffffull
162 1.1.1.1.6.2 yamt #define NFS64BITSMINUS1 0xfffffffffffffffeull
163 1.1.1.1.6.2 yamt
164 1.1.1.1.6.2 yamt /*
165 1.1.1.1.6.2 yamt * Structures for the nfssvc(2) syscall. Not that anyone but nfsd, mount_nfs
166 1.1.1.1.6.2 yamt * and nfsloaduser should ever try and use it.
167 1.1.1.1.6.2 yamt */
168 1.1.1.1.6.2 yamt struct nfsd_addsock_args {
169 1.1.1.1.6.2 yamt int sock; /* Socket to serve */
170 1.1.1.1.6.2 yamt caddr_t name; /* Client addr for connection based sockets */
171 1.1.1.1.6.2 yamt int namelen; /* Length of name */
172 1.1.1.1.6.2 yamt };
173 1.1.1.1.6.2 yamt
174 1.1.1.1.6.2 yamt /*
175 1.1.1.1.6.2 yamt * nfsd argument for new krpc.
176 1.1.1.1.6.2 yamt */
177 1.1.1.1.6.2 yamt struct nfsd_nfsd_args {
178 1.1.1.1.6.2 yamt const char *principal; /* GSS-API service principal name */
179 1.1.1.1.6.2 yamt int minthreads; /* minimum service thread count */
180 1.1.1.1.6.2 yamt int maxthreads; /* maximum service thread count */
181 1.1.1.1.6.2 yamt };
182 1.1.1.1.6.2 yamt
183 1.1.1.1.6.2 yamt /*
184 1.1.1.1.6.2 yamt * Arguments for use by the callback daemon.
185 1.1.1.1.6.2 yamt */
186 1.1.1.1.6.2 yamt struct nfsd_nfscbd_args {
187 1.1.1.1.6.2 yamt const char *principal; /* GSS-API service principal name */
188 1.1.1.1.6.2 yamt };
189 1.1.1.1.6.2 yamt
190 1.1.1.1.6.2 yamt struct nfscbd_args {
191 1.1.1.1.6.2 yamt int sock; /* Socket to serve */
192 1.1.1.1.6.2 yamt caddr_t name; /* Client addr for connection based sockets */
193 1.1.1.1.6.2 yamt int namelen; /* Length of name */
194 1.1.1.1.6.2 yamt u_short port; /* Port# for callbacks */
195 1.1.1.1.6.2 yamt };
196 1.1.1.1.6.2 yamt
197 1.1.1.1.6.2 yamt struct nfsd_idargs {
198 1.1.1.1.6.2 yamt int nid_flag; /* Flags (see below) */
199 1.1.1.1.6.2 yamt uid_t nid_uid; /* user/group id */
200 1.1.1.1.6.2 yamt gid_t nid_gid;
201 1.1.1.1.6.2 yamt int nid_usermax; /* Upper bound on user name cache */
202 1.1.1.1.6.2 yamt int nid_usertimeout;/* User name timeout (minutes) */
203 1.1.1.1.6.2 yamt u_char *nid_name; /* Name */
204 1.1.1.1.6.2 yamt int nid_namelen; /* and its length */
205 1.1.1.1.6.2 yamt };
206 1.1.1.1.6.2 yamt
207 1.1.1.1.6.2 yamt struct nfsd_clid {
208 1.1.1.1.6.2 yamt int nclid_idlen; /* Length of client id */
209 1.1.1.1.6.2 yamt u_char nclid_id[NFSV4_OPAQUELIMIT]; /* and name */
210 1.1.1.1.6.2 yamt };
211 1.1.1.1.6.2 yamt
212 1.1.1.1.6.2 yamt struct nfsd_dumplist {
213 1.1.1.1.6.2 yamt int ndl_size; /* Number of elements */
214 1.1.1.1.6.2 yamt void *ndl_list; /* and the list of elements */
215 1.1.1.1.6.2 yamt };
216 1.1.1.1.6.2 yamt
217 1.1.1.1.6.2 yamt struct nfsd_dumpclients {
218 1.1.1.1.6.2 yamt u_int32_t ndcl_flags; /* LCL_xxx flags */
219 1.1.1.1.6.2 yamt u_int32_t ndcl_nopenowners; /* Number of openowners */
220 1.1.1.1.6.2 yamt u_int32_t ndcl_nopens; /* and opens */
221 1.1.1.1.6.2 yamt u_int32_t ndcl_nlockowners; /* and of lockowners */
222 1.1.1.1.6.2 yamt u_int32_t ndcl_nlocks; /* and of locks */
223 1.1.1.1.6.2 yamt u_int32_t ndcl_ndelegs; /* and of delegations */
224 1.1.1.1.6.2 yamt u_int32_t ndcl_nolddelegs; /* and old delegations */
225 1.1.1.1.6.2 yamt sa_family_t ndcl_addrfam; /* Callback address */
226 1.1.1.1.6.2 yamt union {
227 1.1.1.1.6.2 yamt struct in_addr sin_addr;
228 1.1.1.1.6.2 yamt struct in6_addr sin6_addr;
229 1.1.1.1.6.2 yamt } ndcl_cbaddr;
230 1.1.1.1.6.2 yamt struct nfsd_clid ndcl_clid; /* and client id */
231 1.1.1.1.6.2 yamt };
232 1.1.1.1.6.2 yamt
233 1.1.1.1.6.2 yamt struct nfsd_dumplocklist {
234 1.1.1.1.6.2 yamt char *ndllck_fname; /* File Name */
235 1.1.1.1.6.2 yamt int ndllck_size; /* Number of elements */
236 1.1.1.1.6.2 yamt void *ndllck_list; /* and the list of elements */
237 1.1.1.1.6.2 yamt };
238 1.1.1.1.6.2 yamt
239 1.1.1.1.6.2 yamt struct nfsd_dumplocks {
240 1.1.1.1.6.2 yamt u_int32_t ndlck_flags; /* state flags NFSLCK_xxx */
241 1.1.1.1.6.2 yamt nfsv4stateid_t ndlck_stateid; /* stateid */
242 1.1.1.1.6.2 yamt u_int64_t ndlck_first; /* lock byte range */
243 1.1.1.1.6.2 yamt u_int64_t ndlck_end;
244 1.1.1.1.6.2 yamt struct nfsd_clid ndlck_owner; /* Owner of open/lock */
245 1.1.1.1.6.2 yamt sa_family_t ndlck_addrfam; /* Callback address */
246 1.1.1.1.6.2 yamt union {
247 1.1.1.1.6.2 yamt struct in_addr sin_addr;
248 1.1.1.1.6.2 yamt struct in6_addr sin6_addr;
249 1.1.1.1.6.2 yamt } ndlck_cbaddr;
250 1.1.1.1.6.2 yamt struct nfsd_clid ndlck_clid; /* and client id */
251 1.1.1.1.6.2 yamt };
252 1.1.1.1.6.2 yamt
253 1.1.1.1.6.2 yamt /*
254 1.1.1.1.6.2 yamt * Structure for referral information.
255 1.1.1.1.6.2 yamt */
256 1.1.1.1.6.2 yamt struct nfsreferral {
257 1.1.1.1.6.2 yamt u_char *nfr_srvlist; /* List of servers */
258 1.1.1.1.6.2 yamt int nfr_srvcnt; /* number of servers */
259 1.1.1.1.6.2 yamt vnode_t nfr_vp; /* vnode for referral */
260 1.1.1.1.6.2 yamt u_int32_t nfr_dfileno; /* assigned dir inode# */
261 1.1.1.1.6.2 yamt };
262 1.1.1.1.6.2 yamt
263 1.1.1.1.6.2 yamt /*
264 1.1.1.1.6.2 yamt * Flags for lc_flags and opsflags for nfsrv_getclient().
265 1.1.1.1.6.2 yamt */
266 1.1.1.1.6.2 yamt #define LCL_NEEDSCONFIRM 0x00000001
267 1.1.1.1.6.2 yamt #define LCL_DONTCLEAN 0x00000002
268 1.1.1.1.6.2 yamt #define LCL_WAKEUPWANTED 0x00000004
269 1.1.1.1.6.2 yamt #define LCL_TCPCALLBACK 0x00000008
270 1.1.1.1.6.2 yamt #define LCL_CALLBACKSON 0x00000010
271 1.1.1.1.6.2 yamt #define LCL_INDEXNOTOK 0x00000020
272 1.1.1.1.6.2 yamt #define LCL_STAMPEDSTABLE 0x00000040
273 1.1.1.1.6.2 yamt #define LCL_EXPIREIT 0x00000080
274 1.1.1.1.6.2 yamt #define LCL_CBDOWN 0x00000100
275 1.1.1.1.6.2 yamt #define LCL_KERBV 0x00000400
276 1.1.1.1.6.2 yamt #define LCL_NAME 0x00000800
277 1.1.1.1.6.2 yamt #define LCL_NEEDSCBNULL 0x00001000
278 1.1.1.1.6.2 yamt #define LCL_GSSINTEGRITY 0x00002000
279 1.1.1.1.6.2 yamt #define LCL_GSSPRIVACY 0x00004000
280 1.1.1.1.6.2 yamt #define LCL_ADMINREVOKED 0x00008000
281 1.1.1.1.6.2 yamt
282 1.1.1.1.6.2 yamt #define LCL_GSS LCL_KERBV /* Or of all mechs */
283 1.1.1.1.6.2 yamt
284 1.1.1.1.6.2 yamt /*
285 1.1.1.1.6.2 yamt * Bits for flags in nfslock and nfsstate.
286 1.1.1.1.6.2 yamt * The access, deny, NFSLCK_READ and NFSLCK_WRITE bits must be defined as
287 1.1.1.1.6.2 yamt * below, in the correct order, so the shifts work for tests.
288 1.1.1.1.6.2 yamt */
289 1.1.1.1.6.2 yamt #define NFSLCK_READACCESS 0x00000001
290 1.1.1.1.6.2 yamt #define NFSLCK_WRITEACCESS 0x00000002
291 1.1.1.1.6.2 yamt #define NFSLCK_ACCESSBITS (NFSLCK_READACCESS | NFSLCK_WRITEACCESS)
292 1.1.1.1.6.2 yamt #define NFSLCK_SHIFT 2
293 1.1.1.1.6.2 yamt #define NFSLCK_READDENY 0x00000004
294 1.1.1.1.6.2 yamt #define NFSLCK_WRITEDENY 0x00000008
295 1.1.1.1.6.2 yamt #define NFSLCK_DENYBITS (NFSLCK_READDENY | NFSLCK_WRITEDENY)
296 1.1.1.1.6.2 yamt #define NFSLCK_SHAREBITS \
297 1.1.1.1.6.2 yamt (NFSLCK_READACCESS|NFSLCK_WRITEACCESS|NFSLCK_READDENY|NFSLCK_WRITEDENY)
298 1.1.1.1.6.2 yamt #define NFSLCK_LOCKSHIFT 4
299 1.1.1.1.6.2 yamt #define NFSLCK_READ 0x00000010
300 1.1.1.1.6.2 yamt #define NFSLCK_WRITE 0x00000020
301 1.1.1.1.6.2 yamt #define NFSLCK_BLOCKING 0x00000040
302 1.1.1.1.6.2 yamt #define NFSLCK_RECLAIM 0x00000080
303 1.1.1.1.6.2 yamt #define NFSLCK_OPENTOLOCK 0x00000100
304 1.1.1.1.6.2 yamt #define NFSLCK_TEST 0x00000200
305 1.1.1.1.6.2 yamt #define NFSLCK_LOCK 0x00000400
306 1.1.1.1.6.2 yamt #define NFSLCK_UNLOCK 0x00000800
307 1.1.1.1.6.2 yamt #define NFSLCK_OPEN 0x00001000
308 1.1.1.1.6.2 yamt #define NFSLCK_CLOSE 0x00002000
309 1.1.1.1.6.2 yamt #define NFSLCK_CHECK 0x00004000
310 1.1.1.1.6.2 yamt #define NFSLCK_RELEASE 0x00008000
311 1.1.1.1.6.2 yamt #define NFSLCK_NEEDSCONFIRM 0x00010000
312 1.1.1.1.6.2 yamt #define NFSLCK_CONFIRM 0x00020000
313 1.1.1.1.6.2 yamt #define NFSLCK_DOWNGRADE 0x00040000
314 1.1.1.1.6.2 yamt #define NFSLCK_DELEGREAD 0x00080000
315 1.1.1.1.6.2 yamt #define NFSLCK_DELEGWRITE 0x00100000
316 1.1.1.1.6.2 yamt #define NFSLCK_DELEGCUR 0x00200000
317 1.1.1.1.6.2 yamt #define NFSLCK_DELEGPREV 0x00400000
318 1.1.1.1.6.2 yamt #define NFSLCK_OLDDELEG 0x00800000
319 1.1.1.1.6.2 yamt #define NFSLCK_DELEGRECALL 0x01000000
320 1.1.1.1.6.2 yamt #define NFSLCK_SETATTR 0x02000000
321 1.1.1.1.6.2 yamt #define NFSLCK_DELEGPURGE 0x04000000
322 1.1.1.1.6.2 yamt #define NFSLCK_DELEGRETURN 0x08000000
323 1.1.1.1.6.2 yamt
324 1.1.1.1.6.2 yamt /* And bits for nid_flag */
325 1.1.1.1.6.2 yamt #define NFSID_INITIALIZE 0x0001
326 1.1.1.1.6.2 yamt #define NFSID_ADDUID 0x0002
327 1.1.1.1.6.2 yamt #define NFSID_DELUID 0x0004
328 1.1.1.1.6.2 yamt #define NFSID_ADDUSERNAME 0x0008
329 1.1.1.1.6.2 yamt #define NFSID_DELUSERNAME 0x0010
330 1.1.1.1.6.2 yamt #define NFSID_ADDGID 0x0020
331 1.1.1.1.6.2 yamt #define NFSID_DELGID 0x0040
332 1.1.1.1.6.2 yamt #define NFSID_ADDGROUPNAME 0x0080
333 1.1.1.1.6.2 yamt #define NFSID_DELGROUPNAME 0x0100
334 1.1.1.1.6.2 yamt
335 1.1.1.1.6.2 yamt /*
336 1.1.1.1.6.2 yamt * fs.nfs sysctl(3) identifiers
337 1.1.1.1.6.2 yamt */
338 1.1.1.1.6.2 yamt #define NFS_NFSSTATS 1 /* struct: struct nfsstats */
339 1.1.1.1.6.2 yamt
340 1.1.1.1.6.2 yamt /*
341 1.1.1.1.6.2 yamt * Here is the definition of the attribute bits array and macros that
342 1.1.1.1.6.2 yamt * manipulate it.
343 1.1.1.1.6.2 yamt * THE MACROS MUST BE MANUALLY MODIFIED IF NFSATTRBIT_MAXWORDS CHANGES!!
344 1.1.1.1.6.2 yamt * It is (NFSATTRBIT_MAX + 31) / 32.
345 1.1.1.1.6.2 yamt */
346 1.1.1.1.6.2 yamt #define NFSATTRBIT_MAXWORDS 2
347 1.1.1.1.6.2 yamt
348 1.1.1.1.6.2 yamt typedef struct {
349 1.1.1.1.6.2 yamt u_int32_t bits[NFSATTRBIT_MAXWORDS];
350 1.1.1.1.6.2 yamt } nfsattrbit_t;
351 1.1.1.1.6.2 yamt
352 1.1.1.1.6.2 yamt #define NFSZERO_ATTRBIT(b) do { (b)->bits[0] = 0; (b)->bits[1] = 0; } while (0)
353 1.1.1.1.6.2 yamt #define NFSSET_ATTRBIT(t, f) do { (t)->bits[0] = (f)->bits[0]; \
354 1.1.1.1.6.2 yamt (t)->bits[1] = (f)->bits[1]; } while (0)
355 1.1.1.1.6.2 yamt #define NFSSETSUPP_ATTRBIT(b) do { \
356 1.1.1.1.6.2 yamt (b)->bits[0] = NFSATTRBIT_SUPP0; \
357 1.1.1.1.6.2 yamt (b)->bits[1] = (NFSATTRBIT_SUPP1 | NFSATTRBIT_SUPPSETONLY); } while (0)
358 1.1.1.1.6.2 yamt #define NFSISSET_ATTRBIT(b, p) ((b)->bits[(p) / 32] & (1 << ((p) % 32)))
359 1.1.1.1.6.2 yamt #define NFSSETBIT_ATTRBIT(b, p) ((b)->bits[(p) / 32] |= (1 << ((p) % 32)))
360 1.1.1.1.6.2 yamt #define NFSCLRBIT_ATTRBIT(b, p) ((b)->bits[(p) / 32] &= ~(1 << ((p) % 32)))
361 1.1.1.1.6.2 yamt #define NFSCLRALL_ATTRBIT(b, a) do { \
362 1.1.1.1.6.2 yamt (b)->bits[0] &= ~((a)->bits[0]); \
363 1.1.1.1.6.2 yamt (b)->bits[1] &= ~((a)->bits[1]); \
364 1.1.1.1.6.2 yamt } while (0)
365 1.1.1.1.6.2 yamt #define NFSCLRNOT_ATTRBIT(b, a) do { \
366 1.1.1.1.6.2 yamt (b)->bits[0] &= ((a)->bits[0]); \
367 1.1.1.1.6.2 yamt (b)->bits[1] &= ((a)->bits[1]); \
368 1.1.1.1.6.2 yamt } while (0)
369 1.1.1.1.6.2 yamt #define NFSCLRNOTFILLABLE_ATTRBIT(b) do { \
370 1.1.1.1.6.2 yamt (b)->bits[0] &= NFSATTRBIT_SUPP0; \
371 1.1.1.1.6.2 yamt (b)->bits[1] &= NFSATTRBIT_SUPP1; } while (0)
372 1.1.1.1.6.2 yamt #define NFSCLRNOTSETABLE_ATTRBIT(b) do { \
373 1.1.1.1.6.2 yamt (b)->bits[0] &= NFSATTRBIT_SETABLE0; \
374 1.1.1.1.6.2 yamt (b)->bits[1] &= NFSATTRBIT_SETABLE1; } while (0)
375 1.1.1.1.6.2 yamt #define NFSNONZERO_ATTRBIT(b) ((b)->bits[0] || (b)->bits[1])
376 1.1.1.1.6.2 yamt #define NFSEQUAL_ATTRBIT(b, p) \
377 1.1.1.1.6.2 yamt ((b)->bits[0] == (p)->bits[0] && (b)->bits[1] == (p)->bits[1])
378 1.1.1.1.6.2 yamt #define NFSGETATTR_ATTRBIT(b) do { \
379 1.1.1.1.6.2 yamt (b)->bits[0] = NFSATTRBIT_GETATTR0; \
380 1.1.1.1.6.2 yamt (b)->bits[1] = NFSATTRBIT_GETATTR1; } while (0)
381 1.1.1.1.6.2 yamt #define NFSWCCATTR_ATTRBIT(b) do { \
382 1.1.1.1.6.2 yamt (b)->bits[0] = NFSATTRBIT_WCCATTR0; \
383 1.1.1.1.6.2 yamt (b)->bits[1] = NFSATTRBIT_WCCATTR1; } while (0)
384 1.1.1.1.6.2 yamt #define NFSWRITEGETATTR_ATTRBIT(b) do { \
385 1.1.1.1.6.2 yamt (b)->bits[0] = NFSATTRBIT_WRITEGETATTR0; \
386 1.1.1.1.6.2 yamt (b)->bits[1] = NFSATTRBIT_WRITEGETATTR1; } while (0)
387 1.1.1.1.6.2 yamt #define NFSCBGETATTR_ATTRBIT(b, c) do { \
388 1.1.1.1.6.2 yamt (c)->bits[0] = ((b)->bits[0] & NFSATTRBIT_CBGETATTR0); \
389 1.1.1.1.6.2 yamt (c)->bits[1] = ((b)->bits[1] & NFSATTRBIT_CBGETATTR1); } while (0)
390 1.1.1.1.6.2 yamt #define NFSPATHCONF_GETATTRBIT(b) do { \
391 1.1.1.1.6.2 yamt (b)->bits[0] = NFSGETATTRBIT_PATHCONF0; \
392 1.1.1.1.6.2 yamt (b)->bits[1] = NFSGETATTRBIT_PATHCONF1; } while (0)
393 1.1.1.1.6.2 yamt #define NFSSTATFS_GETATTRBIT(b) do { \
394 1.1.1.1.6.2 yamt (b)->bits[0] = NFSGETATTRBIT_STATFS0; \
395 1.1.1.1.6.2 yamt (b)->bits[1] = NFSGETATTRBIT_STATFS1; } while (0)
396 1.1.1.1.6.2 yamt #define NFSISSETSTATFS_ATTRBIT(b) \
397 1.1.1.1.6.2 yamt (((b)->bits[0] & NFSATTRBIT_STATFS0) || \
398 1.1.1.1.6.2 yamt ((b)->bits[1] & NFSATTRBIT_STATFS1))
399 1.1.1.1.6.2 yamt #define NFSCLRSTATFS_ATTRBIT(b) do { \
400 1.1.1.1.6.2 yamt (b)->bits[0] &= ~NFSATTRBIT_STATFS0; \
401 1.1.1.1.6.2 yamt (b)->bits[1] &= ~NFSATTRBIT_STATFS1; } while (0)
402 1.1.1.1.6.2 yamt #define NFSREADDIRPLUS_ATTRBIT(b) do { \
403 1.1.1.1.6.2 yamt (b)->bits[0] = NFSATTRBIT_READDIRPLUS0; \
404 1.1.1.1.6.2 yamt (b)->bits[1] = NFSATTRBIT_READDIRPLUS1; } while (0)
405 1.1.1.1.6.2 yamt #define NFSREFERRAL_ATTRBIT(b) do { \
406 1.1.1.1.6.2 yamt (b)->bits[0] = NFSATTRBIT_REFERRAL0; \
407 1.1.1.1.6.2 yamt (b)->bits[1] = NFSATTRBIT_REFERRAL1; } while (0)
408 1.1.1.1.6.2 yamt
409 1.1.1.1.6.2 yamt /*
410 1.1.1.1.6.2 yamt * Store uid, gid creds that were used when the stateid was acquired.
411 1.1.1.1.6.2 yamt * The RPC layer allows NFS_MAXGRPS + 1 groups to go out on the wire,
412 1.1.1.1.6.2 yamt * so that's how many gets stored here.
413 1.1.1.1.6.2 yamt */
414 1.1.1.1.6.2 yamt struct nfscred {
415 1.1.1.1.6.2 yamt uid_t nfsc_uid;
416 1.1.1.1.6.2 yamt gid_t nfsc_groups[NFS_MAXGRPS + 1];
417 1.1.1.1.6.2 yamt int nfsc_ngroups;
418 1.1.1.1.6.2 yamt };
419 1.1.1.1.6.2 yamt
420 1.1.1.1.6.2 yamt /*
421 1.1.1.1.6.2 yamt * Constants that define the file handle for the V4 root directory.
422 1.1.1.1.6.2 yamt * (The FSID must never be used by other file systems that are exported.)
423 1.1.1.1.6.2 yamt */
424 1.1.1.1.6.2 yamt #define NFSV4ROOT_FSID0 ((int32_t) -1)
425 1.1.1.1.6.2 yamt #define NFSV4ROOT_FSID1 ((int32_t) -1)
426 1.1.1.1.6.2 yamt #define NFSV4ROOT_REFERRAL ((int32_t) -2)
427 1.1.1.1.6.2 yamt #define NFSV4ROOT_INO 2 /* It's traditional */
428 1.1.1.1.6.2 yamt #define NFSV4ROOT_GEN 1
429 1.1.1.1.6.2 yamt
430 1.1.1.1.6.2 yamt /*
431 1.1.1.1.6.2 yamt * The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts.
432 1.1.1.1.6.2 yamt * What should be in this set is open to debate, but I believe that since
433 1.1.1.1.6.2 yamt * I/O system calls on ufs are never interrupted by signals the set should
434 1.1.1.1.6.2 yamt * be minimal. My reasoning is that many current programs that use signals
435 1.1.1.1.6.2 yamt * such as SIGALRM will not expect file I/O system calls to be interrupted
436 1.1.1.1.6.2 yamt * by them and break.
437 1.1.1.1.6.2 yamt */
438 1.1.1.1.6.2 yamt #if defined(_KERNEL) || defined(KERNEL)
439 1.1.1.1.6.2 yamt
440 1.1.1.1.6.2 yamt struct uio; struct buf; struct vattr; struct nameidata; /* XXX */
441 1.1.1.1.6.2 yamt
442 1.1.1.1.6.2 yamt /*
443 1.1.1.1.6.2 yamt * Socket errors ignored for connectionless sockets?
444 1.1.1.1.6.2 yamt * For now, ignore them all
445 1.1.1.1.6.2 yamt */
446 1.1.1.1.6.2 yamt #define NFSIGNORE_SOERROR(s, e) \
447 1.1.1.1.6.2 yamt ((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \
448 1.1.1.1.6.2 yamt ((s) & PR_CONNREQUIRED) == 0)
449 1.1.1.1.6.2 yamt
450 1.1.1.1.6.2 yamt
451 1.1.1.1.6.2 yamt /*
452 1.1.1.1.6.2 yamt * This structure holds socket information for a connection. Used by the
453 1.1.1.1.6.2 yamt * client and the server for callbacks.
454 1.1.1.1.6.2 yamt */
455 1.1.1.1.6.2 yamt struct nfssockreq {
456 1.1.1.1.6.2 yamt NFSSOCKADDR_T nr_nam;
457 1.1.1.1.6.2 yamt int nr_sotype;
458 1.1.1.1.6.2 yamt int nr_soproto;
459 1.1.1.1.6.2 yamt int nr_soflags;
460 1.1.1.1.6.2 yamt struct ucred *nr_cred;
461 1.1.1.1.6.2 yamt int nr_lock;
462 1.1.1.1.6.2 yamt NFSMUTEX_T nr_mtx;
463 1.1.1.1.6.2 yamt u_int32_t nr_prog;
464 1.1.1.1.6.2 yamt u_int32_t nr_vers;
465 1.1.1.1.6.2 yamt struct __rpc_client *nr_client;
466 1.1.1.1.6.2 yamt AUTH *nr_auth;
467 1.1.1.1.6.2 yamt };
468 1.1.1.1.6.2 yamt
469 1.1.1.1.6.2 yamt /*
470 1.1.1.1.6.2 yamt * And associated nr_lock bits.
471 1.1.1.1.6.2 yamt */
472 1.1.1.1.6.2 yamt #define NFSR_SNDLOCK 0x01
473 1.1.1.1.6.2 yamt #define NFSR_WANTSND 0x02
474 1.1.1.1.6.2 yamt #define NFSR_RCVLOCK 0x04
475 1.1.1.1.6.2 yamt #define NFSR_WANTRCV 0x08
476 1.1.1.1.6.2 yamt #define NFSR_RESERVEDPORT 0x10
477 1.1.1.1.6.2 yamt #define NFSR_LOCALHOST 0x20
478 1.1.1.1.6.2 yamt
479 1.1.1.1.6.2 yamt /*
480 1.1.1.1.6.2 yamt * Queue head for nfsreq's
481 1.1.1.1.6.2 yamt */
482 1.1.1.1.6.2 yamt TAILQ_HEAD(nfsreqhead, nfsreq);
483 1.1.1.1.6.2 yamt
484 1.1.1.1.6.2 yamt /* This is the only nfsreq R_xxx flag still used. */
485 1.1.1.1.6.2 yamt #define R_DONTRECOVER 0x00000100 /* don't initiate recovery when this
486 1.1.1.1.6.2 yamt rpc gets a stale state reply */
487 1.1.1.1.6.2 yamt
488 1.1.1.1.6.2 yamt /*
489 1.1.1.1.6.2 yamt * Network address hash list element
490 1.1.1.1.6.2 yamt */
491 1.1.1.1.6.2 yamt union nethostaddr {
492 1.1.1.1.6.2 yamt struct in_addr had_inet;
493 1.1.1.1.6.2 yamt struct in6_addr had_inet6;
494 1.1.1.1.6.2 yamt };
495 1.1.1.1.6.2 yamt
496 1.1.1.1.6.2 yamt /*
497 1.1.1.1.6.2 yamt * Structure of list of mechanisms.
498 1.1.1.1.6.2 yamt */
499 1.1.1.1.6.2 yamt struct nfsgss_mechlist {
500 1.1.1.1.6.2 yamt int len;
501 1.1.1.1.6.2 yamt const u_char *str;
502 1.1.1.1.6.2 yamt int totlen;
503 1.1.1.1.6.2 yamt };
504 1.1.1.1.6.2 yamt #define KERBV_MECH 0 /* position in list */
505 1.1.1.1.6.2 yamt
506 1.1.1.1.6.2 yamt /*
507 1.1.1.1.6.2 yamt * This structure is used by the server for describing each request.
508 1.1.1.1.6.2 yamt */
509 1.1.1.1.6.2 yamt struct nfsrv_descript {
510 1.1.1.1.6.2 yamt mbuf_t nd_mrep; /* Request mbuf list */
511 1.1.1.1.6.2 yamt mbuf_t nd_md; /* Current dissect mbuf */
512 1.1.1.1.6.2 yamt mbuf_t nd_mreq; /* Reply mbuf list */
513 1.1.1.1.6.2 yamt mbuf_t nd_mb; /* Current build mbuf */
514 1.1.1.1.6.2 yamt NFSSOCKADDR_T nd_nam; /* and socket addr */
515 1.1.1.1.6.2 yamt NFSSOCKADDR_T nd_nam2; /* return socket addr */
516 1.1.1.1.6.2 yamt caddr_t nd_dpos; /* Current dissect pos */
517 1.1.1.1.6.2 yamt caddr_t nd_bpos; /* Current build pos */
518 1.1.1.1.6.2 yamt u_int16_t nd_procnum; /* RPC # */
519 1.1.1.1.6.2 yamt u_int32_t nd_flag; /* nd_flag */
520 1.1.1.1.6.2 yamt u_int32_t nd_repstat; /* Reply status */
521 1.1.1.1.6.2 yamt int *nd_errp; /* Pointer to ret status */
522 1.1.1.1.6.2 yamt u_int32_t nd_retxid; /* Reply xid */
523 1.1.1.1.6.2 yamt struct nfsrvcache *nd_rp; /* Assoc. cache entry */
524 1.1.1.1.6.2 yamt fhandle_t nd_fh; /* File handle */
525 1.1.1.1.6.2 yamt struct ucred *nd_cred; /* Credentials */
526 1.1.1.1.6.2 yamt uid_t nd_saveduid; /* Saved uid */
527 1.1.1.1.6.2 yamt u_int64_t nd_sockref; /* Rcv socket ref# */
528 1.1.1.1.6.2 yamt u_int64_t nd_compref; /* Compound RPC ref# */
529 1.1.1.1.6.2 yamt time_t nd_tcpconntime; /* Time TCP connection est. */
530 1.1.1.1.6.2 yamt nfsquad_t nd_clientid; /* Implied clientid */
531 1.1.1.1.6.2 yamt int nd_gssnamelen; /* principal name length */
532 1.1.1.1.6.2 yamt char *nd_gssname; /* principal name */
533 1.1.1.1.6.2 yamt uint32_t *nd_slotseq; /* ptr to slot seq# in req */
534 1.1.1.1.6.2 yamt };
535 1.1.1.1.6.2 yamt
536 1.1.1.1.6.2 yamt #define nd_princlen nd_gssnamelen
537 1.1.1.1.6.2 yamt #define nd_principal nd_gssname
538 1.1.1.1.6.2 yamt
539 1.1.1.1.6.2 yamt /* Bits for "nd_flag" */
540 1.1.1.1.6.2 yamt #define ND_DONTSAVEREPLY 0x00000001
541 1.1.1.1.6.2 yamt #define ND_SAVEREPLY 0x00000002
542 1.1.1.1.6.2 yamt #define ND_NFSV2 0x00000004
543 1.1.1.1.6.2 yamt #define ND_NFSV3 0x00000008
544 1.1.1.1.6.2 yamt #define ND_NFSV4 0x00000010
545 1.1.1.1.6.2 yamt #define ND_KERBV 0x00000020
546 1.1.1.1.6.2 yamt #define ND_GSSINTEGRITY 0x00000040
547 1.1.1.1.6.2 yamt #define ND_GSSPRIVACY 0x00000080
548 1.1.1.1.6.2 yamt #define ND_WINDOWVERF 0x00000100
549 1.1.1.1.6.2 yamt #define ND_GSSINITREPLY 0x00000200
550 1.1.1.1.6.2 yamt #define ND_STREAMSOCK 0x00000400
551 1.1.1.1.6.2 yamt #define ND_PUBLOOKUP 0x00000800
552 1.1.1.1.6.2 yamt #define ND_USEGSSNAME 0x00001000
553 1.1.1.1.6.2 yamt #define ND_SAMETCPCONN 0x00002000
554 1.1.1.1.6.2 yamt #define ND_IMPLIEDCLID 0x00004000
555 1.1.1.1.6.2 yamt #define ND_NOMOREDATA 0x00008000
556 1.1.1.1.6.2 yamt #define ND_V4WCCATTR 0x00010000
557 1.1.1.1.6.2 yamt #define ND_NFSCB 0x00020000
558 1.1.1.1.6.2 yamt #define ND_AUTHNONE 0x00040000
559 1.1.1.1.6.2 yamt #define ND_EXAUTHSYS 0x00080000
560 1.1.1.1.6.2 yamt #define ND_EXGSS 0x00100000
561 1.1.1.1.6.2 yamt #define ND_EXGSSINTEGRITY 0x00200000
562 1.1.1.1.6.2 yamt #define ND_EXGSSPRIVACY 0x00400000
563 1.1.1.1.6.2 yamt #define ND_INCRSEQID 0x00800000
564 1.1.1.1.6.2 yamt #define ND_NFSCL 0x01000000
565 1.1.1.1.6.2 yamt #define ND_NFSV41 0x02000000
566 1.1.1.1.6.2 yamt #define ND_HASSEQUENCE 0x04000000
567 1.1.1.1.6.2 yamt
568 1.1.1.1.6.2 yamt /*
569 1.1.1.1.6.2 yamt * ND_GSS should be the "or" of all GSS type authentications.
570 1.1.1.1.6.2 yamt */
571 1.1.1.1.6.2 yamt #define ND_GSS (ND_KERBV)
572 1.1.1.1.6.2 yamt
573 1.1.1.1.6.2 yamt struct nfsv4_opflag {
574 1.1.1.1.6.2 yamt int retfh;
575 1.1.1.1.6.2 yamt int needscfh;
576 1.1.1.1.6.2 yamt int savereply;
577 1.1.1.1.6.2 yamt int modifyfs;
578 1.1.1.1.6.2 yamt int lktype;
579 1.1.1.1.6.2 yamt int needsseq;
580 1.1.1.1.6.2 yamt };
581 1.1.1.1.6.2 yamt
582 1.1.1.1.6.2 yamt /*
583 1.1.1.1.6.2 yamt * Flags used to indicate what to do w.r.t. seqid checking.
584 1.1.1.1.6.2 yamt */
585 1.1.1.1.6.2 yamt #define NFSRVSEQID_FIRST 0x01
586 1.1.1.1.6.2 yamt #define NFSRVSEQID_LAST 0x02
587 1.1.1.1.6.2 yamt #define NFSRVSEQID_OPEN 0x04
588 1.1.1.1.6.2 yamt
589 1.1.1.1.6.2 yamt /*
590 1.1.1.1.6.2 yamt * assign a doubly linked list to a new head
591 1.1.1.1.6.2 yamt * and prepend one list into another.
592 1.1.1.1.6.2 yamt */
593 1.1.1.1.6.2 yamt #define LIST_NEWHEAD(nhead, ohead, field) do { \
594 1.1.1.1.6.2 yamt if (((nhead)->lh_first = (ohead)->lh_first) != NULL) \
595 1.1.1.1.6.2 yamt (ohead)->lh_first->field.le_prev = &(nhead)->lh_first; \
596 1.1.1.1.6.2 yamt (ohead)->lh_first = NULL; \
597 1.1.1.1.6.2 yamt } while (0)
598 1.1.1.1.6.2 yamt
599 1.1.1.1.6.2 yamt #define LIST_PREPEND(head, phead, lelm, field) do { \
600 1.1.1.1.6.2 yamt if ((head)->lh_first != NULL) { \
601 1.1.1.1.6.2 yamt (lelm)->field.le_next = (head)->lh_first; \
602 1.1.1.1.6.2 yamt (lelm)->field.le_next->field.le_prev = \
603 1.1.1.1.6.2 yamt &(lelm)->field.le_next; \
604 1.1.1.1.6.2 yamt } \
605 1.1.1.1.6.2 yamt (head)->lh_first = (phead)->lh_first; \
606 1.1.1.1.6.2 yamt (head)->lh_first->field.le_prev = &(head)->lh_first; \
607 1.1.1.1.6.2 yamt } while (0)
608 1.1.1.1.6.2 yamt
609 1.1.1.1.6.2 yamt /*
610 1.1.1.1.6.2 yamt * File handle structure for client. Malloc'd to the correct length with
611 1.1.1.1.6.2 yamt * malloc type M_NFSFH.
612 1.1.1.1.6.2 yamt */
613 1.1.1.1.6.2 yamt struct nfsfh {
614 1.1.1.1.6.2 yamt u_int16_t nfh_len; /* Length of file handle */
615 1.1.1.1.6.2 yamt u_int8_t nfh_fh[1]; /* and the file handle */
616 1.1.1.1.6.2 yamt };
617 1.1.1.1.6.2 yamt
618 1.1.1.1.6.2 yamt /*
619 1.1.1.1.6.2 yamt * File handle structure for server. The NFSRV_MAXFH constant is
620 1.1.1.1.6.2 yamt * set in nfsdport.h. I use a 32bit length, so that alignment is
621 1.1.1.1.6.2 yamt * preserved.
622 1.1.1.1.6.2 yamt */
623 1.1.1.1.6.2 yamt struct nfsrvfh {
624 1.1.1.1.6.2 yamt u_int32_t nfsrvfh_len;
625 1.1.1.1.6.2 yamt u_int8_t nfsrvfh_data[NFSRV_MAXFH];
626 1.1.1.1.6.2 yamt };
627 1.1.1.1.6.2 yamt
628 1.1.1.1.6.2 yamt /*
629 1.1.1.1.6.2 yamt * This structure is used for sleep locks on the NFSv4 nfsd threads and
630 1.1.1.1.6.2 yamt * NFSv4 client data structures.
631 1.1.1.1.6.2 yamt */
632 1.1.1.1.6.2 yamt struct nfsv4lock {
633 1.1.1.1.6.2 yamt u_int32_t nfslock_usecnt;
634 1.1.1.1.6.2 yamt u_int8_t nfslock_lock;
635 1.1.1.1.6.2 yamt };
636 1.1.1.1.6.2 yamt #define NFSV4LOCK_LOCK 0x01
637 1.1.1.1.6.2 yamt #define NFSV4LOCK_LOCKWANTED 0x02
638 1.1.1.1.6.2 yamt #define NFSV4LOCK_WANTED 0x04
639 1.1.1.1.6.2 yamt
640 1.1.1.1.6.2 yamt /*
641 1.1.1.1.6.2 yamt * Values for the override argument for nfsvno_accchk().
642 1.1.1.1.6.2 yamt */
643 1.1.1.1.6.2 yamt #define NFSACCCHK_NOOVERRIDE 0
644 1.1.1.1.6.2 yamt #define NFSACCCHK_ALLOWROOT 1
645 1.1.1.1.6.2 yamt #define NFSACCCHK_ALLOWOWNER 2
646 1.1.1.1.6.2 yamt
647 1.1.1.1.6.2 yamt /*
648 1.1.1.1.6.2 yamt * and values for the vpislocked argument for nfsvno_accchk().
649 1.1.1.1.6.2 yamt */
650 1.1.1.1.6.2 yamt #define NFSACCCHK_VPNOTLOCKED 0
651 1.1.1.1.6.2 yamt #define NFSACCCHK_VPISLOCKED 1
652 1.1.1.1.6.2 yamt
653 1.1.1.1.6.2 yamt /*
654 1.1.1.1.6.2 yamt * Slot for the NFSv4.1 Sequence Op.
655 1.1.1.1.6.2 yamt */
656 1.1.1.1.6.2 yamt struct nfsslot {
657 1.1.1.1.6.2 yamt int nfssl_inprog;
658 1.1.1.1.6.2 yamt uint32_t nfssl_seq;
659 1.1.1.1.6.2 yamt struct mbuf *nfssl_reply;
660 1.1.1.1.6.2 yamt };
661 1.1.1.1.6.2 yamt
662 1.1.1.1.6.2 yamt #endif /* _KERNEL */
663 1.1.1.1.6.2 yamt
664 1.1.1.1.6.2 yamt #endif /* _NFS_NFS_H */
665