]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
483a1d10 | 2 | * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved. |
1c79356b A |
3 | * |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
e5568f75 A |
6 | * The contents of this file constitute Original Code as defined in and |
7 | * are subject to the Apple Public Source License Version 1.1 (the | |
8 | * "License"). You may not use this file except in compliance with the | |
9 | * License. Please obtain a copy of the License at | |
10 | * http://www.apple.com/publicsource and read it before using this file. | |
1c79356b | 11 | * |
e5568f75 A |
12 | * This Original Code and all software distributed under the License are |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
1c79356b A |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
e5568f75 A |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the |
17 | * License for the specific language governing rights and limitations | |
18 | * under the License. | |
1c79356b A |
19 | * |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ | |
23 | /* | |
24 | * Copyright (c) 1989, 1993 | |
25 | * The Regents of the University of California. All rights reserved. | |
26 | * | |
27 | * This code is derived from software contributed to Berkeley by | |
28 | * Rick Macklem at The University of Guelph. | |
29 | * | |
30 | * Redistribution and use in source and binary forms, with or without | |
31 | * modification, are permitted provided that the following conditions | |
32 | * are met: | |
33 | * 1. Redistributions of source code must retain the above copyright | |
34 | * notice, this list of conditions and the following disclaimer. | |
35 | * 2. Redistributions in binary form must reproduce the above copyright | |
36 | * notice, this list of conditions and the following disclaimer in the | |
37 | * documentation and/or other materials provided with the distribution. | |
38 | * 3. All advertising materials mentioning features or use of this software | |
39 | * must display the following acknowledgement: | |
40 | * This product includes software developed by the University of | |
41 | * California, Berkeley and its contributors. | |
42 | * 4. Neither the name of the University nor the names of its contributors | |
43 | * may be used to endorse or promote products derived from this software | |
44 | * without specific prior written permission. | |
45 | * | |
46 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
47 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
48 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
49 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
50 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
51 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
52 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
53 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
54 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
55 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
56 | * SUCH DAMAGE. | |
57 | * | |
58 | * @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95 | |
59 | * FreeBSD-Id: nfsm_subs.h,v 1.13 1997/07/16 09:06:30 dfr Exp $ | |
60 | */ | |
61 | ||
62 | ||
63 | #ifndef _NFS_NFSM_SUBS_H_ | |
64 | #define _NFS_NFSM_SUBS_H_ | |
65 | ||
9bccf70c | 66 | #include <sys/appleapiopts.h> |
1c79356b | 67 | |
9bccf70c | 68 | #ifdef __APPLE_API_PRIVATE |
1c79356b A |
69 | /* |
70 | * These macros do strange and peculiar things to mbuf chains for | |
71 | * the assistance of the nfs code. To attempt to use them for any | |
72 | * other purpose will be dangerous. (they make weird assumptions) | |
73 | */ | |
74 | ||
75 | /* | |
76 | * First define what the actual subs. return | |
77 | */ | |
78 | struct mbuf *nfsm_reqh __P((struct vnode *vp, u_long procid, int hsiz, | |
79 | caddr_t *bposp)); | |
80 | struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid, | |
81 | int auth_type, int auth_len, char *auth_str, | |
82 | int verf_len, char *verf_str, | |
83 | struct mbuf *mrest, int mrest_len, | |
84 | struct mbuf **mbp, u_long *xidp)); | |
85 | ||
86 | #define M_HASCL(m) ((m)->m_flags & M_EXT) | |
87 | #define NFSMINOFF(m) \ | |
88 | if (M_HASCL(m)) \ | |
89 | (m)->m_data = (m)->m_ext.ext_buf; \ | |
90 | else if ((m)->m_flags & M_PKTHDR) \ | |
91 | (m)->m_data = (m)->m_pktdat; \ | |
92 | else \ | |
93 | (m)->m_data = (m)->m_dat | |
94 | #define NFSMADV(m, s) (m)->m_data += (s) | |
95 | #define NFSMSIZ(m) ((M_HASCL(m))?MCLBYTES: \ | |
96 | (((m)->m_flags & M_PKTHDR)?MHLEN:MLEN)) | |
97 | ||
98 | /* | |
99 | * Now for the macros that do the simple stuff and call the functions | |
100 | * for the hard stuff. | |
101 | * These macros use several vars. declared in nfsm_reqhead and these | |
102 | * vars. must not be used elsewhere unless you are careful not to corrupt | |
103 | * them. The vars. starting with pN and tN (N=1,2,3,..) are temporaries | |
104 | * that may be used so long as the value is not expected to retained | |
105 | * after a macro. | |
106 | * I know, this is kind of dorkey, but it makes the actual op functions | |
107 | * fairly clean and deals with the mess caused by the xdr discriminating | |
108 | * unions. | |
109 | */ | |
110 | ||
111 | #define nfsm_build(a,c,s) \ | |
112 | { if ((s) > M_TRAILINGSPACE(mb)) { \ | |
113 | MGET(mb2, M_WAIT, MT_DATA); \ | |
114 | if ((s) > MLEN) \ | |
115 | panic("build > MLEN"); \ | |
116 | mb->m_next = mb2; \ | |
117 | mb = mb2; \ | |
118 | mb->m_len = 0; \ | |
119 | bpos = mtod(mb, caddr_t); \ | |
120 | } \ | |
121 | (a) = (c)(bpos); \ | |
122 | mb->m_len += (s); \ | |
123 | bpos += (s); } | |
124 | ||
125 | #define nfsm_dissect(a, c, s) \ | |
126 | { t1 = mtod(md, caddr_t)+md->m_len-dpos; \ | |
127 | if (t1 >= (s)) { \ | |
128 | (a) = (c)(dpos); \ | |
129 | dpos += (s); \ | |
130 | } else if ((t1 = nfsm_disct(&md, &dpos, (s), t1, &cp2))) { \ | |
131 | error = t1; \ | |
132 | m_freem(mrep); \ | |
133 | goto nfsmout; \ | |
134 | } else { \ | |
135 | (a) = (c)cp2; \ | |
136 | } } | |
137 | ||
138 | #define nfsm_fhtom(v, v3) \ | |
139 | { if (v3) { \ | |
140 | t2 = nfsm_rndup(VTONFS(v)->n_fhsize) + NFSX_UNSIGNED; \ | |
141 | if (t2 <= M_TRAILINGSPACE(mb)) { \ | |
142 | nfsm_build(tl, u_long *, t2); \ | |
143 | *tl++ = txdr_unsigned(VTONFS(v)->n_fhsize); \ | |
144 | *(tl + ((t2>>2) - 2)) = 0; \ | |
145 | bcopy((caddr_t)VTONFS(v)->n_fhp,(caddr_t)tl, \ | |
146 | VTONFS(v)->n_fhsize); \ | |
147 | } else if ((t2 = nfsm_strtmbuf(&mb, &bpos, \ | |
148 | (caddr_t)VTONFS(v)->n_fhp, VTONFS(v)->n_fhsize))) { \ | |
149 | error = t2; \ | |
150 | m_freem(mreq); \ | |
151 | goto nfsmout; \ | |
152 | } \ | |
153 | } else { \ | |
154 | nfsm_build(cp, caddr_t, NFSX_V2FH); \ | |
155 | bcopy((caddr_t)VTONFS(v)->n_fhp, cp, NFSX_V2FH); \ | |
156 | } } | |
157 | ||
158 | #define nfsm_srvfhtom(f, v3) \ | |
159 | { if (v3) { \ | |
160 | nfsm_build(tl, u_long *, NFSX_UNSIGNED + NFSX_V3FH); \ | |
161 | *tl++ = txdr_unsigned(NFSX_V3FH); \ | |
162 | bcopy((caddr_t)(f), (caddr_t)tl, NFSX_V3FH); \ | |
163 | } else { \ | |
164 | nfsm_build(cp, caddr_t, NFSX_V2FH); \ | |
165 | bcopy((caddr_t)(f), cp, NFSX_V2FH); \ | |
166 | } } | |
167 | ||
168 | #define nfsm_srvpostop_fh(f) \ | |
169 | { nfsm_build(tl, u_long *, 2 * NFSX_UNSIGNED + NFSX_V3FH); \ | |
170 | *tl++ = nfs_true; \ | |
171 | *tl++ = txdr_unsigned(NFSX_V3FH); \ | |
172 | bcopy((caddr_t)(f), (caddr_t)tl, NFSX_V3FH); \ | |
173 | } | |
174 | ||
fa4905b1 | 175 | #define nfsm_mtofh(d, v, v3, f, x) \ |
1c79356b A |
176 | { struct nfsnode *ttnp; nfsfh_t *ttfhp; int ttfhsize; \ |
177 | if (v3) { \ | |
178 | nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ | |
179 | (f) = fxdr_unsigned(int, *tl); \ | |
180 | } else \ | |
181 | (f) = 1; \ | |
182 | if (f) { \ | |
183 | nfsm_getfh(ttfhp, ttfhsize, (v3)); \ | |
184 | if ((t1 = nfs_nget((d)->v_mount, ttfhp, ttfhsize, \ | |
185 | &ttnp))) { \ | |
186 | error = t1; \ | |
187 | m_freem(mrep); \ | |
188 | goto nfsmout; \ | |
189 | } \ | |
190 | (v) = NFSTOV(ttnp); \ | |
191 | } \ | |
192 | if (v3) { \ | |
193 | nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ | |
194 | if (f) \ | |
195 | (f) = fxdr_unsigned(int, *tl); \ | |
196 | else if (fxdr_unsigned(int, *tl)) \ | |
197 | nfsm_adv(NFSX_V3FATTR); \ | |
198 | } \ | |
199 | if (f) \ | |
fa4905b1 | 200 | nfsm_loadattr((v), (struct vattr *)0, (x)); \ |
1c79356b A |
201 | } |
202 | ||
203 | #define nfsm_getfh(f, s, v3) \ | |
204 | { if (v3) { \ | |
205 | nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ | |
206 | if (((s) = fxdr_unsigned(int, *tl)) <= 0 || \ | |
207 | (s) > NFSX_V3FHMAX) { \ | |
208 | m_freem(mrep); \ | |
209 | error = EBADRPC; \ | |
210 | goto nfsmout; \ | |
211 | } \ | |
212 | } else \ | |
213 | (s) = NFSX_V2FH; \ | |
214 | nfsm_dissect((f), nfsfh_t *, nfsm_rndup(s)); } | |
215 | ||
fa4905b1 | 216 | #define nfsm_loadattr(v, a, x) \ |
1c79356b | 217 | { struct vnode *ttvp = (v); \ |
fa4905b1 A |
218 | if ((t1 = nfs_loadattrcache(&ttvp, &md, &dpos, (a), 0, \ |
219 | (x)))) { \ | |
1c79356b A |
220 | error = t1; \ |
221 | m_freem(mrep); \ | |
222 | goto nfsmout; \ | |
223 | } \ | |
224 | (v) = ttvp; } | |
225 | ||
fa4905b1 | 226 | #define nfsm_postop_attr(v, f, x) \ |
1c79356b A |
227 | { struct vnode *ttvp = (v); \ |
228 | nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ | |
229 | if (((f) = fxdr_unsigned(int, *tl))) { \ | |
230 | if ((t1 = nfs_loadattrcache(&ttvp, &md, &dpos, \ | |
fa4905b1 | 231 | (struct vattr *)0, 1, (x)))) { \ |
1c79356b A |
232 | error = t1; \ |
233 | (f) = 0; \ | |
234 | m_freem(mrep); \ | |
235 | goto nfsmout; \ | |
236 | } \ | |
fa4905b1 A |
237 | if (*(x) == 0) \ |
238 | (f) = 0; \ | |
1c79356b A |
239 | (v) = ttvp; \ |
240 | } } | |
241 | ||
483a1d10 A |
242 | #define nfsm_wcc_data(v, premtime, newpostattr, x) \ |
243 | { \ | |
1c79356b A |
244 | nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ |
245 | if (*tl == nfs_true) { \ | |
246 | nfsm_dissect(tl, u_long *, 6 * NFSX_UNSIGNED); \ | |
483a1d10 | 247 | (premtime) = fxdr_unsigned(time_t, *(tl + 2)); \ |
1c79356b | 248 | } else { \ |
483a1d10 A |
249 | (premtime) = 0; \ |
250 | } \ | |
251 | nfsm_postop_attr((v), (newpostattr), (x)); \ | |
252 | } | |
1c79356b A |
253 | |
254 | #define nfsm_v3sattr(s, a, u, g) \ | |
255 | { (s)->sa_modetrue = nfs_true; \ | |
256 | (s)->sa_mode = vtonfsv3_mode((a)->va_mode); \ | |
257 | (s)->sa_uidtrue = nfs_true; \ | |
258 | (s)->sa_uid = txdr_unsigned(u); \ | |
259 | (s)->sa_gidtrue = nfs_true; \ | |
260 | (s)->sa_gid = txdr_unsigned(g); \ | |
261 | (s)->sa_sizefalse = nfs_false; \ | |
262 | (s)->sa_atimetype = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); \ | |
263 | (s)->sa_mtimetype = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); \ | |
264 | } | |
265 | ||
266 | #define nfsm_strsiz(s,m) \ | |
267 | { nfsm_dissect(tl,u_long *,NFSX_UNSIGNED); \ | |
268 | if (((s) = fxdr_unsigned(long,*tl)) > (m)) { \ | |
269 | m_freem(mrep); \ | |
270 | error = EBADRPC; \ | |
271 | goto nfsmout; \ | |
272 | } } | |
273 | ||
274 | #define nfsm_srvstrsiz(s,m) \ | |
275 | { nfsm_dissect(tl,u_long *,NFSX_UNSIGNED); \ | |
276 | if (((s) = fxdr_unsigned(long,*tl)) > (m) || (s) <= 0) { \ | |
277 | error = EBADRPC; \ | |
278 | nfsm_reply(0); \ | |
279 | } } | |
280 | ||
281 | #define nfsm_srvnamesiz(s) \ | |
282 | { nfsm_dissect(tl,u_long *,NFSX_UNSIGNED); \ | |
283 | if (((s) = fxdr_unsigned(long,*tl)) > NFS_MAXNAMLEN) \ | |
284 | error = NFSERR_NAMETOL; \ | |
285 | if ((s) <= 0) \ | |
286 | error = EBADRPC; \ | |
287 | if (error) \ | |
288 | nfsm_reply(0); \ | |
289 | } | |
290 | ||
291 | #define nfsm_mtouio(p,s) \ | |
292 | if ((s) > 0 && \ | |
293 | (t1 = nfsm_mbuftouio(&md,(p),(s),&dpos))) { \ | |
294 | error = t1; \ | |
295 | m_freem(mrep); \ | |
296 | goto nfsmout; \ | |
297 | } | |
298 | ||
299 | #define nfsm_uiotom(p,s) \ | |
300 | if ((t1 = nfsm_uiotombuf((p),&mb,(s),&bpos))) { \ | |
301 | error = t1; \ | |
302 | m_freem(mreq); \ | |
303 | goto nfsmout; \ | |
304 | } | |
305 | ||
306 | #define nfsm_reqhead(v,a,s) \ | |
307 | mb = mreq = nfsm_reqh((v),(a),(s),&bpos) | |
308 | ||
309 | #define nfsm_reqdone m_freem(mrep); \ | |
310 | nfsmout: | |
311 | ||
312 | #define nfsm_rndup(a) (((a)+3)&(~0x3)) | |
313 | ||
314 | /* | |
315 | * We seem to see cases mainly on shutdown where the vnode got recycled | |
316 | * on use while waiting on server. Maybe nfs vnode locking will help if | |
317 | * we implement that, but for now, check for bad vnodes and return an | |
318 | * error. This call spot should catch most of them. Note that NFSv2 | |
319 | * just goes to nfsmout here, while nfsV3 goes back to caller's next | |
320 | * line for post-processing. It will do a nfsm_reqdone also making | |
321 | * m_freem(mrep). Wondering if some of our freeing problems could be | |
322 | * due to nfsv3 calling nfsm_reqdone unlike nfsv2. Separate problem. | |
323 | */ | |
fa4905b1 | 324 | #define nfsm_request(v, t, p, c, x) \ |
1c79356b | 325 | { \ |
55e303ae A |
326 | int nfsv3; \ |
327 | if (!VFSTONFS((v)->v_mount)) { \ | |
328 | error = ENXIO; \ | |
329 | goto nfsmout; \ | |
330 | } \ | |
331 | nfsv3 = (VFSTONFS((v)->v_mount))->nm_flag & NFSMNT_NFSV3; \ | |
1c79356b | 332 | if ((error = nfs_request((v), mreq, (t), (p), \ |
fa4905b1 | 333 | (c), &mrep, &md, &dpos, (x)))) { \ |
1c79356b A |
334 | if (error & NFSERR_RETERR) \ |
335 | error &= ~NFSERR_RETERR; \ | |
336 | else \ | |
337 | goto nfsmout; \ | |
338 | } \ | |
1c79356b A |
339 | } |
340 | ||
341 | #define nfsm_strtom(a,s,m) \ | |
342 | if ((s) > (m)) { \ | |
343 | m_freem(mreq); \ | |
344 | error = ENAMETOOLONG; \ | |
345 | goto nfsmout; \ | |
346 | } \ | |
347 | t2 = nfsm_rndup(s)+NFSX_UNSIGNED; \ | |
348 | if (t2 <= M_TRAILINGSPACE(mb)) { \ | |
349 | nfsm_build(tl,u_long *,t2); \ | |
350 | *tl++ = txdr_unsigned(s); \ | |
351 | *(tl+((t2>>2)-2)) = 0; \ | |
352 | bcopy((caddr_t)(a), (caddr_t)tl, (s)); \ | |
353 | } else if ((t2 = nfsm_strtmbuf(&mb, &bpos, (a), (s)))) { \ | |
354 | error = t2; \ | |
355 | m_freem(mreq); \ | |
356 | goto nfsmout; \ | |
357 | } | |
358 | ||
359 | #define nfsm_srvdone \ | |
360 | nfsmout: \ | |
361 | return(error) | |
362 | ||
363 | #define nfsm_reply(s) \ | |
364 | { \ | |
365 | nfsd->nd_repstat = error; \ | |
366 | if (error && !(nfsd->nd_flag & ND_NFSV3)) \ | |
367 | (void) nfs_rephead(0, nfsd, slp, error, cache, &frev, \ | |
368 | mrq, &mb, &bpos); \ | |
369 | else \ | |
370 | (void) nfs_rephead((s), nfsd, slp, error, cache, &frev, \ | |
371 | mrq, &mb, &bpos); \ | |
372 | m_freem(mrep); \ | |
e5568f75 | 373 | mrep = NULL; \ |
1c79356b A |
374 | mreq = *mrq; \ |
375 | if (error && (!(nfsd->nd_flag & ND_NFSV3) || \ | |
376 | error == EBADRPC)) \ | |
377 | return(0); \ | |
378 | } | |
379 | ||
380 | #define nfsm_writereply(s, v3) \ | |
381 | { \ | |
382 | nfsd->nd_repstat = error; \ | |
383 | if (error && !(v3)) \ | |
384 | (void) nfs_rephead(0, nfsd, slp, error, cache, &frev, \ | |
385 | &mreq, &mb, &bpos); \ | |
386 | else \ | |
387 | (void) nfs_rephead((s), nfsd, slp, error, cache, &frev, \ | |
388 | &mreq, &mb, &bpos); \ | |
389 | } | |
390 | ||
391 | #define nfsm_adv(s) \ | |
392 | { t1 = mtod(md, caddr_t)+md->m_len-dpos; \ | |
393 | if (t1 >= (s)) { \ | |
394 | dpos += (s); \ | |
395 | } else if ((t1 = nfs_adv(&md, &dpos, (s), t1))) { \ | |
396 | error = t1; \ | |
397 | m_freem(mrep); \ | |
398 | goto nfsmout; \ | |
399 | } } | |
400 | ||
401 | #define nfsm_srvmtofh(f) \ | |
402 | { if (nfsd->nd_flag & ND_NFSV3) { \ | |
403 | nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ | |
404 | if (fxdr_unsigned(int, *tl) != NFSX_V3FH) { \ | |
405 | error = EBADRPC; \ | |
406 | nfsm_reply(0); \ | |
407 | } \ | |
408 | } \ | |
409 | nfsm_dissect(tl, u_long *, NFSX_V3FH); \ | |
410 | bcopy((caddr_t)tl, (caddr_t)(f), NFSX_V3FH); \ | |
411 | if ((nfsd->nd_flag & ND_NFSV3) == 0) \ | |
412 | nfsm_adv(NFSX_V2FH - NFSX_V3FH); \ | |
413 | } | |
414 | ||
415 | #define nfsm_clget \ | |
416 | if (bp >= be) { \ | |
417 | if (mp == mb) \ | |
418 | mp->m_len += bp-bpos; \ | |
419 | MGET(mp, M_WAIT, MT_DATA); \ | |
420 | MCLGET(mp, M_WAIT); \ | |
421 | mp->m_len = NFSMSIZ(mp); \ | |
422 | mp2->m_next = mp; \ | |
423 | mp2 = mp; \ | |
424 | bp = mtod(mp, caddr_t); \ | |
425 | be = bp+mp->m_len; \ | |
426 | } \ | |
427 | tl = (u_long *)bp | |
428 | ||
429 | #define nfsm_srvfillattr(a, f) \ | |
430 | nfsm_srvfattr(nfsd, (a), (f)) | |
431 | ||
432 | #define nfsm_srvwcc_data(br, b, ar, a) \ | |
433 | nfsm_srvwcc(nfsd, (br), (b), (ar), (a), &mb, &bpos) | |
434 | ||
435 | #define nfsm_srvpostop_attr(r, a) \ | |
436 | nfsm_srvpostopattr(nfsd, (r), (a), &mb, &bpos) | |
437 | ||
438 | #define nfsm_srvsattr(a) \ | |
55e303ae A |
439 | { \ |
440 | struct timeval now; \ | |
441 | nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ | |
1c79356b A |
442 | if (*tl == nfs_true) { \ |
443 | nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ | |
444 | (a)->va_mode = nfstov_mode(*tl); \ | |
445 | } \ | |
446 | nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ | |
447 | if (*tl == nfs_true) { \ | |
448 | nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ | |
449 | (a)->va_uid = fxdr_unsigned(uid_t, *tl); \ | |
450 | } \ | |
451 | nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ | |
452 | if (*tl == nfs_true) { \ | |
453 | nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ | |
454 | (a)->va_gid = fxdr_unsigned(gid_t, *tl); \ | |
455 | } \ | |
456 | nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ | |
457 | if (*tl == nfs_true) { \ | |
458 | nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); \ | |
459 | fxdr_hyper(tl, &(a)->va_size); \ | |
460 | } \ | |
461 | nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ | |
55e303ae | 462 | microtime(&now); \ |
1c79356b A |
463 | switch (fxdr_unsigned(int, *tl)) { \ |
464 | case NFSV3SATTRTIME_TOCLIENT: \ | |
465 | nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); \ | |
466 | fxdr_nfsv3time(tl, &(a)->va_atime); \ | |
467 | break; \ | |
468 | case NFSV3SATTRTIME_TOSERVER: \ | |
55e303ae A |
469 | (a)->va_atime.tv_sec = now.tv_sec; \ |
470 | (a)->va_atime.tv_nsec = now.tv_usec * 1000; \ | |
1c79356b A |
471 | break; \ |
472 | }; \ | |
473 | nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \ | |
474 | switch (fxdr_unsigned(int, *tl)) { \ | |
475 | case NFSV3SATTRTIME_TOCLIENT: \ | |
476 | nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); \ | |
477 | fxdr_nfsv3time(tl, &(a)->va_mtime); \ | |
478 | break; \ | |
479 | case NFSV3SATTRTIME_TOSERVER: \ | |
55e303ae A |
480 | (a)->va_mtime.tv_sec = now.tv_sec; \ |
481 | (a)->va_mtime.tv_nsec = now.tv_usec * 1000; \ | |
1c79356b A |
482 | break; \ |
483 | }; } | |
484 | ||
9bccf70c A |
485 | #endif /* __APPLE_API_PRIVATE */ |
486 | #endif /* _NFS_NFSM_SUBS_H_ */ |