nfsclstate.h revision 1.1.1.1.10.3 1 1.1.1.1.10.2 tls /* $NetBSD: nfsclstate.h,v 1.1.1.1.10.3 2017/12/03 11:38:42 jdolecek Exp $ */
2 1.1.1.1.10.2 tls /*-
3 1.1.1.1.10.2 tls * Copyright (c) 2009 Rick Macklem, University of Guelph
4 1.1.1.1.10.2 tls * All rights reserved.
5 1.1.1.1.10.2 tls *
6 1.1.1.1.10.2 tls * Redistribution and use in source and binary forms, with or without
7 1.1.1.1.10.2 tls * modification, are permitted provided that the following conditions
8 1.1.1.1.10.2 tls * are met:
9 1.1.1.1.10.2 tls * 1. Redistributions of source code must retain the above copyright
10 1.1.1.1.10.2 tls * notice, this list of conditions and the following disclaimer.
11 1.1.1.1.10.2 tls * 2. Redistributions in binary form must reproduce the above copyright
12 1.1.1.1.10.2 tls * notice, this list of conditions and the following disclaimer in the
13 1.1.1.1.10.2 tls * documentation and/or other materials provided with the distribution.
14 1.1.1.1.10.2 tls *
15 1.1.1.1.10.2 tls * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 1.1.1.1.10.2 tls * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 1.1.1.1.10.2 tls * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 1.1.1.1.10.2 tls * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 1.1.1.1.10.2 tls * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 1.1.1.1.10.2 tls * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 1.1.1.1.10.2 tls * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 1.1.1.1.10.2 tls * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 1.1.1.1.10.2 tls * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 1.1.1.1.10.2 tls * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 1.1.1.1.10.2 tls * SUCH DAMAGE.
26 1.1.1.1.10.2 tls *
27 1.1.1.1.10.3 jdolecek * FreeBSD: head/sys/fs/nfs/nfsclstate.h 268115 2014-07-01 20:47:16Z rmacklem
28 1.1.1.1.10.2 tls * $NetBSD: nfsclstate.h,v 1.1.1.1.10.3 2017/12/03 11:38:42 jdolecek Exp $
29 1.1.1.1.10.2 tls */
30 1.1.1.1.10.2 tls
31 1.1.1.1.10.2 tls #ifndef _NFS_NFSCLSTATE_H_
32 1.1.1.1.10.2 tls #define _NFS_NFSCLSTATE_H_
33 1.1.1.1.10.2 tls
34 1.1.1.1.10.2 tls /*
35 1.1.1.1.10.2 tls * Definitions for NFS V4 client state handling.
36 1.1.1.1.10.2 tls */
37 1.1.1.1.10.2 tls LIST_HEAD(nfsclopenhead, nfsclopen);
38 1.1.1.1.10.2 tls LIST_HEAD(nfscllockownerhead, nfscllockowner);
39 1.1.1.1.10.2 tls SLIST_HEAD(nfscllockownerfhhead, nfscllockownerfh);
40 1.1.1.1.10.2 tls LIST_HEAD(nfscllockhead, nfscllock);
41 1.1.1.1.10.2 tls LIST_HEAD(nfsclhead, nfsclclient);
42 1.1.1.1.10.2 tls LIST_HEAD(nfsclownerhead, nfsclowner);
43 1.1.1.1.10.2 tls TAILQ_HEAD(nfscldeleghead, nfscldeleg);
44 1.1.1.1.10.2 tls LIST_HEAD(nfscldeleghash, nfscldeleg);
45 1.1.1.1.10.2 tls TAILQ_HEAD(nfscllayouthead, nfscllayout);
46 1.1.1.1.10.2 tls LIST_HEAD(nfscllayouthash, nfscllayout);
47 1.1.1.1.10.2 tls LIST_HEAD(nfsclflayouthead, nfsclflayout);
48 1.1.1.1.10.2 tls LIST_HEAD(nfscldevinfohead, nfscldevinfo);
49 1.1.1.1.10.2 tls LIST_HEAD(nfsclrecalllayouthead, nfsclrecalllayout);
50 1.1.1.1.10.2 tls #define NFSCLDELEGHASHSIZE 256
51 1.1.1.1.10.2 tls #define NFSCLDELEGHASH(c, f, l) \
52 1.1.1.1.10.2 tls (&((c)->nfsc_deleghash[ncl_hash((f), (l)) % NFSCLDELEGHASHSIZE]))
53 1.1.1.1.10.2 tls #define NFSCLLAYOUTHASHSIZE 256
54 1.1.1.1.10.2 tls #define NFSCLLAYOUTHASH(c, f, l) \
55 1.1.1.1.10.2 tls (&((c)->nfsc_layouthash[ncl_hash((f), (l)) % NFSCLLAYOUTHASHSIZE]))
56 1.1.1.1.10.2 tls
57 1.1.1.1.10.2 tls /* Structure for NFSv4.1 session stuff. */
58 1.1.1.1.10.2 tls struct nfsclsession {
59 1.1.1.1.10.3 jdolecek kmutex_t nfsess_mtx;
60 1.1.1.1.10.2 tls struct nfsslot nfsess_cbslots[NFSV4_CBSLOTS];
61 1.1.1.1.10.2 tls nfsquad_t nfsess_clientid;
62 1.1.1.1.10.3 jdolecek SVCXPRT *nfsess_xprt; /* For backchannel callback */
63 1.1.1.1.10.2 tls uint32_t nfsess_slotseq[64]; /* Max for 64bit nm_slots */
64 1.1.1.1.10.2 tls uint64_t nfsess_slots;
65 1.1.1.1.10.2 tls uint32_t nfsess_sequenceid;
66 1.1.1.1.10.2 tls uint32_t nfsess_maxcache; /* Max size for cached reply. */
67 1.1.1.1.10.2 tls uint16_t nfsess_foreslots;
68 1.1.1.1.10.2 tls uint16_t nfsess_backslots;
69 1.1.1.1.10.2 tls uint8_t nfsess_sessionid[NFSX_V4SESSIONID];
70 1.1.1.1.10.2 tls };
71 1.1.1.1.10.2 tls
72 1.1.1.1.10.2 tls /*
73 1.1.1.1.10.2 tls * This structure holds the session, clientid and related information
74 1.1.1.1.10.2 tls * needed for an NFSv4.1 Meta Data Server (MDS) or Data Server (DS).
75 1.1.1.1.10.2 tls * It is malloc'd to the correct length.
76 1.1.1.1.10.2 tls */
77 1.1.1.1.10.2 tls struct nfsclds {
78 1.1.1.1.10.2 tls TAILQ_ENTRY(nfsclds) nfsclds_list;
79 1.1.1.1.10.2 tls struct nfsclsession nfsclds_sess;
80 1.1.1.1.10.3 jdolecek kmutex_t nfsclds_mtx;
81 1.1.1.1.10.2 tls struct nfssockreq *nfsclds_sockp;
82 1.1.1.1.10.2 tls time_t nfsclds_expire;
83 1.1.1.1.10.2 tls uint16_t nfsclds_flags;
84 1.1.1.1.10.2 tls uint16_t nfsclds_servownlen;
85 1.1.1.1.10.2 tls uint8_t nfsclds_verf[NFSX_VERF];
86 1.1.1.1.10.2 tls uint8_t nfsclds_serverown[0];
87 1.1.1.1.10.2 tls };
88 1.1.1.1.10.2 tls
89 1.1.1.1.10.2 tls /*
90 1.1.1.1.10.2 tls * Flags for nfsclds_flags.
91 1.1.1.1.10.2 tls */
92 1.1.1.1.10.2 tls #define NFSCLDS_HASWRITEVERF 0x0001
93 1.1.1.1.10.2 tls #define NFSCLDS_MDS 0x0002
94 1.1.1.1.10.2 tls #define NFSCLDS_DS 0x0004
95 1.1.1.1.10.2 tls
96 1.1.1.1.10.2 tls struct nfsclclient {
97 1.1.1.1.10.2 tls LIST_ENTRY(nfsclclient) nfsc_list;
98 1.1.1.1.10.2 tls struct nfsclownerhead nfsc_owner;
99 1.1.1.1.10.2 tls struct nfscldeleghead nfsc_deleg;
100 1.1.1.1.10.2 tls struct nfscldeleghash nfsc_deleghash[NFSCLDELEGHASHSIZE];
101 1.1.1.1.10.2 tls struct nfscllayouthead nfsc_layout;
102 1.1.1.1.10.2 tls struct nfscllayouthash nfsc_layouthash[NFSCLLAYOUTHASHSIZE];
103 1.1.1.1.10.2 tls struct nfscldevinfohead nfsc_devinfo;
104 1.1.1.1.10.2 tls struct nfsv4lock nfsc_lock;
105 1.1.1.1.10.2 tls struct proc *nfsc_renewthread;
106 1.1.1.1.10.2 tls struct nfsmount *nfsc_nmp;
107 1.1.1.1.10.2 tls time_t nfsc_expire;
108 1.1.1.1.10.2 tls u_int32_t nfsc_clientidrev;
109 1.1.1.1.10.2 tls u_int32_t nfsc_rev;
110 1.1.1.1.10.2 tls u_int32_t nfsc_renew;
111 1.1.1.1.10.2 tls u_int32_t nfsc_cbident;
112 1.1.1.1.10.2 tls u_int16_t nfsc_flags;
113 1.1.1.1.10.2 tls u_int16_t nfsc_idlen;
114 1.1.1.1.10.2 tls u_int8_t nfsc_id[1]; /* Malloc'd to correct length */
115 1.1.1.1.10.2 tls };
116 1.1.1.1.10.2 tls
117 1.1.1.1.10.2 tls /*
118 1.1.1.1.10.2 tls * Bits for nfsc_flags.
119 1.1.1.1.10.2 tls */
120 1.1.1.1.10.2 tls #define NFSCLFLAGS_INITED 0x0001
121 1.1.1.1.10.2 tls #define NFSCLFLAGS_HASCLIENTID 0x0002
122 1.1.1.1.10.2 tls #define NFSCLFLAGS_RECOVER 0x0004
123 1.1.1.1.10.2 tls #define NFSCLFLAGS_UMOUNT 0x0008
124 1.1.1.1.10.2 tls #define NFSCLFLAGS_HASTHREAD 0x0010
125 1.1.1.1.10.2 tls #define NFSCLFLAGS_AFINET6 0x0020
126 1.1.1.1.10.2 tls #define NFSCLFLAGS_EXPIREIT 0x0040
127 1.1.1.1.10.2 tls #define NFSCLFLAGS_FIRSTDELEG 0x0080
128 1.1.1.1.10.2 tls #define NFSCLFLAGS_GOTDELEG 0x0100
129 1.1.1.1.10.2 tls #define NFSCLFLAGS_RECVRINPROG 0x0200
130 1.1.1.1.10.2 tls
131 1.1.1.1.10.2 tls struct nfsclowner {
132 1.1.1.1.10.2 tls LIST_ENTRY(nfsclowner) nfsow_list;
133 1.1.1.1.10.2 tls struct nfsclopenhead nfsow_open;
134 1.1.1.1.10.2 tls struct nfsclclient *nfsow_clp;
135 1.1.1.1.10.2 tls u_int32_t nfsow_seqid;
136 1.1.1.1.10.2 tls u_int32_t nfsow_defunct;
137 1.1.1.1.10.2 tls struct nfsv4lock nfsow_rwlock;
138 1.1.1.1.10.2 tls u_int8_t nfsow_owner[NFSV4CL_LOCKNAMELEN];
139 1.1.1.1.10.2 tls };
140 1.1.1.1.10.2 tls
141 1.1.1.1.10.2 tls /*
142 1.1.1.1.10.2 tls * MALLOC'd to the correct length to accommodate the file handle.
143 1.1.1.1.10.2 tls */
144 1.1.1.1.10.2 tls struct nfscldeleg {
145 1.1.1.1.10.2 tls TAILQ_ENTRY(nfscldeleg) nfsdl_list;
146 1.1.1.1.10.2 tls LIST_ENTRY(nfscldeleg) nfsdl_hash;
147 1.1.1.1.10.2 tls struct nfsclownerhead nfsdl_owner; /* locally issued state */
148 1.1.1.1.10.2 tls struct nfscllockownerhead nfsdl_lock;
149 1.1.1.1.10.2 tls nfsv4stateid_t nfsdl_stateid;
150 1.1.1.1.10.2 tls struct acl_entry nfsdl_ace; /* Delegation ace */
151 1.1.1.1.10.2 tls struct nfsclclient *nfsdl_clp;
152 1.1.1.1.10.2 tls struct nfsv4lock nfsdl_rwlock; /* for active I/O ops */
153 1.1.1.1.10.2 tls struct nfscred nfsdl_cred; /* Cred. used for Open */
154 1.1.1.1.10.2 tls time_t nfsdl_timestamp; /* used for stale cleanup */
155 1.1.1.1.10.2 tls u_int64_t nfsdl_sizelimit; /* Limit for file growth */
156 1.1.1.1.10.2 tls u_int64_t nfsdl_size; /* saved copy of file size */
157 1.1.1.1.10.2 tls u_int64_t nfsdl_change; /* and change attribute */
158 1.1.1.1.10.2 tls struct timespec nfsdl_modtime; /* local modify time */
159 1.1.1.1.10.2 tls u_int16_t nfsdl_fhlen;
160 1.1.1.1.10.2 tls u_int8_t nfsdl_flags;
161 1.1.1.1.10.2 tls u_int8_t nfsdl_fh[1]; /* must be last */
162 1.1.1.1.10.2 tls };
163 1.1.1.1.10.2 tls
164 1.1.1.1.10.2 tls /*
165 1.1.1.1.10.2 tls * nfsdl_flags bits.
166 1.1.1.1.10.2 tls */
167 1.1.1.1.10.2 tls #define NFSCLDL_READ 0x01
168 1.1.1.1.10.2 tls #define NFSCLDL_WRITE 0x02
169 1.1.1.1.10.2 tls #define NFSCLDL_RECALL 0x04
170 1.1.1.1.10.2 tls #define NFSCLDL_NEEDRECLAIM 0x08
171 1.1.1.1.10.2 tls #define NFSCLDL_ZAPPED 0x10
172 1.1.1.1.10.2 tls #define NFSCLDL_MODTIMESET 0x20
173 1.1.1.1.10.2 tls #define NFSCLDL_DELEGRET 0x40
174 1.1.1.1.10.2 tls
175 1.1.1.1.10.2 tls /*
176 1.1.1.1.10.2 tls * MALLOC'd to the correct length to accommodate the file handle.
177 1.1.1.1.10.2 tls */
178 1.1.1.1.10.2 tls struct nfsclopen {
179 1.1.1.1.10.2 tls LIST_ENTRY(nfsclopen) nfso_list;
180 1.1.1.1.10.2 tls struct nfscllockownerhead nfso_lock;
181 1.1.1.1.10.2 tls nfsv4stateid_t nfso_stateid;
182 1.1.1.1.10.2 tls struct nfsclowner *nfso_own;
183 1.1.1.1.10.2 tls struct nfscred nfso_cred; /* Cred. used for Open */
184 1.1.1.1.10.2 tls u_int32_t nfso_mode;
185 1.1.1.1.10.2 tls u_int32_t nfso_opencnt;
186 1.1.1.1.10.2 tls u_int16_t nfso_fhlen;
187 1.1.1.1.10.2 tls u_int8_t nfso_posixlock; /* 1 for POSIX type locking */
188 1.1.1.1.10.2 tls u_int8_t nfso_fh[1]; /* must be last */
189 1.1.1.1.10.2 tls };
190 1.1.1.1.10.2 tls
191 1.1.1.1.10.2 tls /*
192 1.1.1.1.10.2 tls * Return values for nfscl_open(). NFSCLOPEN_OK must == 0.
193 1.1.1.1.10.2 tls */
194 1.1.1.1.10.2 tls #define NFSCLOPEN_OK 0
195 1.1.1.1.10.2 tls #define NFSCLOPEN_DOOPEN 1
196 1.1.1.1.10.2 tls #define NFSCLOPEN_DOOPENDOWNGRADE 2
197 1.1.1.1.10.2 tls #define NFSCLOPEN_SETCRED 3
198 1.1.1.1.10.2 tls
199 1.1.1.1.10.2 tls struct nfscllockowner {
200 1.1.1.1.10.2 tls LIST_ENTRY(nfscllockowner) nfsl_list;
201 1.1.1.1.10.2 tls struct nfscllockhead nfsl_lock;
202 1.1.1.1.10.2 tls struct nfsclopen *nfsl_open;
203 1.1.1.1.10.2 tls NFSPROC_T *nfsl_inprog;
204 1.1.1.1.10.2 tls nfsv4stateid_t nfsl_stateid;
205 1.1.1.1.10.2 tls int nfsl_lockflags;
206 1.1.1.1.10.2 tls u_int32_t nfsl_seqid;
207 1.1.1.1.10.2 tls struct nfsv4lock nfsl_rwlock;
208 1.1.1.1.10.2 tls u_int8_t nfsl_owner[NFSV4CL_LOCKNAMELEN];
209 1.1.1.1.10.2 tls u_int8_t nfsl_openowner[NFSV4CL_LOCKNAMELEN];
210 1.1.1.1.10.2 tls };
211 1.1.1.1.10.2 tls
212 1.1.1.1.10.2 tls /*
213 1.1.1.1.10.2 tls * Byte range entry for the above lock owner.
214 1.1.1.1.10.2 tls */
215 1.1.1.1.10.2 tls struct nfscllock {
216 1.1.1.1.10.2 tls LIST_ENTRY(nfscllock) nfslo_list;
217 1.1.1.1.10.2 tls u_int64_t nfslo_first;
218 1.1.1.1.10.2 tls u_int64_t nfslo_end;
219 1.1.1.1.10.2 tls short nfslo_type;
220 1.1.1.1.10.2 tls };
221 1.1.1.1.10.2 tls
222 1.1.1.1.10.2 tls /* This structure is used to collect a list of lockowners to free up. */
223 1.1.1.1.10.2 tls struct nfscllockownerfh {
224 1.1.1.1.10.2 tls SLIST_ENTRY(nfscllockownerfh) nfslfh_list;
225 1.1.1.1.10.2 tls struct nfscllockownerhead nfslfh_lock;
226 1.1.1.1.10.2 tls int nfslfh_len;
227 1.1.1.1.10.2 tls uint8_t nfslfh_fh[NFSX_V4FHMAX];
228 1.1.1.1.10.2 tls };
229 1.1.1.1.10.2 tls
230 1.1.1.1.10.2 tls /*
231 1.1.1.1.10.2 tls * MALLOC'd to the correct length to accommodate the file handle.
232 1.1.1.1.10.2 tls */
233 1.1.1.1.10.2 tls struct nfscllayout {
234 1.1.1.1.10.2 tls TAILQ_ENTRY(nfscllayout) nfsly_list;
235 1.1.1.1.10.2 tls LIST_ENTRY(nfscllayout) nfsly_hash;
236 1.1.1.1.10.2 tls nfsv4stateid_t nfsly_stateid;
237 1.1.1.1.10.2 tls struct nfsv4lock nfsly_lock;
238 1.1.1.1.10.2 tls uint64_t nfsly_filesid[2];
239 1.1.1.1.10.2 tls uint64_t nfsly_lastbyte;
240 1.1.1.1.10.2 tls struct nfsclflayouthead nfsly_flayread;
241 1.1.1.1.10.2 tls struct nfsclflayouthead nfsly_flayrw;
242 1.1.1.1.10.2 tls struct nfsclrecalllayouthead nfsly_recall;
243 1.1.1.1.10.2 tls time_t nfsly_timestamp;
244 1.1.1.1.10.2 tls struct nfsclclient *nfsly_clp;
245 1.1.1.1.10.2 tls uint16_t nfsly_flags;
246 1.1.1.1.10.2 tls uint16_t nfsly_fhlen;
247 1.1.1.1.10.2 tls uint8_t nfsly_fh[1];
248 1.1.1.1.10.2 tls };
249 1.1.1.1.10.2 tls
250 1.1.1.1.10.2 tls /*
251 1.1.1.1.10.2 tls * Flags for nfsly_flags.
252 1.1.1.1.10.2 tls */
253 1.1.1.1.10.2 tls #define NFSLY_FILES 0x0001
254 1.1.1.1.10.2 tls #define NFSLY_BLOCK 0x0002
255 1.1.1.1.10.2 tls #define NFSLY_OBJECT 0x0004
256 1.1.1.1.10.2 tls #define NFSLY_RECALL 0x0008
257 1.1.1.1.10.2 tls #define NFSLY_RECALLFILE 0x0010
258 1.1.1.1.10.2 tls #define NFSLY_RECALLFSID 0x0020
259 1.1.1.1.10.2 tls #define NFSLY_RECALLALL 0x0040
260 1.1.1.1.10.2 tls #define NFSLY_RETONCLOSE 0x0080
261 1.1.1.1.10.2 tls #define NFSLY_WRITTEN 0x0100 /* Has been used to write to a DS. */
262 1.1.1.1.10.2 tls
263 1.1.1.1.10.2 tls /*
264 1.1.1.1.10.2 tls * MALLOC'd to the correct length to accommodate the file handle list.
265 1.1.1.1.10.2 tls * These hang off of nfsly_flayread and nfsly_flayrw, sorted in increasing
266 1.1.1.1.10.2 tls * offset order.
267 1.1.1.1.10.2 tls * The nfsly_flayread list holds the ones with iomode == NFSLAYOUTIOMODE_READ,
268 1.1.1.1.10.2 tls * whereas the nfsly_flayrw holds the ones with iomode == NFSLAYOUTIOMODE_RW.
269 1.1.1.1.10.2 tls */
270 1.1.1.1.10.2 tls struct nfsclflayout {
271 1.1.1.1.10.2 tls LIST_ENTRY(nfsclflayout) nfsfl_list;
272 1.1.1.1.10.2 tls uint8_t nfsfl_dev[NFSX_V4DEVICEID];
273 1.1.1.1.10.2 tls uint64_t nfsfl_off;
274 1.1.1.1.10.2 tls uint64_t nfsfl_end;
275 1.1.1.1.10.2 tls uint64_t nfsfl_patoff;
276 1.1.1.1.10.2 tls struct nfscldevinfo *nfsfl_devp;
277 1.1.1.1.10.2 tls uint32_t nfsfl_iomode;
278 1.1.1.1.10.2 tls uint32_t nfsfl_util;
279 1.1.1.1.10.2 tls uint32_t nfsfl_stripe1;
280 1.1.1.1.10.2 tls uint16_t nfsfl_flags;
281 1.1.1.1.10.2 tls uint16_t nfsfl_fhcnt;
282 1.1.1.1.10.2 tls struct nfsfh *nfsfl_fh[1]; /* FH list for DS */
283 1.1.1.1.10.2 tls };
284 1.1.1.1.10.2 tls
285 1.1.1.1.10.2 tls /*
286 1.1.1.1.10.2 tls * Flags for nfsfl_flags.
287 1.1.1.1.10.2 tls */
288 1.1.1.1.10.2 tls #define NFSFL_RECALL 0x0001 /* File layout has been recalled */
289 1.1.1.1.10.2 tls
290 1.1.1.1.10.2 tls /*
291 1.1.1.1.10.2 tls * Structure that is used to store a LAYOUTRECALL.
292 1.1.1.1.10.2 tls */
293 1.1.1.1.10.2 tls struct nfsclrecalllayout {
294 1.1.1.1.10.2 tls LIST_ENTRY(nfsclrecalllayout) nfsrecly_list;
295 1.1.1.1.10.2 tls uint64_t nfsrecly_off;
296 1.1.1.1.10.2 tls uint64_t nfsrecly_len;
297 1.1.1.1.10.2 tls int nfsrecly_recalltype;
298 1.1.1.1.10.2 tls uint32_t nfsrecly_iomode;
299 1.1.1.1.10.2 tls uint32_t nfsrecly_stateseqid;
300 1.1.1.1.10.2 tls };
301 1.1.1.1.10.2 tls
302 1.1.1.1.10.2 tls /*
303 1.1.1.1.10.2 tls * Stores the NFSv4.1 Device Info. Malloc'd to the correct length to
304 1.1.1.1.10.2 tls * store the list of network connections and list of indices.
305 1.1.1.1.10.2 tls * nfsdi_data[] is allocated the following way:
306 1.1.1.1.10.2 tls * - nfsdi_addrcnt * struct nfsclds
307 1.1.1.1.10.2 tls * - stripe indices, each stored as one byte, since there can be many
308 1.1.1.1.10.2 tls * of them. (This implies a limit of 256 on nfsdi_addrcnt, since the
309 1.1.1.1.10.2 tls * indices select which address.)
310 1.1.1.1.10.2 tls */
311 1.1.1.1.10.2 tls struct nfscldevinfo {
312 1.1.1.1.10.2 tls LIST_ENTRY(nfscldevinfo) nfsdi_list;
313 1.1.1.1.10.2 tls uint8_t nfsdi_deviceid[NFSX_V4DEVICEID];
314 1.1.1.1.10.2 tls struct nfsclclient *nfsdi_clp;
315 1.1.1.1.10.2 tls uint32_t nfsdi_refcnt;
316 1.1.1.1.10.2 tls uint32_t nfsdi_layoutrefs;
317 1.1.1.1.10.2 tls uint16_t nfsdi_stripecnt;
318 1.1.1.1.10.2 tls uint16_t nfsdi_addrcnt;
319 1.1.1.1.10.2 tls struct nfsclds *nfsdi_data[0];
320 1.1.1.1.10.2 tls };
321 1.1.1.1.10.2 tls
322 1.1.1.1.10.2 tls /* These inline functions return values from nfsdi_data[]. */
323 1.1.1.1.10.2 tls /*
324 1.1.1.1.10.2 tls * Return a pointer to the address at "pos".
325 1.1.1.1.10.2 tls */
326 1.1.1.1.10.2 tls static __inline struct nfsclds **
327 1.1.1.1.10.2 tls nfsfldi_addr(struct nfscldevinfo *ndi, int pos)
328 1.1.1.1.10.2 tls {
329 1.1.1.1.10.2 tls
330 1.1.1.1.10.2 tls if (pos >= ndi->nfsdi_addrcnt)
331 1.1.1.1.10.2 tls return (NULL);
332 1.1.1.1.10.2 tls return (&ndi->nfsdi_data[pos]);
333 1.1.1.1.10.2 tls }
334 1.1.1.1.10.2 tls
335 1.1.1.1.10.2 tls /*
336 1.1.1.1.10.2 tls * Return the Nth ("pos") stripe index.
337 1.1.1.1.10.2 tls */
338 1.1.1.1.10.2 tls static __inline int
339 1.1.1.1.10.2 tls nfsfldi_stripeindex(struct nfscldevinfo *ndi, int pos)
340 1.1.1.1.10.2 tls {
341 1.1.1.1.10.2 tls uint8_t *valp;
342 1.1.1.1.10.2 tls
343 1.1.1.1.10.2 tls if (pos >= ndi->nfsdi_stripecnt)
344 1.1.1.1.10.2 tls return (-1);
345 1.1.1.1.10.2 tls valp = (uint8_t *)&ndi->nfsdi_data[ndi->nfsdi_addrcnt];
346 1.1.1.1.10.2 tls valp += pos;
347 1.1.1.1.10.2 tls return ((int)*valp);
348 1.1.1.1.10.2 tls }
349 1.1.1.1.10.2 tls
350 1.1.1.1.10.2 tls /*
351 1.1.1.1.10.2 tls * Set the Nth ("pos") stripe index to "val".
352 1.1.1.1.10.2 tls */
353 1.1.1.1.10.2 tls static __inline void
354 1.1.1.1.10.2 tls nfsfldi_setstripeindex(struct nfscldevinfo *ndi, int pos, uint8_t val)
355 1.1.1.1.10.2 tls {
356 1.1.1.1.10.2 tls uint8_t *valp;
357 1.1.1.1.10.2 tls
358 1.1.1.1.10.2 tls if (pos >= ndi->nfsdi_stripecnt)
359 1.1.1.1.10.2 tls return;
360 1.1.1.1.10.2 tls valp = (uint8_t *)&ndi->nfsdi_data[ndi->nfsdi_addrcnt];
361 1.1.1.1.10.2 tls valp += pos;
362 1.1.1.1.10.2 tls *valp = val;
363 1.1.1.1.10.2 tls }
364 1.1.1.1.10.2 tls
365 1.1.1.1.10.2 tls /*
366 1.1.1.1.10.2 tls * Macro for incrementing the seqid#.
367 1.1.1.1.10.2 tls */
368 1.1.1.1.10.2 tls #define NFSCL_INCRSEQID(s, n) do { \
369 1.1.1.1.10.2 tls if (((n)->nd_flag & ND_INCRSEQID)) \
370 1.1.1.1.10.2 tls (s)++; \
371 1.1.1.1.10.2 tls } while (0)
372 1.1.1.1.10.2 tls
373 1.1.1.1.10.2 tls #endif /* _NFS_NFSCLSTATE_H_ */
374