1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate * CDDL HEADER START
3*0Sstevel@tonic-gate *
4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance
7*0Sstevel@tonic-gate * with the License.
8*0Sstevel@tonic-gate *
9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate * and limitations under the License.
13*0Sstevel@tonic-gate *
14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate *
20*0Sstevel@tonic-gate * CDDL HEADER END
21*0Sstevel@tonic-gate */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate * Copyright (c) 1991, 1999 by Sun Microsystems, Inc.
24*0Sstevel@tonic-gate * All rights reserved.
25*0Sstevel@tonic-gate */
26*0Sstevel@tonic-gate
27*0Sstevel@tonic-gate #ident "%Z%%M% %I% %E% SMI" /* SunOS */
28*0Sstevel@tonic-gate
29*0Sstevel@tonic-gate #include <sys/types.h>
30*0Sstevel@tonic-gate #include <sys/errno.h>
31*0Sstevel@tonic-gate #include <sys/tiuser.h>
32*0Sstevel@tonic-gate #include <setjmp.h>
33*0Sstevel@tonic-gate #include <string.h>
34*0Sstevel@tonic-gate
35*0Sstevel@tonic-gate #include <rpc/types.h>
36*0Sstevel@tonic-gate #include <rpc/xdr.h>
37*0Sstevel@tonic-gate #include <rpc/auth.h>
38*0Sstevel@tonic-gate #include <rpc/clnt.h>
39*0Sstevel@tonic-gate #include <rpc/rpc_msg.h>
40*0Sstevel@tonic-gate #include "snoop.h"
41*0Sstevel@tonic-gate #include "snoop_nfs.h"
42*0Sstevel@tonic-gate
43*0Sstevel@tonic-gate #include <sys/stat.h>
44*0Sstevel@tonic-gate #include <sys/param.h>
45*0Sstevel@tonic-gate #include <rpcsvc/nfs_prot.h>
46*0Sstevel@tonic-gate
47*0Sstevel@tonic-gate #ifndef MIN
48*0Sstevel@tonic-gate #define MIN(a, b) ((a) < (b) ? (a) : (b))
49*0Sstevel@tonic-gate #endif
50*0Sstevel@tonic-gate
51*0Sstevel@tonic-gate extern jmp_buf xdr_err;
52*0Sstevel@tonic-gate
53*0Sstevel@tonic-gate static void nfscall3(int);
54*0Sstevel@tonic-gate static void nfsreply3(int);
55*0Sstevel@tonic-gate static char *perms(int);
56*0Sstevel@tonic-gate static char *filetype(int);
57*0Sstevel@tonic-gate static char *sum_access(void);
58*0Sstevel@tonic-gate static char *sum_readdirres(void);
59*0Sstevel@tonic-gate static char *sum_readdirplusres(void);
60*0Sstevel@tonic-gate static char *sum_createhow(void);
61*0Sstevel@tonic-gate static char *sum_stablehow(void);
62*0Sstevel@tonic-gate static void detail_sattr3(void);
63*0Sstevel@tonic-gate static void detail_diropargs3(void);
64*0Sstevel@tonic-gate static void detail_readdirres(void);
65*0Sstevel@tonic-gate static void detail_readdirplusres(void);
66*0Sstevel@tonic-gate static void detail_fattr3(void);
67*0Sstevel@tonic-gate static void detail_access(void);
68*0Sstevel@tonic-gate static void detail_mode(int);
69*0Sstevel@tonic-gate static void detail_wcc_attr(void);
70*0Sstevel@tonic-gate static void detail_pre_op_attr(char *);
71*0Sstevel@tonic-gate static void detail_wcc_data(char *);
72*0Sstevel@tonic-gate static void skip_postop(void);
73*0Sstevel@tonic-gate static void skip_wcc_data(void);
74*0Sstevel@tonic-gate static void skip_sattr3(void);
75*0Sstevel@tonic-gate
76*0Sstevel@tonic-gate #define DONT_CHANGE 0
77*0Sstevel@tonic-gate #define SET_TO_SERVER_TIME 1
78*0Sstevel@tonic-gate #define SET_TO_CLIENT_TIME 2
79*0Sstevel@tonic-gate
80*0Sstevel@tonic-gate #define UNCHECKED 0
81*0Sstevel@tonic-gate #define GUARDED 1
82*0Sstevel@tonic-gate #define EXCLUSIVE 2
83*0Sstevel@tonic-gate
84*0Sstevel@tonic-gate #define ACCESS3_READ 0x0001
85*0Sstevel@tonic-gate #define ACCESS3_LOOKUP 0x0002
86*0Sstevel@tonic-gate #define ACCESS3_MODIFY 0x0004
87*0Sstevel@tonic-gate #define ACCESS3_EXTEND 0x0008
88*0Sstevel@tonic-gate #define ACCESS3_DELETE 0x0010
89*0Sstevel@tonic-gate #define ACCESS3_EXECUTE 0x0020
90*0Sstevel@tonic-gate
91*0Sstevel@tonic-gate #define UNSTABLE 0
92*0Sstevel@tonic-gate #define DATA_SYNC 1
93*0Sstevel@tonic-gate #define FILE_SYNC 2
94*0Sstevel@tonic-gate
95*0Sstevel@tonic-gate #define NF3REG 1 /* regular file */
96*0Sstevel@tonic-gate #define NF3DIR 2 /* directory */
97*0Sstevel@tonic-gate #define NF3BLK 3 /* block special */
98*0Sstevel@tonic-gate #define NF3CHR 4 /* character special */
99*0Sstevel@tonic-gate #define NF3LNK 5 /* symbolic link */
100*0Sstevel@tonic-gate #define NF3SOCK 6 /* unix domain socket */
101*0Sstevel@tonic-gate #define NF3FIFO 7 /* named pipe */
102*0Sstevel@tonic-gate
103*0Sstevel@tonic-gate #define NFS3_FHSIZE 64
104*0Sstevel@tonic-gate
105*0Sstevel@tonic-gate static char *procnames_short[] = {
106*0Sstevel@tonic-gate "NULL3", /* 0 */
107*0Sstevel@tonic-gate "GETATTR3", /* 1 */
108*0Sstevel@tonic-gate "SETATTR3", /* 2 */
109*0Sstevel@tonic-gate "LOOKUP3", /* 3 */
110*0Sstevel@tonic-gate "ACCESS3", /* 4 */
111*0Sstevel@tonic-gate "READLINK3", /* 5 */
112*0Sstevel@tonic-gate "READ3", /* 6 */
113*0Sstevel@tonic-gate "WRITE3", /* 7 */
114*0Sstevel@tonic-gate "CREATE3", /* 8 */
115*0Sstevel@tonic-gate "MKDIR3", /* 9 */
116*0Sstevel@tonic-gate "SYMLINK3", /* 10 */
117*0Sstevel@tonic-gate "MKNOD3", /* 11 */
118*0Sstevel@tonic-gate "REMOVE3", /* 12 */
119*0Sstevel@tonic-gate "RMDIR3", /* 13 */
120*0Sstevel@tonic-gate "RENAME3", /* 14 */
121*0Sstevel@tonic-gate "LINK3", /* 15 */
122*0Sstevel@tonic-gate "READDIR3", /* 16 */
123*0Sstevel@tonic-gate "READDIRPLUS3", /* 17 */
124*0Sstevel@tonic-gate "FSSTAT3", /* 18 */
125*0Sstevel@tonic-gate "FSINFO3", /* 19 */
126*0Sstevel@tonic-gate "PATHCONF3", /* 20 */
127*0Sstevel@tonic-gate "COMMIT3", /* 21 */
128*0Sstevel@tonic-gate };
129*0Sstevel@tonic-gate
130*0Sstevel@tonic-gate static char *procnames_long[] = {
131*0Sstevel@tonic-gate "Null procedure", /* 0 */
132*0Sstevel@tonic-gate "Get file attributes", /* 1 */
133*0Sstevel@tonic-gate "Set file attributes", /* 2 */
134*0Sstevel@tonic-gate "Look up file name", /* 3 */
135*0Sstevel@tonic-gate "Check access permission", /* 4 */
136*0Sstevel@tonic-gate "Read from symbolic link", /* 5 */
137*0Sstevel@tonic-gate "Read from file", /* 6 */
138*0Sstevel@tonic-gate "Write to file", /* 7 */
139*0Sstevel@tonic-gate "Create file", /* 8 */
140*0Sstevel@tonic-gate "Make directory", /* 9 */
141*0Sstevel@tonic-gate "Make symbolic link", /* 10 */
142*0Sstevel@tonic-gate "Make special file", /* 11 */
143*0Sstevel@tonic-gate "Remove file", /* 12 */
144*0Sstevel@tonic-gate "Remove directory", /* 13 */
145*0Sstevel@tonic-gate "Rename", /* 14 */
146*0Sstevel@tonic-gate "Link", /* 15 */
147*0Sstevel@tonic-gate "Read from directory", /* 16 */
148*0Sstevel@tonic-gate "Read from directory - plus", /* 17 */
149*0Sstevel@tonic-gate "Get filesystem statistics", /* 18 */
150*0Sstevel@tonic-gate "Get filesystem information", /* 19 */
151*0Sstevel@tonic-gate "Get POSIX information", /* 20 */
152*0Sstevel@tonic-gate "Commit to stable storage", /* 21 */
153*0Sstevel@tonic-gate };
154*0Sstevel@tonic-gate
155*0Sstevel@tonic-gate #define MAXPROC 21
156*0Sstevel@tonic-gate
157*0Sstevel@tonic-gate void
interpret_nfs3(flags,type,xid,vers,proc,data,len)158*0Sstevel@tonic-gate interpret_nfs3(flags, type, xid, vers, proc, data, len)
159*0Sstevel@tonic-gate int flags, type, xid, vers, proc;
160*0Sstevel@tonic-gate char *data;
161*0Sstevel@tonic-gate int len;
162*0Sstevel@tonic-gate {
163*0Sstevel@tonic-gate char *line;
164*0Sstevel@tonic-gate char buff[NFS_MAXPATHLEN + 1]; /* protocol allows longer */
165*0Sstevel@tonic-gate u_longlong_t off;
166*0Sstevel@tonic-gate int sz, how;
167*0Sstevel@tonic-gate char *fh, *name;
168*0Sstevel@tonic-gate
169*0Sstevel@tonic-gate if (proc < 0 || proc > MAXPROC)
170*0Sstevel@tonic-gate return;
171*0Sstevel@tonic-gate
172*0Sstevel@tonic-gate if (flags & F_SUM) {
173*0Sstevel@tonic-gate line = get_sum_line();
174*0Sstevel@tonic-gate
175*0Sstevel@tonic-gate if (type == CALL) {
176*0Sstevel@tonic-gate (void) sprintf(line, "NFS C %s",
177*0Sstevel@tonic-gate procnames_short[proc]);
178*0Sstevel@tonic-gate line += strlen(line);
179*0Sstevel@tonic-gate switch (proc) {
180*0Sstevel@tonic-gate case NFSPROC3_GETATTR:
181*0Sstevel@tonic-gate case NFSPROC3_READLINK:
182*0Sstevel@tonic-gate case NFSPROC3_FSSTAT:
183*0Sstevel@tonic-gate case NFSPROC3_FSINFO:
184*0Sstevel@tonic-gate case NFSPROC3_PATHCONF:
185*0Sstevel@tonic-gate (void) sprintf(line, sum_nfsfh3());
186*0Sstevel@tonic-gate break;
187*0Sstevel@tonic-gate case NFSPROC3_SETATTR:
188*0Sstevel@tonic-gate (void) sprintf(line, sum_nfsfh3());
189*0Sstevel@tonic-gate break;
190*0Sstevel@tonic-gate case NFSPROC3_READDIR:
191*0Sstevel@tonic-gate fh = sum_nfsfh3();
192*0Sstevel@tonic-gate off = getxdr_u_longlong();
193*0Sstevel@tonic-gate (void) getxdr_u_longlong();
194*0Sstevel@tonic-gate sz = getxdr_u_long();
195*0Sstevel@tonic-gate (void) sprintf(line, "%s Cookie=%llu for %lu",
196*0Sstevel@tonic-gate fh, off, sz);
197*0Sstevel@tonic-gate break;
198*0Sstevel@tonic-gate case NFSPROC3_READDIRPLUS:
199*0Sstevel@tonic-gate fh = sum_nfsfh3();
200*0Sstevel@tonic-gate off = getxdr_u_longlong();
201*0Sstevel@tonic-gate (void) getxdr_u_longlong();
202*0Sstevel@tonic-gate sz = getxdr_u_long();
203*0Sstevel@tonic-gate (void) sprintf(line,
204*0Sstevel@tonic-gate "%s Cookie=%llu for %lu/%lu",
205*0Sstevel@tonic-gate fh, off, sz, getxdr_u_long());
206*0Sstevel@tonic-gate break;
207*0Sstevel@tonic-gate case NFSPROC3_ACCESS:
208*0Sstevel@tonic-gate fh = sum_nfsfh3();
209*0Sstevel@tonic-gate (void) sprintf(line, "%s (%s)",
210*0Sstevel@tonic-gate fh, sum_access());
211*0Sstevel@tonic-gate break;
212*0Sstevel@tonic-gate case NFSPROC3_LOOKUP:
213*0Sstevel@tonic-gate case NFSPROC3_REMOVE:
214*0Sstevel@tonic-gate case NFSPROC3_RMDIR:
215*0Sstevel@tonic-gate case NFSPROC3_MKDIR:
216*0Sstevel@tonic-gate fh = sum_nfsfh3();
217*0Sstevel@tonic-gate (void) sprintf(line, "%s %s",
218*0Sstevel@tonic-gate fh, getxdr_string(buff,
219*0Sstevel@tonic-gate NFS_MAXPATHLEN));
220*0Sstevel@tonic-gate break;
221*0Sstevel@tonic-gate case NFSPROC3_CREATE:
222*0Sstevel@tonic-gate fh = sum_nfsfh3();
223*0Sstevel@tonic-gate name = getxdr_string(buff, NFS_MAXPATHLEN);
224*0Sstevel@tonic-gate (void) sprintf(line, "%s (%s) %s",
225*0Sstevel@tonic-gate fh, sum_createhow(), name);
226*0Sstevel@tonic-gate break;
227*0Sstevel@tonic-gate case NFSPROC3_MKNOD:
228*0Sstevel@tonic-gate fh = sum_nfsfh3();
229*0Sstevel@tonic-gate name = getxdr_string(buff, NFS_MAXPATHLEN);
230*0Sstevel@tonic-gate how = getxdr_long();
231*0Sstevel@tonic-gate (void) sprintf(line, "%s (%s) %s",
232*0Sstevel@tonic-gate fh, filetype(how), name);
233*0Sstevel@tonic-gate break;
234*0Sstevel@tonic-gate case NFSPROC3_READ:
235*0Sstevel@tonic-gate fh = sum_nfsfh3();
236*0Sstevel@tonic-gate off = getxdr_u_longlong();
237*0Sstevel@tonic-gate sz = getxdr_u_long();
238*0Sstevel@tonic-gate (void) sprintf(line, "%s at %llu for %lu",
239*0Sstevel@tonic-gate fh, off, sz);
240*0Sstevel@tonic-gate break;
241*0Sstevel@tonic-gate case NFSPROC3_WRITE:
242*0Sstevel@tonic-gate fh = sum_nfsfh3();
243*0Sstevel@tonic-gate off = getxdr_u_longlong();
244*0Sstevel@tonic-gate sz = getxdr_u_long();
245*0Sstevel@tonic-gate (void) sprintf(line, "%s at %llu for %lu (%s)",
246*0Sstevel@tonic-gate fh, off, sz, sum_stablehow());
247*0Sstevel@tonic-gate break;
248*0Sstevel@tonic-gate case NFSPROC3_SYMLINK:
249*0Sstevel@tonic-gate fh = sum_nfsfh3();
250*0Sstevel@tonic-gate (void) sprintf(line, "%s %s",
251*0Sstevel@tonic-gate fh, getxdr_string(buff,
252*0Sstevel@tonic-gate NFS_MAXPATHLEN));
253*0Sstevel@tonic-gate skip_sattr3();
254*0Sstevel@tonic-gate line += strlen(line);
255*0Sstevel@tonic-gate (void) sprintf(line, " to %s",
256*0Sstevel@tonic-gate getxdr_string(buff, NFS_MAXPATHLEN));
257*0Sstevel@tonic-gate break;
258*0Sstevel@tonic-gate case NFSPROC3_RENAME:
259*0Sstevel@tonic-gate fh = sum_nfsfh3();
260*0Sstevel@tonic-gate (void) sprintf(line, "%s %s",
261*0Sstevel@tonic-gate fh, getxdr_string(buff,
262*0Sstevel@tonic-gate NFS_MAXPATHLEN));
263*0Sstevel@tonic-gate line += strlen(line);
264*0Sstevel@tonic-gate fh = sum_nfsfh3();
265*0Sstevel@tonic-gate (void) sprintf(line, " to%s %s",
266*0Sstevel@tonic-gate fh, getxdr_string(buff,
267*0Sstevel@tonic-gate NFS_MAXPATHLEN));
268*0Sstevel@tonic-gate break;
269*0Sstevel@tonic-gate case NFSPROC3_LINK:
270*0Sstevel@tonic-gate fh = sum_nfsfh3();
271*0Sstevel@tonic-gate (void) sprintf(line, "%s", fh);
272*0Sstevel@tonic-gate line += strlen(line);
273*0Sstevel@tonic-gate fh = sum_nfsfh3();
274*0Sstevel@tonic-gate (void) sprintf(line, " to%s %s",
275*0Sstevel@tonic-gate fh, getxdr_string(buff,
276*0Sstevel@tonic-gate NFS_MAXPATHLEN));
277*0Sstevel@tonic-gate break;
278*0Sstevel@tonic-gate case NFSPROC3_COMMIT:
279*0Sstevel@tonic-gate fh = sum_nfsfh3();
280*0Sstevel@tonic-gate off = getxdr_u_longlong();
281*0Sstevel@tonic-gate sz = getxdr_u_long();
282*0Sstevel@tonic-gate (void) sprintf(line, "%s at %llu for %lu",
283*0Sstevel@tonic-gate fh, off, sz);
284*0Sstevel@tonic-gate break;
285*0Sstevel@tonic-gate default:
286*0Sstevel@tonic-gate break;
287*0Sstevel@tonic-gate }
288*0Sstevel@tonic-gate
289*0Sstevel@tonic-gate check_retransmit(line, xid);
290*0Sstevel@tonic-gate } else {
291*0Sstevel@tonic-gate (void) sprintf(line, "NFS R %s ",
292*0Sstevel@tonic-gate procnames_short[proc]);
293*0Sstevel@tonic-gate line += strlen(line);
294*0Sstevel@tonic-gate switch (proc) {
295*0Sstevel@tonic-gate case NFSPROC3_LOOKUP:
296*0Sstevel@tonic-gate if (sum_nfsstat3(line) == NFS3_OK)
297*0Sstevel@tonic-gate (void) strcat(line, sum_nfsfh3());
298*0Sstevel@tonic-gate break;
299*0Sstevel@tonic-gate case NFSPROC3_CREATE:
300*0Sstevel@tonic-gate case NFSPROC3_MKDIR:
301*0Sstevel@tonic-gate case NFSPROC3_SYMLINK:
302*0Sstevel@tonic-gate case NFSPROC3_MKNOD:
303*0Sstevel@tonic-gate if (sum_nfsstat3(line) == NFS3_OK) {
304*0Sstevel@tonic-gate if (getxdr_bool())
305*0Sstevel@tonic-gate (void) strcat(line,
306*0Sstevel@tonic-gate sum_nfsfh3());
307*0Sstevel@tonic-gate }
308*0Sstevel@tonic-gate break;
309*0Sstevel@tonic-gate case NFSPROC3_READLINK:
310*0Sstevel@tonic-gate if (sum_nfsstat3(line) == NFS3_OK) {
311*0Sstevel@tonic-gate line += strlen(line);
312*0Sstevel@tonic-gate skip_postop();
313*0Sstevel@tonic-gate (void) sprintf(line, " (Path=%s)",
314*0Sstevel@tonic-gate getxdr_string(buff,
315*0Sstevel@tonic-gate NFS_MAXPATHLEN));
316*0Sstevel@tonic-gate }
317*0Sstevel@tonic-gate break;
318*0Sstevel@tonic-gate case NFSPROC3_GETATTR:
319*0Sstevel@tonic-gate case NFSPROC3_SETATTR:
320*0Sstevel@tonic-gate case NFSPROC3_REMOVE:
321*0Sstevel@tonic-gate case NFSPROC3_RMDIR:
322*0Sstevel@tonic-gate case NFSPROC3_RENAME:
323*0Sstevel@tonic-gate case NFSPROC3_LINK:
324*0Sstevel@tonic-gate case NFSPROC3_FSSTAT:
325*0Sstevel@tonic-gate case NFSPROC3_FSINFO:
326*0Sstevel@tonic-gate case NFSPROC3_PATHCONF:
327*0Sstevel@tonic-gate (void) sum_nfsstat3(line);
328*0Sstevel@tonic-gate break;
329*0Sstevel@tonic-gate case NFSPROC3_ACCESS:
330*0Sstevel@tonic-gate if (sum_nfsstat3(line) == NFS3_OK) {
331*0Sstevel@tonic-gate line += strlen(line);
332*0Sstevel@tonic-gate skip_postop();
333*0Sstevel@tonic-gate (void) sprintf(line, " (%s)",
334*0Sstevel@tonic-gate sum_access());
335*0Sstevel@tonic-gate }
336*0Sstevel@tonic-gate break;
337*0Sstevel@tonic-gate case NFSPROC3_WRITE:
338*0Sstevel@tonic-gate if (sum_nfsstat3(line) == NFS3_OK) {
339*0Sstevel@tonic-gate line += strlen(line);
340*0Sstevel@tonic-gate skip_wcc_data();
341*0Sstevel@tonic-gate sz = getxdr_u_long();
342*0Sstevel@tonic-gate (void) sprintf(line, " %d (%s)",
343*0Sstevel@tonic-gate sz, sum_stablehow());
344*0Sstevel@tonic-gate }
345*0Sstevel@tonic-gate break;
346*0Sstevel@tonic-gate case NFSPROC3_READDIR:
347*0Sstevel@tonic-gate if (sum_nfsstat3(line) == NFS3_OK)
348*0Sstevel@tonic-gate (void) strcat(line, sum_readdirres());
349*0Sstevel@tonic-gate break;
350*0Sstevel@tonic-gate case NFSPROC3_READ:
351*0Sstevel@tonic-gate if (sum_nfsstat3(line) == NFS3_OK) {
352*0Sstevel@tonic-gate line += strlen(line);
353*0Sstevel@tonic-gate skip_postop();
354*0Sstevel@tonic-gate (void) sprintf(line, " (%lu bytes)",
355*0Sstevel@tonic-gate getxdr_u_long());
356*0Sstevel@tonic-gate if (getxdr_bool())
357*0Sstevel@tonic-gate (void) strcat(line, " EOF");
358*0Sstevel@tonic-gate }
359*0Sstevel@tonic-gate break;
360*0Sstevel@tonic-gate case NFSPROC3_READDIRPLUS:
361*0Sstevel@tonic-gate if (sum_nfsstat3(line) == NFS3_OK)
362*0Sstevel@tonic-gate (void) strcat(line,
363*0Sstevel@tonic-gate sum_readdirplusres());
364*0Sstevel@tonic-gate break;
365*0Sstevel@tonic-gate case NFSPROC3_COMMIT:
366*0Sstevel@tonic-gate (void) sum_nfsstat3(line);
367*0Sstevel@tonic-gate break;
368*0Sstevel@tonic-gate default:
369*0Sstevel@tonic-gate break;
370*0Sstevel@tonic-gate }
371*0Sstevel@tonic-gate }
372*0Sstevel@tonic-gate }
373*0Sstevel@tonic-gate
374*0Sstevel@tonic-gate if (flags & F_DTAIL) {
375*0Sstevel@tonic-gate show_header("NFS: ", "Sun NFS", len);
376*0Sstevel@tonic-gate show_space();
377*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Proc = %d (%s)",
378*0Sstevel@tonic-gate proc, procnames_long[proc]);
379*0Sstevel@tonic-gate if (type == CALL)
380*0Sstevel@tonic-gate nfscall3(proc);
381*0Sstevel@tonic-gate else
382*0Sstevel@tonic-gate nfsreply3(proc);
383*0Sstevel@tonic-gate show_trailer();
384*0Sstevel@tonic-gate }
385*0Sstevel@tonic-gate }
386*0Sstevel@tonic-gate
387*0Sstevel@tonic-gate /*
388*0Sstevel@tonic-gate * Print out version 3 NFS call packets
389*0Sstevel@tonic-gate */
390*0Sstevel@tonic-gate static void
nfscall3(proc)391*0Sstevel@tonic-gate nfscall3(proc)
392*0Sstevel@tonic-gate int proc;
393*0Sstevel@tonic-gate {
394*0Sstevel@tonic-gate int h;
395*0Sstevel@tonic-gate
396*0Sstevel@tonic-gate switch (proc) {
397*0Sstevel@tonic-gate case NFSPROC3_GETATTR:
398*0Sstevel@tonic-gate case NFSPROC3_READLINK:
399*0Sstevel@tonic-gate case NFSPROC3_FSINFO:
400*0Sstevel@tonic-gate case NFSPROC3_FSSTAT:
401*0Sstevel@tonic-gate case NFSPROC3_PATHCONF:
402*0Sstevel@tonic-gate detail_nfsfh3();
403*0Sstevel@tonic-gate break;
404*0Sstevel@tonic-gate case NFSPROC3_SETATTR:
405*0Sstevel@tonic-gate detail_nfsfh3();
406*0Sstevel@tonic-gate detail_sattr3();
407*0Sstevel@tonic-gate if (getxdr_bool())
408*0Sstevel@tonic-gate (void) showxdr_date_ns("Guard = %s");
409*0Sstevel@tonic-gate break;
410*0Sstevel@tonic-gate case NFSPROC3_LOOKUP:
411*0Sstevel@tonic-gate case NFSPROC3_REMOVE:
412*0Sstevel@tonic-gate case NFSPROC3_RMDIR:
413*0Sstevel@tonic-gate detail_diropargs3();
414*0Sstevel@tonic-gate break;
415*0Sstevel@tonic-gate case NFSPROC3_ACCESS:
416*0Sstevel@tonic-gate detail_nfsfh3();
417*0Sstevel@tonic-gate detail_access();
418*0Sstevel@tonic-gate break;
419*0Sstevel@tonic-gate case NFSPROC3_MKDIR:
420*0Sstevel@tonic-gate detail_diropargs3();
421*0Sstevel@tonic-gate detail_sattr3();
422*0Sstevel@tonic-gate break;
423*0Sstevel@tonic-gate case NFSPROC3_CREATE:
424*0Sstevel@tonic-gate detail_diropargs3();
425*0Sstevel@tonic-gate h = getxdr_u_long();
426*0Sstevel@tonic-gate if (h == EXCLUSIVE)
427*0Sstevel@tonic-gate showxdr_hex(8, "Guard = %s");
428*0Sstevel@tonic-gate else {
429*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Method = %s",
430*0Sstevel@tonic-gate h == UNCHECKED ? "Unchecked" : "Guarded");
431*0Sstevel@tonic-gate detail_sattr3();
432*0Sstevel@tonic-gate }
433*0Sstevel@tonic-gate break;
434*0Sstevel@tonic-gate case NFSPROC3_MKNOD:
435*0Sstevel@tonic-gate detail_diropargs3();
436*0Sstevel@tonic-gate h = getxdr_u_long();
437*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "File type = %s",
438*0Sstevel@tonic-gate filetype(h));
439*0Sstevel@tonic-gate switch (h) {
440*0Sstevel@tonic-gate case NF3CHR:
441*0Sstevel@tonic-gate case NF3BLK:
442*0Sstevel@tonic-gate detail_sattr3();
443*0Sstevel@tonic-gate showxdr_u_long("Major = %lu");
444*0Sstevel@tonic-gate showxdr_u_long("Minor = %lu");
445*0Sstevel@tonic-gate break;
446*0Sstevel@tonic-gate case NF3SOCK:
447*0Sstevel@tonic-gate case NF3FIFO:
448*0Sstevel@tonic-gate detail_sattr3();
449*0Sstevel@tonic-gate break;
450*0Sstevel@tonic-gate }
451*0Sstevel@tonic-gate break;
452*0Sstevel@tonic-gate case NFSPROC3_WRITE:
453*0Sstevel@tonic-gate detail_nfsfh3();
454*0Sstevel@tonic-gate (void) showxdr_u_longlong("Offset = %llu");
455*0Sstevel@tonic-gate (void) showxdr_u_long("Size = %lu");
456*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Stable = %s",
457*0Sstevel@tonic-gate sum_stablehow());
458*0Sstevel@tonic-gate break;
459*0Sstevel@tonic-gate case NFSPROC3_RENAME:
460*0Sstevel@tonic-gate detail_diropargs3();
461*0Sstevel@tonic-gate detail_diropargs3();
462*0Sstevel@tonic-gate break;
463*0Sstevel@tonic-gate case NFSPROC3_LINK:
464*0Sstevel@tonic-gate detail_nfsfh3();
465*0Sstevel@tonic-gate detail_diropargs3();
466*0Sstevel@tonic-gate break;
467*0Sstevel@tonic-gate case NFSPROC3_SYMLINK:
468*0Sstevel@tonic-gate detail_diropargs3();
469*0Sstevel@tonic-gate detail_sattr3();
470*0Sstevel@tonic-gate (void) showxdr_string(MAXPATHLEN, "Path = %s");
471*0Sstevel@tonic-gate break;
472*0Sstevel@tonic-gate case NFSPROC3_READDIR:
473*0Sstevel@tonic-gate detail_nfsfh3();
474*0Sstevel@tonic-gate (void) showxdr_u_longlong("Cookie = %llu");
475*0Sstevel@tonic-gate (void) showxdr_hex(8, "Verifier = %s");
476*0Sstevel@tonic-gate (void) showxdr_u_long("Count = %lu");
477*0Sstevel@tonic-gate break;
478*0Sstevel@tonic-gate case NFSPROC3_READDIRPLUS:
479*0Sstevel@tonic-gate detail_nfsfh3();
480*0Sstevel@tonic-gate (void) showxdr_u_longlong("Cookie = %llu");
481*0Sstevel@tonic-gate (void) showxdr_hex(8, "Verifier = %s");
482*0Sstevel@tonic-gate (void) showxdr_u_long("Dircount = %lu");
483*0Sstevel@tonic-gate (void) showxdr_u_long("Maxcount = %lu");
484*0Sstevel@tonic-gate break;
485*0Sstevel@tonic-gate case NFSPROC3_READ:
486*0Sstevel@tonic-gate case NFSPROC3_COMMIT:
487*0Sstevel@tonic-gate detail_nfsfh3();
488*0Sstevel@tonic-gate (void) showxdr_u_longlong("Offset = %llu");
489*0Sstevel@tonic-gate (void) showxdr_long("Count = %lu");
490*0Sstevel@tonic-gate break;
491*0Sstevel@tonic-gate default:
492*0Sstevel@tonic-gate break;
493*0Sstevel@tonic-gate }
494*0Sstevel@tonic-gate }
495*0Sstevel@tonic-gate
496*0Sstevel@tonic-gate /*
497*0Sstevel@tonic-gate * Print out version 3 NFS reply packets
498*0Sstevel@tonic-gate */
499*0Sstevel@tonic-gate static void
nfsreply3(proc)500*0Sstevel@tonic-gate nfsreply3(proc)
501*0Sstevel@tonic-gate int proc;
502*0Sstevel@tonic-gate {
503*0Sstevel@tonic-gate int bits;
504*0Sstevel@tonic-gate
505*0Sstevel@tonic-gate switch (proc) {
506*0Sstevel@tonic-gate case NFSPROC3_GETATTR:
507*0Sstevel@tonic-gate if (detail_nfsstat3() == NFS3_OK) {
508*0Sstevel@tonic-gate detail_fattr3();
509*0Sstevel@tonic-gate }
510*0Sstevel@tonic-gate break;
511*0Sstevel@tonic-gate case NFSPROC3_SETATTR:
512*0Sstevel@tonic-gate (void) detail_nfsstat3();
513*0Sstevel@tonic-gate detail_wcc_data("");
514*0Sstevel@tonic-gate break;
515*0Sstevel@tonic-gate case NFSPROC3_WRITE:
516*0Sstevel@tonic-gate if (detail_nfsstat3() == NFS3_OK) {
517*0Sstevel@tonic-gate detail_wcc_data("");
518*0Sstevel@tonic-gate (void) showxdr_u_long("Count = %lu bytes written");
519*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Stable = %s",
520*0Sstevel@tonic-gate sum_stablehow());
521*0Sstevel@tonic-gate (void) showxdr_hex(8, "Verifier = %s");
522*0Sstevel@tonic-gate } else
523*0Sstevel@tonic-gate detail_wcc_data("");
524*0Sstevel@tonic-gate break;
525*0Sstevel@tonic-gate case NFSPROC3_LOOKUP:
526*0Sstevel@tonic-gate if (detail_nfsstat3() == NFS3_OK) {
527*0Sstevel@tonic-gate detail_nfsfh3();
528*0Sstevel@tonic-gate detail_post_op_attr("(object)");
529*0Sstevel@tonic-gate }
530*0Sstevel@tonic-gate detail_post_op_attr("(directory)");
531*0Sstevel@tonic-gate break;
532*0Sstevel@tonic-gate case NFSPROC3_CREATE:
533*0Sstevel@tonic-gate case NFSPROC3_MKDIR:
534*0Sstevel@tonic-gate case NFSPROC3_SYMLINK:
535*0Sstevel@tonic-gate case NFSPROC3_MKNOD:
536*0Sstevel@tonic-gate if (detail_nfsstat3() == NFS3_OK) {
537*0Sstevel@tonic-gate if (getxdr_bool())
538*0Sstevel@tonic-gate detail_nfsfh3();
539*0Sstevel@tonic-gate else
540*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
541*0Sstevel@tonic-gate "(No file handle available)");
542*0Sstevel@tonic-gate detail_post_op_attr("");
543*0Sstevel@tonic-gate }
544*0Sstevel@tonic-gate detail_wcc_data("");
545*0Sstevel@tonic-gate break;
546*0Sstevel@tonic-gate case NFSPROC3_READLINK:
547*0Sstevel@tonic-gate if (detail_nfsstat3() == NFS3_OK) {
548*0Sstevel@tonic-gate detail_post_op_attr("");
549*0Sstevel@tonic-gate (void) showxdr_string(MAXPATHLEN, "Path = %s");
550*0Sstevel@tonic-gate } else
551*0Sstevel@tonic-gate detail_post_op_attr("");
552*0Sstevel@tonic-gate break;
553*0Sstevel@tonic-gate case NFSPROC3_READ:
554*0Sstevel@tonic-gate if (detail_nfsstat3() == NFS3_OK) {
555*0Sstevel@tonic-gate detail_post_op_attr("");
556*0Sstevel@tonic-gate (void) showxdr_u_long("Count = %lu bytes read");
557*0Sstevel@tonic-gate (void) showxdr_bool("End of file = %s");
558*0Sstevel@tonic-gate } else
559*0Sstevel@tonic-gate detail_post_op_attr("");
560*0Sstevel@tonic-gate break;
561*0Sstevel@tonic-gate case NFSPROC3_ACCESS:
562*0Sstevel@tonic-gate if (detail_nfsstat3() == NFS3_OK) {
563*0Sstevel@tonic-gate detail_post_op_attr("");
564*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Access = %s",
565*0Sstevel@tonic-gate sum_access());
566*0Sstevel@tonic-gate } else
567*0Sstevel@tonic-gate detail_post_op_attr("");
568*0Sstevel@tonic-gate break;
569*0Sstevel@tonic-gate case NFSPROC3_REMOVE:
570*0Sstevel@tonic-gate case NFSPROC3_RMDIR:
571*0Sstevel@tonic-gate (void) detail_nfsstat3();
572*0Sstevel@tonic-gate detail_wcc_data("");
573*0Sstevel@tonic-gate break;
574*0Sstevel@tonic-gate case NFSPROC3_RENAME:
575*0Sstevel@tonic-gate (void) detail_nfsstat3();
576*0Sstevel@tonic-gate detail_wcc_data("(from directory)");
577*0Sstevel@tonic-gate detail_wcc_data("(to directory)");
578*0Sstevel@tonic-gate break;
579*0Sstevel@tonic-gate case NFSPROC3_LINK:
580*0Sstevel@tonic-gate (void) detail_nfsstat3();
581*0Sstevel@tonic-gate detail_post_op_attr("");
582*0Sstevel@tonic-gate detail_wcc_data("");
583*0Sstevel@tonic-gate break;
584*0Sstevel@tonic-gate case NFSPROC3_READDIR:
585*0Sstevel@tonic-gate if (detail_nfsstat3() == NFS3_OK) {
586*0Sstevel@tonic-gate detail_readdirres();
587*0Sstevel@tonic-gate } else
588*0Sstevel@tonic-gate detail_post_op_attr("");
589*0Sstevel@tonic-gate break;
590*0Sstevel@tonic-gate case NFSPROC3_READDIRPLUS:
591*0Sstevel@tonic-gate if (detail_nfsstat3() == NFS3_OK) {
592*0Sstevel@tonic-gate detail_readdirplusres();
593*0Sstevel@tonic-gate } else
594*0Sstevel@tonic-gate detail_post_op_attr("");
595*0Sstevel@tonic-gate break;
596*0Sstevel@tonic-gate case NFSPROC3_FSSTAT:
597*0Sstevel@tonic-gate if (detail_nfsstat3() == NFS3_OK) {
598*0Sstevel@tonic-gate detail_post_op_attr("");
599*0Sstevel@tonic-gate (void) showxdr_u_longlong(
600*0Sstevel@tonic-gate "Total space = %llu bytes");
601*0Sstevel@tonic-gate (void) showxdr_u_longlong(
602*0Sstevel@tonic-gate "Available space = %llu bytes");
603*0Sstevel@tonic-gate (void) showxdr_u_longlong(
604*0Sstevel@tonic-gate "Available space - this user = %llu bytes");
605*0Sstevel@tonic-gate (void) showxdr_u_longlong(
606*0Sstevel@tonic-gate "Total file slots = %llu");
607*0Sstevel@tonic-gate (void) showxdr_u_longlong(
608*0Sstevel@tonic-gate "Available file slots = %llu");
609*0Sstevel@tonic-gate (void) showxdr_u_longlong(
610*0Sstevel@tonic-gate "Available file slots - this user = %llu");
611*0Sstevel@tonic-gate (void) showxdr_u_long("Invariant time = %lu sec");
612*0Sstevel@tonic-gate } else
613*0Sstevel@tonic-gate detail_post_op_attr("");
614*0Sstevel@tonic-gate break;
615*0Sstevel@tonic-gate case NFSPROC3_FSINFO:
616*0Sstevel@tonic-gate if (detail_nfsstat3() == NFS3_OK) {
617*0Sstevel@tonic-gate detail_post_op_attr("");
618*0Sstevel@tonic-gate (void) show_line("Read transfer sizes:");
619*0Sstevel@tonic-gate (void) showxdr_u_long(" Maximum = %lu bytes");
620*0Sstevel@tonic-gate (void) showxdr_u_long(" Preferred = %lu bytes");
621*0Sstevel@tonic-gate (void) showxdr_u_long(
622*0Sstevel@tonic-gate " Suggested multiple = %lu bytes");
623*0Sstevel@tonic-gate (void) show_line("Write transfer sizes:");
624*0Sstevel@tonic-gate (void) showxdr_u_long(" Maximum = %lu bytes");
625*0Sstevel@tonic-gate (void) showxdr_u_long(" Preferred = %lu bytes");
626*0Sstevel@tonic-gate (void) showxdr_u_long(
627*0Sstevel@tonic-gate " Suggested multiple = %lu bytes");
628*0Sstevel@tonic-gate (void) show_line("Directory read size:");
629*0Sstevel@tonic-gate (void) showxdr_u_long(" Preferred = %lu bytes");
630*0Sstevel@tonic-gate (void) show_line("File system limits:");
631*0Sstevel@tonic-gate (void) showxdr_u_longlong(
632*0Sstevel@tonic-gate " Max file size = %llu bytes");
633*0Sstevel@tonic-gate (void) showxdr_date_ns(
634*0Sstevel@tonic-gate " Server minimum time discrimination = %s sec");
635*0Sstevel@tonic-gate bits = showxdr_u_long("Properties = 0x%02x");
636*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), " %s",
637*0Sstevel@tonic-gate getflag(bits, FSF3_LINK,
638*0Sstevel@tonic-gate "Hard links supported",
639*0Sstevel@tonic-gate "(hard links not supported)"));
640*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), " %s",
641*0Sstevel@tonic-gate getflag(bits, FSF3_SYMLINK,
642*0Sstevel@tonic-gate "Symbolic links supported",
643*0Sstevel@tonic-gate "(symbolic links not supported)"));
644*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), " %s",
645*0Sstevel@tonic-gate getflag(bits, FSF3_HOMOGENEOUS,
646*0Sstevel@tonic-gate "Pathconf cannot vary per file",
647*0Sstevel@tonic-gate "(pathconf can vary per file)"));
648*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), " %s",
649*0Sstevel@tonic-gate getflag(bits, FSF3_CANSETTIME,
650*0Sstevel@tonic-gate "Server can always set file times",
651*0Sstevel@tonic-gate "(server cannot always set file times)"));
652*0Sstevel@tonic-gate } else
653*0Sstevel@tonic-gate detail_post_op_attr("");
654*0Sstevel@tonic-gate break;
655*0Sstevel@tonic-gate case NFSPROC3_PATHCONF:
656*0Sstevel@tonic-gate if (detail_nfsstat3() == NFS3_OK) {
657*0Sstevel@tonic-gate detail_post_op_attr("");
658*0Sstevel@tonic-gate (void) showxdr_u_long("Link max = %lu");
659*0Sstevel@tonic-gate (void) showxdr_u_long("Name max = %lu");
660*0Sstevel@tonic-gate (void) showxdr_bool("No trunc = %s");
661*0Sstevel@tonic-gate (void) showxdr_bool("Chown restricted = %s");
662*0Sstevel@tonic-gate (void) showxdr_bool("Case insensitive = %s");
663*0Sstevel@tonic-gate (void) showxdr_bool("Case preserving = %s");
664*0Sstevel@tonic-gate } else
665*0Sstevel@tonic-gate detail_post_op_attr("");
666*0Sstevel@tonic-gate break;
667*0Sstevel@tonic-gate case NFSPROC3_COMMIT:
668*0Sstevel@tonic-gate if (detail_nfsstat3() == NFS3_OK) {
669*0Sstevel@tonic-gate detail_wcc_data("");
670*0Sstevel@tonic-gate (void) showxdr_hex(8, "Verifier = %s");
671*0Sstevel@tonic-gate } else
672*0Sstevel@tonic-gate detail_wcc_data("");
673*0Sstevel@tonic-gate break;
674*0Sstevel@tonic-gate default:
675*0Sstevel@tonic-gate break;
676*0Sstevel@tonic-gate }
677*0Sstevel@tonic-gate }
678*0Sstevel@tonic-gate
679*0Sstevel@tonic-gate static void
detail_diropargs3()680*0Sstevel@tonic-gate detail_diropargs3()
681*0Sstevel@tonic-gate {
682*0Sstevel@tonic-gate
683*0Sstevel@tonic-gate detail_nfsfh3();
684*0Sstevel@tonic-gate (void) showxdr_string(MAXPATHLEN, "File name = %s");
685*0Sstevel@tonic-gate }
686*0Sstevel@tonic-gate
687*0Sstevel@tonic-gate int
sum_nfsstat3(line)688*0Sstevel@tonic-gate sum_nfsstat3(line)
689*0Sstevel@tonic-gate char *line;
690*0Sstevel@tonic-gate {
691*0Sstevel@tonic-gate ulong_t status;
692*0Sstevel@tonic-gate char *p;
693*0Sstevel@tonic-gate
694*0Sstevel@tonic-gate status = getxdr_long();
695*0Sstevel@tonic-gate switch (status) {
696*0Sstevel@tonic-gate case NFS3_OK: p = "OK"; break;
697*0Sstevel@tonic-gate case NFS3ERR_PERM: p = "Not owner"; break;
698*0Sstevel@tonic-gate case NFS3ERR_NOENT: p = "No such file or directory"; break;
699*0Sstevel@tonic-gate case NFS3ERR_IO: p = "I/O error"; break;
700*0Sstevel@tonic-gate case NFS3ERR_NXIO: p = "No such device or address"; break;
701*0Sstevel@tonic-gate case NFS3ERR_ACCES: p = "Permission denied"; break;
702*0Sstevel@tonic-gate case NFS3ERR_EXIST: p = "File exists"; break;
703*0Sstevel@tonic-gate case NFS3ERR_XDEV: p = "Attempted cross-device link"; break;
704*0Sstevel@tonic-gate case NFS3ERR_NODEV: p = "No such device"; break;
705*0Sstevel@tonic-gate case NFS3ERR_NOTDIR: p = "Not a directory"; break;
706*0Sstevel@tonic-gate case NFS3ERR_ISDIR: p = "Is a directory"; break;
707*0Sstevel@tonic-gate case NFS3ERR_INVAL: p = "Invalid argument"; break;
708*0Sstevel@tonic-gate case NFS3ERR_FBIG: p = "File too large"; break;
709*0Sstevel@tonic-gate case NFS3ERR_NOSPC: p = "No space left on device"; break;
710*0Sstevel@tonic-gate case NFS3ERR_ROFS: p = "Read-only file system"; break;
711*0Sstevel@tonic-gate case NFS3ERR_MLINK: p = "Too many links"; break;
712*0Sstevel@tonic-gate case NFS3ERR_NAMETOOLONG:p = "File name too long"; break;
713*0Sstevel@tonic-gate case NFS3ERR_NOTEMPTY: p = "Directory not empty"; break;
714*0Sstevel@tonic-gate case NFS3ERR_DQUOT: p = "Disc quota exceeded"; break;
715*0Sstevel@tonic-gate case NFS3ERR_STALE: p = "Stale NFS file handle"; break;
716*0Sstevel@tonic-gate case NFS3ERR_REMOTE: p = "Too many levels of remote in path"; break;
717*0Sstevel@tonic-gate case NFS3ERR_BADHANDLE: p = "Illegal NFS file handle"; break;
718*0Sstevel@tonic-gate case NFS3ERR_NOT_SYNC: p = "Update synch mismatch"; break;
719*0Sstevel@tonic-gate case NFS3ERR_BAD_COOKIE:p = "Readdir cookie is stale"; break;
720*0Sstevel@tonic-gate case NFS3ERR_NOTSUPP: p = "Operation not supported"; break;
721*0Sstevel@tonic-gate case NFS3ERR_TOOSMALL: p = "Buffer/request too small"; break;
722*0Sstevel@tonic-gate case NFS3ERR_SERVERFAULT:p = "Server fault"; break;
723*0Sstevel@tonic-gate case NFS3ERR_BADTYPE: p = "Bad type"; break;
724*0Sstevel@tonic-gate case NFS3ERR_JUKEBOX: p = "File is temporarily unavailable"; break;
725*0Sstevel@tonic-gate default: p = "(unknown error)"; break;
726*0Sstevel@tonic-gate }
727*0Sstevel@tonic-gate
728*0Sstevel@tonic-gate (void) strcpy(line, p);
729*0Sstevel@tonic-gate return (status);
730*0Sstevel@tonic-gate }
731*0Sstevel@tonic-gate
732*0Sstevel@tonic-gate int
detail_nfsstat3()733*0Sstevel@tonic-gate detail_nfsstat3()
734*0Sstevel@tonic-gate {
735*0Sstevel@tonic-gate ulong_t status;
736*0Sstevel@tonic-gate char buff[64];
737*0Sstevel@tonic-gate int pos;
738*0Sstevel@tonic-gate
739*0Sstevel@tonic-gate pos = getxdr_pos();
740*0Sstevel@tonic-gate status = sum_nfsstat3(buff);
741*0Sstevel@tonic-gate
742*0Sstevel@tonic-gate (void) sprintf(get_line(pos, getxdr_pos()), "Status = %d (%s)",
743*0Sstevel@tonic-gate status, buff);
744*0Sstevel@tonic-gate
745*0Sstevel@tonic-gate return ((int)status);
746*0Sstevel@tonic-gate }
747*0Sstevel@tonic-gate
748*0Sstevel@tonic-gate static void
skip_postop()749*0Sstevel@tonic-gate skip_postop()
750*0Sstevel@tonic-gate {
751*0Sstevel@tonic-gate
752*0Sstevel@tonic-gate if (getxdr_bool())
753*0Sstevel@tonic-gate xdr_skip(21 * 4); /* XDR size of fattr3 */
754*0Sstevel@tonic-gate }
755*0Sstevel@tonic-gate
756*0Sstevel@tonic-gate static void
skip_wcc_data()757*0Sstevel@tonic-gate skip_wcc_data()
758*0Sstevel@tonic-gate {
759*0Sstevel@tonic-gate
760*0Sstevel@tonic-gate if (getxdr_bool() > 0)
761*0Sstevel@tonic-gate xdr_skip(3 * 8);
762*0Sstevel@tonic-gate skip_postop();
763*0Sstevel@tonic-gate }
764*0Sstevel@tonic-gate
765*0Sstevel@tonic-gate static void
skip_sattr3()766*0Sstevel@tonic-gate skip_sattr3()
767*0Sstevel@tonic-gate {
768*0Sstevel@tonic-gate
769*0Sstevel@tonic-gate if (getxdr_bool() > 0)
770*0Sstevel@tonic-gate xdr_skip(4); /* mode */
771*0Sstevel@tonic-gate if (getxdr_bool() > 0)
772*0Sstevel@tonic-gate xdr_skip(4); /* uid */
773*0Sstevel@tonic-gate if (getxdr_bool() > 0)
774*0Sstevel@tonic-gate xdr_skip(4); /* gid */
775*0Sstevel@tonic-gate if (getxdr_bool() > 0)
776*0Sstevel@tonic-gate xdr_skip(8); /* size */
777*0Sstevel@tonic-gate if (getxdr_bool() > 0)
778*0Sstevel@tonic-gate xdr_skip(8); /* atime */
779*0Sstevel@tonic-gate if (getxdr_bool() > 0)
780*0Sstevel@tonic-gate xdr_skip(8); /* mtime */
781*0Sstevel@tonic-gate }
782*0Sstevel@tonic-gate
783*0Sstevel@tonic-gate char *
sum_nfsfh3()784*0Sstevel@tonic-gate sum_nfsfh3()
785*0Sstevel@tonic-gate {
786*0Sstevel@tonic-gate int len;
787*0Sstevel@tonic-gate int fh;
788*0Sstevel@tonic-gate static char buff[16];
789*0Sstevel@tonic-gate
790*0Sstevel@tonic-gate len = getxdr_long();
791*0Sstevel@tonic-gate fh = sum_filehandle(len);
792*0Sstevel@tonic-gate (void) sprintf(buff, " FH=%04X", fh & 0xFFFF);
793*0Sstevel@tonic-gate return (buff);
794*0Sstevel@tonic-gate }
795*0Sstevel@tonic-gate
796*0Sstevel@tonic-gate void
detail_nfsfh3()797*0Sstevel@tonic-gate detail_nfsfh3()
798*0Sstevel@tonic-gate {
799*0Sstevel@tonic-gate int pos;
800*0Sstevel@tonic-gate int i, l, len;
801*0Sstevel@tonic-gate int fh;
802*0Sstevel@tonic-gate
803*0Sstevel@tonic-gate len = getxdr_long();
804*0Sstevel@tonic-gate pos = getxdr_pos();
805*0Sstevel@tonic-gate fh = sum_filehandle(len);
806*0Sstevel@tonic-gate setxdr_pos(pos);
807*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "File handle = [%04X]", fh & 0xFFFF);
808*0Sstevel@tonic-gate i = 0;
809*0Sstevel@tonic-gate while (i < len) {
810*0Sstevel@tonic-gate l = MIN(len - i, 32);
811*0Sstevel@tonic-gate (void) showxdr_hex(l, " %s");
812*0Sstevel@tonic-gate i += l;
813*0Sstevel@tonic-gate }
814*0Sstevel@tonic-gate }
815*0Sstevel@tonic-gate
816*0Sstevel@tonic-gate static char *
sum_access()817*0Sstevel@tonic-gate sum_access()
818*0Sstevel@tonic-gate {
819*0Sstevel@tonic-gate int bits;
820*0Sstevel@tonic-gate static char buff[64];
821*0Sstevel@tonic-gate
822*0Sstevel@tonic-gate bits = getxdr_u_long();
823*0Sstevel@tonic-gate buff[0] = '\0';
824*0Sstevel@tonic-gate
825*0Sstevel@tonic-gate if (bits & ACCESS3_READ)
826*0Sstevel@tonic-gate (void) strcat(buff, "read,");
827*0Sstevel@tonic-gate if (bits & ACCESS3_LOOKUP)
828*0Sstevel@tonic-gate (void) strcat(buff, "lookup,");
829*0Sstevel@tonic-gate if (bits & ACCESS3_MODIFY)
830*0Sstevel@tonic-gate (void) strcat(buff, "modify,");
831*0Sstevel@tonic-gate if (bits & ACCESS3_EXTEND)
832*0Sstevel@tonic-gate (void) strcat(buff, "extend,");
833*0Sstevel@tonic-gate if (bits & ACCESS3_DELETE)
834*0Sstevel@tonic-gate (void) strcat(buff, "delete,");
835*0Sstevel@tonic-gate if (bits & ACCESS3_EXECUTE)
836*0Sstevel@tonic-gate (void) strcat(buff, "execute,");
837*0Sstevel@tonic-gate if (buff[0] != '\0')
838*0Sstevel@tonic-gate buff[strlen(buff) - 1] = '\0';
839*0Sstevel@tonic-gate
840*0Sstevel@tonic-gate return (buff);
841*0Sstevel@tonic-gate }
842*0Sstevel@tonic-gate
843*0Sstevel@tonic-gate static void
detail_access()844*0Sstevel@tonic-gate detail_access()
845*0Sstevel@tonic-gate {
846*0Sstevel@tonic-gate uint_t bits;
847*0Sstevel@tonic-gate
848*0Sstevel@tonic-gate bits = showxdr_u_long("Access bits = 0x%08x");
849*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), " %s",
850*0Sstevel@tonic-gate getflag(bits, ACCESS3_READ, "Read", "(no read)"));
851*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), " %s",
852*0Sstevel@tonic-gate getflag(bits, ACCESS3_LOOKUP, "Lookup", "(no lookup)"));
853*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), " %s",
854*0Sstevel@tonic-gate getflag(bits, ACCESS3_MODIFY, "Modify", "(no modify)"));
855*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), " %s",
856*0Sstevel@tonic-gate getflag(bits, ACCESS3_EXTEND, "Extend", "(no extend)"));
857*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), " %s",
858*0Sstevel@tonic-gate getflag(bits, ACCESS3_DELETE, "Delete", "(no delete)"));
859*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), " %s",
860*0Sstevel@tonic-gate getflag(bits, ACCESS3_EXECUTE, "Execute", "(no execute)"));
861*0Sstevel@tonic-gate }
862*0Sstevel@tonic-gate
863*0Sstevel@tonic-gate static void
detail_mode(mode)864*0Sstevel@tonic-gate detail_mode(mode)
865*0Sstevel@tonic-gate int mode;
866*0Sstevel@tonic-gate {
867*0Sstevel@tonic-gate
868*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), " Mode = 0%o", mode);
869*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
870*0Sstevel@tonic-gate " Setuid = %d, Setgid = %d, Sticky = %d",
871*0Sstevel@tonic-gate (mode & S_ISUID) != 0,
872*0Sstevel@tonic-gate (mode & S_ISGID) != 0,
873*0Sstevel@tonic-gate (mode & S_ISVTX) != 0);
874*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), " Owner's permissions = %s",
875*0Sstevel@tonic-gate perms(mode >> 6 & 0x7));
876*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), " Group's permissions = %s",
877*0Sstevel@tonic-gate perms(mode >> 3 & 0x7));
878*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), " Other's permissions = %s",
879*0Sstevel@tonic-gate perms(mode & 0x7));
880*0Sstevel@tonic-gate }
881*0Sstevel@tonic-gate
882*0Sstevel@tonic-gate static void
detail_fattr3()883*0Sstevel@tonic-gate detail_fattr3()
884*0Sstevel@tonic-gate {
885*0Sstevel@tonic-gate uint_t fltype, mode, nlinks, uid, gid;
886*0Sstevel@tonic-gate uint_t major, minor;
887*0Sstevel@tonic-gate u_longlong_t size, used, fsid, fileid;
888*0Sstevel@tonic-gate
889*0Sstevel@tonic-gate fltype = getxdr_u_long();
890*0Sstevel@tonic-gate mode = getxdr_u_long();
891*0Sstevel@tonic-gate nlinks = getxdr_u_long();
892*0Sstevel@tonic-gate uid = getxdr_u_long();
893*0Sstevel@tonic-gate gid = getxdr_u_long();
894*0Sstevel@tonic-gate size = getxdr_u_longlong();
895*0Sstevel@tonic-gate used = getxdr_u_longlong();
896*0Sstevel@tonic-gate major = getxdr_u_long();
897*0Sstevel@tonic-gate minor = getxdr_u_long();
898*0Sstevel@tonic-gate fsid = getxdr_u_longlong();
899*0Sstevel@tonic-gate fileid = getxdr_u_longlong();
900*0Sstevel@tonic-gate
901*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
902*0Sstevel@tonic-gate " File type = %d (%s)",
903*0Sstevel@tonic-gate fltype, filetype(fltype));
904*0Sstevel@tonic-gate detail_mode(mode);
905*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
906*0Sstevel@tonic-gate " Link count = %u, User ID = %u, Group ID = %u",
907*0Sstevel@tonic-gate nlinks, uid, gid);
908*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
909*0Sstevel@tonic-gate " File size = %llu, Used = %llu",
910*0Sstevel@tonic-gate size, used);
911*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
912*0Sstevel@tonic-gate " Special: Major = %u, Minor = %u",
913*0Sstevel@tonic-gate major, minor);
914*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
915*0Sstevel@tonic-gate " File system id = %llu, File id = %llu",
916*0Sstevel@tonic-gate fsid, fileid);
917*0Sstevel@tonic-gate (void) showxdr_date_ns(" Last access time = %s");
918*0Sstevel@tonic-gate (void) showxdr_date_ns(" Modification time = %s");
919*0Sstevel@tonic-gate (void) showxdr_date_ns(" Attribute change time = %s");
920*0Sstevel@tonic-gate (void) show_line("");
921*0Sstevel@tonic-gate }
922*0Sstevel@tonic-gate
923*0Sstevel@tonic-gate static void
detail_sattr3()924*0Sstevel@tonic-gate detail_sattr3()
925*0Sstevel@tonic-gate {
926*0Sstevel@tonic-gate int t;
927*0Sstevel@tonic-gate
928*0Sstevel@tonic-gate if (getxdr_bool())
929*0Sstevel@tonic-gate detail_mode(getxdr_u_long());
930*0Sstevel@tonic-gate else
931*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Mode = (not set)");
932*0Sstevel@tonic-gate if (getxdr_bool())
933*0Sstevel@tonic-gate (void) showxdr_long("User ID = %d");
934*0Sstevel@tonic-gate else
935*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "User ID = (not set)");
936*0Sstevel@tonic-gate if (getxdr_bool())
937*0Sstevel@tonic-gate (void) showxdr_long("Group ID = %d");
938*0Sstevel@tonic-gate else
939*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Group ID = (not set)");
940*0Sstevel@tonic-gate if (getxdr_bool())
941*0Sstevel@tonic-gate (void) showxdr_u_longlong("Size = %llu");
942*0Sstevel@tonic-gate else
943*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Size = (not set)");
944*0Sstevel@tonic-gate
945*0Sstevel@tonic-gate if ((t = getxdr_u_long()) == SET_TO_CLIENT_TIME)
946*0Sstevel@tonic-gate (void) showxdr_date("Access time = %s (set to client time)");
947*0Sstevel@tonic-gate else if (t == SET_TO_SERVER_TIME)
948*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
949*0Sstevel@tonic-gate "Access time = (set to server time)");
950*0Sstevel@tonic-gate else
951*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Access time = (do not set)");
952*0Sstevel@tonic-gate
953*0Sstevel@tonic-gate if ((t = getxdr_u_long()) == SET_TO_CLIENT_TIME) {
954*0Sstevel@tonic-gate (void) showxdr_date(
955*0Sstevel@tonic-gate "Modification time = %s (set to client time)");
956*0Sstevel@tonic-gate } else if (t == SET_TO_SERVER_TIME)
957*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
958*0Sstevel@tonic-gate "Modification time = (set to server time)");
959*0Sstevel@tonic-gate else
960*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
961*0Sstevel@tonic-gate "Modification time = (do not set)");
962*0Sstevel@tonic-gate (void) show_line("");
963*0Sstevel@tonic-gate }
964*0Sstevel@tonic-gate
965*0Sstevel@tonic-gate static char *
filetype(n)966*0Sstevel@tonic-gate filetype(n)
967*0Sstevel@tonic-gate int n;
968*0Sstevel@tonic-gate {
969*0Sstevel@tonic-gate
970*0Sstevel@tonic-gate switch (n) {
971*0Sstevel@tonic-gate case NF3REG:
972*0Sstevel@tonic-gate return ("Regular File");
973*0Sstevel@tonic-gate case NF3DIR:
974*0Sstevel@tonic-gate return ("Directory");
975*0Sstevel@tonic-gate case NF3BLK:
976*0Sstevel@tonic-gate return ("Block special");
977*0Sstevel@tonic-gate case NF3CHR:
978*0Sstevel@tonic-gate return ("Character special");
979*0Sstevel@tonic-gate case NF3LNK:
980*0Sstevel@tonic-gate return ("Symbolic Link");
981*0Sstevel@tonic-gate case NF3SOCK:
982*0Sstevel@tonic-gate return ("Unix domain socket");
983*0Sstevel@tonic-gate case NF3FIFO:
984*0Sstevel@tonic-gate return ("Named pipe");
985*0Sstevel@tonic-gate default:
986*0Sstevel@tonic-gate return ("?");
987*0Sstevel@tonic-gate }
988*0Sstevel@tonic-gate /* NOTREACHED */
989*0Sstevel@tonic-gate }
990*0Sstevel@tonic-gate
991*0Sstevel@tonic-gate static char *
perms(n)992*0Sstevel@tonic-gate perms(n)
993*0Sstevel@tonic-gate int n;
994*0Sstevel@tonic-gate {
995*0Sstevel@tonic-gate static char buff[4];
996*0Sstevel@tonic-gate
997*0Sstevel@tonic-gate buff[0] = n & 4 ? 'r' : '-';
998*0Sstevel@tonic-gate buff[1] = n & 2 ? 'w' : '-';
999*0Sstevel@tonic-gate buff[2] = n & 1 ? 'x' : '-';
1000*0Sstevel@tonic-gate buff[3] = '\0';
1001*0Sstevel@tonic-gate return (buff);
1002*0Sstevel@tonic-gate }
1003*0Sstevel@tonic-gate
1004*0Sstevel@tonic-gate static void
detail_wcc_attr()1005*0Sstevel@tonic-gate detail_wcc_attr()
1006*0Sstevel@tonic-gate {
1007*0Sstevel@tonic-gate
1008*0Sstevel@tonic-gate (void) showxdr_u_longlong(" Size = %llu bytes");
1009*0Sstevel@tonic-gate (void) showxdr_date_ns(" Modification time = %s");
1010*0Sstevel@tonic-gate (void) showxdr_date_ns(" Attribute change time = %s");
1011*0Sstevel@tonic-gate (void) show_line("");
1012*0Sstevel@tonic-gate }
1013*0Sstevel@tonic-gate
1014*0Sstevel@tonic-gate static void
detail_pre_op_attr(str)1015*0Sstevel@tonic-gate detail_pre_op_attr(str)
1016*0Sstevel@tonic-gate char *str;
1017*0Sstevel@tonic-gate {
1018*0Sstevel@tonic-gate
1019*0Sstevel@tonic-gate if (getxdr_bool()) {
1020*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
1021*0Sstevel@tonic-gate "Pre-operation attributes: %s", str);
1022*0Sstevel@tonic-gate detail_wcc_attr();
1023*0Sstevel@tonic-gate } else
1024*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
1025*0Sstevel@tonic-gate "Pre-operation attributes: %s (not available)", str);
1026*0Sstevel@tonic-gate }
1027*0Sstevel@tonic-gate
1028*0Sstevel@tonic-gate void
detail_post_op_attr(str)1029*0Sstevel@tonic-gate detail_post_op_attr(str)
1030*0Sstevel@tonic-gate char *str;
1031*0Sstevel@tonic-gate {
1032*0Sstevel@tonic-gate
1033*0Sstevel@tonic-gate if (getxdr_bool()) {
1034*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
1035*0Sstevel@tonic-gate "Post-operation attributes: %s", str);
1036*0Sstevel@tonic-gate detail_fattr3();
1037*0Sstevel@tonic-gate } else
1038*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
1039*0Sstevel@tonic-gate "Post-operation attributes: %s (not available)", str);
1040*0Sstevel@tonic-gate }
1041*0Sstevel@tonic-gate
1042*0Sstevel@tonic-gate static void
detail_wcc_data(str)1043*0Sstevel@tonic-gate detail_wcc_data(str)
1044*0Sstevel@tonic-gate char *str;
1045*0Sstevel@tonic-gate {
1046*0Sstevel@tonic-gate
1047*0Sstevel@tonic-gate detail_pre_op_attr(str);
1048*0Sstevel@tonic-gate detail_post_op_attr(str);
1049*0Sstevel@tonic-gate }
1050*0Sstevel@tonic-gate
1051*0Sstevel@tonic-gate static char *
sum_readdirres()1052*0Sstevel@tonic-gate sum_readdirres()
1053*0Sstevel@tonic-gate {
1054*0Sstevel@tonic-gate static char buff[NFS_MAXNAMLEN + 1]; /* protocol allows longer names */
1055*0Sstevel@tonic-gate static int entries;
1056*0Sstevel@tonic-gate
1057*0Sstevel@tonic-gate entries = 0;
1058*0Sstevel@tonic-gate if (setjmp(xdr_err)) {
1059*0Sstevel@tonic-gate (void) sprintf(buff, " %d+ entries (incomplete)", entries);
1060*0Sstevel@tonic-gate return (buff);
1061*0Sstevel@tonic-gate }
1062*0Sstevel@tonic-gate skip_postop();
1063*0Sstevel@tonic-gate xdr_skip(8); /* cookieverf */
1064*0Sstevel@tonic-gate while (getxdr_bool()) {
1065*0Sstevel@tonic-gate entries++;
1066*0Sstevel@tonic-gate xdr_skip(8); /* fileid */
1067*0Sstevel@tonic-gate (void) getxdr_string(buff, NFS_MAXNAMLEN); /* name */
1068*0Sstevel@tonic-gate xdr_skip(8); /* cookie */
1069*0Sstevel@tonic-gate }
1070*0Sstevel@tonic-gate
1071*0Sstevel@tonic-gate (void) sprintf(buff, " %d entries (%s)",
1072*0Sstevel@tonic-gate entries, getxdr_bool() ? "No more" : "More");
1073*0Sstevel@tonic-gate return (buff);
1074*0Sstevel@tonic-gate }
1075*0Sstevel@tonic-gate
1076*0Sstevel@tonic-gate static char *
sum_readdirplusres()1077*0Sstevel@tonic-gate sum_readdirplusres()
1078*0Sstevel@tonic-gate {
1079*0Sstevel@tonic-gate static char buff[NFS_MAXNAMLEN + 1]; /* protocol allows longer */
1080*0Sstevel@tonic-gate static int entries;
1081*0Sstevel@tonic-gate int skip;
1082*0Sstevel@tonic-gate
1083*0Sstevel@tonic-gate entries = 0;
1084*0Sstevel@tonic-gate if (setjmp(xdr_err)) {
1085*0Sstevel@tonic-gate (void) sprintf(buff, " %d+ entries (incomplete)", entries);
1086*0Sstevel@tonic-gate return (buff);
1087*0Sstevel@tonic-gate }
1088*0Sstevel@tonic-gate skip_postop();
1089*0Sstevel@tonic-gate xdr_skip(8); /* cookieverf */
1090*0Sstevel@tonic-gate while (getxdr_bool()) {
1091*0Sstevel@tonic-gate entries++;
1092*0Sstevel@tonic-gate xdr_skip(8); /* fileid */
1093*0Sstevel@tonic-gate (void) getxdr_string(buff, NFS_MAXNAMLEN); /* name */
1094*0Sstevel@tonic-gate xdr_skip(8); /* cookie */
1095*0Sstevel@tonic-gate skip_postop(); /* post-op */
1096*0Sstevel@tonic-gate if (getxdr_bool()) {
1097*0Sstevel@tonic-gate skip = getxdr_long();
1098*0Sstevel@tonic-gate xdr_skip(RNDUP(skip)); /* fhandle */
1099*0Sstevel@tonic-gate }
1100*0Sstevel@tonic-gate }
1101*0Sstevel@tonic-gate
1102*0Sstevel@tonic-gate (void) sprintf(buff, " %d entries (%s)",
1103*0Sstevel@tonic-gate entries, getxdr_bool() ? "No more" : "More");
1104*0Sstevel@tonic-gate return (buff);
1105*0Sstevel@tonic-gate }
1106*0Sstevel@tonic-gate
1107*0Sstevel@tonic-gate static void
detail_readdirres()1108*0Sstevel@tonic-gate detail_readdirres()
1109*0Sstevel@tonic-gate {
1110*0Sstevel@tonic-gate static int entries;
1111*0Sstevel@tonic-gate u_longlong_t fileid, cookie;
1112*0Sstevel@tonic-gate char *name;
1113*0Sstevel@tonic-gate char buff[NFS_MAXNAMLEN + 1]; /* protocol allows longer names */
1114*0Sstevel@tonic-gate
1115*0Sstevel@tonic-gate entries = 0;
1116*0Sstevel@tonic-gate detail_post_op_attr("");
1117*0Sstevel@tonic-gate (void) showxdr_hex(8, "Cookie verifier = %s");
1118*0Sstevel@tonic-gate (void) show_line("");
1119*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), " File id Cookie Name");
1120*0Sstevel@tonic-gate
1121*0Sstevel@tonic-gate if (setjmp(xdr_err)) {
1122*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
1123*0Sstevel@tonic-gate " %d+ entries. (Frame is incomplete)",
1124*0Sstevel@tonic-gate entries);
1125*0Sstevel@tonic-gate return;
1126*0Sstevel@tonic-gate }
1127*0Sstevel@tonic-gate while (getxdr_bool()) {
1128*0Sstevel@tonic-gate entries++;
1129*0Sstevel@tonic-gate fileid = getxdr_u_longlong();
1130*0Sstevel@tonic-gate name = (char *)getxdr_string(buff, NFS_MAXNAMLEN);
1131*0Sstevel@tonic-gate cookie = getxdr_u_longlong();
1132*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
1133*0Sstevel@tonic-gate " %10llu %10llu %s",
1134*0Sstevel@tonic-gate fileid, cookie, name);
1135*0Sstevel@tonic-gate }
1136*0Sstevel@tonic-gate
1137*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), " %d entries", entries);
1138*0Sstevel@tonic-gate (void) showxdr_bool("EOF = %s");
1139*0Sstevel@tonic-gate }
1140*0Sstevel@tonic-gate
1141*0Sstevel@tonic-gate static void
detail_readdirplusres()1142*0Sstevel@tonic-gate detail_readdirplusres()
1143*0Sstevel@tonic-gate {
1144*0Sstevel@tonic-gate static int entries;
1145*0Sstevel@tonic-gate
1146*0Sstevel@tonic-gate entries = 0;
1147*0Sstevel@tonic-gate detail_post_op_attr("");
1148*0Sstevel@tonic-gate (void) showxdr_hex(8, "Cookie verifier = %s");
1149*0Sstevel@tonic-gate (void) show_line("");
1150*0Sstevel@tonic-gate
1151*0Sstevel@tonic-gate if (setjmp(xdr_err)) {
1152*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
1153*0Sstevel@tonic-gate " %d+ entries. (Frame is incomplete)",
1154*0Sstevel@tonic-gate entries);
1155*0Sstevel@tonic-gate return;
1156*0Sstevel@tonic-gate }
1157*0Sstevel@tonic-gate while (getxdr_bool()) {
1158*0Sstevel@tonic-gate entries++;
1159*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
1160*0Sstevel@tonic-gate "------------------ entry #%d",
1161*0Sstevel@tonic-gate entries);
1162*0Sstevel@tonic-gate (void) showxdr_u_longlong("File ID = %llu");
1163*0Sstevel@tonic-gate (void) showxdr_string(NFS_MAXNAMLEN, "Name = %s");
1164*0Sstevel@tonic-gate (void) showxdr_u_longlong("Cookie = %llu");
1165*0Sstevel@tonic-gate detail_post_op_attr("");
1166*0Sstevel@tonic-gate if (getxdr_bool())
1167*0Sstevel@tonic-gate detail_nfsfh3();
1168*0Sstevel@tonic-gate else
1169*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
1170*0Sstevel@tonic-gate "(No file handle available)");
1171*0Sstevel@tonic-gate }
1172*0Sstevel@tonic-gate
1173*0Sstevel@tonic-gate (void) show_line("");
1174*0Sstevel@tonic-gate (void) sprintf(get_line(0, 0), " %d entries", entries);
1175*0Sstevel@tonic-gate (void) showxdr_bool("EOF = %s");
1176*0Sstevel@tonic-gate }
1177*0Sstevel@tonic-gate
1178*0Sstevel@tonic-gate static char *
sum_createhow()1179*0Sstevel@tonic-gate sum_createhow()
1180*0Sstevel@tonic-gate {
1181*0Sstevel@tonic-gate long how;
1182*0Sstevel@tonic-gate
1183*0Sstevel@tonic-gate how = getxdr_long();
1184*0Sstevel@tonic-gate switch (how) {
1185*0Sstevel@tonic-gate case UNCHECKED:
1186*0Sstevel@tonic-gate return ("UNCHECKED");
1187*0Sstevel@tonic-gate case GUARDED:
1188*0Sstevel@tonic-gate return ("GUARDED");
1189*0Sstevel@tonic-gate case EXCLUSIVE:
1190*0Sstevel@tonic-gate return ("EXCLUSIVE");
1191*0Sstevel@tonic-gate default:
1192*0Sstevel@tonic-gate return ("?");
1193*0Sstevel@tonic-gate }
1194*0Sstevel@tonic-gate /* NOTREACHED */
1195*0Sstevel@tonic-gate }
1196*0Sstevel@tonic-gate
1197*0Sstevel@tonic-gate static char *
sum_stablehow()1198*0Sstevel@tonic-gate sum_stablehow()
1199*0Sstevel@tonic-gate {
1200*0Sstevel@tonic-gate long stable;
1201*0Sstevel@tonic-gate
1202*0Sstevel@tonic-gate stable = getxdr_long();
1203*0Sstevel@tonic-gate switch (stable) {
1204*0Sstevel@tonic-gate case UNSTABLE:
1205*0Sstevel@tonic-gate return ("ASYNC");
1206*0Sstevel@tonic-gate case DATA_SYNC:
1207*0Sstevel@tonic-gate return ("DSYNC");
1208*0Sstevel@tonic-gate case FILE_SYNC:
1209*0Sstevel@tonic-gate return ("FSYNC");
1210*0Sstevel@tonic-gate default:
1211*0Sstevel@tonic-gate return ("?");
1212*0Sstevel@tonic-gate }
1213*0Sstevel@tonic-gate /* NOTREACHED */
1214*0Sstevel@tonic-gate }
1215