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