17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5cef4cb45San  * Common Development and Distribution License (the "License").
6cef4cb45San  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21bbe876c0SMarcel Telka 
22bbe876c0SMarcel Telka /*
23bbe876c0SMarcel Telka  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
24bbe876c0SMarcel Telka  */
25bbe876c0SMarcel Telka 
267c478bd9Sstevel@tonic-gate /*
272f172c55SRobert Thurlow  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
287c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
297c478bd9Sstevel@tonic-gate  */
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #include <ctype.h>
327c478bd9Sstevel@tonic-gate #include <string.h>
337c478bd9Sstevel@tonic-gate #include <strings.h>
347c478bd9Sstevel@tonic-gate #include <stdlib.h>
357c478bd9Sstevel@tonic-gate #include <sys/types.h>
367c478bd9Sstevel@tonic-gate #include <sys/errno.h>
377c478bd9Sstevel@tonic-gate #include <sys/tiuser.h>
387c478bd9Sstevel@tonic-gate #include <setjmp.h>
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #include <rpc/types.h>
417c478bd9Sstevel@tonic-gate #include <rpc/xdr.h>
427c478bd9Sstevel@tonic-gate #include <rpc/auth.h>
437c478bd9Sstevel@tonic-gate #include <rpc/clnt.h>
447c478bd9Sstevel@tonic-gate #include <rpc/rpc_msg.h>
457c478bd9Sstevel@tonic-gate #include "snoop.h"
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate #include <sys/stat.h>
487c478bd9Sstevel@tonic-gate #include <sys/param.h>
4919f828dfSToomas Soome #include <sys/sysmacros.h>
507c478bd9Sstevel@tonic-gate #include <rpcsvc/nfs_prot.h>
517c478bd9Sstevel@tonic-gate /* use the same nfs4_prot.h as the xdr code */
527c478bd9Sstevel@tonic-gate #include "rpcsvc/nfs4_prot.h"
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate /*
557c478bd9Sstevel@tonic-gate  * XXX With NFS v2 and v3, we only need to xdr the pieces that we care
567c478bd9Sstevel@tonic-gate  * about.  Anything else we can ignore and just skip to the next packet.
577c478bd9Sstevel@tonic-gate  * So all the stuff that deals directly with XDR lives in snoop_display.c
587c478bd9Sstevel@tonic-gate  * With v4, we need to XDR entire structures so that we can skip over
597c478bd9Sstevel@tonic-gate  * uninteresting bits in a compound array, so we call XDR directly from
607c478bd9Sstevel@tonic-gate  * here.  We need to rethink how we're going to structure XDR access.  Do
617c478bd9Sstevel@tonic-gate  * we continue to hide it all in snoop_display.c, or do we expose it to all
627c478bd9Sstevel@tonic-gate  * the protocol modules?
637c478bd9Sstevel@tonic-gate  */
647c478bd9Sstevel@tonic-gate extern XDR xdrm;
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate #ifndef MIN
677c478bd9Sstevel@tonic-gate #define	MIN(a, b)	((a) < (b) ? (a) : (b))
687c478bd9Sstevel@tonic-gate #endif
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate /*
717c478bd9Sstevel@tonic-gate  * Maximum number of characters to display in compound4 summary line.
727c478bd9Sstevel@tonic-gate  */
737c478bd9Sstevel@tonic-gate #define	SUM_COMPND_MAX	100
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate /*
767c478bd9Sstevel@tonic-gate  * Maximum number of recognized attributes.
777c478bd9Sstevel@tonic-gate  */
787c478bd9Sstevel@tonic-gate #define	MAX_ATTRIBUTES	56
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate /*
817c478bd9Sstevel@tonic-gate  * This data structure provides a more convenient way to access an
827c478bd9Sstevel@tonic-gate  * attribute bitmask.  map[N] = value of bit N in a bitmap4.
837c478bd9Sstevel@tonic-gate  * It's defined as a struct so as to step around all the weird rules in C
847c478bd9Sstevel@tonic-gate  * about arrays, pointers, passing them as arguments, etc.
857c478bd9Sstevel@tonic-gate  */
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate typedef struct {
887c478bd9Sstevel@tonic-gate 	char map[MAX_ATTRIBUTES];
897c478bd9Sstevel@tonic-gate } unpkd_attrmap_t;
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate static void sumarg_cb_getattr(char *buf, size_t buflen, void *obj);
937c478bd9Sstevel@tonic-gate static void dtlarg_cb_getattr(void *obj);
947c478bd9Sstevel@tonic-gate static void sumarg_cb_recall(char *buf, size_t buflen, void *obj);
957c478bd9Sstevel@tonic-gate static void dtlarg_cb_recall(void *obj);
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate static void sumarg_access(char *buf, size_t buflen, void *obj);
997c478bd9Sstevel@tonic-gate static void dtlarg_access(void *obj);
1007c478bd9Sstevel@tonic-gate static void sumarg_close(char *buf, size_t buflen, void *obj);
1017c478bd9Sstevel@tonic-gate static void dtlarg_close(void *obj);
1027c478bd9Sstevel@tonic-gate static void sumarg_commit(char *buf, size_t buflen, void *obj);
1037c478bd9Sstevel@tonic-gate static void dtlarg_commit(void *obj);
1047c478bd9Sstevel@tonic-gate static void sumarg_compnt(char *buf, size_t buflen, void *obj);
1057c478bd9Sstevel@tonic-gate static void dtlarg_compnt(void *obj);
1067c478bd9Sstevel@tonic-gate static void sumarg_create(char *buf, size_t buflen, void *obj);
1077c478bd9Sstevel@tonic-gate static void dtlarg_create(void *obj);
1087c478bd9Sstevel@tonic-gate static void sumarg_delprge(char *buf, size_t buflen, void *obj);
1097c478bd9Sstevel@tonic-gate static void dtlarg_delprge(void *obj);
1107c478bd9Sstevel@tonic-gate static void sumarg_delret(char *buf, size_t buflen, void *obj);
1117c478bd9Sstevel@tonic-gate static void dtlarg_delret(void *obj);
1127c478bd9Sstevel@tonic-gate static void sumarg_getattr(char *buf, size_t buflen, void *obj);
1137c478bd9Sstevel@tonic-gate static void dtlarg_getattr(void *obj);
1147c478bd9Sstevel@tonic-gate static void sumarg_link(char *buf, size_t buflen, void *obj);
1157c478bd9Sstevel@tonic-gate static void dtlarg_link(void *obj);
1167c478bd9Sstevel@tonic-gate static void sum_open_to_lock_owner(char *buf, int buflen,
1177c478bd9Sstevel@tonic-gate 					open_to_lock_owner4 *own);
1187c478bd9Sstevel@tonic-gate static void sum_exist_lock_owner(char *buf, int buflen,
1197c478bd9Sstevel@tonic-gate 					exist_lock_owner4 *own);
1207c478bd9Sstevel@tonic-gate static void sum_locker(char *buf, size_t buflen, locker4 *lk);
1217c478bd9Sstevel@tonic-gate static void sumarg_lock(char *buf, size_t buflen, void *obj);
1227c478bd9Sstevel@tonic-gate static void detail_open_to_lock_owner(open_to_lock_owner4 *own);
1237c478bd9Sstevel@tonic-gate static void detail_exist_lock_owner(exist_lock_owner4 *own);
1247c478bd9Sstevel@tonic-gate static void detail_locker(locker4 *lk);
1257c478bd9Sstevel@tonic-gate static void dtlarg_lock(void *obj);
1267c478bd9Sstevel@tonic-gate static void sumarg_lockt(char *buf, size_t buflen, void *obj);
1277c478bd9Sstevel@tonic-gate static void dtlarg_lockt(void *obj);
1287c478bd9Sstevel@tonic-gate static void sumarg_locku(char *buf, size_t buflen, void *obj);
1297c478bd9Sstevel@tonic-gate static void dtlarg_locku(void *obj);
1307c478bd9Sstevel@tonic-gate static void sumarg_lookup(char *buf, size_t buflen, void *obj);
1317c478bd9Sstevel@tonic-gate static void dtlarg_lookup(void *obj);
1327c478bd9Sstevel@tonic-gate static void sumarg_open(char *buf, size_t buflen, void *obj);
1337c478bd9Sstevel@tonic-gate static void dtlarg_open(void *obj);
1347c478bd9Sstevel@tonic-gate static void sumarg_openattr(char *buf, size_t buflen, void *obj);
1357c478bd9Sstevel@tonic-gate static void dtlarg_openattr(void *obj);
1367c478bd9Sstevel@tonic-gate static void sumarg_open_confirm(char *buf, size_t buflen, void *obj);
1377c478bd9Sstevel@tonic-gate static void dtlarg_open_confirm(void *obj);
1387c478bd9Sstevel@tonic-gate static void sumarg_open_downgrd(char *buf, size_t buflen, void *obj);
1397c478bd9Sstevel@tonic-gate static void dtlarg_open_downgrd(void *obj);
1407c478bd9Sstevel@tonic-gate static void sumarg_putfh(char *buf, size_t buflen, void *obj);
1417c478bd9Sstevel@tonic-gate static void dtlarg_putfh(void *obj);
1427c478bd9Sstevel@tonic-gate static void sumarg_read(char *buf, size_t buflen, void *obj);
1437c478bd9Sstevel@tonic-gate static void dtlarg_read(void *obj);
1447c478bd9Sstevel@tonic-gate static void sumarg_readdir(char *buf, size_t buflen, void *obj);
1457c478bd9Sstevel@tonic-gate static void dtlarg_readdir(void *obj);
1467c478bd9Sstevel@tonic-gate static void sumarg_release_lkown(char *buf, size_t buflen, void *obj);
1477c478bd9Sstevel@tonic-gate static void dtlarg_release_lkown(void *obj);
1487c478bd9Sstevel@tonic-gate static void sumarg_rename(char *buf, size_t buflen, void *obj);
1497c478bd9Sstevel@tonic-gate static void dtlarg_rename(void *obj);
1507c478bd9Sstevel@tonic-gate static void sumarg_renew(char *buf, size_t buflen, void *obj);
1517c478bd9Sstevel@tonic-gate static void dtlarg_renew(void *buf);
1527c478bd9Sstevel@tonic-gate static void sumarg_secinfo(char *buf, size_t buflen, void *obj);
1537c478bd9Sstevel@tonic-gate static void dtlarg_secinfo(void *obj);
1547c478bd9Sstevel@tonic-gate static void sumarg_setattr(char *buf, size_t buflen, void *obj);
1557c478bd9Sstevel@tonic-gate static void dtlarg_setattr(void *obj);
1567c478bd9Sstevel@tonic-gate static void sumarg_setclid(char *buf, size_t buflen, void *obj);
1577c478bd9Sstevel@tonic-gate static void dtlarg_setclid(void *obj);
1587c478bd9Sstevel@tonic-gate static void sumarg_setclid_cfm(char *buf, size_t buflen, void *obj);
1597c478bd9Sstevel@tonic-gate static void dtlarg_setclid_cfm(void *obj);
1607c478bd9Sstevel@tonic-gate static void dtlarg_verify(void *obj);
1617c478bd9Sstevel@tonic-gate static void sumarg_write(char *buf, size_t buflen, void *obj);
1627c478bd9Sstevel@tonic-gate static void dtlarg_write(void *obj);
1637c478bd9Sstevel@tonic-gate 
1647c478bd9Sstevel@tonic-gate static void sumres_cb_getattr(char *buf, size_t buflen, void *obj);
1657c478bd9Sstevel@tonic-gate static void dtlres_cb_getattr(void *obj);
1667c478bd9Sstevel@tonic-gate 
1677c478bd9Sstevel@tonic-gate static void sumres_access(char *buf, size_t buflen, void *obj);
1687c478bd9Sstevel@tonic-gate static void dtlres_access(void *obj);
1697c478bd9Sstevel@tonic-gate static void sumres_close(char *buf, size_t buflen, void *obj);
1707c478bd9Sstevel@tonic-gate static void dtlres_close(void *obj);
1717c478bd9Sstevel@tonic-gate static void sumres_commit(char *buf, size_t buflen, void *obj);
1727c478bd9Sstevel@tonic-gate static void dtlres_commit(void *obj);
1737c478bd9Sstevel@tonic-gate static void dtlres_create(void *obj);
1747c478bd9Sstevel@tonic-gate static void sumres_getattr(char *buf, size_t buflen, void *obj);
1757c478bd9Sstevel@tonic-gate static void dtlres_getattr(void *obj);
1767c478bd9Sstevel@tonic-gate static void sumres_getfh(char *buf, size_t buflen, void *obj);
1777c478bd9Sstevel@tonic-gate static void dtlres_getfh(void *obj);
1787c478bd9Sstevel@tonic-gate static void dtlres_link(void *obj);
1797c478bd9Sstevel@tonic-gate static void sumres_lock(char *buf, size_t buflen, void *obj);
1807c478bd9Sstevel@tonic-gate static void dtlres_lock(void *obj);
1817c478bd9Sstevel@tonic-gate static void sumres_lockt(char *buf, size_t buflen, void *obj);
1827c478bd9Sstevel@tonic-gate static void dtlres_lockt(void *obj);
1837c478bd9Sstevel@tonic-gate static void sumres_locku(char *buf, size_t buflen, void *obj);
1847c478bd9Sstevel@tonic-gate static void dtlres_locku(void *obj);
1857c478bd9Sstevel@tonic-gate static void sumres_open(char *buf, size_t buflen, void *obj);
1867c478bd9Sstevel@tonic-gate static void dtlres_open(void *obj);
1877c478bd9Sstevel@tonic-gate static void sumres_open_confirm(char *buf, size_t buflen, void *obj);
1887c478bd9Sstevel@tonic-gate static void dtlres_open_confirm(void *obj);
1897c478bd9Sstevel@tonic-gate static void sumres_open_downgrd(char *buf, size_t buflen, void *obj);
1907c478bd9Sstevel@tonic-gate static void dtlres_open_downgrd(void *obj);
1917c478bd9Sstevel@tonic-gate static void sumres_read(char *buf, size_t buflen, void *obj);
1927c478bd9Sstevel@tonic-gate static void dtlres_read(void *obj);
1937c478bd9Sstevel@tonic-gate static void sumres_readdir(char *buf, size_t buflen, void *obj);
1947c478bd9Sstevel@tonic-gate static void dtlres_readdir(void *obj);
1957c478bd9Sstevel@tonic-gate static void sumres_readlnk(char *buf, size_t buflen, void *obj);
1967c478bd9Sstevel@tonic-gate static void dtlres_readlnk(void *obj);
1977c478bd9Sstevel@tonic-gate static void dtlres_remove(void *obj);
1987c478bd9Sstevel@tonic-gate static void dtlres_rename(void *obj);
1997c478bd9Sstevel@tonic-gate static void sumres_secinfo(char *buf, size_t buflen, void *obj);
2007c478bd9Sstevel@tonic-gate static void dtlres_secinfo(void *obj);
2017c478bd9Sstevel@tonic-gate static void sumres_setattr(char *buf, size_t buflen, void *obj);
2027c478bd9Sstevel@tonic-gate static void dtlres_setattr(void *obj);
2037c478bd9Sstevel@tonic-gate static void sumres_setclid(char *buf, size_t buflen, void *obj);
2047c478bd9Sstevel@tonic-gate static void dtlres_setclid(void *obj);
2057c478bd9Sstevel@tonic-gate static void sumres_write(char *buf, size_t buflen, void *obj);
2067c478bd9Sstevel@tonic-gate static void dtlres_write(void *obj);
2077c478bd9Sstevel@tonic-gate static void sum_nfsstat4(char *buf, size_t buflen, void *obj);
2087c478bd9Sstevel@tonic-gate static void dtl_nfsstat4(void *obj);
2097c478bd9Sstevel@tonic-gate static uint32_t adler16(void *, int);
2107c478bd9Sstevel@tonic-gate static void nfs4_xdr_skip(int nbytes);
2117c478bd9Sstevel@tonic-gate static char *sum_lock_type_name(enum nfs_lock_type4 type);
2127c478bd9Sstevel@tonic-gate 
2137c478bd9Sstevel@tonic-gate int nfs4_pkt_start;
2147c478bd9Sstevel@tonic-gate int nfs4_pkt_len;
2157c478bd9Sstevel@tonic-gate int nfs4_skip_bytes;
2167c478bd9Sstevel@tonic-gate int nfs4_fragged_rpc;
2177c478bd9Sstevel@tonic-gate char *nfs4err_fragrpc = "<Fragmented RPC>";
2187c478bd9Sstevel@tonic-gate char *nfs4err_xdrfrag = "<XDR Error or Fragmented RPC>";
2197c478bd9Sstevel@tonic-gate 
2207c478bd9Sstevel@tonic-gate /*
2217c478bd9Sstevel@tonic-gate  * need a way to enable this if current testcases are parsing snoop
2227c478bd9Sstevel@tonic-gate  * error text. -- maybe an env var would do as temp workaround until
2237c478bd9Sstevel@tonic-gate  * testcases changed to grep for new error text.
2247c478bd9Sstevel@tonic-gate  */
2257c478bd9Sstevel@tonic-gate int nfs4_use_old_error_text = 0;
2267c478bd9Sstevel@tonic-gate 
2277c478bd9Sstevel@tonic-gate /*
2287c478bd9Sstevel@tonic-gate  * Information about each operation that can appear in a compound call.
2297c478bd9Sstevel@tonic-gate  * The function pointers are to formatting functions for summary arguments
2307c478bd9Sstevel@tonic-gate  * and results, and detail arguments & results.
2317c478bd9Sstevel@tonic-gate  */
2327c478bd9Sstevel@tonic-gate 
2337c478bd9Sstevel@tonic-gate typedef struct {
2347c478bd9Sstevel@tonic-gate 	char	*name;
2357c478bd9Sstevel@tonic-gate 	void	(*sumarg)(char *, size_t, void *);
2367c478bd9Sstevel@tonic-gate 	void	(*sumres)(char *, size_t, void *);
2377c478bd9Sstevel@tonic-gate 	void	(*dtlarg)(void *);
2387c478bd9Sstevel@tonic-gate 	void	(*dtlres)(void *);
2397c478bd9Sstevel@tonic-gate } op_info_t;
2407c478bd9Sstevel@tonic-gate 
2417c478bd9Sstevel@tonic-gate static op_info_t cb_opcode_info[] = {
2427c478bd9Sstevel@tonic-gate 	{"OP_ZERO",	NULL,	NULL,	NULL,	NULL},	/* 0 */
2437c478bd9Sstevel@tonic-gate 	{"OP_ONE",	NULL,	NULL,	NULL,	NULL},
2447c478bd9Sstevel@tonic-gate 	{"OP_TWO",	NULL,	NULL,	NULL,	NULL},  /* minor vers */
2457c478bd9Sstevel@tonic-gate 	{"CB_GETATTR",
2467c478bd9Sstevel@tonic-gate 		sumarg_cb_getattr,	sumres_cb_getattr,
2477c478bd9Sstevel@tonic-gate 		dtlarg_cb_getattr,	dtlres_cb_getattr},
2487c478bd9Sstevel@tonic-gate 	{"CB_RECALL",
2497c478bd9Sstevel@tonic-gate 		sumarg_cb_recall,	sum_nfsstat4,
2507c478bd9Sstevel@tonic-gate 		dtlarg_cb_recall,	dtl_nfsstat4},
2517c478bd9Sstevel@tonic-gate };
25219f828dfSToomas Soome static uint_t cb_num_opcodes = ARRAY_SIZE(cb_opcode_info);
2537c478bd9Sstevel@tonic-gate 
2547c478bd9Sstevel@tonic-gate static op_info_t opcode_info[] = {
2557c478bd9Sstevel@tonic-gate 	{"OP_ZERO",	NULL,	NULL,	NULL,	NULL},	/* 0 */
2567c478bd9Sstevel@tonic-gate 	{"OP_ONE",	NULL,	NULL,	NULL,	NULL},
2577c478bd9Sstevel@tonic-gate 	{"OP_TWO",	NULL,	NULL,	NULL,	NULL},  /* minor vers */
2587c478bd9Sstevel@tonic-gate 	{"ACCESS",
2597c478bd9Sstevel@tonic-gate 	sumarg_access,	sumres_access,	dtlarg_access,	dtlres_access},
2607c478bd9Sstevel@tonic-gate 	{"CLOSE",
2617c478bd9Sstevel@tonic-gate 	sumarg_close,	sumres_close,	dtlarg_close,	dtlres_close},
2627c478bd9Sstevel@tonic-gate 	{"COMMIT",
2637c478bd9Sstevel@tonic-gate 	sumarg_commit,	sumres_commit,	dtlarg_commit,	dtlres_commit},
2647c478bd9Sstevel@tonic-gate 	{"CREATE",					/* 5 */
2657c478bd9Sstevel@tonic-gate 	sumarg_create,	sum_nfsstat4,	dtlarg_create,	dtlres_create},
2667c478bd9Sstevel@tonic-gate 	{"DELEGPURGE",
2677c478bd9Sstevel@tonic-gate 	sumarg_delprge,	sum_nfsstat4,	dtlarg_delprge,	dtl_nfsstat4},
2687c478bd9Sstevel@tonic-gate 	{"DELEGRETURN",
2697c478bd9Sstevel@tonic-gate 	sumarg_delret,	sum_nfsstat4,	dtlarg_delret,	dtl_nfsstat4},
2707c478bd9Sstevel@tonic-gate 	{"GETATTR",
2717c478bd9Sstevel@tonic-gate 	sumarg_getattr,	sumres_getattr,	dtlarg_getattr,	dtlres_getattr},
2727c478bd9Sstevel@tonic-gate 	{"GETFH",
2737c478bd9Sstevel@tonic-gate 	NULL,		sumres_getfh,	NULL,	dtlres_getfh},
2747c478bd9Sstevel@tonic-gate 	{"LINK",					/* 10 */
2757c478bd9Sstevel@tonic-gate 	sumarg_link,	sum_nfsstat4,	dtlarg_link,	dtlres_link},
2767c478bd9Sstevel@tonic-gate 	{"LOCK",
2777c478bd9Sstevel@tonic-gate 	sumarg_lock,	sumres_lock,	dtlarg_lock,	dtlres_lock},
2787c478bd9Sstevel@tonic-gate 	{"LOCKT",
2797c478bd9Sstevel@tonic-gate 	sumarg_lockt,	sumres_lockt,	dtlarg_lockt,	dtlres_lockt},
2807c478bd9Sstevel@tonic-gate 	{"LOCKU",
2817c478bd9Sstevel@tonic-gate 	sumarg_locku,	sumres_locku,	dtlarg_locku,	dtlres_locku},
2827c478bd9Sstevel@tonic-gate 	{"LOOKUP",
2837c478bd9Sstevel@tonic-gate 	sumarg_lookup,	sum_nfsstat4,	dtlarg_lookup,	dtl_nfsstat4},
2847c478bd9Sstevel@tonic-gate 	{"LOOKUPP",					/* 15 */
2857c478bd9Sstevel@tonic-gate 	NULL,		sum_nfsstat4,	NULL,		dtl_nfsstat4},
2867c478bd9Sstevel@tonic-gate 	{"NVERIFY",
2877c478bd9Sstevel@tonic-gate 	NULL,		sum_nfsstat4,	dtlarg_verify,	dtl_nfsstat4},
2887c478bd9Sstevel@tonic-gate 	{"OPEN",
2897c478bd9Sstevel@tonic-gate 	sumarg_open,	sumres_open,	dtlarg_open,	dtlres_open},
2907c478bd9Sstevel@tonic-gate 	{"OPENATTR",
2917c478bd9Sstevel@tonic-gate 	sumarg_openattr, sum_nfsstat4, dtlarg_openattr, dtl_nfsstat4},
2927c478bd9Sstevel@tonic-gate 	{"OPEN_CONFIRM",
2937c478bd9Sstevel@tonic-gate 	sumarg_open_confirm,
2947c478bd9Sstevel@tonic-gate 	sumres_open_confirm,
2957c478bd9Sstevel@tonic-gate 	dtlarg_open_confirm,
2967c478bd9Sstevel@tonic-gate 	dtlres_open_confirm},
2977c478bd9Sstevel@tonic-gate 	{"OPEN_DOWNGRADE",
2987c478bd9Sstevel@tonic-gate 	sumarg_open_downgrd,
2997c478bd9Sstevel@tonic-gate 	sumres_open_downgrd,
3007c478bd9Sstevel@tonic-gate 	dtlarg_open_downgrd,
3017c478bd9Sstevel@tonic-gate 	dtlres_open_downgrd},
3027c478bd9Sstevel@tonic-gate 	{"PUTFH",
3037c478bd9Sstevel@tonic-gate 	sumarg_putfh,	sum_nfsstat4,	dtlarg_putfh,	dtl_nfsstat4},
3047c478bd9Sstevel@tonic-gate 	{"PUTPUBFH",					/* 20 */
3057c478bd9Sstevel@tonic-gate 	NULL,		sum_nfsstat4,	NULL,		dtl_nfsstat4},
3067c478bd9Sstevel@tonic-gate 	{"PUTROOTFH",
3077c478bd9Sstevel@tonic-gate 	NULL,		sum_nfsstat4,	NULL,		dtl_nfsstat4},
3087c478bd9Sstevel@tonic-gate 	{"READ",
3097c478bd9Sstevel@tonic-gate 	sumarg_read,	sumres_read,	dtlarg_read,	dtlres_read},
3107c478bd9Sstevel@tonic-gate 	{"READDIR",
3117c478bd9Sstevel@tonic-gate 	sumarg_readdir,	sumres_readdir,	dtlarg_readdir,	dtlres_readdir},
3127c478bd9Sstevel@tonic-gate 	{"READLINK",
3137c478bd9Sstevel@tonic-gate 	NULL,		sumres_readlnk,	NULL,		dtlres_readlnk},
3147c478bd9Sstevel@tonic-gate 	{"REMOVE",					/* 25 */
3157c478bd9Sstevel@tonic-gate 	sumarg_compnt,	sum_nfsstat4,	dtlarg_compnt,	dtlres_remove},
3167c478bd9Sstevel@tonic-gate 	{"RENAME",
3177c478bd9Sstevel@tonic-gate 	sumarg_rename,	sum_nfsstat4,	dtlarg_rename,	dtlres_rename},
3187c478bd9Sstevel@tonic-gate 	{"RENEW",
3197c478bd9Sstevel@tonic-gate 	sumarg_renew,	sum_nfsstat4,	dtlarg_renew,	dtl_nfsstat4},
3207c478bd9Sstevel@tonic-gate 	{"RESTOREFH",
3217c478bd9Sstevel@tonic-gate 	NULL,		sum_nfsstat4,	NULL,		dtl_nfsstat4},
3227c478bd9Sstevel@tonic-gate 	{"SAVEFH",
3237c478bd9Sstevel@tonic-gate 	NULL,		sum_nfsstat4,	NULL,		dtl_nfsstat4},
3247c478bd9Sstevel@tonic-gate 	{"SECINFO",					/* 30 */
3257c478bd9Sstevel@tonic-gate 	sumarg_secinfo,	sumres_secinfo,	dtlarg_secinfo,	dtlres_secinfo},
3267c478bd9Sstevel@tonic-gate 	{"SETATTR",
3277c478bd9Sstevel@tonic-gate 	sumarg_setattr,	sumres_setattr,	dtlarg_setattr,	dtlres_setattr},
3287c478bd9Sstevel@tonic-gate 	{"SETCLIENTID",
3297c478bd9Sstevel@tonic-gate 	sumarg_setclid,	sumres_setclid,	dtlarg_setclid,	dtlres_setclid},
3307c478bd9Sstevel@tonic-gate 	{"SETCLIENTID_CONFIRM",
3317c478bd9Sstevel@tonic-gate 	sumarg_setclid_cfm,
3327c478bd9Sstevel@tonic-gate 	sum_nfsstat4,
3337c478bd9Sstevel@tonic-gate 	dtlarg_setclid_cfm,
3347c478bd9Sstevel@tonic-gate 	dtl_nfsstat4},
3357c478bd9Sstevel@tonic-gate 	{"VERIFY",
3367c478bd9Sstevel@tonic-gate 	NULL,		sum_nfsstat4,	dtlarg_verify,	dtl_nfsstat4},
3377c478bd9Sstevel@tonic-gate 	{"WRITE",
3387c478bd9Sstevel@tonic-gate 	sumarg_write,	sumres_write,	dtlarg_write,	dtlres_write},
3397c478bd9Sstevel@tonic-gate 	{"RELEASE_LOCKOWNER",
3407c478bd9Sstevel@tonic-gate 	sumarg_release_lkown, sum_nfsstat4,
3417c478bd9Sstevel@tonic-gate 	dtlarg_release_lkown, dtl_nfsstat4},
3427c478bd9Sstevel@tonic-gate };
34319f828dfSToomas Soome static uint_t num_opcodes = ARRAY_SIZE(opcode_info);
3447c478bd9Sstevel@tonic-gate 
3457c478bd9Sstevel@tonic-gate /*
3467c478bd9Sstevel@tonic-gate  * File types.
3477c478bd9Sstevel@tonic-gate  */
3487c478bd9Sstevel@tonic-gate 
3497c478bd9Sstevel@tonic-gate typedef struct {
3507c478bd9Sstevel@tonic-gate 	char *short_name;		/* for summary output */
3517c478bd9Sstevel@tonic-gate 	char *long_name;		/* for detail output */
3527c478bd9Sstevel@tonic-gate } ftype_names_t;
3537c478bd9Sstevel@tonic-gate 
3547c478bd9Sstevel@tonic-gate static ftype_names_t ftype_names[] = {
3557c478bd9Sstevel@tonic-gate 	{"Type 0",	"Type 0"},
3567c478bd9Sstevel@tonic-gate 	{"REG",		"Regular File"},
3577c478bd9Sstevel@tonic-gate 	{"DIR",		"Directory"},
3587c478bd9Sstevel@tonic-gate 	{"BLK",		"Block Device"},
3597c478bd9Sstevel@tonic-gate 	{"CHR",		"Character Device"},
3607c478bd9Sstevel@tonic-gate 	{"LNK",		"Symbolic Link"},	/* 5 */
3617c478bd9Sstevel@tonic-gate 	{"SOCK",	"Socket"},
3627c478bd9Sstevel@tonic-gate 	{"FIFO",	"FIFO"},
3637c478bd9Sstevel@tonic-gate 	{"ATTRDIR",	"Attribute Directory"},
3647c478bd9Sstevel@tonic-gate 	{"NAMEDATTR",	"Named Attribute"},
3657c478bd9Sstevel@tonic-gate };
3667c478bd9Sstevel@tonic-gate static uint_t num_ftypes = sizeof (ftype_names) / sizeof (ftype_names_t);
3677c478bd9Sstevel@tonic-gate 
3687c478bd9Sstevel@tonic-gate static ftype_names_t	open_rflags[] = {
3697c478bd9Sstevel@tonic-gate 	{"?",	"UNKNOWN"},	/* 0 */
3707c478bd9Sstevel@tonic-gate 	{"CF",	"CONFIRM"},	/* 1 */
3717c478bd9Sstevel@tonic-gate 	{"PL",	"POSIX LOCK"},	/* 2 */
3727c478bd9Sstevel@tonic-gate 	{"?",	"UNKNOWN"},
3737c478bd9Sstevel@tonic-gate };
3747c478bd9Sstevel@tonic-gate static uint_t num_open_rflags =
3757c478bd9Sstevel@tonic-gate 	sizeof (open_rflags) / sizeof (ftype_names_t) - 1;
3767c478bd9Sstevel@tonic-gate 
3777c478bd9Sstevel@tonic-gate static char *get_flags(uint_t, ftype_names_t *, uint_t, int, char *);
3787c478bd9Sstevel@tonic-gate 
3797c478bd9Sstevel@tonic-gate #define	sum_open_rflags(flag) \
3807c478bd9Sstevel@tonic-gate 	get_flags((flag), open_rflags, num_open_rflags, 1, " RF=")
3817c478bd9Sstevel@tonic-gate 
3827c478bd9Sstevel@tonic-gate #define	detail_open_rflags(flag) \
3837c478bd9Sstevel@tonic-gate 	get_flags((flag), open_rflags, num_open_rflags, 0, NULL)
3847c478bd9Sstevel@tonic-gate 
3857c478bd9Sstevel@tonic-gate static void prt_supported_attrs(XDR *);
3867c478bd9Sstevel@tonic-gate static void prt_type(XDR *);
3877c478bd9Sstevel@tonic-gate static void prt_fh_expire_type(XDR *);
3887c478bd9Sstevel@tonic-gate static void prt_change(XDR *);
3897c478bd9Sstevel@tonic-gate static void prt_size(XDR *);
3907c478bd9Sstevel@tonic-gate static void prt_link_support(XDR *);
3917c478bd9Sstevel@tonic-gate static void prt_symlink_support(XDR *);
3927c478bd9Sstevel@tonic-gate static void prt_named_attr(XDR *);
3937c478bd9Sstevel@tonic-gate static void prt_fsid(XDR *);
3947c478bd9Sstevel@tonic-gate static void prt_unique_handles(XDR *);
3957c478bd9Sstevel@tonic-gate static void prt_lease_time(XDR *);
3967c478bd9Sstevel@tonic-gate static void prt_rdattr_error(XDR *);
3977c478bd9Sstevel@tonic-gate static void prt_acl(XDR *);
3987c478bd9Sstevel@tonic-gate static void prt_aclsupport(XDR *);
3997c478bd9Sstevel@tonic-gate static void prt_archive(XDR *);
4007c478bd9Sstevel@tonic-gate static void prt_cansettime(XDR *);
4017c478bd9Sstevel@tonic-gate static void prt_case_insensitive(XDR *);
4027c478bd9Sstevel@tonic-gate static void prt_case_preserving(XDR *);
4037c478bd9Sstevel@tonic-gate static void prt_chown_restricted(XDR *);
4047c478bd9Sstevel@tonic-gate static void prt_filehandle(XDR *);
4057c478bd9Sstevel@tonic-gate static void prt_fileid(XDR *);
4067c478bd9Sstevel@tonic-gate static void prt_mounted_on_fileid(XDR *);
4077c478bd9Sstevel@tonic-gate static void prt_files_avail(XDR *);
4087c478bd9Sstevel@tonic-gate static void prt_files_free(XDR *);
4097c478bd9Sstevel@tonic-gate static void prt_files_total(XDR *);
4107c478bd9Sstevel@tonic-gate static void prt_fs_locations(XDR *);
4117c478bd9Sstevel@tonic-gate static void prt_hidden(XDR *);
4127c478bd9Sstevel@tonic-gate static void prt_homogeneous(XDR *);
4137c478bd9Sstevel@tonic-gate static void prt_maxfilesize(XDR *);
4147c478bd9Sstevel@tonic-gate static void prt_maxlink(XDR *);
4157c478bd9Sstevel@tonic-gate static void prt_maxname(XDR *);
4167c478bd9Sstevel@tonic-gate static void prt_maxread(XDR *);
4177c478bd9Sstevel@tonic-gate static void prt_maxwrite(XDR *);
4187c478bd9Sstevel@tonic-gate static void prt_mimetype(XDR *);
4197c478bd9Sstevel@tonic-gate static void prt_mode(XDR *);
4207c478bd9Sstevel@tonic-gate static void prt_no_trunc(XDR *);
4217c478bd9Sstevel@tonic-gate static void prt_numlinks(XDR *);
4227c478bd9Sstevel@tonic-gate static void prt_owner(XDR *);
4237c478bd9Sstevel@tonic-gate static void prt_owner_group(XDR *);
4247c478bd9Sstevel@tonic-gate static void prt_quota_avail_hard(XDR *);
4257c478bd9Sstevel@tonic-gate static void prt_quota_avail_soft(XDR *);
4267c478bd9Sstevel@tonic-gate static void prt_quota_used(XDR *);
4277c478bd9Sstevel@tonic-gate static void prt_rawdev(XDR *);
4287c478bd9Sstevel@tonic-gate static void prt_space_avail(XDR *);
4297c478bd9Sstevel@tonic-gate static void prt_space_free(XDR *);
4307c478bd9Sstevel@tonic-gate static void prt_space_total(XDR *);
4317c478bd9Sstevel@tonic-gate static void prt_space_used(XDR *);
4327c478bd9Sstevel@tonic-gate static void prt_system(XDR *);
4337c478bd9Sstevel@tonic-gate static void prt_time_access(XDR *);
4347c478bd9Sstevel@tonic-gate static void prt_time_access_set(XDR *);
4357c478bd9Sstevel@tonic-gate static void prt_time_backup(XDR *);
4367c478bd9Sstevel@tonic-gate static void prt_time_create(XDR *);
4377c478bd9Sstevel@tonic-gate static void prt_time_delta(XDR *);
4387c478bd9Sstevel@tonic-gate static void prt_time_metadata(XDR *);
4397c478bd9Sstevel@tonic-gate static void prt_time_modify(XDR *);
4407c478bd9Sstevel@tonic-gate static void prt_time_modify_set(XDR *);
4417c478bd9Sstevel@tonic-gate 
4427c478bd9Sstevel@tonic-gate 
4437c478bd9Sstevel@tonic-gate 
4447c478bd9Sstevel@tonic-gate /*
4457c478bd9Sstevel@tonic-gate  * Information for attributes.
4467c478bd9Sstevel@tonic-gate  * name		name of the attribute.
4477c478bd9Sstevel@tonic-gate  * prt_details	function to XDR decode the attribute and print it.
4487c478bd9Sstevel@tonic-gate  *
4497c478bd9Sstevel@tonic-gate  * XXX If this table ever gets extensively changed (including
4507c478bd9Sstevel@tonic-gate  * reorganization to track changes to the spec), it would probably be a
4517c478bd9Sstevel@tonic-gate  * good idea to change to a scheme where the table is mechanically
4527c478bd9Sstevel@tonic-gate  * generated.  Look at $SRC/uts/common/rpcsvc for how this is done in the
4537c478bd9Sstevel@tonic-gate  * kernel.
4547c478bd9Sstevel@tonic-gate  */
4557c478bd9Sstevel@tonic-gate 
4567c478bd9Sstevel@tonic-gate typedef struct {
4577c478bd9Sstevel@tonic-gate 	char	*name;
4587c478bd9Sstevel@tonic-gate 	void	(*prt_details)(XDR *);
4597c478bd9Sstevel@tonic-gate } attr_info_t;
4607c478bd9Sstevel@tonic-gate 
4617c478bd9Sstevel@tonic-gate static attr_info_t attr_info[MAX_ATTRIBUTES] = {
4627c478bd9Sstevel@tonic-gate 	{"SUPPORTED_ATTRS",	prt_supported_attrs},
4637c478bd9Sstevel@tonic-gate 	{"TYPE",		prt_type},
4647c478bd9Sstevel@tonic-gate 	{"FH_EXPIRE_TYPE",	prt_fh_expire_type},
4657c478bd9Sstevel@tonic-gate 	{"CHANGE",		prt_change},
4667c478bd9Sstevel@tonic-gate 	{"SIZE",		prt_size},
4677c478bd9Sstevel@tonic-gate 	{"LINK_SUPPORT",	prt_link_support},	/* 5 */
4687c478bd9Sstevel@tonic-gate 	{"SYMLINK_SUPPORT",	prt_symlink_support},
4697c478bd9Sstevel@tonic-gate 	{"NAMED_ATTR",		prt_named_attr},
4707c478bd9Sstevel@tonic-gate 	{"FSID",		prt_fsid},
4717c478bd9Sstevel@tonic-gate 	{"UNIQUE_HANDLES",	prt_unique_handles},
4727c478bd9Sstevel@tonic-gate 	{"LEASE_TIME",		prt_lease_time},	/* 10 */
4737c478bd9Sstevel@tonic-gate 	{"RDATTR_ERROR",	prt_rdattr_error},
4747c478bd9Sstevel@tonic-gate 	{"ACL",			prt_acl},
4757c478bd9Sstevel@tonic-gate 	{"ACLSUPPORT",		prt_aclsupport},
4767c478bd9Sstevel@tonic-gate 	{"ARCHIVE",		prt_archive},
4777c478bd9Sstevel@tonic-gate 	{"CANSETTIME",		prt_cansettime},	/* 15 */
4787c478bd9Sstevel@tonic-gate 	{"CASE_INSENSITIVE",	prt_case_insensitive},
4797c478bd9Sstevel@tonic-gate 	{"CASE_PRESERVING",	prt_case_preserving},
4807c478bd9Sstevel@tonic-gate 	{"CHOWN_RESTRICTED",	prt_chown_restricted},
4817c478bd9Sstevel@tonic-gate 	{"FILEHANDLE",		prt_filehandle},
4827c478bd9Sstevel@tonic-gate 	{"FILEID",		prt_fileid},		/* 20 */
4837c478bd9Sstevel@tonic-gate 	{"FILES_AVAIL",		prt_files_avail},
4847c478bd9Sstevel@tonic-gate 	{"FILES_FREE",		prt_files_free},
4857c478bd9Sstevel@tonic-gate 	{"FILES_TOTAL",		prt_files_total},
4867c478bd9Sstevel@tonic-gate 	{"FS_LOCATIONS",	prt_fs_locations},
4877c478bd9Sstevel@tonic-gate 	{"HIDDEN",		prt_hidden},		/* 25 */
4887c478bd9Sstevel@tonic-gate 	{"HOMOGENEOUS",		prt_homogeneous},
4897c478bd9Sstevel@tonic-gate 	{"MAXFILESIZE",		prt_maxfilesize},
4907c478bd9Sstevel@tonic-gate 	{"MAXLINK",		prt_maxlink},
4917c478bd9Sstevel@tonic-gate 	{"MAXNAME",		prt_maxname},
4927c478bd9Sstevel@tonic-gate 	{"MAXREAD",		prt_maxread},		/* 30 */
4937c478bd9Sstevel@tonic-gate 	{"MAXWRITE",		prt_maxwrite},
4947c478bd9Sstevel@tonic-gate 	{"MIMETYPE",		prt_mimetype},
4957c478bd9Sstevel@tonic-gate 	{"MODE",		prt_mode},
4967c478bd9Sstevel@tonic-gate 	{"NO_TRUNC",		prt_no_trunc},
4977c478bd9Sstevel@tonic-gate 	{"NUMLINKS",		prt_numlinks},		/* 35 */
4987c478bd9Sstevel@tonic-gate 	{"OWNER",		prt_owner},
4997c478bd9Sstevel@tonic-gate 	{"OWNER_GROUP",		prt_owner_group},
5007c478bd9Sstevel@tonic-gate 	{"QUOTA_AVAIL_HARD",	prt_quota_avail_hard},
5017c478bd9Sstevel@tonic-gate 	{"QUOTA_AVAIL_SOFT",	prt_quota_avail_soft},
5027c478bd9Sstevel@tonic-gate 	{"QUOTA_USED",		prt_quota_used},	/* 40 */
5037c478bd9Sstevel@tonic-gate 	{"RAWDEV",		prt_rawdev},
5047c478bd9Sstevel@tonic-gate 	{"SPACE_AVAIL",		prt_space_avail},
5057c478bd9Sstevel@tonic-gate 	{"SPACE_FREE",		prt_space_free},
5067c478bd9Sstevel@tonic-gate 	{"SPACE_TOTAL",		prt_space_total},
5077c478bd9Sstevel@tonic-gate 	{"SPACE_USED",		prt_space_used},	/* 45 */
5087c478bd9Sstevel@tonic-gate 	{"SYSTEM",		prt_system},
5097c478bd9Sstevel@tonic-gate 	{"TIME_ACCESS",		prt_time_access},
5107c478bd9Sstevel@tonic-gate 	{"TIME_ACCESS_SET",	prt_time_access_set},
5117c478bd9Sstevel@tonic-gate 	{"TIME_BACKUP",		prt_time_backup},
5127c478bd9Sstevel@tonic-gate 	{"TIME_CREATE",		prt_time_create},	/* 50 */
5137c478bd9Sstevel@tonic-gate 	{"TIME_DELTA",		prt_time_delta},
5147c478bd9Sstevel@tonic-gate 	{"TIME_METADATA",	prt_time_metadata},
5157c478bd9Sstevel@tonic-gate 	{"TIME_MODIFY",		prt_time_modify},
5167c478bd9Sstevel@tonic-gate 	{"TIME_MODIFY_SET",	prt_time_modify_set},
5177c478bd9Sstevel@tonic-gate 	{"MOUNTED_ON_FILEID",	prt_mounted_on_fileid},
5187c478bd9Sstevel@tonic-gate };
5197c478bd9Sstevel@tonic-gate 
5207c478bd9Sstevel@tonic-gate extern char *get_sum_line();
5217c478bd9Sstevel@tonic-gate 
5227c478bd9Sstevel@tonic-gate extern jmp_buf xdr_err;
5237c478bd9Sstevel@tonic-gate 
5247c478bd9Sstevel@tonic-gate static void sum_comp4res(char *, char *(*)(void));
5257c478bd9Sstevel@tonic-gate static char *sum_compound4args(void);
5267c478bd9Sstevel@tonic-gate static char *sum_compound4res(void);
5277c478bd9Sstevel@tonic-gate static char *sum_operand(nfs_argop4 *opp);
5287c478bd9Sstevel@tonic-gate static char *sum_result(nfs_resop4 *resp);
5297c478bd9Sstevel@tonic-gate 
5307c478bd9Sstevel@tonic-gate static char *sum_cb_compound4args(void);
5317c478bd9Sstevel@tonic-gate static char *sum_cb_compound4res(void);
5327c478bd9Sstevel@tonic-gate static char *sum_cb_operand(nfs_cb_argop4 *opp);
5337c478bd9Sstevel@tonic-gate static char *sum_cb_result(nfs_cb_resop4 *resp);
5347c478bd9Sstevel@tonic-gate 
5357c478bd9Sstevel@tonic-gate static void detail_acetype4(acetype4);
5367c478bd9Sstevel@tonic-gate static void detail_uint32_bitmap(uint32_t, char *[], int);
5377c478bd9Sstevel@tonic-gate static void detail_aceflag4(aceflag4);
5387c478bd9Sstevel@tonic-gate static void detail_acemask4(acemask4);
5397c478bd9Sstevel@tonic-gate static void detail_nfs_argop4(void);
5407c478bd9Sstevel@tonic-gate static void detail_nfs_resop4(void);
5417c478bd9Sstevel@tonic-gate static void detail_cb_argop4(void);
5427c478bd9Sstevel@tonic-gate static void detail_cb_resop4(void);
5437c478bd9Sstevel@tonic-gate 
5447c478bd9Sstevel@tonic-gate static char *attr_name(uint_t);
5457c478bd9Sstevel@tonic-gate static char *claim_name(enum open_claim_type4 claim_type);
5467c478bd9Sstevel@tonic-gate static char *delegation_type_name(enum open_delegation_type4 type);
5477c478bd9Sstevel@tonic-gate static char *flavor_name(uint_t flavor);
5487c478bd9Sstevel@tonic-gate static char *gss_svc_name(rpc_gss_svc_t svc);
5497c478bd9Sstevel@tonic-gate static char *limitby_name(enum limit_by4 limitby);
5507c478bd9Sstevel@tonic-gate static char *lock_type_name(enum nfs_lock_type4);
5517c478bd9Sstevel@tonic-gate static char *opcode_name(uint_t);
5527c478bd9Sstevel@tonic-gate static char *cb_opcode_name(uint_t opnum);
5537c478bd9Sstevel@tonic-gate static char *status_name(int);
5547c478bd9Sstevel@tonic-gate static char *status_name_compat(int);
5557c478bd9Sstevel@tonic-gate static char *status_name_pcol(int);
5567c478bd9Sstevel@tonic-gate static char *sum_type_name(nfs_ftype4);
5577c478bd9Sstevel@tonic-gate static void sum_access4(char *buf, size_t buflen, uint32_t bits);
5587c478bd9Sstevel@tonic-gate static void detail_access4(char *, uint32_t);
5597c478bd9Sstevel@tonic-gate static void sum_claim(char *buf, size_t buflen, open_claim4 *claim);
5607c478bd9Sstevel@tonic-gate static void detail_claim(open_claim4 *claim);
5617c478bd9Sstevel@tonic-gate static char *sum_clientid(clientid4 client);
5627c478bd9Sstevel@tonic-gate static void detail_clientid(clientid4 client);
5637c478bd9Sstevel@tonic-gate static char *_sum_stateid(stateid4 *, char *prefix);
5647c478bd9Sstevel@tonic-gate static void sum_delegation(char *buf, size_t buflen, open_delegation4 *delp);
5657c478bd9Sstevel@tonic-gate static void detail_delegation(open_delegation4 *delp);
5667c478bd9Sstevel@tonic-gate static void detail_lock_owner(lock_owner4 *owner);
5677c478bd9Sstevel@tonic-gate static void detail_open_owner(open_owner4 *owner);
5687c478bd9Sstevel@tonic-gate static void sum_openflag(char *bufp, int buflen, openflag4 *flagp);
5697c478bd9Sstevel@tonic-gate static char *get_deleg_typestr(open_delegation_type4 dt);
5707c478bd9Sstevel@tonic-gate static void detail_openflag(openflag4 *flagp);
5717c478bd9Sstevel@tonic-gate static void sum_name(char *buf, size_t buflen, open_claim4 *claim);
5727c478bd9Sstevel@tonic-gate static void detail_rpcsec_gss(rpcsec_gss_info *);
5737c478bd9Sstevel@tonic-gate static void detail_secinfo4(secinfo4 *infop);
5747c478bd9Sstevel@tonic-gate static char *sum_space_limit(nfs_space_limit4 *limitp);
5757c478bd9Sstevel@tonic-gate static void detail_space_limit(nfs_space_limit4 *limitp);
5767c478bd9Sstevel@tonic-gate static char *detail_type_name(nfs_ftype4);
5777c478bd9Sstevel@tonic-gate static char *createhow4_name(createhow4 *crtp);
5787c478bd9Sstevel@tonic-gate 
5797c478bd9Sstevel@tonic-gate 
5807c478bd9Sstevel@tonic-gate static void showxdr_utf8string(char *);
5817c478bd9Sstevel@tonic-gate static char *utf8localize(utf8string *);
5827c478bd9Sstevel@tonic-gate static void utf8free(void);
5837c478bd9Sstevel@tonic-gate static void sum_pathname4(char *, size_t, pathname4 *);
5842f172c55SRobert Thurlow static void detail_pathname4(pathname4 *pathp, char *);
5857c478bd9Sstevel@tonic-gate static void sum_compname4(char *buf, size_t buflen, component4 *comp);
5867c478bd9Sstevel@tonic-gate static void detail_compname4(component4 *comp);
5877c478bd9Sstevel@tonic-gate 
5887c478bd9Sstevel@tonic-gate static void detail_fattr4(fattr4 *attrp);
5897c478bd9Sstevel@tonic-gate static void detail_attr_bitmap(char *, bitmap4 *, unpkd_attrmap_t *);
5907c478bd9Sstevel@tonic-gate static void sum_attr_bitmap(char *buf, size_t buflen, bitmap4 *mapp);
5917c478bd9Sstevel@tonic-gate static void detail_fattr4_change(char *msg, fattr4_change chg);
5927c478bd9Sstevel@tonic-gate static char *sum_fh4(nfs_fh4 *fhp);
5937c478bd9Sstevel@tonic-gate static void detail_fh4(nfs_fh4 *fh);
5947c478bd9Sstevel@tonic-gate 
5957c478bd9Sstevel@tonic-gate #define	fh4_hash(fh) adler16((fh)->nfs_fh4_val, (fh)->nfs_fh4_len)
5967c478bd9Sstevel@tonic-gate #define	stateid_hash(st) adler16((st)->other, sizeof ((st)->other))
5977c478bd9Sstevel@tonic-gate #define	owner_hash(own) adler16((own)->owner_val, (own)->owner_len)
5987c478bd9Sstevel@tonic-gate 
5997c478bd9Sstevel@tonic-gate #define	sum_deleg_stateid(st)	_sum_stateid((st), "DST=")
6007c478bd9Sstevel@tonic-gate #define	sum_open_stateid(st)	_sum_stateid((st), "OST=")
6017c478bd9Sstevel@tonic-gate #define	sum_lock_stateid(st)	_sum_stateid((st), "LST=")
6027c478bd9Sstevel@tonic-gate #define	sum_stateid(st)		_sum_stateid((st), "ST=")
6037c478bd9Sstevel@tonic-gate 
6047c478bd9Sstevel@tonic-gate #define	detail_deleg_stateid(st)	_detail_stateid((st), "Delegation ")
6057c478bd9Sstevel@tonic-gate #define	detail_open_stateid(st)		_detail_stateid((st), "Open ")
6067c478bd9Sstevel@tonic-gate #define	detail_lock_stateid(st)		_detail_stateid((st), "Lock ")
6077c478bd9Sstevel@tonic-gate #define	detail_stateid(st)		_detail_stateid((st), "")
6087c478bd9Sstevel@tonic-gate 
6097c478bd9Sstevel@tonic-gate #define	SPECIAL_STATEID0	"SPC0"
6107c478bd9Sstevel@tonic-gate #define	SPECIAL_STATEID1	"SPC1"
6117c478bd9Sstevel@tonic-gate 
6127c478bd9Sstevel@tonic-gate #define	DONT_CHANGE		0
6137c478bd9Sstevel@tonic-gate #define	SET_TO_SERVER_TIME	1
6147c478bd9Sstevel@tonic-gate #define	SET_TO_CLIENT_TIME	2
6157c478bd9Sstevel@tonic-gate 
6167c478bd9Sstevel@tonic-gate static stateid4 spec_stateid_0 =
6177c478bd9Sstevel@tonic-gate 	{0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
6187c478bd9Sstevel@tonic-gate static stateid4 spec_stateid_1 =
6197c478bd9Sstevel@tonic-gate 	{0xFFFFFFFF, {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}};
6207c478bd9Sstevel@tonic-gate 
6217c478bd9Sstevel@tonic-gate static char *procnames_short[] = {
6227c478bd9Sstevel@tonic-gate 	"NULL4",	/*  0 */
6237c478bd9Sstevel@tonic-gate 	"COMPOUND4"	/*  1 */
6247c478bd9Sstevel@tonic-gate };
6257c478bd9Sstevel@tonic-gate 
6267c478bd9Sstevel@tonic-gate static char *procnames_long[] = {
6277c478bd9Sstevel@tonic-gate 	"Null procedure",		/*  0 */
6287c478bd9Sstevel@tonic-gate 	"Compound",			/*  1 */
6297c478bd9Sstevel@tonic-gate };
6307c478bd9Sstevel@tonic-gate 
6317c478bd9Sstevel@tonic-gate static char *cb_procnames_short[] = {
6327c478bd9Sstevel@tonic-gate 	"CB_NULL",	/*  0 */
6337c478bd9Sstevel@tonic-gate 	"CB_COMPOUND"	/*  1 */
6347c478bd9Sstevel@tonic-gate };
6357c478bd9Sstevel@tonic-gate 
6367c478bd9Sstevel@tonic-gate static char *cb_procnames_long[] = {
6377c478bd9Sstevel@tonic-gate 	"Null CallBack procedure",	/*  0 */
6387c478bd9Sstevel@tonic-gate 	"CallBack compound",		/*  1 */
6397c478bd9Sstevel@tonic-gate };
6407c478bd9Sstevel@tonic-gate 
6417c478bd9Sstevel@tonic-gate static char *acetype4_names[] = {
6427c478bd9Sstevel@tonic-gate 	"ACE4_ACCESS_ALLOWED_ACE_TYPE",
6437c478bd9Sstevel@tonic-gate 	"ACE4_ACCESS_DENIED_ACE_TYPE",
6447c478bd9Sstevel@tonic-gate 	"ACE4_SYSTEM_AUDIT_ACE_TYPE",
6457c478bd9Sstevel@tonic-gate 	"ACE4_SYSTEM_ALARM_ACE_TYPE"
6467c478bd9Sstevel@tonic-gate };
6477c478bd9Sstevel@tonic-gate #define	ACETYPE4_NAMES_MAX (sizeof (acetype4_names) / sizeof (char *))
6487c478bd9Sstevel@tonic-gate 
6497c478bd9Sstevel@tonic-gate static char *aceflag4_names[] = {
6507c478bd9Sstevel@tonic-gate 	"ACE4_FILE_INHERIT_ACE",
6517c478bd9Sstevel@tonic-gate 	"ACE4_DIRECTORY_INHERIT_ACE",
6527c478bd9Sstevel@tonic-gate 	"ACE4_NO_PROPAGATE_INHERIT_ACE",
6537c478bd9Sstevel@tonic-gate 	"ACE4_INHERIT_ONLY_ACE",
6547c478bd9Sstevel@tonic-gate 	"ACE4_SUCCESSFUL_ACCESS_ACE_FLAG",
6557c478bd9Sstevel@tonic-gate 	"ACE4_FAILED_ACCESS_ACE_FLAG",
6567c478bd9Sstevel@tonic-gate 	"ACE4_IDENTIFIER_GROUP"
6577c478bd9Sstevel@tonic-gate };
6587c478bd9Sstevel@tonic-gate #define	ACEFLAG4_NAMES_MAX (sizeof (aceflag4_names) / sizeof (char *))
6597c478bd9Sstevel@tonic-gate 
6607c478bd9Sstevel@tonic-gate static char *acemask4_names[] = {
6617c478bd9Sstevel@tonic-gate 	"ACE4_READ_DATA/ACE4_LIST_DIRECTORY",
6627c478bd9Sstevel@tonic-gate 	"ACE4_WRITE_DATA/ACE4_ADD_FILE",
6637c478bd9Sstevel@tonic-gate 	"ACE4_APPEND_DATA/ACE4_ADD_SUBDIRECTORY",
6647c478bd9Sstevel@tonic-gate 	"ACE4_READ_NAMED_ATTRS",
6657c478bd9Sstevel@tonic-gate 	"ACE4_WRITE_NAMED_ATTRS",
6667c478bd9Sstevel@tonic-gate 	"ACE4_EXECUTE",
6677c478bd9Sstevel@tonic-gate 	"ACE4_DELETE_CHILD",
6687c478bd9Sstevel@tonic-gate 	"ACE4_READ_ATTRIBUTES",
6697c478bd9Sstevel@tonic-gate 	"ACE4_WRITE_ATTRIBUTES",
6707c478bd9Sstevel@tonic-gate 	"UNDEFINED",	/* 0x00000200 */
6717c478bd9Sstevel@tonic-gate 	"UNDEFINED",	/* 0x00000400 */
6727c478bd9Sstevel@tonic-gate 	"UNDEFINED",	/* 0x00000800 */
6737c478bd9Sstevel@tonic-gate 	"UNDEFINED",	/* 0x00001000 */
6747c478bd9Sstevel@tonic-gate 	"UNDEFINED",	/* 0x00002000 */
6757c478bd9Sstevel@tonic-gate 	"UNDEFINED",	/* 0x00004000 */
6767c478bd9Sstevel@tonic-gate 	"UNDEFINED",	/* 0x00008000 */
6777c478bd9Sstevel@tonic-gate 	"ACE4_DELETE",
6787c478bd9Sstevel@tonic-gate 	"ACE4_READ_ACL",
6797c478bd9Sstevel@tonic-gate 	"ACE4_WRITE_ACL",
6807c478bd9Sstevel@tonic-gate 	"ACE4_WRITE_OWNER",
6817c478bd9Sstevel@tonic-gate 	"ACE4_SYNCHRONIZE"
6827c478bd9Sstevel@tonic-gate };
6837c478bd9Sstevel@tonic-gate #define	ACEMASK4_NAMES_MAX (sizeof (acemask4_names) / sizeof (char *))
6847c478bd9Sstevel@tonic-gate 
6857c478bd9Sstevel@tonic-gate #define	MAXPROC	1
6867c478bd9Sstevel@tonic-gate 
6877c478bd9Sstevel@tonic-gate /*ARGSUSED*/
6887c478bd9Sstevel@tonic-gate void
interpret_nfs4_cb(int flags,int type,int xid,int vers,int proc,char * data,int len)6897c478bd9Sstevel@tonic-gate interpret_nfs4_cb(int flags, int type, int xid, int vers, int proc,
6902d8dae53SMarcel Telka     char *data, int len)
6917c478bd9Sstevel@tonic-gate {
6927c478bd9Sstevel@tonic-gate 	char *line = NULL;
6937c478bd9Sstevel@tonic-gate 
6947c478bd9Sstevel@tonic-gate 	if (proc < 0 || proc > MAXPROC)
6957c478bd9Sstevel@tonic-gate 		return;
6967c478bd9Sstevel@tonic-gate 
6977c478bd9Sstevel@tonic-gate 	if (flags & F_SUM) {
6987c478bd9Sstevel@tonic-gate 		line = get_sum_line();
6997c478bd9Sstevel@tonic-gate 
7007c478bd9Sstevel@tonic-gate 		if (type == CALL) {
7017c478bd9Sstevel@tonic-gate 			(void) sprintf(line, "NFS C %s",
7022f172c55SRobert Thurlow 			    proc == CB_COMPOUND ? "CB4" :
7032f172c55SRobert Thurlow 			    cb_procnames_short[proc]);
7047c478bd9Sstevel@tonic-gate 			line += strlen(line);
7057c478bd9Sstevel@tonic-gate 
7067c478bd9Sstevel@tonic-gate 			if (proc == CB_COMPOUND) {
7077c478bd9Sstevel@tonic-gate 				static utf8string tag;
7087c478bd9Sstevel@tonic-gate 
7097c478bd9Sstevel@tonic-gate 				if (!xdr_utf8string(&xdrm, &tag))
7107c478bd9Sstevel@tonic-gate 					longjmp(xdr_err, 1);
7117c478bd9Sstevel@tonic-gate 				sprintf(line, " (%.20s) %s",
7122f172c55SRobert Thurlow 				    utf8localize(&tag),
7132f172c55SRobert Thurlow 				    sum_cb_compound4args());
7147c478bd9Sstevel@tonic-gate 				xdr_free(xdr_utf8string, (char *)&tag);
7157c478bd9Sstevel@tonic-gate 			}
7167c478bd9Sstevel@tonic-gate 			check_retransmit(line, xid);
7177c478bd9Sstevel@tonic-gate 		} else {
7187c478bd9Sstevel@tonic-gate 			(void) sprintf(line, "NFS R %s ",
7192f172c55SRobert Thurlow 			    proc == CB_COMPOUND ? "CB4" :
7202f172c55SRobert Thurlow 			    cb_procnames_short[proc]);
7217c478bd9Sstevel@tonic-gate 			line += strlen(line);
7227c478bd9Sstevel@tonic-gate 			if (proc == CB_COMPOUND)
7237c478bd9Sstevel@tonic-gate 				sum_comp4res(line, sum_cb_compound4res);
7247c478bd9Sstevel@tonic-gate 		}
7257c478bd9Sstevel@tonic-gate 	}
7267c478bd9Sstevel@tonic-gate 
7277c478bd9Sstevel@tonic-gate 	if (flags & F_DTAIL) {
7287c478bd9Sstevel@tonic-gate 		show_header("NFS:  ", "Sun NFS4 CallBack", len);
7297c478bd9Sstevel@tonic-gate 		show_space();
7307c478bd9Sstevel@tonic-gate 		(void) sprintf(get_line(0, 0), "Proc = %d (%s)",
7312f172c55SRobert Thurlow 		    proc, cb_procnames_long[proc]);
7327c478bd9Sstevel@tonic-gate 		if (proc == CB_COMPOUND) {
7337c478bd9Sstevel@tonic-gate 			if (type == CALL) {
7347c478bd9Sstevel@tonic-gate 				showxdr_utf8string("Tag = %s");
7357c478bd9Sstevel@tonic-gate 				detail_cb_argop4();
7367c478bd9Sstevel@tonic-gate 			} else {
7377c478bd9Sstevel@tonic-gate 				nfsstat4 status;
7387c478bd9Sstevel@tonic-gate 
7397c478bd9Sstevel@tonic-gate 				status = getxdr_long();
7407c478bd9Sstevel@tonic-gate 				showxdr_utf8string("Tag = %s");
7417c478bd9Sstevel@tonic-gate 				sprintf(get_line(0, 0), "Status = %d (%s)",
7422f172c55SRobert Thurlow 				    status, status_name(status));
7437c478bd9Sstevel@tonic-gate 				detail_cb_resop4();
7447c478bd9Sstevel@tonic-gate 			}
7457c478bd9Sstevel@tonic-gate 		}
7467c478bd9Sstevel@tonic-gate 		show_trailer();
7477c478bd9Sstevel@tonic-gate 	}
7487c478bd9Sstevel@tonic-gate 
7497c478bd9Sstevel@tonic-gate 	utf8free();			/* cf. utf8localize() */
7507c478bd9Sstevel@tonic-gate }
7517c478bd9Sstevel@tonic-gate 
7527c478bd9Sstevel@tonic-gate 
7537c478bd9Sstevel@tonic-gate /*ARGSUSED*/
7547c478bd9Sstevel@tonic-gate void
interpret_nfs4(int flags,int type,int xid,int vers,int proc,char * data,int len)7557c478bd9Sstevel@tonic-gate interpret_nfs4(int flags, int type, int xid, int vers, int proc,
7562d8dae53SMarcel Telka     char *data, int len)
7577c478bd9Sstevel@tonic-gate {
7587c478bd9Sstevel@tonic-gate 	char *line = NULL;
7597c478bd9Sstevel@tonic-gate 
7607c478bd9Sstevel@tonic-gate 	if (proc < 0 || proc > MAXPROC)
7617c478bd9Sstevel@tonic-gate 		return;
7627c478bd9Sstevel@tonic-gate 
7637c478bd9Sstevel@tonic-gate 	nfs4_fragged_rpc = 0;
7647c478bd9Sstevel@tonic-gate 	nfs4_pkt_len = len;
7657c478bd9Sstevel@tonic-gate 	nfs4_pkt_start = xdr_getpos(&xdrm);
7667c478bd9Sstevel@tonic-gate 
7677c478bd9Sstevel@tonic-gate 	if (flags & F_SUM) {
7687c478bd9Sstevel@tonic-gate 		line = get_sum_line();
7697c478bd9Sstevel@tonic-gate 
7707c478bd9Sstevel@tonic-gate 		if (type == CALL) {
7717c478bd9Sstevel@tonic-gate 			(void) sprintf(line, "NFS C %s",
7722f172c55SRobert Thurlow 			    proc == NFSPROC4_COMPOUND ? "4" :
7732f172c55SRobert Thurlow 			    procnames_short[proc]);
7747c478bd9Sstevel@tonic-gate 			line += strlen(line);
7757c478bd9Sstevel@tonic-gate 
7767c478bd9Sstevel@tonic-gate 			if (proc == NFSPROC4_COMPOUND) {
7777c478bd9Sstevel@tonic-gate 				static utf8string tag;
7787c478bd9Sstevel@tonic-gate 
7797c478bd9Sstevel@tonic-gate 				if (!xdr_utf8string(&xdrm, &tag))
7807c478bd9Sstevel@tonic-gate 					longjmp(xdr_err, 1);
7817c478bd9Sstevel@tonic-gate 				sprintf(line, " (%.20s) %s",
7822f172c55SRobert Thurlow 				    utf8localize(&tag),
7832f172c55SRobert Thurlow 				    sum_compound4args());
7847c478bd9Sstevel@tonic-gate 				xdr_free(xdr_utf8string, (char *)&tag);
7857c478bd9Sstevel@tonic-gate 			}
7867c478bd9Sstevel@tonic-gate 			check_retransmit(line, xid);
7877c478bd9Sstevel@tonic-gate 		} else {
7887c478bd9Sstevel@tonic-gate 			(void) sprintf(line, "NFS R %s ",
7892f172c55SRobert Thurlow 			    proc == NFSPROC4_COMPOUND ? "4" :
7902f172c55SRobert Thurlow 			    procnames_short[proc]);
7917c478bd9Sstevel@tonic-gate 			line += strlen(line);
7927c478bd9Sstevel@tonic-gate 
7937c478bd9Sstevel@tonic-gate 			if (proc == NFSPROC4_COMPOUND)
7947c478bd9Sstevel@tonic-gate 				sum_comp4res(line, sum_compound4res);
7957c478bd9Sstevel@tonic-gate 		}
7967c478bd9Sstevel@tonic-gate 	}
7977c478bd9Sstevel@tonic-gate 
7987c478bd9Sstevel@tonic-gate 	if (flags & F_DTAIL) {
7997c478bd9Sstevel@tonic-gate 		show_header("NFS:  ", "Sun NFS", len);
8007c478bd9Sstevel@tonic-gate 		show_space();
8017c478bd9Sstevel@tonic-gate 		(void) sprintf(get_line(0, 0), "Proc = %d (%s)",
8022f172c55SRobert Thurlow 		    proc, procnames_long[proc]);
8037c478bd9Sstevel@tonic-gate 		if (proc == NFSPROC4_COMPOUND) {
8047c478bd9Sstevel@tonic-gate 			if (type == CALL) {
8057c478bd9Sstevel@tonic-gate 				showxdr_utf8string("Tag = %s");
8067c478bd9Sstevel@tonic-gate 				detail_nfs_argop4();
8077c478bd9Sstevel@tonic-gate 			} else {
8087c478bd9Sstevel@tonic-gate 				nfsstat4 status;
8097c478bd9Sstevel@tonic-gate 
8107c478bd9Sstevel@tonic-gate 				status = getxdr_long();
8117c478bd9Sstevel@tonic-gate 				showxdr_utf8string("Tag = %s");
8127c478bd9Sstevel@tonic-gate 				sprintf(get_line(0, 0), "Status = %d (%s)",
8132f172c55SRobert Thurlow 				    status, status_name(status));
8147c478bd9Sstevel@tonic-gate 				detail_nfs_resop4();
8157c478bd9Sstevel@tonic-gate 			}
8167c478bd9Sstevel@tonic-gate 		}
8177c478bd9Sstevel@tonic-gate 		show_trailer();
8187c478bd9Sstevel@tonic-gate 	}
8197c478bd9Sstevel@tonic-gate 
8207c478bd9Sstevel@tonic-gate 	utf8free();			/* cf. utf8localize() */
8217c478bd9Sstevel@tonic-gate }
8227c478bd9Sstevel@tonic-gate 
8237c478bd9Sstevel@tonic-gate 
8247c478bd9Sstevel@tonic-gate 
8257c478bd9Sstevel@tonic-gate /*
8267c478bd9Sstevel@tonic-gate  * Return the names and arguments of the oplist elements, up to
8277c478bd9Sstevel@tonic-gate  * SUM_COMPND_MAX characters.  If the elements don't fit, include a "..."
8287c478bd9Sstevel@tonic-gate  * at the end of the string.
8297c478bd9Sstevel@tonic-gate  */
8307c478bd9Sstevel@tonic-gate 
8317c478bd9Sstevel@tonic-gate static char *
sum_compound4args(void)8327c478bd9Sstevel@tonic-gate sum_compound4args(void)
8337c478bd9Sstevel@tonic-gate {
8347c478bd9Sstevel@tonic-gate 	static char buf[SUM_COMPND_MAX + 2]; /* 1 for null, 1 for overflow */
8357c478bd9Sstevel@tonic-gate 	int numops;
8367c478bd9Sstevel@tonic-gate 	const size_t buflen = sizeof (buf);
8377c478bd9Sstevel@tonic-gate 	char *bp;
8387c478bd9Sstevel@tonic-gate 	nfs_argop4 one_op;
8397c478bd9Sstevel@tonic-gate 	uint32_t minor_version;
8407c478bd9Sstevel@tonic-gate 
8417c478bd9Sstevel@tonic-gate 	buf[0] = '\0';
8427c478bd9Sstevel@tonic-gate 
8437c478bd9Sstevel@tonic-gate 	if (setjmp(xdr_err)) {
8447c478bd9Sstevel@tonic-gate 		bp = buf + strlen(buf);
8457c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf),
8462f172c55SRobert Thurlow 		    nfs4_fragged_rpc ? nfs4err_fragrpc : nfs4err_xdrfrag);
8477c478bd9Sstevel@tonic-gate 		return (buf);
8487c478bd9Sstevel@tonic-gate 	}
8497c478bd9Sstevel@tonic-gate 
8507c478bd9Sstevel@tonic-gate 	/*
8517c478bd9Sstevel@tonic-gate 	 * might be nice to print minor version, but doesn't
8527c478bd9Sstevel@tonic-gate 	 * seem like very useful info for summary mode
8537c478bd9Sstevel@tonic-gate 	 */
8547c478bd9Sstevel@tonic-gate 	if (!xdr_uint32_t(&xdrm, &minor_version))
8557c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
8567c478bd9Sstevel@tonic-gate 
8577c478bd9Sstevel@tonic-gate 	numops = getxdr_long();
8587c478bd9Sstevel@tonic-gate 	bp = buf;
8597c478bd9Sstevel@tonic-gate 	while (numops-- > 0) {
8607c478bd9Sstevel@tonic-gate 		char *operand;
8617c478bd9Sstevel@tonic-gate 
8627c478bd9Sstevel@tonic-gate 		bzero(&one_op, sizeof (one_op));
8637c478bd9Sstevel@tonic-gate 
8647c478bd9Sstevel@tonic-gate 		if (!xdr_nfs_argop4(&xdrm, &one_op)) {
8657c478bd9Sstevel@tonic-gate 			xdr_free(xdr_nfs_argop4, (char *)&one_op);
8667c478bd9Sstevel@tonic-gate 			longjmp(xdr_err, 1);
8677c478bd9Sstevel@tonic-gate 		}
8687c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf), "%s ",
8692f172c55SRobert Thurlow 		    opcode_name(one_op.argop));
8707c478bd9Sstevel@tonic-gate 		bp += strlen(bp);
8717c478bd9Sstevel@tonic-gate 
8727c478bd9Sstevel@tonic-gate 		operand = sum_operand(&one_op);
8737c478bd9Sstevel@tonic-gate 		if (strlen(operand) > 0) {
8747c478bd9Sstevel@tonic-gate 			snprintf(bp, buflen - (bp - buf), "%s ", operand);
8757c478bd9Sstevel@tonic-gate 			bp += strlen(bp);
8767c478bd9Sstevel@tonic-gate 		}
8777c478bd9Sstevel@tonic-gate 
8787c478bd9Sstevel@tonic-gate 		/* nfs4_skip_bytes set by xdr_nfs4_argop4 */
8797c478bd9Sstevel@tonic-gate 		if (nfs4_skip_bytes != 0)
8807c478bd9Sstevel@tonic-gate 			nfs4_xdr_skip(nfs4_skip_bytes);
8817c478bd9Sstevel@tonic-gate 
8827c478bd9Sstevel@tonic-gate 		xdr_free(xdr_nfs_argop4, (char *)&one_op);
8837c478bd9Sstevel@tonic-gate 
8847c478bd9Sstevel@tonic-gate 		/* add "..." if past the "end" of the buffer */
8857c478bd9Sstevel@tonic-gate 		if (bp - buf > SUM_COMPND_MAX) {
8867c478bd9Sstevel@tonic-gate 			strcpy(buf + SUM_COMPND_MAX - strlen("..."),
8877c478bd9Sstevel@tonic-gate 			    "...");
8887c478bd9Sstevel@tonic-gate 			break;
8897c478bd9Sstevel@tonic-gate 		}
8907c478bd9Sstevel@tonic-gate 	}
8917c478bd9Sstevel@tonic-gate 
8927c478bd9Sstevel@tonic-gate 	return (buf);
8937c478bd9Sstevel@tonic-gate }
8947c478bd9Sstevel@tonic-gate 
8957c478bd9Sstevel@tonic-gate static void
nfs4_xdr_skip(int nbytes)8967c478bd9Sstevel@tonic-gate nfs4_xdr_skip(int nbytes)
8977c478bd9Sstevel@tonic-gate {
8987c478bd9Sstevel@tonic-gate 	int resid, off, len, cur_pos, new_pos;
8997c478bd9Sstevel@tonic-gate 
9007c478bd9Sstevel@tonic-gate 	len = RNDUP(nbytes);
9017c478bd9Sstevel@tonic-gate 	cur_pos = xdr_getpos(&xdrm);
9027c478bd9Sstevel@tonic-gate 
9037c478bd9Sstevel@tonic-gate 	/*
9047c478bd9Sstevel@tonic-gate 	 * Time to skip over the rd/wr data.  If the
9057c478bd9Sstevel@tonic-gate 	 * rd/wr data is completely contained in the first
9067c478bd9Sstevel@tonic-gate 	 * frag, we must skip over it to process the rest of
9077c478bd9Sstevel@tonic-gate 	 * the packet.
9087c478bd9Sstevel@tonic-gate 	 *
9097c478bd9Sstevel@tonic-gate 	 * nfs4_pkt_start: XDR position of start of NFS4 compound
9107c478bd9Sstevel@tonic-gate 	 * nfs4_pkt_len: number of bytes in pkt relative to
9117c478bd9Sstevel@tonic-gate 	 *		 nfs4_pkt_start
9127c478bd9Sstevel@tonic-gate 	 *
9137c478bd9Sstevel@tonic-gate 	 * cur_pos: current XDR position
9147c478bd9Sstevel@tonic-gate 	 * off: current XDR position relative to nfs4_pkt_start
9157c478bd9Sstevel@tonic-gate 	 * resid: number of unprocessed bytes in current pkt
9167c478bd9Sstevel@tonic-gate 	 *	  (relative to cur_pos/off)
9177c478bd9Sstevel@tonic-gate 	 *
9187c478bd9Sstevel@tonic-gate 	 * If nbytes <= resid, then we must skip over the rd/wr
9197c478bd9Sstevel@tonic-gate 	 * bytes so we can read the next op/compound in this
9207c478bd9Sstevel@tonic-gate 	 * packet.  Otherwise, set the fragged flag so we can
9217c478bd9Sstevel@tonic-gate 	 * display the fragged_rpc message.
9227c478bd9Sstevel@tonic-gate 	 */
9237c478bd9Sstevel@tonic-gate 	off = cur_pos - nfs4_pkt_start;
9247c478bd9Sstevel@tonic-gate 	resid = nfs4_pkt_len - off;
9257c478bd9Sstevel@tonic-gate 
9267c478bd9Sstevel@tonic-gate 	/*
9277c478bd9Sstevel@tonic-gate 	 * set nfs4_fragged_rpc if the requested number of "skip"
9287c478bd9Sstevel@tonic-gate 	 * bytes is larger than the bytes remaining in the XDR
9297c478bd9Sstevel@tonic-gate 	 * stream/current packet.  The global is reset to 0 at
9307c478bd9Sstevel@tonic-gate 	 * start of interpret_nfs4.
9317c478bd9Sstevel@tonic-gate 	 */
9327c478bd9Sstevel@tonic-gate 	new_pos = cur_pos + ((nfs4_fragged_rpc = len > resid) ? resid : len);
9337c478bd9Sstevel@tonic-gate 
9347c478bd9Sstevel@tonic-gate 	/* there's nothing to do for error case (if it fails pkt is doomed) */
9357c478bd9Sstevel@tonic-gate 	xdr_setpos(&xdrm, new_pos);
9367c478bd9Sstevel@tonic-gate }
9377c478bd9Sstevel@tonic-gate 
9387c478bd9Sstevel@tonic-gate 
9397c478bd9Sstevel@tonic-gate /*
9407c478bd9Sstevel@tonic-gate  * Return the names and arguments of the oplist elements, up to
9417c478bd9Sstevel@tonic-gate  * SUM_COMPND_MAX characters.  If the elements don't fit, include a "..."
9427c478bd9Sstevel@tonic-gate  * at the end of the string.
9437c478bd9Sstevel@tonic-gate  */
9447c478bd9Sstevel@tonic-gate static char *
sum_cb_compound4args(void)9457c478bd9Sstevel@tonic-gate sum_cb_compound4args(void)
9467c478bd9Sstevel@tonic-gate {
9477c478bd9Sstevel@tonic-gate 	static char buf[SUM_COMPND_MAX + 2]; /* 1 for null, 1 for overflow */
9487c478bd9Sstevel@tonic-gate 	int numops;
9497c478bd9Sstevel@tonic-gate 	const size_t buflen = sizeof (buf);
9507c478bd9Sstevel@tonic-gate 	char *bp;
9517c478bd9Sstevel@tonic-gate 	nfs_cb_argop4 one_op;
9527c478bd9Sstevel@tonic-gate 	uint32_t minor_version, callback_ident;
9537c478bd9Sstevel@tonic-gate 
9547c478bd9Sstevel@tonic-gate 	buf[0] = '\0';
9557c478bd9Sstevel@tonic-gate 	if (setjmp(xdr_err)) {
9567c478bd9Sstevel@tonic-gate 		bp = buf + strlen(buf);
9577c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf), "<XDR Error or Fragmented"
9582f172c55SRobert Thurlow 		    " RPC>");
9597c478bd9Sstevel@tonic-gate 		return (buf);
9607c478bd9Sstevel@tonic-gate 	}
9617c478bd9Sstevel@tonic-gate 
9627c478bd9Sstevel@tonic-gate 	/*
9637c478bd9Sstevel@tonic-gate 	 * might be nice to print minor version, but doesn't
9647c478bd9Sstevel@tonic-gate 	 * seem like very useful info for summary mode
9657c478bd9Sstevel@tonic-gate 	 */
9667c478bd9Sstevel@tonic-gate 	if (!xdr_uint32_t(&xdrm, &minor_version))
9677c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
9687c478bd9Sstevel@tonic-gate 
9697c478bd9Sstevel@tonic-gate 	/* print callback_ident */
9707c478bd9Sstevel@tonic-gate 	if (!xdr_uint32_t(&xdrm, &callback_ident))
9717c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
9727c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "CBID=%u ", callback_ident);
9737c478bd9Sstevel@tonic-gate 
9747c478bd9Sstevel@tonic-gate 	bp = buf + strlen(buf);
9757c478bd9Sstevel@tonic-gate 	numops = getxdr_long();
9767c478bd9Sstevel@tonic-gate 
9777c478bd9Sstevel@tonic-gate 	while (numops-- > 0) {
9787c478bd9Sstevel@tonic-gate 		char *operand;
9797c478bd9Sstevel@tonic-gate 
9807c478bd9Sstevel@tonic-gate 		bzero(&one_op, sizeof (one_op));
9817c478bd9Sstevel@tonic-gate 		if (!xdr_nfs_cb_argop4(&xdrm, &one_op)) {
9827c478bd9Sstevel@tonic-gate 			xdr_free(xdr_nfs_cb_argop4, (char *)&one_op);
9837c478bd9Sstevel@tonic-gate 			longjmp(xdr_err, 1);
9847c478bd9Sstevel@tonic-gate 		}
9857c478bd9Sstevel@tonic-gate 
9867c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf), "%s ",
9872f172c55SRobert Thurlow 		    cb_opcode_name(one_op.argop));
9887c478bd9Sstevel@tonic-gate 		bp += strlen(bp);
9897c478bd9Sstevel@tonic-gate 		operand = sum_cb_operand(&one_op);
9907c478bd9Sstevel@tonic-gate 		if (strlen(operand) > 0) {
9917c478bd9Sstevel@tonic-gate 			snprintf(bp, buflen - (bp - buf), "%s ", operand);
9927c478bd9Sstevel@tonic-gate 			bp += strlen(bp);
9937c478bd9Sstevel@tonic-gate 		}
9947c478bd9Sstevel@tonic-gate 
9957c478bd9Sstevel@tonic-gate 		xdr_free(xdr_nfs_cb_argop4, (char *)&one_op);
9967c478bd9Sstevel@tonic-gate 
9977c478bd9Sstevel@tonic-gate 		/* add "..." if past the "end" of the buffer */
9987c478bd9Sstevel@tonic-gate 		if (bp - buf > SUM_COMPND_MAX) {
9997c478bd9Sstevel@tonic-gate 			strcpy(buf + SUM_COMPND_MAX - strlen("..."),
10007c478bd9Sstevel@tonic-gate 			    "...");
10017c478bd9Sstevel@tonic-gate 			break;
10027c478bd9Sstevel@tonic-gate 		}
10037c478bd9Sstevel@tonic-gate 	}
10047c478bd9Sstevel@tonic-gate 
10057c478bd9Sstevel@tonic-gate 	return (buf);
10067c478bd9Sstevel@tonic-gate }
10077c478bd9Sstevel@tonic-gate 
10087c478bd9Sstevel@tonic-gate /*
10097c478bd9Sstevel@tonic-gate  * Return the summarized argument list for the given nfs_argop4.
10107c478bd9Sstevel@tonic-gate  */
10117c478bd9Sstevel@tonic-gate 
10127c478bd9Sstevel@tonic-gate static char *
sum_operand(nfs_argop4 * opp)10137c478bd9Sstevel@tonic-gate sum_operand(nfs_argop4 *opp)
10147c478bd9Sstevel@tonic-gate {
10157c478bd9Sstevel@tonic-gate 	static char buf[1024];
10167c478bd9Sstevel@tonic-gate 	void (*fmtproc)(char *, size_t, void *);
10177c478bd9Sstevel@tonic-gate 
10187c478bd9Sstevel@tonic-gate 	buf[0] = '\0';
10197c478bd9Sstevel@tonic-gate 	if (opp->argop < num_opcodes) {
10207c478bd9Sstevel@tonic-gate 		fmtproc = opcode_info[opp->argop].sumarg;
10217c478bd9Sstevel@tonic-gate 		if (fmtproc != NULL)
10227c478bd9Sstevel@tonic-gate 			fmtproc(buf, sizeof (buf), &opp->nfs_argop4_u);
10237c478bd9Sstevel@tonic-gate 	}
10247c478bd9Sstevel@tonic-gate 
10257c478bd9Sstevel@tonic-gate 	return (buf);
10267c478bd9Sstevel@tonic-gate }
10277c478bd9Sstevel@tonic-gate 
10287c478bd9Sstevel@tonic-gate /*
10297c478bd9Sstevel@tonic-gate  * Return the summarized argument list for the given nfs_argop4.
10307c478bd9Sstevel@tonic-gate  */
10317c478bd9Sstevel@tonic-gate 
10327c478bd9Sstevel@tonic-gate static char *
sum_cb_operand(nfs_cb_argop4 * opp)10337c478bd9Sstevel@tonic-gate sum_cb_operand(nfs_cb_argop4 *opp)
10347c478bd9Sstevel@tonic-gate {
10357c478bd9Sstevel@tonic-gate 	static char buf[1024];
10367c478bd9Sstevel@tonic-gate 	void (*fmtproc)(char *, size_t, void *);
10377c478bd9Sstevel@tonic-gate 
10387c478bd9Sstevel@tonic-gate 	buf[0] = '\0';
10397c478bd9Sstevel@tonic-gate 	if (opp->argop < cb_num_opcodes) {
10407c478bd9Sstevel@tonic-gate 		fmtproc = cb_opcode_info[opp->argop].sumarg;
10417c478bd9Sstevel@tonic-gate 		if (fmtproc != NULL)
10427c478bd9Sstevel@tonic-gate 			fmtproc(buf, sizeof (buf), &opp->nfs_cb_argop4_u);
10437c478bd9Sstevel@tonic-gate 	}
10447c478bd9Sstevel@tonic-gate 
10457c478bd9Sstevel@tonic-gate 	return (buf);
10467c478bd9Sstevel@tonic-gate }
10477c478bd9Sstevel@tonic-gate 
10487c478bd9Sstevel@tonic-gate /*
10497c478bd9Sstevel@tonic-gate  * Print details about the nfs_argop4 that is next in the XDR stream.
10507c478bd9Sstevel@tonic-gate  */
10517c478bd9Sstevel@tonic-gate 
10527c478bd9Sstevel@tonic-gate static void
detail_nfs_argop4(void)10537c478bd9Sstevel@tonic-gate detail_nfs_argop4(void)
10547c478bd9Sstevel@tonic-gate {
10557c478bd9Sstevel@tonic-gate 	int numops;
10567c478bd9Sstevel@tonic-gate 	nfs_argop4 one_op;
10577c478bd9Sstevel@tonic-gate 	void (*fmtproc)(void *);
10587c478bd9Sstevel@tonic-gate 	uint32_t minor_version;
10597c478bd9Sstevel@tonic-gate 
10607c478bd9Sstevel@tonic-gate 	if (!xdr_uint32_t(&xdrm, &minor_version))
10617c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
10627c478bd9Sstevel@tonic-gate 
10637c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line(0, 0), "Minor version = %u",
10642f172c55SRobert Thurlow 	    minor_version);
10657c478bd9Sstevel@tonic-gate 
10667c478bd9Sstevel@tonic-gate 	numops = getxdr_long();
10677c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line(0, 0), "Number of operations = %d",
10682f172c55SRobert Thurlow 	    numops);
10697c478bd9Sstevel@tonic-gate 
10707c478bd9Sstevel@tonic-gate 	while (numops-- > 0) {
10717c478bd9Sstevel@tonic-gate 		bzero(&one_op, sizeof (one_op));
10727c478bd9Sstevel@tonic-gate 
10737c478bd9Sstevel@tonic-gate 		if (!xdr_nfs_argop4(&xdrm, &one_op)) {
10747c478bd9Sstevel@tonic-gate 			xdr_free(xdr_nfs_argop4, (char *)&one_op);
10757c478bd9Sstevel@tonic-gate 			longjmp(xdr_err, 1);
10767c478bd9Sstevel@tonic-gate 		}
10777c478bd9Sstevel@tonic-gate 
10787c478bd9Sstevel@tonic-gate 		get_line(0, 0);		/* blank line to separate ops */
10797c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Op = %d (%s)",
10802f172c55SRobert Thurlow 		    one_op.argop, opcode_name(one_op.argop));
10817c478bd9Sstevel@tonic-gate 		if (one_op.argop < num_opcodes) {
10827c478bd9Sstevel@tonic-gate 			fmtproc = opcode_info[one_op.argop].dtlarg;
10837c478bd9Sstevel@tonic-gate 			if (fmtproc != NULL)
10847c478bd9Sstevel@tonic-gate 				fmtproc(&one_op.nfs_argop4_u);
10857c478bd9Sstevel@tonic-gate 		}
10867c478bd9Sstevel@tonic-gate 
10877c478bd9Sstevel@tonic-gate 		/* nfs4_skip_bytes set by xdr_nfs_argop4() */
10887c478bd9Sstevel@tonic-gate 		if (nfs4_skip_bytes)
10897c478bd9Sstevel@tonic-gate 			nfs4_xdr_skip(nfs4_skip_bytes);
10907c478bd9Sstevel@tonic-gate 
10917c478bd9Sstevel@tonic-gate 		xdr_free(xdr_nfs_argop4, (char *)&one_op);
10927c478bd9Sstevel@tonic-gate 	}
10937c478bd9Sstevel@tonic-gate }
10947c478bd9Sstevel@tonic-gate 
10957c478bd9Sstevel@tonic-gate 
10967c478bd9Sstevel@tonic-gate /*
10977c478bd9Sstevel@tonic-gate  * Print details about the nfs_argop4 that is next in the XDR stream.
10987c478bd9Sstevel@tonic-gate  */
10997c478bd9Sstevel@tonic-gate static void
detail_cb_argop4(void)11007c478bd9Sstevel@tonic-gate detail_cb_argop4(void)
11017c478bd9Sstevel@tonic-gate {
11027c478bd9Sstevel@tonic-gate 	int numops;
11037c478bd9Sstevel@tonic-gate 	nfs_cb_argop4 one_op;
11047c478bd9Sstevel@tonic-gate 	void (*fmtproc)(void *);
11057c478bd9Sstevel@tonic-gate 	uint32_t minor_version, callback_ident;
11067c478bd9Sstevel@tonic-gate 
11077c478bd9Sstevel@tonic-gate 	if (!xdr_uint32_t(&xdrm, &minor_version))
11087c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
11097c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line(0, 0), "Minor version = %u",
11102f172c55SRobert Thurlow 	    minor_version);
11117c478bd9Sstevel@tonic-gate 
11127c478bd9Sstevel@tonic-gate 	if (!xdr_uint32_t(&xdrm, &callback_ident))
11137c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
11147c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line(0, 0), "Callback Ident = %u",
11152f172c55SRobert Thurlow 	    callback_ident);
11167c478bd9Sstevel@tonic-gate 
11177c478bd9Sstevel@tonic-gate 	numops = getxdr_long();
11187c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line(0, 0), "Number of operations = %d",
11192f172c55SRobert Thurlow 	    numops);
11207c478bd9Sstevel@tonic-gate 
11217c478bd9Sstevel@tonic-gate 	while (numops-- > 0) {
11227c478bd9Sstevel@tonic-gate 		bzero(&one_op, sizeof (one_op));
11237c478bd9Sstevel@tonic-gate 		if (!xdr_nfs_cb_argop4(&xdrm, &one_op)) {
11247c478bd9Sstevel@tonic-gate 			xdr_free(xdr_nfs_cb_argop4, (char *)&one_op);
11257c478bd9Sstevel@tonic-gate 			longjmp(xdr_err, 1);
11267c478bd9Sstevel@tonic-gate 		}
11277c478bd9Sstevel@tonic-gate 
11287c478bd9Sstevel@tonic-gate 		get_line(0, 0);		/* blank line to separate ops */
11297c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Op = %d (%s)",
11302f172c55SRobert Thurlow 		    one_op.argop, cb_opcode_name(one_op.argop));
11317c478bd9Sstevel@tonic-gate 		if (one_op.argop < cb_num_opcodes) {
11327c478bd9Sstevel@tonic-gate 			fmtproc = cb_opcode_info[one_op.argop].dtlarg;
11337c478bd9Sstevel@tonic-gate 			if (fmtproc != NULL)
11347c478bd9Sstevel@tonic-gate 				fmtproc(&one_op.nfs_cb_argop4_u);
11357c478bd9Sstevel@tonic-gate 		}
11367c478bd9Sstevel@tonic-gate 
11377c478bd9Sstevel@tonic-gate 		xdr_free(xdr_nfs_cb_argop4, (char *)&one_op);
11387c478bd9Sstevel@tonic-gate 	}
11397c478bd9Sstevel@tonic-gate }
11407c478bd9Sstevel@tonic-gate 
11417c478bd9Sstevel@tonic-gate /*
11427c478bd9Sstevel@tonic-gate  * component_name: return a printable string for the given component4.  I'm
11437c478bd9Sstevel@tonic-gate  * leaving this as a separate function (as opposed to having the callers
11447c478bd9Sstevel@tonic-gate  * call utf8localize() directly) in case the definition of component4
11457c478bd9Sstevel@tonic-gate  * changes.
11467c478bd9Sstevel@tonic-gate  */
11477c478bd9Sstevel@tonic-gate 
11487c478bd9Sstevel@tonic-gate static char *
component_name(component4 * cp)11497c478bd9Sstevel@tonic-gate component_name(component4 *cp)
11507c478bd9Sstevel@tonic-gate {
11517c478bd9Sstevel@tonic-gate 	return (utf8localize(cp));
11527c478bd9Sstevel@tonic-gate }
11537c478bd9Sstevel@tonic-gate 
11547c478bd9Sstevel@tonic-gate /*
11557c478bd9Sstevel@tonic-gate  * linktext_name.  cf. component_name().
11567c478bd9Sstevel@tonic-gate  */
11577c478bd9Sstevel@tonic-gate 
11587c478bd9Sstevel@tonic-gate static char *
linktext_name(linktext4 * lp)11597c478bd9Sstevel@tonic-gate linktext_name(linktext4 *lp)
11607c478bd9Sstevel@tonic-gate {
1161bbe876c0SMarcel Telka 	return (utf8localize((utf8string *)lp));
11627c478bd9Sstevel@tonic-gate }
11637c478bd9Sstevel@tonic-gate 
11647c478bd9Sstevel@tonic-gate /*
11657c478bd9Sstevel@tonic-gate  * stable_how4_name: return a string for "how".
11667c478bd9Sstevel@tonic-gate  */
11677c478bd9Sstevel@tonic-gate 
11687c478bd9Sstevel@tonic-gate static char *
stable_how4_name(stable_how4 how)11697c478bd9Sstevel@tonic-gate stable_how4_name(stable_how4 how)
11707c478bd9Sstevel@tonic-gate {
11717c478bd9Sstevel@tonic-gate 	char *result;
11727c478bd9Sstevel@tonic-gate 
11737c478bd9Sstevel@tonic-gate 	switch (how) {
11747c478bd9Sstevel@tonic-gate 	case UNSTABLE4:
11757c478bd9Sstevel@tonic-gate 		result = "ASYNC";
11767c478bd9Sstevel@tonic-gate 		break;
11777c478bd9Sstevel@tonic-gate 	case DATA_SYNC4:
11787c478bd9Sstevel@tonic-gate 		result = "DSYNC";
11797c478bd9Sstevel@tonic-gate 		break;
11807c478bd9Sstevel@tonic-gate 	case FILE_SYNC4:
11817c478bd9Sstevel@tonic-gate 		result = "FSYNC";
11827c478bd9Sstevel@tonic-gate 		break;
11837c478bd9Sstevel@tonic-gate 	default:
11847c478bd9Sstevel@tonic-gate 		result = "?";
11857c478bd9Sstevel@tonic-gate 		break;
11867c478bd9Sstevel@tonic-gate 	}
11877c478bd9Sstevel@tonic-gate 
11887c478bd9Sstevel@tonic-gate 	return (result);
11897c478bd9Sstevel@tonic-gate }
11907c478bd9Sstevel@tonic-gate 
11917c478bd9Sstevel@tonic-gate /*
11927c478bd9Sstevel@tonic-gate  * sum_open_share_access: return a string corresponding to the
11937c478bd9Sstevel@tonic-gate  * given OPEN share access bitmask.
11947c478bd9Sstevel@tonic-gate  */
11957c478bd9Sstevel@tonic-gate 
11967c478bd9Sstevel@tonic-gate static char *
sum_open_share_access(int32_t mask)11977c478bd9Sstevel@tonic-gate sum_open_share_access(int32_t mask)
11987c478bd9Sstevel@tonic-gate {
11997c478bd9Sstevel@tonic-gate 	char *result;
12007c478bd9Sstevel@tonic-gate 
12017c478bd9Sstevel@tonic-gate 	switch (mask) {
12027c478bd9Sstevel@tonic-gate 	case 0:
12037c478bd9Sstevel@tonic-gate 		result = "N";
12047c478bd9Sstevel@tonic-gate 		break;
12057c478bd9Sstevel@tonic-gate 	case OPEN4_SHARE_ACCESS_READ:
12067c478bd9Sstevel@tonic-gate 		result = "R";
12077c478bd9Sstevel@tonic-gate 		break;
12087c478bd9Sstevel@tonic-gate 	case OPEN4_SHARE_ACCESS_WRITE:
12097c478bd9Sstevel@tonic-gate 		result = "W";
12107c478bd9Sstevel@tonic-gate 		break;
12117c478bd9Sstevel@tonic-gate 	case OPEN4_SHARE_ACCESS_BOTH:
12127c478bd9Sstevel@tonic-gate 		result = "RW";
12137c478bd9Sstevel@tonic-gate 		break;
12147c478bd9Sstevel@tonic-gate 	default:
12157c478bd9Sstevel@tonic-gate 		result = "?";
12167c478bd9Sstevel@tonic-gate 		break;
12177c478bd9Sstevel@tonic-gate 	}
12187c478bd9Sstevel@tonic-gate 
12197c478bd9Sstevel@tonic-gate 	return (result);
12207c478bd9Sstevel@tonic-gate }
12217c478bd9Sstevel@tonic-gate 
12227c478bd9Sstevel@tonic-gate /*
12237c478bd9Sstevel@tonic-gate  * sum_open_share_deny: return a string corresponding to the
12247c478bd9Sstevel@tonic-gate  * given OPEN share deny bitmask.
12257c478bd9Sstevel@tonic-gate  */
12267c478bd9Sstevel@tonic-gate 
12277c478bd9Sstevel@tonic-gate static char *
sum_open_share_deny(int32_t mask)12287c478bd9Sstevel@tonic-gate sum_open_share_deny(int32_t mask)
12297c478bd9Sstevel@tonic-gate {
12307c478bd9Sstevel@tonic-gate 	char *result;
12317c478bd9Sstevel@tonic-gate 
12327c478bd9Sstevel@tonic-gate 	switch (mask) {
12337c478bd9Sstevel@tonic-gate 	case OPEN4_SHARE_DENY_NONE:
12347c478bd9Sstevel@tonic-gate 		result = "N";
12357c478bd9Sstevel@tonic-gate 		break;
12367c478bd9Sstevel@tonic-gate 	case OPEN4_SHARE_DENY_READ:
12377c478bd9Sstevel@tonic-gate 		result = "R";
12387c478bd9Sstevel@tonic-gate 		break;
12397c478bd9Sstevel@tonic-gate 	case OPEN4_SHARE_DENY_WRITE:
12407c478bd9Sstevel@tonic-gate 		result = "W";
12417c478bd9Sstevel@tonic-gate 		break;
12427c478bd9Sstevel@tonic-gate 	case OPEN4_SHARE_DENY_BOTH:
12437c478bd9Sstevel@tonic-gate 		result = "RW";
12447c478bd9Sstevel@tonic-gate 		break;
12457c478bd9Sstevel@tonic-gate 	default:
12467c478bd9Sstevel@tonic-gate 		result = "?";
12477c478bd9Sstevel@tonic-gate 		break;
12487c478bd9Sstevel@tonic-gate 	}
12497c478bd9Sstevel@tonic-gate 
12507c478bd9Sstevel@tonic-gate 	return (result);
12517c478bd9Sstevel@tonic-gate }
12527c478bd9Sstevel@tonic-gate 
12537c478bd9Sstevel@tonic-gate static int
special_stateid(stateid4 * stateid)12547c478bd9Sstevel@tonic-gate special_stateid(stateid4 *stateid)
12557c478bd9Sstevel@tonic-gate {
12567c478bd9Sstevel@tonic-gate 
12577c478bd9Sstevel@tonic-gate 	if (! memcmp(stateid, &spec_stateid_0, sizeof (*stateid)))
12587c478bd9Sstevel@tonic-gate 		return (0);
12597c478bd9Sstevel@tonic-gate 
12607c478bd9Sstevel@tonic-gate 	if (! memcmp(stateid, &spec_stateid_1, sizeof (*stateid)))
12617c478bd9Sstevel@tonic-gate 		return (1);
12627c478bd9Sstevel@tonic-gate 
12637c478bd9Sstevel@tonic-gate 	return (-1);
12647c478bd9Sstevel@tonic-gate }
12657c478bd9Sstevel@tonic-gate 
12667c478bd9Sstevel@tonic-gate static char *
_sum_stateid(stateid4 * stateid,char * prefix)12677c478bd9Sstevel@tonic-gate _sum_stateid(stateid4 *stateid, char *prefix)
12687c478bd9Sstevel@tonic-gate {
12697c478bd9Sstevel@tonic-gate 	static char buf[32];
12707c478bd9Sstevel@tonic-gate 	int spec;
12717c478bd9Sstevel@tonic-gate 
12727c478bd9Sstevel@tonic-gate 	if ((spec = special_stateid(stateid)) < 0)
12737c478bd9Sstevel@tonic-gate 		snprintf(buf, sizeof (buf), "%s%04X:%u", prefix,
12742f172c55SRobert Thurlow 		    stateid_hash(stateid), stateid->seqid);
12757c478bd9Sstevel@tonic-gate 	else
12767c478bd9Sstevel@tonic-gate 		snprintf(buf, sizeof (buf), "%s%s", prefix,
12772f172c55SRobert Thurlow 		    spec == 0 ? "SPC0" : (spec == 1 ? "SPC1" : "SPC?"));
12787c478bd9Sstevel@tonic-gate 	return (buf);
12797c478bd9Sstevel@tonic-gate }
12807c478bd9Sstevel@tonic-gate 
12817c478bd9Sstevel@tonic-gate static void
_detail_stateid(stateid4 * stateid,char * prefix)12827c478bd9Sstevel@tonic-gate _detail_stateid(stateid4 *stateid, char *prefix)
12837c478bd9Sstevel@tonic-gate {
12847c478bd9Sstevel@tonic-gate 	int spec;
12857c478bd9Sstevel@tonic-gate 	char seqstr[32] = {0};
12867c478bd9Sstevel@tonic-gate 
12877c478bd9Sstevel@tonic-gate 	spec = special_stateid(stateid);
12887c478bd9Sstevel@tonic-gate 
12897c478bd9Sstevel@tonic-gate 	if (spec < 0)
12907c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "%sState ID hash = %04X",
12912f172c55SRobert Thurlow 		    prefix, stateid_hash(stateid));
12927c478bd9Sstevel@tonic-gate 	else
12937c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "%sState ID hash = %s",	prefix,
12942f172c55SRobert Thurlow 		    spec == 0 ? "SPECIAL_0" :
12952f172c55SRobert Thurlow 		    (spec == 1 ? "SPECIAL_1" : "SPECIAL_?"));
12967c478bd9Sstevel@tonic-gate 
12977c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "    len = %u    val = %s",
12982f172c55SRobert Thurlow 	    sizeof (stateid->other),
12992f172c55SRobert Thurlow 	    tohex(stateid->other, sizeof (stateid->other)));
13007c478bd9Sstevel@tonic-gate 
13017c478bd9Sstevel@tonic-gate 	/*
13027c478bd9Sstevel@tonic-gate 	 * If spec 0/1 stateid, print seqid in hex; otherwise,
13037c478bd9Sstevel@tonic-gate 	 * use decimal.  This makes it more clear how spec stateids
13047c478bd9Sstevel@tonic-gate 	 * are constructed [obvious that either all bits are 0, or all
13057c478bd9Sstevel@tonic-gate 	 * bits are 1].
13067c478bd9Sstevel@tonic-gate 	 */
13077c478bd9Sstevel@tonic-gate 	if (spec == -1)
13087c478bd9Sstevel@tonic-gate 		sprintf(seqstr, "%d", stateid->seqid);
13097c478bd9Sstevel@tonic-gate 	else
13107c478bd9Sstevel@tonic-gate 		sprintf(seqstr, "%08X", stateid->seqid);
13117c478bd9Sstevel@tonic-gate 
13127c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "    %sState ID Sequence ID = %s",
13132f172c55SRobert Thurlow 	    prefix, seqstr);
13147c478bd9Sstevel@tonic-gate }
13157c478bd9Sstevel@tonic-gate 
13167c478bd9Sstevel@tonic-gate 
13177c478bd9Sstevel@tonic-gate static char *
sum_lock_denied(LOCK4denied * denied)13187c478bd9Sstevel@tonic-gate sum_lock_denied(LOCK4denied *denied)
13197c478bd9Sstevel@tonic-gate {
13207c478bd9Sstevel@tonic-gate 	static char buf[64];
13217c478bd9Sstevel@tonic-gate 
13222d8dae53SMarcel Telka 	sprintf(buf, "%s %llu:%llu LO=%04X",
13232f172c55SRobert Thurlow 	    sum_lock_type_name(denied->locktype),
13242f172c55SRobert Thurlow 	    denied->offset, denied->length,
13252f172c55SRobert Thurlow 	    owner_hash(&denied->owner.owner));
13267c478bd9Sstevel@tonic-gate 
13277c478bd9Sstevel@tonic-gate 	return (buf);
13287c478bd9Sstevel@tonic-gate }
13297c478bd9Sstevel@tonic-gate 
13307c478bd9Sstevel@tonic-gate static void
detail_lock_denied(LOCK4denied * denied)13317c478bd9Sstevel@tonic-gate detail_lock_denied(LOCK4denied *denied)
13327c478bd9Sstevel@tonic-gate {
13337c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Type = %s", lock_type_name(denied->locktype));
13347c478bd9Sstevel@tonic-gate 	detail_lock_owner(&denied->owner);
13357c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Offset = %llu", denied->offset);
13367c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Length = %llu", denied->length);
13377c478bd9Sstevel@tonic-gate }
13387c478bd9Sstevel@tonic-gate 
13397c478bd9Sstevel@tonic-gate /*
13407c478bd9Sstevel@tonic-gate  * sum_createhow4: return the string name of "how".
13417c478bd9Sstevel@tonic-gate  */
13427c478bd9Sstevel@tonic-gate 
13437c478bd9Sstevel@tonic-gate static char *
createhow4_name(createhow4 * crtp)13447c478bd9Sstevel@tonic-gate createhow4_name(createhow4 *crtp)
13457c478bd9Sstevel@tonic-gate {
13467c478bd9Sstevel@tonic-gate 	char *result;
13477c478bd9Sstevel@tonic-gate 
13487c478bd9Sstevel@tonic-gate 	switch (crtp->mode) {
13497c478bd9Sstevel@tonic-gate 	case UNCHECKED4:
13507c478bd9Sstevel@tonic-gate 		result = "UNCHECKED";
13517c478bd9Sstevel@tonic-gate 		break;
13527c478bd9Sstevel@tonic-gate 	case GUARDED4:
13537c478bd9Sstevel@tonic-gate 		result = "GUARDED";
13547c478bd9Sstevel@tonic-gate 		break;
13557c478bd9Sstevel@tonic-gate 	case EXCLUSIVE4:
13567c478bd9Sstevel@tonic-gate 		result = "EXCLUSIVE";
13577c478bd9Sstevel@tonic-gate 		break;
13587c478bd9Sstevel@tonic-gate 	default:
13597c478bd9Sstevel@tonic-gate 		result = "?";
13607c478bd9Sstevel@tonic-gate 		break;
13617c478bd9Sstevel@tonic-gate 	}
13627c478bd9Sstevel@tonic-gate 
13637c478bd9Sstevel@tonic-gate 	return (result);
13647c478bd9Sstevel@tonic-gate }
13657c478bd9Sstevel@tonic-gate 
13667c478bd9Sstevel@tonic-gate /*
13677c478bd9Sstevel@tonic-gate  * detail_createhow4: print detail information about "how".
13687c478bd9Sstevel@tonic-gate  */
13697c478bd9Sstevel@tonic-gate 
13707c478bd9Sstevel@tonic-gate static void
detail_createhow4(createhow4 * crtp)13717c478bd9Sstevel@tonic-gate detail_createhow4(createhow4 *crtp)
13727c478bd9Sstevel@tonic-gate {
13737c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Method = %s",
13742f172c55SRobert Thurlow 	    createhow4_name(crtp));
13757c478bd9Sstevel@tonic-gate 
13767c478bd9Sstevel@tonic-gate 	switch (crtp->mode) {
13777c478bd9Sstevel@tonic-gate 	case UNCHECKED4:
13787c478bd9Sstevel@tonic-gate 	case GUARDED4:
13797c478bd9Sstevel@tonic-gate 		detail_fattr4(&crtp->createhow4_u.createattrs);
13807c478bd9Sstevel@tonic-gate 		break;
13817c478bd9Sstevel@tonic-gate 	case EXCLUSIVE4:
13827c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "  Verifier = %s",
13832f172c55SRobert Thurlow 		    tohex(crtp->createhow4_u.createverf,
13842f172c55SRobert Thurlow 		    NFS4_VERIFIER_SIZE));
13857c478bd9Sstevel@tonic-gate 		break;
13867c478bd9Sstevel@tonic-gate 	}
13877c478bd9Sstevel@tonic-gate }
13887c478bd9Sstevel@tonic-gate 
13897c478bd9Sstevel@tonic-gate static void
detail_createtype4(createtype4 * crtp)13907c478bd9Sstevel@tonic-gate detail_createtype4(createtype4 *crtp)
13917c478bd9Sstevel@tonic-gate {
13927c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Type = %s",
13932f172c55SRobert Thurlow 	    detail_type_name(crtp->type));
13947c478bd9Sstevel@tonic-gate 	switch (crtp->type) {
13957c478bd9Sstevel@tonic-gate 	case NF4LNK:
13967c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Linkdata = %s",
1397bbe876c0SMarcel Telka 		    utf8localize((utf8string *)&crtp->createtype4_u.linkdata));
13987c478bd9Sstevel@tonic-gate 		break;
13997c478bd9Sstevel@tonic-gate 	case NF4BLK:
14007c478bd9Sstevel@tonic-gate 	case NF4CHR:
14017c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Specdata1 = %04x Specdata2 = %04x",
14022f172c55SRobert Thurlow 		    crtp->createtype4_u.devdata.specdata1,
14032f172c55SRobert Thurlow 		    crtp->createtype4_u.devdata.specdata2);
14047c478bd9Sstevel@tonic-gate 		break;
14057c478bd9Sstevel@tonic-gate 	default:
14067c478bd9Sstevel@tonic-gate 		break;
14077c478bd9Sstevel@tonic-gate 	}
14087c478bd9Sstevel@tonic-gate }
14097c478bd9Sstevel@tonic-gate 
14107c478bd9Sstevel@tonic-gate static void
sumarg_access(char * buf,size_t buflen,void * obj)14117c478bd9Sstevel@tonic-gate sumarg_access(char *buf, size_t buflen, void *obj)
14127c478bd9Sstevel@tonic-gate {
14137c478bd9Sstevel@tonic-gate 	ACCESS4args *args = (ACCESS4args *)obj;
14147c478bd9Sstevel@tonic-gate 
14157c478bd9Sstevel@tonic-gate 	sum_access4(buf, buflen, args->access);
14167c478bd9Sstevel@tonic-gate }
14177c478bd9Sstevel@tonic-gate 
14187c478bd9Sstevel@tonic-gate static void
dtlarg_access(void * obj)14197c478bd9Sstevel@tonic-gate dtlarg_access(void *obj)
14207c478bd9Sstevel@tonic-gate {
14217c478bd9Sstevel@tonic-gate 	ACCESS4args *args = (ACCESS4args *)obj;
14227c478bd9Sstevel@tonic-gate 
14237c478bd9Sstevel@tonic-gate 	detail_access4("Access bits", args->access);
14247c478bd9Sstevel@tonic-gate }
14257c478bd9Sstevel@tonic-gate 
14267c478bd9Sstevel@tonic-gate static void
sumarg_close(char * buf,size_t buflen,void * obj)14277c478bd9Sstevel@tonic-gate sumarg_close(char *buf, size_t buflen, void *obj)
14287c478bd9Sstevel@tonic-gate {
14297c478bd9Sstevel@tonic-gate 	CLOSE4args *args = (CLOSE4args *)obj;
14307c478bd9Sstevel@tonic-gate 
14317c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "SQ=%u %s",
14322f172c55SRobert Thurlow 	    args->seqid, sum_open_stateid(&args->open_stateid));
14337c478bd9Sstevel@tonic-gate }
14347c478bd9Sstevel@tonic-gate 
14357c478bd9Sstevel@tonic-gate static void
dtlarg_close(void * obj)14367c478bd9Sstevel@tonic-gate dtlarg_close(void *obj)
14377c478bd9Sstevel@tonic-gate {
14387c478bd9Sstevel@tonic-gate 	CLOSE4args *args = (CLOSE4args *)obj;
14397c478bd9Sstevel@tonic-gate 
14407c478bd9Sstevel@tonic-gate 	detail_open_stateid(&args->open_stateid);
14417c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Sequence ID = %u", args->seqid);
14427c478bd9Sstevel@tonic-gate }
14437c478bd9Sstevel@tonic-gate 
14447c478bd9Sstevel@tonic-gate static void
sumarg_commit(char * buf,size_t buflen,void * obj)14457c478bd9Sstevel@tonic-gate sumarg_commit(char *buf, size_t buflen, void *obj)
14467c478bd9Sstevel@tonic-gate {
14477c478bd9Sstevel@tonic-gate 	COMMIT4args *args = (COMMIT4args *)obj;
14487c478bd9Sstevel@tonic-gate 
14497c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "at %llu for %u ", args->offset,
14502f172c55SRobert Thurlow 	    args->count);
14517c478bd9Sstevel@tonic-gate }
14527c478bd9Sstevel@tonic-gate 
14537c478bd9Sstevel@tonic-gate static void
dtlarg_commit(void * obj)14547c478bd9Sstevel@tonic-gate dtlarg_commit(void *obj)
14557c478bd9Sstevel@tonic-gate {
14567c478bd9Sstevel@tonic-gate 	COMMIT4args *args = (COMMIT4args *)obj;
14577c478bd9Sstevel@tonic-gate 
14587c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Offset = %llu", args->offset);
14597c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Count = %u", args->count);
14607c478bd9Sstevel@tonic-gate }
14617c478bd9Sstevel@tonic-gate 
14627c478bd9Sstevel@tonic-gate static void
sumarg_compnt(char * buf,size_t buflen,void * obj)14637c478bd9Sstevel@tonic-gate sumarg_compnt(char *buf, size_t buflen, void *obj)
14647c478bd9Sstevel@tonic-gate {
14657c478bd9Sstevel@tonic-gate 	component4 *comp = (component4 *)obj;
14667c478bd9Sstevel@tonic-gate 
14677c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "%s", component_name(comp));
14687c478bd9Sstevel@tonic-gate }
14697c478bd9Sstevel@tonic-gate 
14707c478bd9Sstevel@tonic-gate static void
dtlarg_compnt(void * obj)14717c478bd9Sstevel@tonic-gate dtlarg_compnt(void *obj)
14727c478bd9Sstevel@tonic-gate {
14737c478bd9Sstevel@tonic-gate 	component4 *comp = (component4 *)obj;
14747c478bd9Sstevel@tonic-gate 
14757c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Name = %s", component_name(comp));
14767c478bd9Sstevel@tonic-gate }
14777c478bd9Sstevel@tonic-gate 
14787c478bd9Sstevel@tonic-gate static void
sumarg_create(char * buf,size_t buflen,void * obj)14797c478bd9Sstevel@tonic-gate sumarg_create(char *buf, size_t buflen, void *obj)
14807c478bd9Sstevel@tonic-gate {
14817c478bd9Sstevel@tonic-gate 	CREATE4args *args = (CREATE4args *)obj;
14827c478bd9Sstevel@tonic-gate 
14837c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "%s %s ", component_name(&args->objname),
14842f172c55SRobert Thurlow 	    sum_type_name(args->objtype.type));
14857c478bd9Sstevel@tonic-gate }
14867c478bd9Sstevel@tonic-gate 
14877c478bd9Sstevel@tonic-gate static void
dtlarg_create(void * obj)14887c478bd9Sstevel@tonic-gate dtlarg_create(void *obj)
14897c478bd9Sstevel@tonic-gate {
14907c478bd9Sstevel@tonic-gate 	CREATE4args *args = (CREATE4args *)obj;
14917c478bd9Sstevel@tonic-gate 
14927c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Name = %s", component_name(&args->objname));
14937c478bd9Sstevel@tonic-gate 	detail_createtype4(&args->objtype);
14947c478bd9Sstevel@tonic-gate 	detail_fattr4(&args->createattrs);
14957c478bd9Sstevel@tonic-gate }
14967c478bd9Sstevel@tonic-gate 
14977c478bd9Sstevel@tonic-gate static void
sumarg_delprge(char * buf,size_t buflen,void * obj)14987c478bd9Sstevel@tonic-gate sumarg_delprge(char *buf, size_t buflen, void *obj)
14997c478bd9Sstevel@tonic-gate {
15007c478bd9Sstevel@tonic-gate 	DELEGPURGE4args *args = (DELEGPURGE4args *)obj;
15017c478bd9Sstevel@tonic-gate 
15027c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "%s", sum_clientid(args->clientid));
15037c478bd9Sstevel@tonic-gate }
15047c478bd9Sstevel@tonic-gate 
15057c478bd9Sstevel@tonic-gate static void
dtlarg_delprge(void * obj)15067c478bd9Sstevel@tonic-gate dtlarg_delprge(void *obj)
15077c478bd9Sstevel@tonic-gate {
15087c478bd9Sstevel@tonic-gate 	DELEGPURGE4args *args = (DELEGPURGE4args *)obj;
15097c478bd9Sstevel@tonic-gate 
15107c478bd9Sstevel@tonic-gate 	detail_clientid(args->clientid);
15117c478bd9Sstevel@tonic-gate }
15127c478bd9Sstevel@tonic-gate 
15137c478bd9Sstevel@tonic-gate static void
sumarg_delret(char * buf,size_t buflen,void * obj)15147c478bd9Sstevel@tonic-gate sumarg_delret(char *buf, size_t buflen, void *obj)
15157c478bd9Sstevel@tonic-gate {
15167c478bd9Sstevel@tonic-gate 	DELEGRETURN4args *args = (DELEGRETURN4args *)obj;
15177c478bd9Sstevel@tonic-gate 
15187c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "%s", sum_deleg_stateid(&args->deleg_stateid));
15197c478bd9Sstevel@tonic-gate }
15207c478bd9Sstevel@tonic-gate 
15217c478bd9Sstevel@tonic-gate static void
dtlarg_delret(void * obj)15227c478bd9Sstevel@tonic-gate dtlarg_delret(void *obj)
15237c478bd9Sstevel@tonic-gate {
15247c478bd9Sstevel@tonic-gate 	DELEGRETURN4args *args = (DELEGRETURN4args *)obj;
15257c478bd9Sstevel@tonic-gate 
15267c478bd9Sstevel@tonic-gate 	detail_deleg_stateid(&args->deleg_stateid);
15277c478bd9Sstevel@tonic-gate }
15287c478bd9Sstevel@tonic-gate 
15297c478bd9Sstevel@tonic-gate static void
sumarg_getattr(char * buf,size_t buflen,void * obj)15307c478bd9Sstevel@tonic-gate sumarg_getattr(char *buf, size_t buflen, void *obj)
15317c478bd9Sstevel@tonic-gate {
15327c478bd9Sstevel@tonic-gate 	GETATTR4args *args = (GETATTR4args *)obj;
15337c478bd9Sstevel@tonic-gate 
15347c478bd9Sstevel@tonic-gate 	sum_attr_bitmap(buf, buflen, &args->attr_request);
15357c478bd9Sstevel@tonic-gate }
15367c478bd9Sstevel@tonic-gate 
15377c478bd9Sstevel@tonic-gate static void
dtlarg_getattr(void * obj)15387c478bd9Sstevel@tonic-gate dtlarg_getattr(void *obj)
15397c478bd9Sstevel@tonic-gate {
15407c478bd9Sstevel@tonic-gate 	GETATTR4args *args = (GETATTR4args *)obj;
15417c478bd9Sstevel@tonic-gate 
15427c478bd9Sstevel@tonic-gate 	detail_attr_bitmap("", &args->attr_request, NULL);
15437c478bd9Sstevel@tonic-gate }
15447c478bd9Sstevel@tonic-gate 
15457c478bd9Sstevel@tonic-gate static void
sumarg_cb_getattr(char * buf,size_t buflen,void * obj)15467c478bd9Sstevel@tonic-gate sumarg_cb_getattr(char *buf, size_t buflen, void *obj)
15477c478bd9Sstevel@tonic-gate {
15487c478bd9Sstevel@tonic-gate 	CB_GETATTR4args *args = (CB_GETATTR4args *)obj;
15497c478bd9Sstevel@tonic-gate 	char *bp = buf;
15507c478bd9Sstevel@tonic-gate 
15517c478bd9Sstevel@tonic-gate 	snprintf(bp, buflen, "%s ", sum_fh4(&args->fh));
15527c478bd9Sstevel@tonic-gate 	bp += strlen(bp);
15537c478bd9Sstevel@tonic-gate 	sum_attr_bitmap(bp, buflen - (bp - buf), &args->attr_request);
15547c478bd9Sstevel@tonic-gate }
15557c478bd9Sstevel@tonic-gate 
15567c478bd9Sstevel@tonic-gate static void
dtlarg_cb_getattr(void * obj)15577c478bd9Sstevel@tonic-gate dtlarg_cb_getattr(void *obj)
15587c478bd9Sstevel@tonic-gate {
15597c478bd9Sstevel@tonic-gate 	CB_GETATTR4args *args = (CB_GETATTR4args *)obj;
15607c478bd9Sstevel@tonic-gate 
15617c478bd9Sstevel@tonic-gate 	detail_fh4(&args->fh);
15627c478bd9Sstevel@tonic-gate 	detail_attr_bitmap("", &args->attr_request, NULL);
15637c478bd9Sstevel@tonic-gate }
15647c478bd9Sstevel@tonic-gate 
15657c478bd9Sstevel@tonic-gate static void
sumarg_cb_recall(char * buf,size_t buflen,void * obj)15667c478bd9Sstevel@tonic-gate sumarg_cb_recall(char *buf, size_t buflen, void *obj)
15677c478bd9Sstevel@tonic-gate {
15687c478bd9Sstevel@tonic-gate 	CB_RECALL4args *args = (CB_RECALL4args *)obj;
15697c478bd9Sstevel@tonic-gate 	char *bp = buf;
15707c478bd9Sstevel@tonic-gate 
15717c478bd9Sstevel@tonic-gate 	snprintf(bp, buflen, "%s %s TR=%s", sum_fh4(&args->fh),
15722f172c55SRobert Thurlow 	    sum_stateid(&args->stateid), args->truncate ? "T" : "F");
15737c478bd9Sstevel@tonic-gate }
15747c478bd9Sstevel@tonic-gate 
15757c478bd9Sstevel@tonic-gate static void
dtlarg_cb_recall(void * obj)15767c478bd9Sstevel@tonic-gate dtlarg_cb_recall(void *obj)
15777c478bd9Sstevel@tonic-gate {
15787c478bd9Sstevel@tonic-gate 	CB_RECALL4args *args = (CB_RECALL4args *)obj;
15797c478bd9Sstevel@tonic-gate 
15807c478bd9Sstevel@tonic-gate 	detail_fh4(&args->fh);
15817c478bd9Sstevel@tonic-gate 	detail_stateid(&args->stateid);
15827c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Truncate = %s",
15832f172c55SRobert Thurlow 	    args->truncate ? "True" : "False");
15847c478bd9Sstevel@tonic-gate }
15857c478bd9Sstevel@tonic-gate 
15867c478bd9Sstevel@tonic-gate 
15877c478bd9Sstevel@tonic-gate /*
15887c478bd9Sstevel@tonic-gate  * name openhow seqid claim access deny owner
15897c478bd9Sstevel@tonic-gate  */
15907c478bd9Sstevel@tonic-gate static void
sumarg_open(char * buf,size_t buflen,void * obj)15917c478bd9Sstevel@tonic-gate sumarg_open(char *buf, size_t buflen, void *obj)
15927c478bd9Sstevel@tonic-gate {
15937c478bd9Sstevel@tonic-gate 	OPEN4args *args = (OPEN4args *)obj;
15947c478bd9Sstevel@tonic-gate 	char *bp = buf;
15957c478bd9Sstevel@tonic-gate 	int blen = buflen, len;
15967c478bd9Sstevel@tonic-gate 
15977c478bd9Sstevel@tonic-gate 	sum_name(bp, buflen, &args->claim);
15987c478bd9Sstevel@tonic-gate 	bp += (len = strlen(bp));
15997c478bd9Sstevel@tonic-gate 	blen -= len;
16007c478bd9Sstevel@tonic-gate 
16017c478bd9Sstevel@tonic-gate 	sum_openflag(bp, blen, &args->openhow);
16027c478bd9Sstevel@tonic-gate 	bp += (len = strlen(bp));
16037c478bd9Sstevel@tonic-gate 	blen -= len;
16047c478bd9Sstevel@tonic-gate 
16057c478bd9Sstevel@tonic-gate 	snprintf(bp, blen, " SQ=%u", args->seqid);
16067c478bd9Sstevel@tonic-gate 	bp += (len = strlen(bp));
16077c478bd9Sstevel@tonic-gate 	blen -= len;
16087c478bd9Sstevel@tonic-gate 
16097c478bd9Sstevel@tonic-gate 	sum_claim(bp, blen, &args->claim);
16107c478bd9Sstevel@tonic-gate 	bp += (len = strlen(bp));
16117c478bd9Sstevel@tonic-gate 	blen -= len;
16127c478bd9Sstevel@tonic-gate 
16137c478bd9Sstevel@tonic-gate 	snprintf(bp, blen, " AC=%s DN=%s OO=%04X",
16142f172c55SRobert Thurlow 	    sum_open_share_access(args->share_access),
16152f172c55SRobert Thurlow 	    sum_open_share_deny(args->share_deny),
16162f172c55SRobert Thurlow 	    owner_hash(&args->owner.owner));
16177c478bd9Sstevel@tonic-gate }
16187c478bd9Sstevel@tonic-gate 
16197c478bd9Sstevel@tonic-gate static void
dtlarg_open(void * obj)16207c478bd9Sstevel@tonic-gate dtlarg_open(void *obj)
16217c478bd9Sstevel@tonic-gate {
16227c478bd9Sstevel@tonic-gate 	OPEN4args *args = (OPEN4args *)obj;
16237c478bd9Sstevel@tonic-gate 
16247c478bd9Sstevel@tonic-gate 	detail_claim(&args->claim);
16257c478bd9Sstevel@tonic-gate 	detail_openflag(&args->openhow);
16267c478bd9Sstevel@tonic-gate 	detail_open_owner(&args->owner);
16277c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Sequence ID = %u", args->seqid);
16287c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Access = 0x%x (%s)",
16292f172c55SRobert Thurlow 	    args->share_access, sum_open_share_access(args->share_access));
16307c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Deny   = 0x%x (%s)",
16312f172c55SRobert Thurlow 	    args->share_deny, sum_open_share_access(args->share_deny));
16327c478bd9Sstevel@tonic-gate }
16337c478bd9Sstevel@tonic-gate 
16347c478bd9Sstevel@tonic-gate static void
sumarg_openattr(char * buf,size_t buflen,void * obj)16357c478bd9Sstevel@tonic-gate sumarg_openattr(char *buf, size_t buflen, void *obj)
16367c478bd9Sstevel@tonic-gate {
16377c478bd9Sstevel@tonic-gate 	OPENATTR4args *args = (OPENATTR4args *)obj;
16387c478bd9Sstevel@tonic-gate 
16397c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "CD=%s",
16402f172c55SRobert Thurlow 	    args->createdir ? "T" : "F");
16417c478bd9Sstevel@tonic-gate }
16427c478bd9Sstevel@tonic-gate 
16437c478bd9Sstevel@tonic-gate static void
dtlarg_openattr(void * obj)16447c478bd9Sstevel@tonic-gate dtlarg_openattr(void *obj)
16457c478bd9Sstevel@tonic-gate {
16467c478bd9Sstevel@tonic-gate 	OPENATTR4args *args = (OPENATTR4args *)obj;
16477c478bd9Sstevel@tonic-gate 
16487c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "CreateDir = %s",
16492f172c55SRobert Thurlow 	    args->createdir ? "True" : "False");
16507c478bd9Sstevel@tonic-gate }
16517c478bd9Sstevel@tonic-gate 
16527c478bd9Sstevel@tonic-gate static void
sumarg_open_confirm(char * buf,size_t buflen,void * obj)16537c478bd9Sstevel@tonic-gate sumarg_open_confirm(char *buf, size_t buflen, void *obj)
16547c478bd9Sstevel@tonic-gate {
16557c478bd9Sstevel@tonic-gate 	char *bp = buf;
16567c478bd9Sstevel@tonic-gate 	OPEN_CONFIRM4args *args = (OPEN_CONFIRM4args *)obj;
16577c478bd9Sstevel@tonic-gate 
16587c478bd9Sstevel@tonic-gate 	snprintf(bp, buflen, "SQ=%u %s", args->seqid,
16592f172c55SRobert Thurlow 	    sum_open_stateid(&args->open_stateid));
16607c478bd9Sstevel@tonic-gate }
16617c478bd9Sstevel@tonic-gate 
16627c478bd9Sstevel@tonic-gate static void
dtlarg_open_confirm(void * obj)16637c478bd9Sstevel@tonic-gate dtlarg_open_confirm(void *obj)
16647c478bd9Sstevel@tonic-gate {
16657c478bd9Sstevel@tonic-gate 	OPEN_CONFIRM4args *args = (OPEN_CONFIRM4args *)obj;
16667c478bd9Sstevel@tonic-gate 
16677c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Sequence ID = %u", args->seqid);
16687c478bd9Sstevel@tonic-gate 	detail_open_stateid(&args->open_stateid);
16697c478bd9Sstevel@tonic-gate }
16707c478bd9Sstevel@tonic-gate 
16717c478bd9Sstevel@tonic-gate static void
sumarg_open_downgrd(char * buf,size_t buflen,void * obj)16727c478bd9Sstevel@tonic-gate sumarg_open_downgrd(char *buf, size_t buflen, void *obj)
16737c478bd9Sstevel@tonic-gate {
16747c478bd9Sstevel@tonic-gate 	OPEN_DOWNGRADE4args *args = (OPEN_DOWNGRADE4args *)obj;
16757c478bd9Sstevel@tonic-gate 
16767c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "SQ=%u %s AC=%s DN=%s",
16772f172c55SRobert Thurlow 	    args->seqid, sum_open_stateid(&args->open_stateid),
16782f172c55SRobert Thurlow 	    sum_open_share_access(args->share_access),
16792f172c55SRobert Thurlow 	    sum_open_share_deny(args->share_deny));
16807c478bd9Sstevel@tonic-gate }
16817c478bd9Sstevel@tonic-gate 
16827c478bd9Sstevel@tonic-gate static void
dtlarg_open_downgrd(void * obj)16837c478bd9Sstevel@tonic-gate dtlarg_open_downgrd(void *obj)
16847c478bd9Sstevel@tonic-gate {
16857c478bd9Sstevel@tonic-gate 	OPEN_DOWNGRADE4args *args = (OPEN_DOWNGRADE4args *)obj;
16867c478bd9Sstevel@tonic-gate 
16877c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Open Sequence ID = %u", args->seqid);
16887c478bd9Sstevel@tonic-gate 	detail_open_stateid(&args->open_stateid);
16897c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Access = 0x%x (%s)",
16902f172c55SRobert Thurlow 	    args->share_access, sum_open_share_access(args->share_access));
16917c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Deny   = 0x%x (%s)",
16922f172c55SRobert Thurlow 	    args->share_deny, sum_open_share_access(args->share_deny));
16937c478bd9Sstevel@tonic-gate }
16947c478bd9Sstevel@tonic-gate 
16957c478bd9Sstevel@tonic-gate static void
sumarg_putfh(char * buf,size_t buflen,void * obj)16967c478bd9Sstevel@tonic-gate sumarg_putfh(char *buf, size_t buflen, void *obj)
16977c478bd9Sstevel@tonic-gate {
16987c478bd9Sstevel@tonic-gate 	PUTFH4args *args = (PUTFH4args *)obj;
16997c478bd9Sstevel@tonic-gate 
17007c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "%s", sum_fh4(&args->object));
17017c478bd9Sstevel@tonic-gate }
17027c478bd9Sstevel@tonic-gate 
17037c478bd9Sstevel@tonic-gate static void
dtlarg_putfh(void * obj)17047c478bd9Sstevel@tonic-gate dtlarg_putfh(void *obj)
17057c478bd9Sstevel@tonic-gate {
17067c478bd9Sstevel@tonic-gate 	PUTFH4args *args = (PUTFH4args *)obj;
17077c478bd9Sstevel@tonic-gate 
17087c478bd9Sstevel@tonic-gate 	detail_fh4(&args->object);
17097c478bd9Sstevel@tonic-gate }
17107c478bd9Sstevel@tonic-gate 
17117c478bd9Sstevel@tonic-gate static void
sumarg_link(char * buf,size_t buflen,void * obj)17127c478bd9Sstevel@tonic-gate sumarg_link(char *buf, size_t buflen, void *obj)
17137c478bd9Sstevel@tonic-gate {
17147c478bd9Sstevel@tonic-gate 	LINK4args *args = (LINK4args *)obj;
17157c478bd9Sstevel@tonic-gate 
17167c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "%s", component_name(&args->newname));
17177c478bd9Sstevel@tonic-gate }
17187c478bd9Sstevel@tonic-gate 
17197c478bd9Sstevel@tonic-gate static void
dtlarg_link(void * obj)17207c478bd9Sstevel@tonic-gate dtlarg_link(void *obj)
17217c478bd9Sstevel@tonic-gate {
17227c478bd9Sstevel@tonic-gate 	LINK4args *args = (LINK4args *)obj;
17237c478bd9Sstevel@tonic-gate 
17247c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "New name = %s",
17252f172c55SRobert Thurlow 	    component_name(&args->newname));
17267c478bd9Sstevel@tonic-gate }
17277c478bd9Sstevel@tonic-gate 
17287c478bd9Sstevel@tonic-gate static void
sum_open_to_lock_owner(char * buf,int buflen,open_to_lock_owner4 * own)17297c478bd9Sstevel@tonic-gate sum_open_to_lock_owner(char *buf, int buflen, open_to_lock_owner4 *own)
17307c478bd9Sstevel@tonic-gate {
17317c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, " OSQ=%u %s LSQ=%u LO=%04X", own->open_seqid,
17322f172c55SRobert Thurlow 	    sum_open_stateid(&own->open_stateid), own->lock_seqid,
17332f172c55SRobert Thurlow 	    owner_hash(&own->lock_owner.owner));
17347c478bd9Sstevel@tonic-gate }
17357c478bd9Sstevel@tonic-gate 
17367c478bd9Sstevel@tonic-gate static void
sum_exist_lock_owner(char * buf,int buflen,exist_lock_owner4 * own)17377c478bd9Sstevel@tonic-gate sum_exist_lock_owner(char *buf, int buflen, exist_lock_owner4 *own)
17387c478bd9Sstevel@tonic-gate {
17397c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, " LSQ=%u %s", own->lock_seqid,
17402f172c55SRobert Thurlow 	    sum_lock_stateid(&own->lock_stateid));
17417c478bd9Sstevel@tonic-gate }
17427c478bd9Sstevel@tonic-gate 
17437c478bd9Sstevel@tonic-gate static void
sum_locker(char * buf,size_t len,locker4 * lk)17447c478bd9Sstevel@tonic-gate sum_locker(char *buf, size_t len, locker4 *lk)
17457c478bd9Sstevel@tonic-gate {
17467c478bd9Sstevel@tonic-gate 	if (lk->new_lock_owner == TRUE)
17477c478bd9Sstevel@tonic-gate 		sum_open_to_lock_owner(buf, len, &lk->locker4_u.open_owner);
17487c478bd9Sstevel@tonic-gate 	else
17497c478bd9Sstevel@tonic-gate 		sum_exist_lock_owner(buf, len, &lk->locker4_u.lock_owner);
17507c478bd9Sstevel@tonic-gate }
17517c478bd9Sstevel@tonic-gate 
17527c478bd9Sstevel@tonic-gate static char *
sum_lock_type_name(enum nfs_lock_type4 type)17537c478bd9Sstevel@tonic-gate sum_lock_type_name(enum nfs_lock_type4 type)
17547c478bd9Sstevel@tonic-gate {
17557c478bd9Sstevel@tonic-gate 	char *result;
17567c478bd9Sstevel@tonic-gate 
17577c478bd9Sstevel@tonic-gate 	switch (type) {
17587c478bd9Sstevel@tonic-gate 	case READ_LT:
17597c478bd9Sstevel@tonic-gate 		result = "RD";
17607c478bd9Sstevel@tonic-gate 		break;
17617c478bd9Sstevel@tonic-gate 	case WRITE_LT:
17627c478bd9Sstevel@tonic-gate 		result = "WR";
17637c478bd9Sstevel@tonic-gate 		break;
17647c478bd9Sstevel@tonic-gate 	case READW_LT:
17657c478bd9Sstevel@tonic-gate 		result = "RDW";
17667c478bd9Sstevel@tonic-gate 		break;
17677c478bd9Sstevel@tonic-gate 	case WRITEW_LT:
17687c478bd9Sstevel@tonic-gate 		result = "WRW";
17697c478bd9Sstevel@tonic-gate 		break;
17707c478bd9Sstevel@tonic-gate 	default:
17717c478bd9Sstevel@tonic-gate 		result = "?";
17727c478bd9Sstevel@tonic-gate 		break;
17737c478bd9Sstevel@tonic-gate 	}
17747c478bd9Sstevel@tonic-gate 
17757c478bd9Sstevel@tonic-gate 	return (result);
17767c478bd9Sstevel@tonic-gate }
17777c478bd9Sstevel@tonic-gate 
17787c478bd9Sstevel@tonic-gate static void
sumarg_lock(char * buf,size_t buflen,void * obj)17797c478bd9Sstevel@tonic-gate sumarg_lock(char *buf, size_t buflen, void *obj)
17807c478bd9Sstevel@tonic-gate {
17817c478bd9Sstevel@tonic-gate 	LOCK4args *args = (LOCK4args *)obj;
17827c478bd9Sstevel@tonic-gate 	char *bp = buf;
17837c478bd9Sstevel@tonic-gate 
17847c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "%s%s%llu:%llu",
17852f172c55SRobert Thurlow 	    sum_lock_type_name(args->locktype),
17862f172c55SRobert Thurlow 	    args->reclaim ? " reclaim " : " ",
17872f172c55SRobert Thurlow 	    args->offset, args->length);
17887c478bd9Sstevel@tonic-gate 
17897c478bd9Sstevel@tonic-gate 	bp += strlen(buf);
17907c478bd9Sstevel@tonic-gate 	sum_locker(bp, buflen - (bp - buf), &args->locker);
17917c478bd9Sstevel@tonic-gate }
17927c478bd9Sstevel@tonic-gate 
17937c478bd9Sstevel@tonic-gate static void
detail_open_to_lock_owner(open_to_lock_owner4 * own)17947c478bd9Sstevel@tonic-gate detail_open_to_lock_owner(open_to_lock_owner4 *own)
17957c478bd9Sstevel@tonic-gate {
17967c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Open Sequence ID = %u", own->open_seqid);
17977c478bd9Sstevel@tonic-gate 	detail_open_stateid(&own->open_stateid);
17987c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Lock Sequence ID = %u", own->lock_seqid);
17997c478bd9Sstevel@tonic-gate 	detail_lock_owner(&own->lock_owner);
18007c478bd9Sstevel@tonic-gate }
18017c478bd9Sstevel@tonic-gate 
18027c478bd9Sstevel@tonic-gate static void
detail_exist_lock_owner(exist_lock_owner4 * own)18037c478bd9Sstevel@tonic-gate detail_exist_lock_owner(exist_lock_owner4 *own)
18047c478bd9Sstevel@tonic-gate {
18057c478bd9Sstevel@tonic-gate 	detail_lock_stateid(&own->lock_stateid);
18067c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Lock Sequence ID = %u", own->lock_seqid);
18077c478bd9Sstevel@tonic-gate }
18087c478bd9Sstevel@tonic-gate 
18097c478bd9Sstevel@tonic-gate static void
detail_locker(locker4 * lk)18107c478bd9Sstevel@tonic-gate detail_locker(locker4 *lk)
18117c478bd9Sstevel@tonic-gate {
18127c478bd9Sstevel@tonic-gate 	if (lk->new_lock_owner == TRUE)
18137c478bd9Sstevel@tonic-gate 		detail_open_to_lock_owner(&lk->locker4_u.open_owner);
18147c478bd9Sstevel@tonic-gate 	else
18157c478bd9Sstevel@tonic-gate 		detail_exist_lock_owner(&lk->locker4_u.lock_owner);
18167c478bd9Sstevel@tonic-gate }
18177c478bd9Sstevel@tonic-gate 
18187c478bd9Sstevel@tonic-gate static void
dtlarg_lock(void * obj)18197c478bd9Sstevel@tonic-gate dtlarg_lock(void *obj)
18207c478bd9Sstevel@tonic-gate {
18217c478bd9Sstevel@tonic-gate 	LOCK4args *args = (LOCK4args *)obj;
18227c478bd9Sstevel@tonic-gate 
18237c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Type = %s", lock_type_name(args->locktype));
18247c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Reclaim = %s",
18252f172c55SRobert Thurlow 	    args->reclaim ? "TRUE" : "FALSE");
18267c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Offset = %llu", args->offset);
18277c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Length = %llu", args->length);
18287c478bd9Sstevel@tonic-gate 	detail_locker(&args->locker);
18297c478bd9Sstevel@tonic-gate }
18307c478bd9Sstevel@tonic-gate 
18317c478bd9Sstevel@tonic-gate static void
sumarg_lockt(char * buf,size_t buflen,void * obj)18327c478bd9Sstevel@tonic-gate sumarg_lockt(char *buf, size_t buflen, void *obj)
18337c478bd9Sstevel@tonic-gate {
18347c478bd9Sstevel@tonic-gate 	LOCKT4args *args = (LOCKT4args *)obj;
18357c478bd9Sstevel@tonic-gate 
18362d8dae53SMarcel Telka 	snprintf(buf, buflen, "%s %llu:%llu",
18372d8dae53SMarcel Telka 	    sum_lock_type_name(args->locktype),
18382f172c55SRobert Thurlow 	    args->offset, args->length);
18397c478bd9Sstevel@tonic-gate }
18407c478bd9Sstevel@tonic-gate 
18417c478bd9Sstevel@tonic-gate static void
dtlarg_lockt(void * obj)18427c478bd9Sstevel@tonic-gate dtlarg_lockt(void *obj)
18437c478bd9Sstevel@tonic-gate {
18447c478bd9Sstevel@tonic-gate 	LOCKT4args *args = (LOCKT4args *)obj;
18457c478bd9Sstevel@tonic-gate 
18467c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Type = %s", lock_type_name(args->locktype));
18477c478bd9Sstevel@tonic-gate 	detail_lock_owner(&args->owner);
18487c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Offset = %llu", args->offset);
18497c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Length = %llu", args->length);
18507c478bd9Sstevel@tonic-gate }
18517c478bd9Sstevel@tonic-gate 
18527c478bd9Sstevel@tonic-gate static void
sumarg_locku(char * buf,size_t buflen,void * obj)18537c478bd9Sstevel@tonic-gate sumarg_locku(char *buf, size_t buflen, void *obj)
18547c478bd9Sstevel@tonic-gate {
18557c478bd9Sstevel@tonic-gate 	LOCKU4args *args = (LOCKU4args *)obj;
18567c478bd9Sstevel@tonic-gate 
18572d8dae53SMarcel Telka 	snprintf(buf, buflen, "%llu:%llu LSQ=%u %s",
18582f172c55SRobert Thurlow 	    args->offset, args->length, args->seqid,
18592f172c55SRobert Thurlow 	    sum_lock_stateid(&args->lock_stateid));
18607c478bd9Sstevel@tonic-gate }
18617c478bd9Sstevel@tonic-gate 
18627c478bd9Sstevel@tonic-gate 
18637c478bd9Sstevel@tonic-gate static void
dtlarg_locku(void * obj)18647c478bd9Sstevel@tonic-gate dtlarg_locku(void *obj)
18657c478bd9Sstevel@tonic-gate {
18667c478bd9Sstevel@tonic-gate 	LOCKU4args *args = (LOCKU4args *)obj;
18677c478bd9Sstevel@tonic-gate 
18687c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Type = %s", lock_type_name(args->locktype));
18697c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Sequence ID = %u", args->seqid);
18707c478bd9Sstevel@tonic-gate 	detail_lock_stateid(&args->lock_stateid);
18717c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Offset = %llu", args->offset);
18727c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Length = %llu", args->length);
18737c478bd9Sstevel@tonic-gate }
18747c478bd9Sstevel@tonic-gate 
18757c478bd9Sstevel@tonic-gate static void
sumarg_lookup(char * buf,size_t buflen,void * obj)18767c478bd9Sstevel@tonic-gate sumarg_lookup(char *buf, size_t buflen, void *obj)
18777c478bd9Sstevel@tonic-gate {
18787c478bd9Sstevel@tonic-gate 	LOOKUP4args *args = (LOOKUP4args *)obj;
18797c478bd9Sstevel@tonic-gate 
18807c478bd9Sstevel@tonic-gate 	sum_compname4(buf, buflen, &args->objname);
18817c478bd9Sstevel@tonic-gate }
18827c478bd9Sstevel@tonic-gate 
18837c478bd9Sstevel@tonic-gate static void
dtlarg_lookup(void * obj)18847c478bd9Sstevel@tonic-gate dtlarg_lookup(void *obj)
18857c478bd9Sstevel@tonic-gate {
18867c478bd9Sstevel@tonic-gate 	LOOKUP4args *args = (LOOKUP4args *)obj;
18877c478bd9Sstevel@tonic-gate 
18887c478bd9Sstevel@tonic-gate 	detail_compname4(&args->objname);
18897c478bd9Sstevel@tonic-gate }
18907c478bd9Sstevel@tonic-gate 
18917c478bd9Sstevel@tonic-gate static void
sumarg_read(char * buf,size_t buflen,void * obj)18927c478bd9Sstevel@tonic-gate sumarg_read(char *buf, size_t buflen, void *obj)
18937c478bd9Sstevel@tonic-gate {
18947c478bd9Sstevel@tonic-gate 	READ4args *args = (READ4args *)obj;
18957c478bd9Sstevel@tonic-gate 
18967c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "%s at %llu for %u",
18972f172c55SRobert Thurlow 	    sum_stateid(&args->stateid), args->offset, args->count);
18987c478bd9Sstevel@tonic-gate }
18997c478bd9Sstevel@tonic-gate 
19007c478bd9Sstevel@tonic-gate static void
dtlarg_read(void * obj)19017c478bd9Sstevel@tonic-gate dtlarg_read(void *obj)
19027c478bd9Sstevel@tonic-gate {
19037c478bd9Sstevel@tonic-gate 	READ4args *args = (READ4args *)obj;
19047c478bd9Sstevel@tonic-gate 
19057c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Offset = %llu", args->offset);
19067c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Count = %u", args->count);
19077c478bd9Sstevel@tonic-gate 	detail_stateid(&args->stateid);
19087c478bd9Sstevel@tonic-gate }
19097c478bd9Sstevel@tonic-gate 
19107c478bd9Sstevel@tonic-gate static void
sumarg_readdir(char * buf,size_t buflen,void * obj)19117c478bd9Sstevel@tonic-gate sumarg_readdir(char *buf, size_t buflen, void *obj)
19127c478bd9Sstevel@tonic-gate {
19137c478bd9Sstevel@tonic-gate 	READDIR4args *args = (READDIR4args *)obj;
19147c478bd9Sstevel@tonic-gate 
19157c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "Cookie=%llu (%s) for %u/%u",
19162f172c55SRobert Thurlow 	    args->cookie, tohex(args->cookieverf, NFS4_VERIFIER_SIZE),
19172f172c55SRobert Thurlow 	    args->dircount, args->maxcount);
19187c478bd9Sstevel@tonic-gate }
19197c478bd9Sstevel@tonic-gate 
19207c478bd9Sstevel@tonic-gate static void
dtlarg_readdir(void * obj)19217c478bd9Sstevel@tonic-gate dtlarg_readdir(void *obj)
19227c478bd9Sstevel@tonic-gate {
19237c478bd9Sstevel@tonic-gate 	READDIR4args *args = (READDIR4args *)obj;
19247c478bd9Sstevel@tonic-gate 
19257c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Cookie = %llu", args->cookie);
19267c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Verifier = %s",
19272f172c55SRobert Thurlow 	    tohex(args->cookieverf, NFS4_VERIFIER_SIZE));
19287c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Dircount = %u", args->dircount);
19297c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Maxcount = %u", args->maxcount);
19307c478bd9Sstevel@tonic-gate 	detail_attr_bitmap("", &args->attr_request, NULL);
19317c478bd9Sstevel@tonic-gate }
19327c478bd9Sstevel@tonic-gate 
19337c478bd9Sstevel@tonic-gate static void
dtlarg_release_lkown(void * obj)19347c478bd9Sstevel@tonic-gate dtlarg_release_lkown(void *obj)
19357c478bd9Sstevel@tonic-gate {
19367c478bd9Sstevel@tonic-gate 	RELEASE_LOCKOWNER4args *args = (RELEASE_LOCKOWNER4args *)obj;
19377c478bd9Sstevel@tonic-gate 
19387c478bd9Sstevel@tonic-gate 	detail_lock_owner(&args->lock_owner);
19397c478bd9Sstevel@tonic-gate }
19407c478bd9Sstevel@tonic-gate 
19417c478bd9Sstevel@tonic-gate static void
sumarg_release_lkown(char * buf,size_t buflen,void * obj)19427c478bd9Sstevel@tonic-gate sumarg_release_lkown(char *buf, size_t buflen, void *obj)
19437c478bd9Sstevel@tonic-gate {
19447c478bd9Sstevel@tonic-gate 	RELEASE_LOCKOWNER4args *args = (RELEASE_LOCKOWNER4args *)obj;
19457c478bd9Sstevel@tonic-gate 
19467c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "LO=%04X", owner_hash(&args->lock_owner.owner));
19477c478bd9Sstevel@tonic-gate }
19487c478bd9Sstevel@tonic-gate 
19497c478bd9Sstevel@tonic-gate static void
sumarg_rename(char * buf,size_t buflen,void * obj)19507c478bd9Sstevel@tonic-gate sumarg_rename(char *buf, size_t buflen, void *obj)
19517c478bd9Sstevel@tonic-gate {
19527c478bd9Sstevel@tonic-gate 	RENAME4args *args = (RENAME4args *)obj;
19537c478bd9Sstevel@tonic-gate 
19547c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "%s to %s",
19552f172c55SRobert Thurlow 	    component_name(&args->oldname),
19562f172c55SRobert Thurlow 	    component_name(&args->newname));
19577c478bd9Sstevel@tonic-gate }
19587c478bd9Sstevel@tonic-gate 
19597c478bd9Sstevel@tonic-gate static void
dtlarg_rename(void * obj)19607c478bd9Sstevel@tonic-gate dtlarg_rename(void *obj)
19617c478bd9Sstevel@tonic-gate {
19627c478bd9Sstevel@tonic-gate 	RENAME4args *args = (RENAME4args *)obj;
19637c478bd9Sstevel@tonic-gate 
19647c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Old name = %s",
19652f172c55SRobert Thurlow 	    component_name(&args->oldname));
19667c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "New name = %s",
19672f172c55SRobert Thurlow 	    component_name(&args->newname));
19687c478bd9Sstevel@tonic-gate }
19697c478bd9Sstevel@tonic-gate 
19707c478bd9Sstevel@tonic-gate static void
sumarg_renew(char * buf,size_t buflen,void * obj)19717c478bd9Sstevel@tonic-gate sumarg_renew(char *buf, size_t buflen, void *obj)
19727c478bd9Sstevel@tonic-gate {
19737c478bd9Sstevel@tonic-gate 	RENEW4args *args = (RENEW4args *)obj;
19747c478bd9Sstevel@tonic-gate 
19757c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "%s", sum_clientid(args->clientid));
19767c478bd9Sstevel@tonic-gate }
19777c478bd9Sstevel@tonic-gate static void
dtlarg_renew(void * obj)19787c478bd9Sstevel@tonic-gate dtlarg_renew(void *obj)
19797c478bd9Sstevel@tonic-gate {
19807c478bd9Sstevel@tonic-gate 	RENEW4args *args = (RENEW4args *)obj;
19817c478bd9Sstevel@tonic-gate 
19827c478bd9Sstevel@tonic-gate 	detail_clientid(args->clientid);
19837c478bd9Sstevel@tonic-gate }
19847c478bd9Sstevel@tonic-gate 
19857c478bd9Sstevel@tonic-gate static void
sumarg_secinfo(char * buf,size_t buflen,void * obj)19867c478bd9Sstevel@tonic-gate sumarg_secinfo(char *buf, size_t buflen, void *obj)
19877c478bd9Sstevel@tonic-gate {
19887c478bd9Sstevel@tonic-gate 	SECINFO4args *args = (SECINFO4args *)obj;
19897c478bd9Sstevel@tonic-gate 
19907c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "%s",
19912f172c55SRobert Thurlow 	    component_name(&args->name));
19927c478bd9Sstevel@tonic-gate }
19937c478bd9Sstevel@tonic-gate 
19947c478bd9Sstevel@tonic-gate static void
dtlarg_secinfo(void * obj)19957c478bd9Sstevel@tonic-gate dtlarg_secinfo(void *obj)
19967c478bd9Sstevel@tonic-gate {
19977c478bd9Sstevel@tonic-gate 	SECINFO4args *args = (SECINFO4args *)obj;
19987c478bd9Sstevel@tonic-gate 
19997c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Name = %s",
20002f172c55SRobert Thurlow 	    component_name(&args->name));
20017c478bd9Sstevel@tonic-gate }
20027c478bd9Sstevel@tonic-gate 
20037c478bd9Sstevel@tonic-gate static void
sumarg_setattr(char * buf,size_t buflen,void * obj)20047c478bd9Sstevel@tonic-gate sumarg_setattr(char *buf, size_t buflen, void *obj)
20057c478bd9Sstevel@tonic-gate {
20067c478bd9Sstevel@tonic-gate 	SETATTR4args *args = (SETATTR4args *)obj;
20077c478bd9Sstevel@tonic-gate 
20087c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "%s", sum_stateid(&args->stateid));
20097c478bd9Sstevel@tonic-gate }
20107c478bd9Sstevel@tonic-gate 
20117c478bd9Sstevel@tonic-gate static void
dtlarg_setattr(void * obj)20127c478bd9Sstevel@tonic-gate dtlarg_setattr(void *obj)
20137c478bd9Sstevel@tonic-gate {
20147c478bd9Sstevel@tonic-gate 	SETATTR4args *args = (SETATTR4args *)obj;
20157c478bd9Sstevel@tonic-gate 
20167c478bd9Sstevel@tonic-gate 	detail_stateid(&args->stateid);
20177c478bd9Sstevel@tonic-gate 	detail_fattr4(&args->obj_attributes);
20187c478bd9Sstevel@tonic-gate }
20197c478bd9Sstevel@tonic-gate 
20207c478bd9Sstevel@tonic-gate static void
sumarg_setclid(char * buf,size_t buflen,void * obj)20217c478bd9Sstevel@tonic-gate sumarg_setclid(char *buf, size_t buflen, void *obj)
20227c478bd9Sstevel@tonic-gate {
20237c478bd9Sstevel@tonic-gate 	SETCLIENTID4args *args = (SETCLIENTID4args *)obj;
20247c478bd9Sstevel@tonic-gate 
20257c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "Prog=%u ID=%s Addr=%s CBID=%u",
20262f172c55SRobert Thurlow 	    args->callback.cb_program,
2027*f44e1126SVitaliy Gusev 	    args->callback.cb_location.na_r_netid,
2028*f44e1126SVitaliy Gusev 	    args->callback.cb_location.na_r_addr, args->callback_ident);
20297c478bd9Sstevel@tonic-gate }
20307c478bd9Sstevel@tonic-gate 
20317c478bd9Sstevel@tonic-gate static void
dtlarg_setclid(void * obj)20327c478bd9Sstevel@tonic-gate dtlarg_setclid(void *obj)
20337c478bd9Sstevel@tonic-gate {
20347c478bd9Sstevel@tonic-gate 	SETCLIENTID4args *args = (SETCLIENTID4args *)obj;
20357c478bd9Sstevel@tonic-gate 
20367c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Verifier=%s",
20372f172c55SRobert Thurlow 	    tohex(args->client.verifier, NFS4_VERIFIER_SIZE));
20387c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "ID = (%d) %s",
20392f172c55SRobert Thurlow 	    args->client.id.id_len,
20402f172c55SRobert Thurlow 	    tohex(args->client.id.id_val, args->client.id.id_len));
20417c478bd9Sstevel@tonic-gate 
20427c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Callback Program = %u",
20432f172c55SRobert Thurlow 	    args->callback.cb_program);
20447c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Callback Net ID = %s",
2045*f44e1126SVitaliy Gusev 	    args->callback.cb_location.na_r_netid);
20467c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Callback Addr = %s",
2047*f44e1126SVitaliy Gusev 	    args->callback.cb_location.na_r_addr);
20487c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Callback Ident = %u", args->callback_ident);
20497c478bd9Sstevel@tonic-gate }
20507c478bd9Sstevel@tonic-gate 
20517c478bd9Sstevel@tonic-gate static void
sumarg_setclid_cfm(char * buf,size_t buflen,void * obj)20527c478bd9Sstevel@tonic-gate sumarg_setclid_cfm(char *buf, size_t buflen, void *obj)
20537c478bd9Sstevel@tonic-gate {
20547c478bd9Sstevel@tonic-gate 	SETCLIENTID_CONFIRM4args *args = (SETCLIENTID_CONFIRM4args *)obj;
20557c478bd9Sstevel@tonic-gate 
20567c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "%s CFV=%s", sum_clientid(args->clientid),
20572f172c55SRobert Thurlow 	    tohex(args->setclientid_confirm, NFS4_VERIFIER_SIZE));
20587c478bd9Sstevel@tonic-gate }
20597c478bd9Sstevel@tonic-gate 
20607c478bd9Sstevel@tonic-gate static void
dtlarg_setclid_cfm(void * obj)20617c478bd9Sstevel@tonic-gate dtlarg_setclid_cfm(void *obj)
20627c478bd9Sstevel@tonic-gate {
20637c478bd9Sstevel@tonic-gate 	SETCLIENTID_CONFIRM4args *args = (SETCLIENTID_CONFIRM4args *)obj;
20647c478bd9Sstevel@tonic-gate 
20657c478bd9Sstevel@tonic-gate 	detail_clientid(args->clientid);
20667c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Set Client ID Confirm Verifier = %s",
20672f172c55SRobert Thurlow 	    tohex(args->setclientid_confirm, NFS4_VERIFIER_SIZE));
20687c478bd9Sstevel@tonic-gate }
20697c478bd9Sstevel@tonic-gate 
20707c478bd9Sstevel@tonic-gate 
20717c478bd9Sstevel@tonic-gate static void
dtlarg_verify(void * obj)20727c478bd9Sstevel@tonic-gate dtlarg_verify(void *obj)
20737c478bd9Sstevel@tonic-gate {
20747c478bd9Sstevel@tonic-gate 	NVERIFY4args *args = (NVERIFY4args *)obj;
20757c478bd9Sstevel@tonic-gate 
20767c478bd9Sstevel@tonic-gate 	detail_fattr4(&args->obj_attributes);
20777c478bd9Sstevel@tonic-gate }
20787c478bd9Sstevel@tonic-gate 
20797c478bd9Sstevel@tonic-gate static void
sumarg_write(char * buf,size_t buflen,void * obj)20807c478bd9Sstevel@tonic-gate sumarg_write(char *buf, size_t buflen, void *obj)
20817c478bd9Sstevel@tonic-gate {
20827c478bd9Sstevel@tonic-gate 	WRITE4args *args = (WRITE4args *)obj;
20837c478bd9Sstevel@tonic-gate 
20847c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "%s at %llu for %u",
20852f172c55SRobert Thurlow 	    sum_stateid(&args->stateid), args->offset, args->data.data_len);
20867c478bd9Sstevel@tonic-gate }
20877c478bd9Sstevel@tonic-gate 
20887c478bd9Sstevel@tonic-gate static void
dtlarg_write(void * obj)20897c478bd9Sstevel@tonic-gate dtlarg_write(void *obj)
20907c478bd9Sstevel@tonic-gate {
20917c478bd9Sstevel@tonic-gate 	WRITE4args *args = (WRITE4args *)obj;
20927c478bd9Sstevel@tonic-gate 
20937c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Offset = %llu", args->offset);
20947c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Count = %u", args->data.data_len);
20957c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Stable = %s", stable_how4_name(args->stable));
20967c478bd9Sstevel@tonic-gate 	detail_stateid(&args->stateid);
20977c478bd9Sstevel@tonic-gate }
20987c478bd9Sstevel@tonic-gate 
20997c478bd9Sstevel@tonic-gate static char *
sum_fh4(nfs_fh4 * fh)21007c478bd9Sstevel@tonic-gate sum_fh4(nfs_fh4 *fh)
21017c478bd9Sstevel@tonic-gate {
21027c478bd9Sstevel@tonic-gate 	static char buf[20];
21037c478bd9Sstevel@tonic-gate 
21047c478bd9Sstevel@tonic-gate 	sprintf(buf, "FH=%04X", fh4_hash(fh));
21057c478bd9Sstevel@tonic-gate 
21067c478bd9Sstevel@tonic-gate 	return (buf);
21077c478bd9Sstevel@tonic-gate }
21087c478bd9Sstevel@tonic-gate 
21097c478bd9Sstevel@tonic-gate static void
detail_fh4(nfs_fh4 * fh)21107c478bd9Sstevel@tonic-gate detail_fh4(nfs_fh4 *fh)
21117c478bd9Sstevel@tonic-gate {
21127c478bd9Sstevel@tonic-gate 	int i;
21137c478bd9Sstevel@tonic-gate 	uchar_t *cp;
21147c478bd9Sstevel@tonic-gate 	char *bufp;
21157c478bd9Sstevel@tonic-gate 
21167c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "File handle = [%04X]", fh4_hash(fh));
21177c478bd9Sstevel@tonic-gate 	bufp = get_line(0, 0);
21187c478bd9Sstevel@tonic-gate 	sprintf(bufp, "(%d) ", fh->nfs_fh4_len);
21197c478bd9Sstevel@tonic-gate 	bufp += strlen(bufp);
21207c478bd9Sstevel@tonic-gate 	/* XXX use tohex()? */
21217c478bd9Sstevel@tonic-gate 	for (i = 0, cp = (uchar_t *)fh->nfs_fh4_val;
21227c478bd9Sstevel@tonic-gate 	    i < fh->nfs_fh4_len;
21237c478bd9Sstevel@tonic-gate 	    i++, cp++) {
21247c478bd9Sstevel@tonic-gate 		if (i != 0 && i % 32 == 0)
21257c478bd9Sstevel@tonic-gate 			bufp = get_line(0, 0);
21267c478bd9Sstevel@tonic-gate 		sprintf(bufp, "%02x", *cp);
21277c478bd9Sstevel@tonic-gate 		bufp += strlen(bufp);
21287c478bd9Sstevel@tonic-gate 	}
21297c478bd9Sstevel@tonic-gate }
21307c478bd9Sstevel@tonic-gate 
21317c478bd9Sstevel@tonic-gate static void
detail_fattr4(fattr4 * attrp)21327c478bd9Sstevel@tonic-gate detail_fattr4(fattr4 *attrp)
21337c478bd9Sstevel@tonic-gate {
21347c478bd9Sstevel@tonic-gate 	unpkd_attrmap_t provided;
21357c478bd9Sstevel@tonic-gate 	uint_t attrnum;
21367c478bd9Sstevel@tonic-gate 	XDR attrxdr;
21377c478bd9Sstevel@tonic-gate 	jmp_buf old_errbuf;
21387c478bd9Sstevel@tonic-gate 
21397c478bd9Sstevel@tonic-gate 	xdrmem_create(&attrxdr, attrp->attr_vals.attrlist4_val,
21402f172c55SRobert Thurlow 	    attrp->attr_vals.attrlist4_len, XDR_DECODE);
21417c478bd9Sstevel@tonic-gate 
21427c478bd9Sstevel@tonic-gate 	bcopy(xdr_err, old_errbuf, sizeof (old_errbuf));
21437c478bd9Sstevel@tonic-gate 	if (setjmp(xdr_err)) {
21447c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "<attr_vals too short>");
21457c478bd9Sstevel@tonic-gate 		goto done;
21467c478bd9Sstevel@tonic-gate 	}
21477c478bd9Sstevel@tonic-gate 
21487c478bd9Sstevel@tonic-gate 	detail_attr_bitmap("", &attrp->attrmask, &provided);
21497c478bd9Sstevel@tonic-gate 	for (attrnum = 0; attrnum < MAX_ATTRIBUTES; attrnum++) {
21507c478bd9Sstevel@tonic-gate 		if (provided.map[attrnum]) {
21517c478bd9Sstevel@tonic-gate 			attr_info[attrnum].prt_details(&attrxdr);
21527c478bd9Sstevel@tonic-gate 		}
21537c478bd9Sstevel@tonic-gate 	}
21547c478bd9Sstevel@tonic-gate 
21557c478bd9Sstevel@tonic-gate done:
21567c478bd9Sstevel@tonic-gate 	bcopy(old_errbuf, xdr_err, sizeof (old_errbuf));
21577c478bd9Sstevel@tonic-gate }
21587c478bd9Sstevel@tonic-gate 
21597c478bd9Sstevel@tonic-gate static void
sum_attr_bitmap(char * buf,size_t buflen,bitmap4 * mapp)21607c478bd9Sstevel@tonic-gate sum_attr_bitmap(char *buf, size_t buflen, bitmap4 *mapp)
21617c478bd9Sstevel@tonic-gate {
21627c478bd9Sstevel@tonic-gate 	uint_t num_words;
21637c478bd9Sstevel@tonic-gate 	char *bp;
21647c478bd9Sstevel@tonic-gate 	size_t curlen, remaining;
21657c478bd9Sstevel@tonic-gate 
21667c478bd9Sstevel@tonic-gate 	buf[0] = '\0';
21677c478bd9Sstevel@tonic-gate 	for (num_words = 0; num_words < mapp->bitmap4_len; num_words++) {
21687c478bd9Sstevel@tonic-gate 		curlen = strlen(buf);
21697c478bd9Sstevel@tonic-gate 		if (curlen + sizeof ("<Too Long>") >= buflen) {
21707c478bd9Sstevel@tonic-gate 			strcpy(buf + buflen - sizeof ("<Too Long>"),
21717c478bd9Sstevel@tonic-gate 			    "<Too Long>");
21727c478bd9Sstevel@tonic-gate 			return;
21737c478bd9Sstevel@tonic-gate 		}
21747c478bd9Sstevel@tonic-gate 		bp = buf + curlen;
21757c478bd9Sstevel@tonic-gate 		remaining = buflen - curlen;
21767c478bd9Sstevel@tonic-gate 		snprintf(bp, remaining,
21772f172c55SRobert Thurlow 		    num_words == 0 ? "%x" : " %x",
21782f172c55SRobert Thurlow 		    mapp->bitmap4_val[num_words]);
21797c478bd9Sstevel@tonic-gate 	}
21807c478bd9Sstevel@tonic-gate }
21817c478bd9Sstevel@tonic-gate 
21827c478bd9Sstevel@tonic-gate /*
21837c478bd9Sstevel@tonic-gate  * Print detail information for the given attribute bitmap, and fill in the
21847c478bd9Sstevel@tonic-gate  * unpacked version of the map if "unpacked" is non-null.  Returns the
21857c478bd9Sstevel@tonic-gate  * number of bytes in the bitmap.  "prefix" is an initial string that is
21867c478bd9Sstevel@tonic-gate  * printed at the front of each line.
21877c478bd9Sstevel@tonic-gate  */
21887c478bd9Sstevel@tonic-gate 
21897c478bd9Sstevel@tonic-gate static void
detail_attr_bitmap(char * prefix,bitmap4 * bitp,unpkd_attrmap_t * unpacked)21907c478bd9Sstevel@tonic-gate detail_attr_bitmap(char *prefix, bitmap4 *bitp, unpkd_attrmap_t *unpacked)
21917c478bd9Sstevel@tonic-gate {
21927c478bd9Sstevel@tonic-gate 	uint_t num_words;
21937c478bd9Sstevel@tonic-gate 	uint32_t *wp;
21947c478bd9Sstevel@tonic-gate 	uint_t byte_num;
21957c478bd9Sstevel@tonic-gate 
21967c478bd9Sstevel@tonic-gate 	if (unpacked != NULL)
21977c478bd9Sstevel@tonic-gate 		memset(unpacked, 0, sizeof (unpkd_attrmap_t));
21987c478bd9Sstevel@tonic-gate 
21997c478bd9Sstevel@tonic-gate 	/*
22007c478bd9Sstevel@tonic-gate 	 * Break the bitmap into octets, then print in hex and
22017c478bd9Sstevel@tonic-gate 	 * symbolically.
22027c478bd9Sstevel@tonic-gate 	 */
22037c478bd9Sstevel@tonic-gate 
22047c478bd9Sstevel@tonic-gate 	for (num_words = 0, wp = bitp->bitmap4_val;
22057c478bd9Sstevel@tonic-gate 	    num_words < bitp->bitmap4_len;
22067c478bd9Sstevel@tonic-gate 	    num_words++, wp++) {
22077c478bd9Sstevel@tonic-gate 		for (byte_num = 0; byte_num < 4; byte_num++) {
22087c478bd9Sstevel@tonic-gate 			uchar_t val = (*wp) >> (byte_num * 8);
22097c478bd9Sstevel@tonic-gate 			char *buf = get_line(0, 0);
22107c478bd9Sstevel@tonic-gate 			uint_t attrnum;
22117c478bd9Sstevel@tonic-gate 			int bit;
22127c478bd9Sstevel@tonic-gate 
22137c478bd9Sstevel@tonic-gate 			sprintf(buf, "%s  0x%02x  ", prefix, val);
22147c478bd9Sstevel@tonic-gate 			attrnum = num_words * 32 + byte_num * 8;
22157c478bd9Sstevel@tonic-gate 			for (bit = 7; bit >= 0; bit--) {
22167c478bd9Sstevel@tonic-gate 				if (val & (1 << bit)) {
22177c478bd9Sstevel@tonic-gate 					strcat(buf, " ");
22187c478bd9Sstevel@tonic-gate 					strcat(buf,
22197c478bd9Sstevel@tonic-gate 					    attr_name(attrnum + bit));
22207c478bd9Sstevel@tonic-gate 					if (unpacked != NULL)
22217c478bd9Sstevel@tonic-gate 						unpacked->map[attrnum + bit] =
22222f172c55SRobert Thurlow 						    1;
22237c478bd9Sstevel@tonic-gate 				}
22247c478bd9Sstevel@tonic-gate 			}
22257c478bd9Sstevel@tonic-gate 		}
22267c478bd9Sstevel@tonic-gate 	}
22277c478bd9Sstevel@tonic-gate }
22287c478bd9Sstevel@tonic-gate 
22297c478bd9Sstevel@tonic-gate /*
22307c478bd9Sstevel@tonic-gate  * Format the summary line results from a COMPOUND4 call.
22317c478bd9Sstevel@tonic-gate  */
22327c478bd9Sstevel@tonic-gate 
22337c478bd9Sstevel@tonic-gate static void
sum_comp4res(char * line,char * (* sumres_fn)(void))22347c478bd9Sstevel@tonic-gate sum_comp4res(char *line, char *(*sumres_fn)(void))
22357c478bd9Sstevel@tonic-gate {
22367c478bd9Sstevel@tonic-gate 	nfsstat4 status;
22377c478bd9Sstevel@tonic-gate 	static utf8string tag;
22387c478bd9Sstevel@tonic-gate 
22397c478bd9Sstevel@tonic-gate 	status = getxdr_long();
22407c478bd9Sstevel@tonic-gate 	if (!xdr_utf8string(&xdrm, &tag))
22417c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
22427c478bd9Sstevel@tonic-gate 
22437c478bd9Sstevel@tonic-gate 	sprintf(line, "(%.20s) %s %s", utf8localize(&tag),
22442f172c55SRobert Thurlow 	    status_name(status), sumres_fn());
22457c478bd9Sstevel@tonic-gate 
22467c478bd9Sstevel@tonic-gate 	xdr_free(xdr_utf8string, (char *)&tag);
22477c478bd9Sstevel@tonic-gate }
22487c478bd9Sstevel@tonic-gate 
22497c478bd9Sstevel@tonic-gate 
22507c478bd9Sstevel@tonic-gate /*
22517c478bd9Sstevel@tonic-gate  * Return a set of summary strings for the result data that's next in the
22527c478bd9Sstevel@tonic-gate  * XDR stream, up to SUM_COMPND_MAX characters.  If the strings don't fit,
22537c478bd9Sstevel@tonic-gate  * include a "..." at the end of the string.
22547c478bd9Sstevel@tonic-gate  */
22557c478bd9Sstevel@tonic-gate 
22567c478bd9Sstevel@tonic-gate static char *
sum_compound4res(void)22577c478bd9Sstevel@tonic-gate sum_compound4res(void)
22587c478bd9Sstevel@tonic-gate {
22597c478bd9Sstevel@tonic-gate 	static char buf[SUM_COMPND_MAX + 2]; /* 1 for null, 1 for overflow */
22607c478bd9Sstevel@tonic-gate 	int numres;
22617c478bd9Sstevel@tonic-gate 	const size_t buflen = sizeof (buf);
22627c478bd9Sstevel@tonic-gate 	char *bp;
22637c478bd9Sstevel@tonic-gate 	nfs_resop4 one_res;
22647c478bd9Sstevel@tonic-gate 
22657c478bd9Sstevel@tonic-gate 	buf[0] = '\0';
22667c478bd9Sstevel@tonic-gate 	if (setjmp(xdr_err)) {
22677c478bd9Sstevel@tonic-gate 		bp = buf + strlen(buf);
22687c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf),
22692f172c55SRobert Thurlow 		    nfs4_fragged_rpc ? nfs4err_fragrpc : nfs4err_xdrfrag);
22707c478bd9Sstevel@tonic-gate 		return (buf);
22717c478bd9Sstevel@tonic-gate 	}
22727c478bd9Sstevel@tonic-gate 
22737c478bd9Sstevel@tonic-gate 	numres = getxdr_long();
22747c478bd9Sstevel@tonic-gate 	bp = buf;
22757c478bd9Sstevel@tonic-gate 	while (numres-- > 0) {
22767c478bd9Sstevel@tonic-gate 		char *result;
22777c478bd9Sstevel@tonic-gate 
22787c478bd9Sstevel@tonic-gate 		bzero(&one_res, sizeof (one_res));
22797c478bd9Sstevel@tonic-gate 
22807c478bd9Sstevel@tonic-gate 		if (!xdr_nfs_resop4(&xdrm, &one_res)) {
22817c478bd9Sstevel@tonic-gate 			xdr_free(xdr_nfs_resop4, (char *)&one_res);
22827c478bd9Sstevel@tonic-gate 			longjmp(xdr_err, 1);
22837c478bd9Sstevel@tonic-gate 		}
22847c478bd9Sstevel@tonic-gate 
22857c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf), "%s ",
22862f172c55SRobert Thurlow 		    opcode_name(one_res.resop));
22877c478bd9Sstevel@tonic-gate 		bp += strlen(bp);
22887c478bd9Sstevel@tonic-gate 
22897c478bd9Sstevel@tonic-gate 		result = sum_result(&one_res);
22907c478bd9Sstevel@tonic-gate 		if (strlen(result) > 0) {
22917c478bd9Sstevel@tonic-gate 			snprintf(bp, buflen - (bp - buf), "%s ", result);
22927c478bd9Sstevel@tonic-gate 			bp += strlen(bp);
22937c478bd9Sstevel@tonic-gate 		}
22947c478bd9Sstevel@tonic-gate 
22957c478bd9Sstevel@tonic-gate 		/* nfs4_skip_bytes set by xdr_nfs4_argop4() */
22967c478bd9Sstevel@tonic-gate 		if (nfs4_skip_bytes != 0)
22977c478bd9Sstevel@tonic-gate 			nfs4_xdr_skip(nfs4_skip_bytes);
22987c478bd9Sstevel@tonic-gate 
22997c478bd9Sstevel@tonic-gate 		xdr_free(xdr_nfs_resop4, (char *)&one_res);
23007c478bd9Sstevel@tonic-gate 		/* add "..." if past the "end" of the buffer */
23017c478bd9Sstevel@tonic-gate 		if (bp - buf > SUM_COMPND_MAX) {
23027c478bd9Sstevel@tonic-gate 			strcpy(buf + SUM_COMPND_MAX - strlen("..."),
23037c478bd9Sstevel@tonic-gate 			    "...");
23047c478bd9Sstevel@tonic-gate 			break;
23057c478bd9Sstevel@tonic-gate 		}
23067c478bd9Sstevel@tonic-gate 	}
23077c478bd9Sstevel@tonic-gate 
23087c478bd9Sstevel@tonic-gate 	return (buf);
23097c478bd9Sstevel@tonic-gate }
23107c478bd9Sstevel@tonic-gate 
23117c478bd9Sstevel@tonic-gate 
23127c478bd9Sstevel@tonic-gate /*
23137c478bd9Sstevel@tonic-gate  * Return a set of summary strings for the result data that's next in the
23147c478bd9Sstevel@tonic-gate  * XDR stream, up to SUM_COMPND_MAX characters.  If the strings don't fit,
23157c478bd9Sstevel@tonic-gate  * include a "..." at the end of the string.
23167c478bd9Sstevel@tonic-gate  */
23177c478bd9Sstevel@tonic-gate 
23187c478bd9Sstevel@tonic-gate static char *
sum_cb_compound4res(void)23197c478bd9Sstevel@tonic-gate sum_cb_compound4res(void)
23207c478bd9Sstevel@tonic-gate {
23217c478bd9Sstevel@tonic-gate 	static char buf[SUM_COMPND_MAX + 2]; /* 1 for null, 1 for overflow */
23227c478bd9Sstevel@tonic-gate 	int numres;
23237c478bd9Sstevel@tonic-gate 	const size_t buflen = sizeof (buf);
23247c478bd9Sstevel@tonic-gate 	char *bp;
23257c478bd9Sstevel@tonic-gate 	nfs_cb_resop4 one_res;
23267c478bd9Sstevel@tonic-gate 
23277c478bd9Sstevel@tonic-gate 	buf[0] = '\0';
23287c478bd9Sstevel@tonic-gate 	if (setjmp(xdr_err)) {
23297c478bd9Sstevel@tonic-gate 		bp = buf + strlen(buf);
23307c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf), "<XDR Error or Fragmented"
23312f172c55SRobert Thurlow 		    " RPC>");
23327c478bd9Sstevel@tonic-gate 		return (buf);
23337c478bd9Sstevel@tonic-gate 	}
23347c478bd9Sstevel@tonic-gate 
23357c478bd9Sstevel@tonic-gate 	numres = getxdr_long();
23367c478bd9Sstevel@tonic-gate 	bp = buf;
23377c478bd9Sstevel@tonic-gate 	while (numres-- > 0) {
23387c478bd9Sstevel@tonic-gate 		bzero(&one_res, sizeof (one_res));
23397c478bd9Sstevel@tonic-gate 		if (!xdr_nfs_cb_resop4(&xdrm, &one_res)) {
23407c478bd9Sstevel@tonic-gate 			xdr_free(xdr_nfs_cb_resop4, (char *)&one_res);
23417c478bd9Sstevel@tonic-gate 			longjmp(xdr_err, 1);
23427c478bd9Sstevel@tonic-gate 		}
23437c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf), "%s %s ",
23442f172c55SRobert Thurlow 		    cb_opcode_name(one_res.resop),
23452f172c55SRobert Thurlow 		    sum_cb_result(&one_res));
23467c478bd9Sstevel@tonic-gate 		bp += strlen(bp);
23477c478bd9Sstevel@tonic-gate 
23487c478bd9Sstevel@tonic-gate 		xdr_free(xdr_nfs_cb_resop4, (char *)&one_res);
23497c478bd9Sstevel@tonic-gate 
23507c478bd9Sstevel@tonic-gate 		/* add "..." if past the "end" of the buffer */
23517c478bd9Sstevel@tonic-gate 		if (bp - buf > SUM_COMPND_MAX) {
23527c478bd9Sstevel@tonic-gate 			strcpy(buf + SUM_COMPND_MAX - strlen("..."),
23537c478bd9Sstevel@tonic-gate 			    "...");
23547c478bd9Sstevel@tonic-gate 			break;
23557c478bd9Sstevel@tonic-gate 		}
23567c478bd9Sstevel@tonic-gate 	}
23577c478bd9Sstevel@tonic-gate 
23587c478bd9Sstevel@tonic-gate 	return (buf);
23597c478bd9Sstevel@tonic-gate }
23607c478bd9Sstevel@tonic-gate 
23617c478bd9Sstevel@tonic-gate 
23627c478bd9Sstevel@tonic-gate /*
23637c478bd9Sstevel@tonic-gate  * Return the summarized results for the given resultdata.
23647c478bd9Sstevel@tonic-gate  */
23657c478bd9Sstevel@tonic-gate 
23667c478bd9Sstevel@tonic-gate static char *
sum_result(nfs_resop4 * resp)23677c478bd9Sstevel@tonic-gate sum_result(nfs_resop4 *resp)
23687c478bd9Sstevel@tonic-gate {
23697c478bd9Sstevel@tonic-gate 	static char buf[1024];
23707c478bd9Sstevel@tonic-gate 	void (*fmtproc)(char *, size_t, void *);
23717c478bd9Sstevel@tonic-gate 
23727c478bd9Sstevel@tonic-gate 	buf[0] = '\0';
23737c478bd9Sstevel@tonic-gate 	if (resp->resop < num_opcodes)
23747c478bd9Sstevel@tonic-gate 		fmtproc = opcode_info[resp->resop].sumres;
23757c478bd9Sstevel@tonic-gate 	else if (resp->resop == OP_ILLEGAL)
23767c478bd9Sstevel@tonic-gate 		fmtproc = sum_nfsstat4;
23777c478bd9Sstevel@tonic-gate 	else
23787c478bd9Sstevel@tonic-gate 		fmtproc = NULL;
23797c478bd9Sstevel@tonic-gate 
23807c478bd9Sstevel@tonic-gate 	if (fmtproc != NULL)
23817c478bd9Sstevel@tonic-gate 		fmtproc(buf, sizeof (buf), &resp->nfs_resop4_u);
23827c478bd9Sstevel@tonic-gate 
23837c478bd9Sstevel@tonic-gate 	return (buf);
23847c478bd9Sstevel@tonic-gate }
23857c478bd9Sstevel@tonic-gate 
23867c478bd9Sstevel@tonic-gate /*
23877c478bd9Sstevel@tonic-gate  * Return the summarized results for the given resultdata.
23887c478bd9Sstevel@tonic-gate  */
23897c478bd9Sstevel@tonic-gate 
23907c478bd9Sstevel@tonic-gate static char *
sum_cb_result(nfs_cb_resop4 * resp)23917c478bd9Sstevel@tonic-gate sum_cb_result(nfs_cb_resop4 *resp)
23927c478bd9Sstevel@tonic-gate {
23937c478bd9Sstevel@tonic-gate 	static char buf[1024];
23947c478bd9Sstevel@tonic-gate 	void (*fmtproc)(char *, size_t, void *);
23957c478bd9Sstevel@tonic-gate 
23967c478bd9Sstevel@tonic-gate 	buf[0] = '\0';
23977c478bd9Sstevel@tonic-gate 	if (resp->resop < cb_num_opcodes)
23987c478bd9Sstevel@tonic-gate 		fmtproc = cb_opcode_info[resp->resop].sumres;
23997c478bd9Sstevel@tonic-gate 	else if (resp->resop == OP_CB_ILLEGAL)
24007c478bd9Sstevel@tonic-gate 		fmtproc = sum_nfsstat4;
24017c478bd9Sstevel@tonic-gate 	else
24027c478bd9Sstevel@tonic-gate 		fmtproc = NULL;
24037c478bd9Sstevel@tonic-gate 
24047c478bd9Sstevel@tonic-gate 	if (fmtproc != NULL)
24057c478bd9Sstevel@tonic-gate 		fmtproc(buf, sizeof (buf), &resp->nfs_cb_resop4_u);
24067c478bd9Sstevel@tonic-gate 
24077c478bd9Sstevel@tonic-gate 	return (buf);
24087c478bd9Sstevel@tonic-gate }
24097c478bd9Sstevel@tonic-gate 
24107c478bd9Sstevel@tonic-gate 
24117c478bd9Sstevel@tonic-gate static void
dtl_change_info(char * msg,change_info4 * infop)24127c478bd9Sstevel@tonic-gate dtl_change_info(char *msg, change_info4 *infop)
24137c478bd9Sstevel@tonic-gate {
24147c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "%s:", msg);
24157c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "  Atomic = %s",
24162f172c55SRobert Thurlow 	    infop->atomic ? "TRUE" : "FALSE");
24177c478bd9Sstevel@tonic-gate 	detail_fattr4_change("  Before", infop->before);
24187c478bd9Sstevel@tonic-gate 	detail_fattr4_change("  After", infop->after);
24197c478bd9Sstevel@tonic-gate }
24207c478bd9Sstevel@tonic-gate 
24217c478bd9Sstevel@tonic-gate static void
detail_fattr4_change(char * msg,fattr4_change chg)24227c478bd9Sstevel@tonic-gate detail_fattr4_change(char *msg, fattr4_change chg)
24237c478bd9Sstevel@tonic-gate {
24247c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "%s: 0x%llx", msg, chg);
24257c478bd9Sstevel@tonic-gate 					/* XXX print as time_t, too? */
24267c478bd9Sstevel@tonic-gate }
24277c478bd9Sstevel@tonic-gate 
24287c478bd9Sstevel@tonic-gate static void
sum_nfsstat4(char * buf,size_t buflen,void * obj)24297c478bd9Sstevel@tonic-gate sum_nfsstat4(char *buf, size_t buflen, void *obj)
24307c478bd9Sstevel@tonic-gate {
24317c478bd9Sstevel@tonic-gate 	nfsstat4 status = *(nfsstat4 *)obj;
24327c478bd9Sstevel@tonic-gate 
24337c478bd9Sstevel@tonic-gate 	strncpy(buf, status_name(status), buflen);
24347c478bd9Sstevel@tonic-gate }
24357c478bd9Sstevel@tonic-gate 
24367c478bd9Sstevel@tonic-gate static void
dtl_nfsstat4(void * obj)24377c478bd9Sstevel@tonic-gate dtl_nfsstat4(void *obj)
24387c478bd9Sstevel@tonic-gate {
24397c478bd9Sstevel@tonic-gate 	nfsstat4 status = *(nfsstat4 *)obj;
24407c478bd9Sstevel@tonic-gate 
24417c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Status = %d (%s)", status,
24422f172c55SRobert Thurlow 	    status_name(status));
24437c478bd9Sstevel@tonic-gate }
24447c478bd9Sstevel@tonic-gate 
24457c478bd9Sstevel@tonic-gate static void
sumres_access(char * buf,size_t buflen,void * obj)24467c478bd9Sstevel@tonic-gate sumres_access(char *buf, size_t buflen, void *obj)
24477c478bd9Sstevel@tonic-gate {
24487c478bd9Sstevel@tonic-gate 	ACCESS4res *res = (ACCESS4res *)obj;
24497c478bd9Sstevel@tonic-gate 	char *bp = buf;
24507c478bd9Sstevel@tonic-gate 	int len, blen = buflen;
24517c478bd9Sstevel@tonic-gate 
24527c478bd9Sstevel@tonic-gate 	strcpy(bp, status_name(res->status));
24537c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
24547c478bd9Sstevel@tonic-gate 		bp += (len = strlen(bp));
24557c478bd9Sstevel@tonic-gate 		blen -= len;
24567c478bd9Sstevel@tonic-gate 
24577c478bd9Sstevel@tonic-gate 		snprintf(bp, blen, " Supp=");
24587c478bd9Sstevel@tonic-gate 		bp += (len = strlen(bp));
24597c478bd9Sstevel@tonic-gate 		blen -= len;
24607c478bd9Sstevel@tonic-gate 
24617c478bd9Sstevel@tonic-gate 		sum_access4(bp, blen, res->ACCESS4res_u.resok4.supported);
24627c478bd9Sstevel@tonic-gate 		bp += (len = strlen(bp));
24637c478bd9Sstevel@tonic-gate 		blen -= len;
24647c478bd9Sstevel@tonic-gate 
24657c478bd9Sstevel@tonic-gate 		snprintf(bp, blen, " Allow=");
24667c478bd9Sstevel@tonic-gate 		bp += (len = strlen(bp));
24677c478bd9Sstevel@tonic-gate 		blen -= len;
24687c478bd9Sstevel@tonic-gate 
24697c478bd9Sstevel@tonic-gate 		sum_access4(bp, blen, res->ACCESS4res_u.resok4.access);
24707c478bd9Sstevel@tonic-gate 	}
24717c478bd9Sstevel@tonic-gate }
24727c478bd9Sstevel@tonic-gate 
24737c478bd9Sstevel@tonic-gate static void
dtlres_access(void * obj)24747c478bd9Sstevel@tonic-gate dtlres_access(void *obj)
24757c478bd9Sstevel@tonic-gate {
24767c478bd9Sstevel@tonic-gate 	ACCESS4res *res = (ACCESS4res *)obj;
24777c478bd9Sstevel@tonic-gate 
24787c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
24797c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
24807c478bd9Sstevel@tonic-gate 		detail_access4("Supported Attributes",
24812f172c55SRobert Thurlow 		    res->ACCESS4res_u.resok4.supported);
24827c478bd9Sstevel@tonic-gate 		detail_access4("Allowed Attributes",
24832f172c55SRobert Thurlow 		    res->ACCESS4res_u.resok4.access);
24847c478bd9Sstevel@tonic-gate 	}
24857c478bd9Sstevel@tonic-gate }
24867c478bd9Sstevel@tonic-gate 
24877c478bd9Sstevel@tonic-gate static void
sumres_close(char * buf,size_t buflen,void * obj)24887c478bd9Sstevel@tonic-gate sumres_close(char *buf, size_t buflen, void *obj)
24897c478bd9Sstevel@tonic-gate {
24907c478bd9Sstevel@tonic-gate 	CLOSE4res *res = (CLOSE4res *)obj;
24917c478bd9Sstevel@tonic-gate 
24927c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK)
24937c478bd9Sstevel@tonic-gate 		snprintf(buf, buflen, "%s",
24942f172c55SRobert Thurlow 		    sum_open_stateid(&res->CLOSE4res_u.open_stateid));
24957c478bd9Sstevel@tonic-gate }
24967c478bd9Sstevel@tonic-gate 
24977c478bd9Sstevel@tonic-gate static void
dtlres_close(void * obj)24987c478bd9Sstevel@tonic-gate dtlres_close(void *obj)
24997c478bd9Sstevel@tonic-gate {
25007c478bd9Sstevel@tonic-gate 	CLOSE4res *res = (CLOSE4res *)obj;
25017c478bd9Sstevel@tonic-gate 
25027c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
25037c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
25047c478bd9Sstevel@tonic-gate 		detail_open_stateid(&res->CLOSE4res_u.open_stateid);
25057c478bd9Sstevel@tonic-gate 	}
25067c478bd9Sstevel@tonic-gate }
25077c478bd9Sstevel@tonic-gate 
25087c478bd9Sstevel@tonic-gate static void
sumres_commit(char * buf,size_t buflen,void * obj)25097c478bd9Sstevel@tonic-gate sumres_commit(char *buf, size_t buflen, void *obj)
25107c478bd9Sstevel@tonic-gate {
25117c478bd9Sstevel@tonic-gate 	COMMIT4res *res = (COMMIT4res *)obj;
25127c478bd9Sstevel@tonic-gate 
25137c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK)
25147c478bd9Sstevel@tonic-gate 		snprintf(buf, buflen, "Verf=%s",
25152f172c55SRobert Thurlow 		    tohex(res->COMMIT4res_u.resok4.writeverf,
25162f172c55SRobert Thurlow 		    NFS4_VERIFIER_SIZE));
25177c478bd9Sstevel@tonic-gate }
25187c478bd9Sstevel@tonic-gate 
25197c478bd9Sstevel@tonic-gate static void
dtlres_commit(void * obj)25207c478bd9Sstevel@tonic-gate dtlres_commit(void *obj)
25217c478bd9Sstevel@tonic-gate {
25227c478bd9Sstevel@tonic-gate 	COMMIT4res *res = (COMMIT4res *)obj;
25237c478bd9Sstevel@tonic-gate 
25247c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
25257c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
25267c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Verifier = %s",
25272f172c55SRobert Thurlow 		    tohex(res->COMMIT4res_u.resok4.writeverf,
25282f172c55SRobert Thurlow 		    NFS4_VERIFIER_SIZE));
25297c478bd9Sstevel@tonic-gate 	}
25307c478bd9Sstevel@tonic-gate }
25317c478bd9Sstevel@tonic-gate 
25327c478bd9Sstevel@tonic-gate static void
dtlres_create(void * obj)25337c478bd9Sstevel@tonic-gate dtlres_create(void *obj)
25347c478bd9Sstevel@tonic-gate {
25357c478bd9Sstevel@tonic-gate 	CREATE4res *res = (CREATE4res *)obj;
25367c478bd9Sstevel@tonic-gate 
25377c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
25387c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
25397c478bd9Sstevel@tonic-gate 		dtl_change_info("Change Information",
25402f172c55SRobert Thurlow 		    &res->CREATE4res_u.resok4.cinfo);
25417c478bd9Sstevel@tonic-gate 		detail_attr_bitmap("", &res->CREATE4res_u.resok4.attrset,
25422f172c55SRobert Thurlow 		    NULL);
25437c478bd9Sstevel@tonic-gate 	}
25447c478bd9Sstevel@tonic-gate }
25457c478bd9Sstevel@tonic-gate 
25467c478bd9Sstevel@tonic-gate static void
sumres_getattr(char * buf,size_t buflen,void * obj)25477c478bd9Sstevel@tonic-gate sumres_getattr(char *buf, size_t buflen, void *obj)
25487c478bd9Sstevel@tonic-gate {
25497c478bd9Sstevel@tonic-gate 	GETATTR4res *res = (GETATTR4res *)obj;
25507c478bd9Sstevel@tonic-gate 
25517c478bd9Sstevel@tonic-gate 	strncpy(buf, status_name(res->status), buflen);
25527c478bd9Sstevel@tonic-gate }
25537c478bd9Sstevel@tonic-gate 
25547c478bd9Sstevel@tonic-gate static void
dtlres_getattr(void * obj)25557c478bd9Sstevel@tonic-gate dtlres_getattr(void *obj)
25567c478bd9Sstevel@tonic-gate {
25577c478bd9Sstevel@tonic-gate 	GETATTR4res *res = (GETATTR4res *)obj;
25587c478bd9Sstevel@tonic-gate 
25597c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
25607c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
25617c478bd9Sstevel@tonic-gate 		detail_fattr4(&res->GETATTR4res_u.resok4.obj_attributes);
25627c478bd9Sstevel@tonic-gate 	}
25637c478bd9Sstevel@tonic-gate }
25647c478bd9Sstevel@tonic-gate 
25657c478bd9Sstevel@tonic-gate static void
sumres_cb_getattr(char * buf,size_t buflen,void * obj)25667c478bd9Sstevel@tonic-gate sumres_cb_getattr(char *buf, size_t buflen, void *obj)
25677c478bd9Sstevel@tonic-gate {
25687c478bd9Sstevel@tonic-gate 	CB_GETATTR4res *res = (CB_GETATTR4res *)obj;
25697c478bd9Sstevel@tonic-gate 
25707c478bd9Sstevel@tonic-gate 	strncpy(buf, status_name(res->status), buflen);
25717c478bd9Sstevel@tonic-gate }
25727c478bd9Sstevel@tonic-gate 
25737c478bd9Sstevel@tonic-gate static void
dtlres_cb_getattr(void * obj)25747c478bd9Sstevel@tonic-gate dtlres_cb_getattr(void *obj)
25757c478bd9Sstevel@tonic-gate {
25767c478bd9Sstevel@tonic-gate 	CB_GETATTR4res *res = (CB_GETATTR4res *)obj;
25777c478bd9Sstevel@tonic-gate 
25787c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
25797c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
25807c478bd9Sstevel@tonic-gate 		detail_fattr4(&res->CB_GETATTR4res_u.resok4.obj_attributes);
25817c478bd9Sstevel@tonic-gate 	}
25827c478bd9Sstevel@tonic-gate }
25837c478bd9Sstevel@tonic-gate 
25847c478bd9Sstevel@tonic-gate 
25857c478bd9Sstevel@tonic-gate static void
sumres_getfh(char * buf,size_t buflen,void * obj)25867c478bd9Sstevel@tonic-gate sumres_getfh(char *buf, size_t buflen, void *obj)
25877c478bd9Sstevel@tonic-gate {
25887c478bd9Sstevel@tonic-gate 	char *bp;
25897c478bd9Sstevel@tonic-gate 	GETFH4res *res = (GETFH4res *)obj;
25907c478bd9Sstevel@tonic-gate 
25917c478bd9Sstevel@tonic-gate 	strncpy(buf, status_name(res->status), buflen);
25927c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
25937c478bd9Sstevel@tonic-gate 		bp = buf + strlen(buf);
25947c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf), " %s",
25952f172c55SRobert Thurlow 		    sum_fh4(&res->GETFH4res_u.resok4.object));
25967c478bd9Sstevel@tonic-gate 	}
25977c478bd9Sstevel@tonic-gate }
25987c478bd9Sstevel@tonic-gate 
25997c478bd9Sstevel@tonic-gate static void
dtlres_getfh(void * obj)26007c478bd9Sstevel@tonic-gate dtlres_getfh(void *obj)
26017c478bd9Sstevel@tonic-gate {
26027c478bd9Sstevel@tonic-gate 	GETFH4res *res = (GETFH4res *)obj;
26037c478bd9Sstevel@tonic-gate 
26047c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
26057c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
26067c478bd9Sstevel@tonic-gate 		detail_fh4(&res->GETFH4res_u.resok4.object);
26077c478bd9Sstevel@tonic-gate 	}
26087c478bd9Sstevel@tonic-gate }
26097c478bd9Sstevel@tonic-gate 
26107c478bd9Sstevel@tonic-gate static void
dtlres_link(void * obj)26117c478bd9Sstevel@tonic-gate dtlres_link(void *obj)
26127c478bd9Sstevel@tonic-gate {
26137c478bd9Sstevel@tonic-gate 	LINK4res *res = (LINK4res *)obj;
26147c478bd9Sstevel@tonic-gate 
26157c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
26167c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
26177c478bd9Sstevel@tonic-gate 		dtl_change_info("Change Information",
26182f172c55SRobert Thurlow 		    &res->LINK4res_u.resok4.cinfo);
26197c478bd9Sstevel@tonic-gate 	}
26207c478bd9Sstevel@tonic-gate }
26217c478bd9Sstevel@tonic-gate 
26227c478bd9Sstevel@tonic-gate static void
sumres_lock(char * buf,size_t buflen,void * obj)26237c478bd9Sstevel@tonic-gate sumres_lock(char *buf, size_t buflen, void *obj)
26247c478bd9Sstevel@tonic-gate {
26257c478bd9Sstevel@tonic-gate 	char *bp;
26267c478bd9Sstevel@tonic-gate 	LOCK4res *res = (LOCK4res *)obj;
26277c478bd9Sstevel@tonic-gate 
26287c478bd9Sstevel@tonic-gate 	strncpy(buf, status_name(res->status), buflen);
26297c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
26307c478bd9Sstevel@tonic-gate 		bp = buf + strlen(buf);
26317c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf), " %s",
26322f172c55SRobert Thurlow 		    sum_lock_stateid(&res->LOCK4res_u.resok4.lock_stateid));
26337c478bd9Sstevel@tonic-gate 	}
26347c478bd9Sstevel@tonic-gate 	if (res->status == NFS4ERR_DENIED) {
26357c478bd9Sstevel@tonic-gate 		bp = buf + strlen(buf);
26367c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf), " %s",
26372f172c55SRobert Thurlow 		    sum_lock_denied(&res->LOCK4res_u.denied));
26387c478bd9Sstevel@tonic-gate 	}
26397c478bd9Sstevel@tonic-gate }
26407c478bd9Sstevel@tonic-gate 
26417c478bd9Sstevel@tonic-gate static void
dtlres_lock(void * obj)26427c478bd9Sstevel@tonic-gate dtlres_lock(void *obj)
26437c478bd9Sstevel@tonic-gate {
26447c478bd9Sstevel@tonic-gate 	LOCK4res *res = (LOCK4res *)obj;
26457c478bd9Sstevel@tonic-gate 
26467c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
26477c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
26487c478bd9Sstevel@tonic-gate 		detail_lock_stateid(&res->LOCK4res_u.resok4.lock_stateid);
26497c478bd9Sstevel@tonic-gate 	}
26507c478bd9Sstevel@tonic-gate 	if (res->status == NFS4ERR_DENIED) {
26517c478bd9Sstevel@tonic-gate 		detail_lock_denied(&res->LOCK4res_u.denied);
26527c478bd9Sstevel@tonic-gate 	}
26537c478bd9Sstevel@tonic-gate }
26547c478bd9Sstevel@tonic-gate 
26557c478bd9Sstevel@tonic-gate static void
sumres_lockt(char * buf,size_t buflen,void * obj)26567c478bd9Sstevel@tonic-gate sumres_lockt(char *buf, size_t buflen, void *obj)
26577c478bd9Sstevel@tonic-gate {
26587c478bd9Sstevel@tonic-gate 	char *bp;
26597c478bd9Sstevel@tonic-gate 	LOCKT4res *res = (LOCKT4res *)obj;
26607c478bd9Sstevel@tonic-gate 
26617c478bd9Sstevel@tonic-gate 	strcpy(buf, status_name(res->status));
26627c478bd9Sstevel@tonic-gate 	if (res->status == NFS4ERR_DENIED) {
26637c478bd9Sstevel@tonic-gate 		bp = buf + strlen(buf);
26647c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf), " %s",
26652f172c55SRobert Thurlow 		    sum_lock_denied(&res->LOCKT4res_u.denied));
26667c478bd9Sstevel@tonic-gate 	}
26677c478bd9Sstevel@tonic-gate }
26687c478bd9Sstevel@tonic-gate 
26697c478bd9Sstevel@tonic-gate static void
dtlres_lockt(void * obj)26707c478bd9Sstevel@tonic-gate dtlres_lockt(void *obj)
26717c478bd9Sstevel@tonic-gate {
26727c478bd9Sstevel@tonic-gate 	LOCKT4res *res = (LOCKT4res *)obj;
26737c478bd9Sstevel@tonic-gate 
26747c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
26757c478bd9Sstevel@tonic-gate 	if (res->status == NFS4ERR_DENIED) {
26767c478bd9Sstevel@tonic-gate 		detail_lock_denied(&res->LOCKT4res_u.denied);
26777c478bd9Sstevel@tonic-gate 	}
26787c478bd9Sstevel@tonic-gate }
26797c478bd9Sstevel@tonic-gate 
26807c478bd9Sstevel@tonic-gate static void
sumres_locku(char * buf,size_t buflen,void * obj)26817c478bd9Sstevel@tonic-gate sumres_locku(char *buf, size_t buflen, void *obj)
26827c478bd9Sstevel@tonic-gate {
26837c478bd9Sstevel@tonic-gate 	char *bp;
26847c478bd9Sstevel@tonic-gate 	LOCKU4res *res = (LOCKU4res *)obj;
26857c478bd9Sstevel@tonic-gate 
26867c478bd9Sstevel@tonic-gate 	strncpy(buf, status_name(res->status), buflen);
26877c478bd9Sstevel@tonic-gate 	bp = buf + strlen(buf);
26887c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK)
26897c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf), " %s",
26902f172c55SRobert Thurlow 		    sum_lock_stateid(&res->LOCKU4res_u.lock_stateid));
26917c478bd9Sstevel@tonic-gate }
26927c478bd9Sstevel@tonic-gate 
26937c478bd9Sstevel@tonic-gate static void
dtlres_locku(void * obj)26947c478bd9Sstevel@tonic-gate dtlres_locku(void *obj)
26957c478bd9Sstevel@tonic-gate {
26967c478bd9Sstevel@tonic-gate 	LOCKU4res *res = (LOCKU4res *)obj;
26977c478bd9Sstevel@tonic-gate 
26987c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
26997c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK)
27007c478bd9Sstevel@tonic-gate 		detail_lock_stateid(&res->LOCKU4res_u.lock_stateid);
27017c478bd9Sstevel@tonic-gate }
27027c478bd9Sstevel@tonic-gate 
27037c478bd9Sstevel@tonic-gate static void
sumres_open(char * buf,size_t buflen,void * obj)27047c478bd9Sstevel@tonic-gate sumres_open(char *buf, size_t buflen, void *obj)
27057c478bd9Sstevel@tonic-gate {
27067c478bd9Sstevel@tonic-gate 	char *bp = buf;
27077c478bd9Sstevel@tonic-gate 	OPEN4res *res = (OPEN4res *)obj;
27087c478bd9Sstevel@tonic-gate 	uint_t rflags;
27097c478bd9Sstevel@tonic-gate 	int len, blen = buflen;
27107c478bd9Sstevel@tonic-gate 
27117c478bd9Sstevel@tonic-gate 	strncpy(bp, status_name(res->status), blen);
27127c478bd9Sstevel@tonic-gate 
27137c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
27147c478bd9Sstevel@tonic-gate 		bp += (len = strlen(bp));
27157c478bd9Sstevel@tonic-gate 		blen -= len;
27167c478bd9Sstevel@tonic-gate 
27177c478bd9Sstevel@tonic-gate 		snprintf(bp, blen, " %s",
27182f172c55SRobert Thurlow 		    sum_stateid(&res->OPEN4res_u.resok4.stateid));
27197c478bd9Sstevel@tonic-gate 		bp += (len = strlen(bp));
27207c478bd9Sstevel@tonic-gate 		blen -= len;
27217c478bd9Sstevel@tonic-gate 
27227c478bd9Sstevel@tonic-gate 		if ((rflags = res->OPEN4res_u.resok4.rflags) != 0) {
27237c478bd9Sstevel@tonic-gate 			snprintf(bp, blen, "%s", sum_open_rflags(rflags));
27247c478bd9Sstevel@tonic-gate 			bp += (len = strlen(bp));
27257c478bd9Sstevel@tonic-gate 			blen -= len;
27267c478bd9Sstevel@tonic-gate 		}
27277c478bd9Sstevel@tonic-gate 
27287c478bd9Sstevel@tonic-gate 		sum_delegation(bp, blen, &res->OPEN4res_u.resok4.delegation);
27297c478bd9Sstevel@tonic-gate 	}
27307c478bd9Sstevel@tonic-gate }
27317c478bd9Sstevel@tonic-gate 
27327c478bd9Sstevel@tonic-gate static void
dtlres_open(void * obj)27337c478bd9Sstevel@tonic-gate dtlres_open(void *obj)
27347c478bd9Sstevel@tonic-gate {
27357c478bd9Sstevel@tonic-gate 	OPEN4res *res = (OPEN4res *)obj;
27367c478bd9Sstevel@tonic-gate 
27377c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
27387c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
27397c478bd9Sstevel@tonic-gate 		detail_stateid(&res->OPEN4res_u.resok4.stateid);
27407c478bd9Sstevel@tonic-gate 		dtl_change_info("Change Information",
27412f172c55SRobert Thurlow 		    &res->OPEN4res_u.resok4.cinfo);
27427c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Flags = 0x%x (%s)",
27432f172c55SRobert Thurlow 		    res->OPEN4res_u.resok4.rflags,
27442f172c55SRobert Thurlow 		    detail_open_rflags(res->OPEN4res_u.resok4.rflags));
27457c478bd9Sstevel@tonic-gate 		detail_attr_bitmap("", &res->OPEN4res_u.resok4.attrset,
27462f172c55SRobert Thurlow 		    NULL);
27477c478bd9Sstevel@tonic-gate 		detail_delegation(&res->OPEN4res_u.resok4.delegation);
27487c478bd9Sstevel@tonic-gate 	}
27497c478bd9Sstevel@tonic-gate }
27507c478bd9Sstevel@tonic-gate 
27517c478bd9Sstevel@tonic-gate static void
sumres_open_confirm(char * buf,size_t buflen,void * obj)27527c478bd9Sstevel@tonic-gate sumres_open_confirm(char *buf, size_t buflen, void *obj)
27537c478bd9Sstevel@tonic-gate {
27547c478bd9Sstevel@tonic-gate 	char *bp;
27557c478bd9Sstevel@tonic-gate 	OPEN_CONFIRM4res *res = (OPEN_CONFIRM4res *)obj;
27567c478bd9Sstevel@tonic-gate 
27577c478bd9Sstevel@tonic-gate 	strncpy(buf, status_name(res->status), buflen);
27587c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
27597c478bd9Sstevel@tonic-gate 		bp = buf + strlen(buf);
27607c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf), " %s",
27612f172c55SRobert Thurlow 		    sum_open_stateid(&res->OPEN_CONFIRM4res_u.resok4.
27622f172c55SRobert Thurlow 		    open_stateid));
27637c478bd9Sstevel@tonic-gate 	}
27647c478bd9Sstevel@tonic-gate }
27657c478bd9Sstevel@tonic-gate 
27667c478bd9Sstevel@tonic-gate static void
dtlres_open_confirm(void * obj)27677c478bd9Sstevel@tonic-gate dtlres_open_confirm(void *obj)
27687c478bd9Sstevel@tonic-gate {
27697c478bd9Sstevel@tonic-gate 	OPEN_CONFIRM4res *res = (OPEN_CONFIRM4res *)obj;
27707c478bd9Sstevel@tonic-gate 
27717c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
27727c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
27737c478bd9Sstevel@tonic-gate 		detail_open_stateid(&res->OPEN_CONFIRM4res_u.resok4.
27742f172c55SRobert Thurlow 		    open_stateid);
27757c478bd9Sstevel@tonic-gate 	}
27767c478bd9Sstevel@tonic-gate }
27777c478bd9Sstevel@tonic-gate 
27787c478bd9Sstevel@tonic-gate static void
sumres_open_downgrd(char * buf,size_t buflen,void * obj)27797c478bd9Sstevel@tonic-gate sumres_open_downgrd(char *buf, size_t buflen, void *obj)
27807c478bd9Sstevel@tonic-gate {
27817c478bd9Sstevel@tonic-gate 	char *bp;
27827c478bd9Sstevel@tonic-gate 	OPEN_DOWNGRADE4res *res = (OPEN_DOWNGRADE4res *)obj;
27837c478bd9Sstevel@tonic-gate 
27847c478bd9Sstevel@tonic-gate 	strncpy(buf, status_name(res->status), buflen);
27857c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
27867c478bd9Sstevel@tonic-gate 		bp = buf + strlen(buf);
27877c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf), " %s",
27882f172c55SRobert Thurlow 		    sum_open_stateid(&res->OPEN_DOWNGRADE4res_u.resok4.
27892f172c55SRobert Thurlow 		    open_stateid));
27907c478bd9Sstevel@tonic-gate 	}
27917c478bd9Sstevel@tonic-gate }
27927c478bd9Sstevel@tonic-gate 
27937c478bd9Sstevel@tonic-gate static void
dtlres_open_downgrd(void * obj)27947c478bd9Sstevel@tonic-gate dtlres_open_downgrd(void *obj)
27957c478bd9Sstevel@tonic-gate {
27967c478bd9Sstevel@tonic-gate 	OPEN_DOWNGRADE4res *res = (OPEN_DOWNGRADE4res *)obj;
27977c478bd9Sstevel@tonic-gate 
27987c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
27997c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
28007c478bd9Sstevel@tonic-gate 		detail_open_stateid(&res->OPEN_DOWNGRADE4res_u.resok4.
28012f172c55SRobert Thurlow 		    open_stateid);
28027c478bd9Sstevel@tonic-gate 	}
28037c478bd9Sstevel@tonic-gate }
28047c478bd9Sstevel@tonic-gate 
28057c478bd9Sstevel@tonic-gate static void
sumres_read(char * buf,size_t buflen,void * obj)28067c478bd9Sstevel@tonic-gate sumres_read(char *buf, size_t buflen, void *obj)
28077c478bd9Sstevel@tonic-gate {
28087c478bd9Sstevel@tonic-gate 	char *bp;
28097c478bd9Sstevel@tonic-gate 	READ4res *res = (READ4res *)obj;
28107c478bd9Sstevel@tonic-gate 
28117c478bd9Sstevel@tonic-gate 	strncpy(buf, status_name(res->status), buflen);
28127c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
28137c478bd9Sstevel@tonic-gate 		bp = buf + strlen(buf);
28147c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf), " (%u bytes) %s",
28152f172c55SRobert Thurlow 		    res->READ4res_u.resok4.data.data_len,
28162f172c55SRobert Thurlow 		    res->READ4res_u.resok4.eof ? "EOF" : "");
28177c478bd9Sstevel@tonic-gate 	}
28187c478bd9Sstevel@tonic-gate }
28197c478bd9Sstevel@tonic-gate 
28207c478bd9Sstevel@tonic-gate static void
dtlres_read(void * obj)28217c478bd9Sstevel@tonic-gate dtlres_read(void *obj)
28227c478bd9Sstevel@tonic-gate {
28237c478bd9Sstevel@tonic-gate 	READ4res *res = (READ4res *)obj;
28247c478bd9Sstevel@tonic-gate 
28257c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
28267c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
28277c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Count = %u bytes read",
28282f172c55SRobert Thurlow 		    res->READ4res_u.resok4.data.data_len);
28297c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "End of file = %s",
28302f172c55SRobert Thurlow 		    res->READ4res_u.resok4.eof ? "TRUE" : "FALSE");
28317c478bd9Sstevel@tonic-gate 	}
28327c478bd9Sstevel@tonic-gate }
28337c478bd9Sstevel@tonic-gate 
28347c478bd9Sstevel@tonic-gate static void
sumres_readdir(char * buf,size_t buflen,void * obj)28357c478bd9Sstevel@tonic-gate sumres_readdir(char *buf, size_t buflen, void *obj)
28367c478bd9Sstevel@tonic-gate {
28377c478bd9Sstevel@tonic-gate 	char *bp;
28387c478bd9Sstevel@tonic-gate 	READDIR4res *res = (READDIR4res *)obj;
28397c478bd9Sstevel@tonic-gate 	int num_entries = 0;
28407c478bd9Sstevel@tonic-gate 	entry4 *ep;
28417c478bd9Sstevel@tonic-gate 
28427c478bd9Sstevel@tonic-gate 	strncpy(buf, status_name(res->status), buflen);
28437c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
28447c478bd9Sstevel@tonic-gate 		for (ep = res->READDIR4res_u.resok4.reply.entries;
28457c478bd9Sstevel@tonic-gate 		    ep != NULL;
28467c478bd9Sstevel@tonic-gate 		    ep = ep->nextentry)
28477c478bd9Sstevel@tonic-gate 			num_entries++;
28487c478bd9Sstevel@tonic-gate 		bp = buf + strlen(buf);
28497c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf), " %d entries (%s)",
28502f172c55SRobert Thurlow 		    num_entries,
28512f172c55SRobert Thurlow 		    res->READDIR4res_u.resok4.reply.eof
28522f172c55SRobert Thurlow 		    ? "No more" : "More");
28537c478bd9Sstevel@tonic-gate 	}
28547c478bd9Sstevel@tonic-gate }
28557c478bd9Sstevel@tonic-gate 
28567c478bd9Sstevel@tonic-gate static void
dtlres_readdir(void * obj)28577c478bd9Sstevel@tonic-gate dtlres_readdir(void *obj)
28587c478bd9Sstevel@tonic-gate {
28597c478bd9Sstevel@tonic-gate 	READDIR4res *res = (READDIR4res *)obj;
28607c478bd9Sstevel@tonic-gate 	int num_entries = 0;
28617c478bd9Sstevel@tonic-gate 	entry4 *ep;
28627c478bd9Sstevel@tonic-gate 
28637c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
28647c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
28657c478bd9Sstevel@tonic-gate 		for (ep = res->READDIR4res_u.resok4.reply.entries;
28667c478bd9Sstevel@tonic-gate 		    ep != NULL;
28677c478bd9Sstevel@tonic-gate 		    ep = ep->nextentry) {
28687c478bd9Sstevel@tonic-gate 			num_entries++;
28697c478bd9Sstevel@tonic-gate 			sprintf(get_line(0, 0),
28702f172c55SRobert Thurlow 			    "------------------ entry #%d",
28712f172c55SRobert Thurlow 			    num_entries);
28727c478bd9Sstevel@tonic-gate 			sprintf(get_line(0, 0), "Cookie = %llu",
28732f172c55SRobert Thurlow 			    ep->cookie);
28747c478bd9Sstevel@tonic-gate 			sprintf(get_line(0, 0), "Name = %s",
28752f172c55SRobert Thurlow 			    component_name(&ep->name));
28767c478bd9Sstevel@tonic-gate 			detail_fattr4(&ep->attrs);
28777c478bd9Sstevel@tonic-gate 		}
28787c478bd9Sstevel@tonic-gate 		if (num_entries == 0)
28797c478bd9Sstevel@tonic-gate 			sprintf(get_line(0, 0), "(No entries)");
28807c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "EOF = %s",
28817c478bd9Sstevel@tonic-gate 		    res->READDIR4res_u.resok4.reply.eof ? "TRUE" : "FALSE");
28827c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Verifer = %s",
28832f172c55SRobert Thurlow 		    tohex(res->READDIR4res_u.resok4.cookieverf,
28842f172c55SRobert Thurlow 		    NFS4_VERIFIER_SIZE));
28857c478bd9Sstevel@tonic-gate 	}
28867c478bd9Sstevel@tonic-gate }
28877c478bd9Sstevel@tonic-gate 
28887c478bd9Sstevel@tonic-gate static void
sumres_readlnk(char * buf,size_t buflen,void * obj)28897c478bd9Sstevel@tonic-gate sumres_readlnk(char *buf, size_t buflen, void *obj)
28907c478bd9Sstevel@tonic-gate {
28917c478bd9Sstevel@tonic-gate 	char *bp;
28927c478bd9Sstevel@tonic-gate 	READLINK4res *res = (READLINK4res *)obj;
28937c478bd9Sstevel@tonic-gate 
28947c478bd9Sstevel@tonic-gate 	strncpy(buf, status_name(res->status), buflen);
28957c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
28967c478bd9Sstevel@tonic-gate 		bp = buf + strlen(buf);
28977c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf), " %s",
28982f172c55SRobert Thurlow 		    linktext_name(&res->READLINK4res_u.resok4.link));
28997c478bd9Sstevel@tonic-gate 	}
29007c478bd9Sstevel@tonic-gate }
29017c478bd9Sstevel@tonic-gate 
29027c478bd9Sstevel@tonic-gate static void
dtlres_readlnk(void * obj)29037c478bd9Sstevel@tonic-gate dtlres_readlnk(void *obj)
29047c478bd9Sstevel@tonic-gate {
29057c478bd9Sstevel@tonic-gate 	READLINK4res *res = (READLINK4res *)obj;
29067c478bd9Sstevel@tonic-gate 
29077c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
29087c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
29097c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Link = %s",
29102f172c55SRobert Thurlow 		    linktext_name(&res->READLINK4res_u.resok4.link));
29117c478bd9Sstevel@tonic-gate 	}
29127c478bd9Sstevel@tonic-gate }
29137c478bd9Sstevel@tonic-gate 
29147c478bd9Sstevel@tonic-gate static void
dtlres_remove(void * obj)29157c478bd9Sstevel@tonic-gate dtlres_remove(void *obj)
29167c478bd9Sstevel@tonic-gate {
29177c478bd9Sstevel@tonic-gate 	REMOVE4res *res = (REMOVE4res *)obj;
29187c478bd9Sstevel@tonic-gate 
29197c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
29207c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
29217c478bd9Sstevel@tonic-gate 		dtl_change_info("Change Information",
29222f172c55SRobert Thurlow 		    &res->REMOVE4res_u.resok4.cinfo);
29237c478bd9Sstevel@tonic-gate 	}
29247c478bd9Sstevel@tonic-gate }
29257c478bd9Sstevel@tonic-gate 
29267c478bd9Sstevel@tonic-gate static void
dtlres_rename(void * obj)29277c478bd9Sstevel@tonic-gate dtlres_rename(void *obj)
29287c478bd9Sstevel@tonic-gate {
29297c478bd9Sstevel@tonic-gate 	RENAME4res *res = (RENAME4res *)obj;
29307c478bd9Sstevel@tonic-gate 
29317c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
29327c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
29337c478bd9Sstevel@tonic-gate 		dtl_change_info("Source Change Information",
29342f172c55SRobert Thurlow 		    &res->RENAME4res_u.resok4.source_cinfo);
29357c478bd9Sstevel@tonic-gate 		dtl_change_info("Target Change Information",
29362f172c55SRobert Thurlow 		    &res->RENAME4res_u.resok4.target_cinfo);
29377c478bd9Sstevel@tonic-gate 	}
29387c478bd9Sstevel@tonic-gate }
29397c478bd9Sstevel@tonic-gate 
29407c478bd9Sstevel@tonic-gate static void
sumres_secinfo(char * buf,size_t buflen,void * obj)29417c478bd9Sstevel@tonic-gate sumres_secinfo(char *buf, size_t buflen, void *obj)
29427c478bd9Sstevel@tonic-gate {
29437c478bd9Sstevel@tonic-gate 	char *bp;
29447c478bd9Sstevel@tonic-gate 	SECINFO4res *res = (SECINFO4res *)obj;
29457c478bd9Sstevel@tonic-gate 
29467c478bd9Sstevel@tonic-gate 	strncpy(buf, status_name(res->status), buflen);
29477c478bd9Sstevel@tonic-gate 	bp = buf + strlen(buf);
29487c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
29497c478bd9Sstevel@tonic-gate 		uint_t numinfo = res->SECINFO4res_u.resok4.SECINFO4resok_len;
29507c478bd9Sstevel@tonic-gate 		secinfo4 *infop;
29517c478bd9Sstevel@tonic-gate 
29527c478bd9Sstevel@tonic-gate 		for (infop = res->SECINFO4res_u.resok4.SECINFO4resok_val;
29537c478bd9Sstevel@tonic-gate 		    numinfo != 0;
29547c478bd9Sstevel@tonic-gate 		    infop++, numinfo--) {
29557c478bd9Sstevel@tonic-gate 			snprintf(bp, buflen - (bp - buf), " %s",
29562f172c55SRobert Thurlow 			    flavor_name(infop->flavor));
29577c478bd9Sstevel@tonic-gate 			bp += strlen(bp);
29587c478bd9Sstevel@tonic-gate 		}
29597c478bd9Sstevel@tonic-gate 	}
29607c478bd9Sstevel@tonic-gate }
29617c478bd9Sstevel@tonic-gate 
29627c478bd9Sstevel@tonic-gate static void
dtlres_secinfo(void * obj)29637c478bd9Sstevel@tonic-gate dtlres_secinfo(void *obj)
29647c478bd9Sstevel@tonic-gate {
29657c478bd9Sstevel@tonic-gate 	SECINFO4res *res = (SECINFO4res *)obj;
29667c478bd9Sstevel@tonic-gate 
29677c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
29687c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
29697c478bd9Sstevel@tonic-gate 		uint_t numinfo =
29702f172c55SRobert Thurlow 		    res->SECINFO4res_u.resok4.SECINFO4resok_len;
29717c478bd9Sstevel@tonic-gate 		secinfo4 *infop;
29727c478bd9Sstevel@tonic-gate 
29737c478bd9Sstevel@tonic-gate 		for (infop = res->SECINFO4res_u.resok4.SECINFO4resok_val;
29747c478bd9Sstevel@tonic-gate 		    numinfo != 0;
29757c478bd9Sstevel@tonic-gate 		    infop++, numinfo--) {
29767c478bd9Sstevel@tonic-gate 			detail_secinfo4(infop);
29777c478bd9Sstevel@tonic-gate 		}
29787c478bd9Sstevel@tonic-gate 	}
29797c478bd9Sstevel@tonic-gate }
29807c478bd9Sstevel@tonic-gate 
29817c478bd9Sstevel@tonic-gate static void
sumres_setattr(char * buf,size_t buflen,void * obj)29827c478bd9Sstevel@tonic-gate sumres_setattr(char *buf, size_t buflen, void *obj)
29837c478bd9Sstevel@tonic-gate {
29847c478bd9Sstevel@tonic-gate 	SETATTR4res *res = (SETATTR4res *)obj;
2985be656d98SMarcel Telka 	size_t len;
29867c478bd9Sstevel@tonic-gate 
2987be656d98SMarcel Telka 	(void) snprintf(buf, buflen, "%s ", status_name(res->status));
2988be656d98SMarcel Telka 	len = strlen(buf);
2989be656d98SMarcel Telka 	sum_attr_bitmap(buf + len, buflen - len, &res->attrsset);
29907c478bd9Sstevel@tonic-gate }
29917c478bd9Sstevel@tonic-gate 
29927c478bd9Sstevel@tonic-gate static void
dtlres_setattr(void * obj)29937c478bd9Sstevel@tonic-gate dtlres_setattr(void *obj)
29947c478bd9Sstevel@tonic-gate {
29957c478bd9Sstevel@tonic-gate 	SETATTR4res *res = (SETATTR4res *)obj;
29967c478bd9Sstevel@tonic-gate 
29977c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
29987c478bd9Sstevel@tonic-gate 	detail_attr_bitmap("", &res->attrsset, NULL);
29997c478bd9Sstevel@tonic-gate }
30007c478bd9Sstevel@tonic-gate 
30017c478bd9Sstevel@tonic-gate static void
sumres_setclid(char * buf,size_t buflen,void * obj)30027c478bd9Sstevel@tonic-gate sumres_setclid(char *buf, size_t buflen, void *obj)
30037c478bd9Sstevel@tonic-gate {
30047c478bd9Sstevel@tonic-gate 	char *bp;
30057c478bd9Sstevel@tonic-gate 	SETCLIENTID4res *res = (SETCLIENTID4res *)obj;
30067c478bd9Sstevel@tonic-gate 
30077c478bd9Sstevel@tonic-gate 	strncpy(buf, status_name(res->status), buflen);
30087c478bd9Sstevel@tonic-gate 	switch (res->status) {
30097c478bd9Sstevel@tonic-gate 	case NFS_OK:
30107c478bd9Sstevel@tonic-gate 		bp = buf + strlen(buf);
30117c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf), " %s CFV=%s",
30122f172c55SRobert Thurlow 		    sum_clientid(res->SETCLIENTID4res_u.resok4.clientid),
30132f172c55SRobert Thurlow 		    tohex(res->SETCLIENTID4res_u.resok4.setclientid_confirm,
30142f172c55SRobert Thurlow 		    NFS4_VERIFIER_SIZE));
30157c478bd9Sstevel@tonic-gate 		break;
30167c478bd9Sstevel@tonic-gate 	case NFS4ERR_CLID_INUSE:
30177c478bd9Sstevel@tonic-gate 		bp = buf + strlen(buf);
30187c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf), " ID=%s Addr=%s",
3019*f44e1126SVitaliy Gusev 		    res->SETCLIENTID4res_u.client_using.na_r_netid,
3020*f44e1126SVitaliy Gusev 		    res->SETCLIENTID4res_u.client_using.na_r_addr);
30217c478bd9Sstevel@tonic-gate 		break;
30227c478bd9Sstevel@tonic-gate 	}
30237c478bd9Sstevel@tonic-gate }
30247c478bd9Sstevel@tonic-gate 
30257c478bd9Sstevel@tonic-gate static void
dtlres_setclid(void * obj)30267c478bd9Sstevel@tonic-gate dtlres_setclid(void *obj)
30277c478bd9Sstevel@tonic-gate {
30287c478bd9Sstevel@tonic-gate 	SETCLIENTID4res *res = (SETCLIENTID4res *)obj;
30297c478bd9Sstevel@tonic-gate 
30307c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
30317c478bd9Sstevel@tonic-gate 	switch (res->status) {
30327c478bd9Sstevel@tonic-gate 	case NFS_OK:
30337c478bd9Sstevel@tonic-gate 		detail_clientid(res->SETCLIENTID4res_u.resok4.clientid);
30347c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Set Client ID Confirm Verifier = %s",
30352f172c55SRobert Thurlow 		    tohex(res->SETCLIENTID4res_u.resok4.setclientid_confirm,
30362f172c55SRobert Thurlow 		    NFS4_VERIFIER_SIZE));
30377c478bd9Sstevel@tonic-gate 		break;
30387c478bd9Sstevel@tonic-gate 	case NFS4ERR_CLID_INUSE:
30397c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Used by Net ID = %s",
3040*f44e1126SVitaliy Gusev 		    res->SETCLIENTID4res_u.client_using.na_r_netid);
30417c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Used by Addr = %s",
3042*f44e1126SVitaliy Gusev 		    res->SETCLIENTID4res_u.client_using.na_r_addr);
30437c478bd9Sstevel@tonic-gate 		break;
30447c478bd9Sstevel@tonic-gate 	}
30457c478bd9Sstevel@tonic-gate }
30467c478bd9Sstevel@tonic-gate 
30477c478bd9Sstevel@tonic-gate static void
sumres_write(char * buf,size_t buflen,void * obj)30487c478bd9Sstevel@tonic-gate sumres_write(char *buf, size_t buflen, void *obj)
30497c478bd9Sstevel@tonic-gate {
30507c478bd9Sstevel@tonic-gate 	char *bp;
30517c478bd9Sstevel@tonic-gate 	WRITE4res *res = (WRITE4res *)obj;
30527c478bd9Sstevel@tonic-gate 
30537c478bd9Sstevel@tonic-gate 	strncpy(buf, status_name(res->status), buflen);
30547c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
30557c478bd9Sstevel@tonic-gate 		bp = buf + strlen(buf);
30567c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf), " %u (%s)",
30572f172c55SRobert Thurlow 		    res->WRITE4res_u.resok4.count,
30582f172c55SRobert Thurlow 		    stable_how4_name(res->WRITE4res_u.resok4.committed));
30597c478bd9Sstevel@tonic-gate 	}
30607c478bd9Sstevel@tonic-gate }
30617c478bd9Sstevel@tonic-gate 
30627c478bd9Sstevel@tonic-gate static void
dtlres_write(void * obj)30637c478bd9Sstevel@tonic-gate dtlres_write(void *obj)
30647c478bd9Sstevel@tonic-gate {
30657c478bd9Sstevel@tonic-gate 	WRITE4res *res = (WRITE4res *)obj;
30667c478bd9Sstevel@tonic-gate 
30677c478bd9Sstevel@tonic-gate 	dtl_nfsstat4(obj);
30687c478bd9Sstevel@tonic-gate 	if (res->status == NFS4_OK) {
30697c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Count = %u bytes written",
30702f172c55SRobert Thurlow 		    res->WRITE4res_u.resok4.count);
30717c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Stable = %s",
30722f172c55SRobert Thurlow 		    stable_how4_name(res->WRITE4res_u.resok4.committed));
30737c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Verifier = %s",
30742f172c55SRobert Thurlow 		    tohex(res->WRITE4res_u.resok4.writeverf,
30752f172c55SRobert Thurlow 		    NFS4_VERIFIER_SIZE));
30767c478bd9Sstevel@tonic-gate 	}
30777c478bd9Sstevel@tonic-gate }
30787c478bd9Sstevel@tonic-gate 
30797c478bd9Sstevel@tonic-gate /*
30807c478bd9Sstevel@tonic-gate  * Print details about the nfs_resop4 that is next in the XDR stream.
30817c478bd9Sstevel@tonic-gate  */
30827c478bd9Sstevel@tonic-gate 
30837c478bd9Sstevel@tonic-gate static void
detail_nfs_resop4(void)30847c478bd9Sstevel@tonic-gate detail_nfs_resop4(void)
30857c478bd9Sstevel@tonic-gate {
30867c478bd9Sstevel@tonic-gate 	int numres;
30877c478bd9Sstevel@tonic-gate 	nfs_resop4 one_res;
30887c478bd9Sstevel@tonic-gate 	void (*fmtproc)(void *);
30897c478bd9Sstevel@tonic-gate 
30907c478bd9Sstevel@tonic-gate 	numres = getxdr_long();
30917c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line(0, 0), "Number of results = %d",
30922f172c55SRobert Thurlow 	    numres);
30937c478bd9Sstevel@tonic-gate 
30947c478bd9Sstevel@tonic-gate 	while (numres-- > 0) {
30957c478bd9Sstevel@tonic-gate 		bzero(&one_res, sizeof (one_res));
30967c478bd9Sstevel@tonic-gate 
30977c478bd9Sstevel@tonic-gate 		if (!xdr_nfs_resop4(&xdrm, &one_res)) {
30987c478bd9Sstevel@tonic-gate 			xdr_free(xdr_nfs_resop4, (char *)&one_res);
30997c478bd9Sstevel@tonic-gate 			longjmp(xdr_err, 1);
31007c478bd9Sstevel@tonic-gate 		}
31017c478bd9Sstevel@tonic-gate 
31027c478bd9Sstevel@tonic-gate 		get_line(0, 0);		/* blank line to separate ops */
31037c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Op = %d (%s)",
31042f172c55SRobert Thurlow 		    one_res.resop, opcode_name(one_res.resop));
31057c478bd9Sstevel@tonic-gate 		if (one_res.resop < num_opcodes)
31067c478bd9Sstevel@tonic-gate 			fmtproc = opcode_info[one_res.resop].dtlres;
31077c478bd9Sstevel@tonic-gate 		else if (one_res.resop == OP_ILLEGAL)
31087c478bd9Sstevel@tonic-gate 			fmtproc = dtl_nfsstat4;
31097c478bd9Sstevel@tonic-gate 		else
31107c478bd9Sstevel@tonic-gate 			fmtproc = NULL;
31117c478bd9Sstevel@tonic-gate 
31127c478bd9Sstevel@tonic-gate 		if (fmtproc != NULL)
31137c478bd9Sstevel@tonic-gate 			fmtproc(&one_res.nfs_resop4_u);
31147c478bd9Sstevel@tonic-gate 
31157c478bd9Sstevel@tonic-gate 		/* nfs4_skip_bytes set by xdr_nfs_resop4()() */
31167c478bd9Sstevel@tonic-gate 		if (nfs4_skip_bytes)
31177c478bd9Sstevel@tonic-gate 			nfs4_xdr_skip(nfs4_skip_bytes);
31187c478bd9Sstevel@tonic-gate 
31197c478bd9Sstevel@tonic-gate 		xdr_free(xdr_nfs_resop4, (char *)&one_res);
31207c478bd9Sstevel@tonic-gate 	}
31217c478bd9Sstevel@tonic-gate }
31227c478bd9Sstevel@tonic-gate 
31237c478bd9Sstevel@tonic-gate 
31247c478bd9Sstevel@tonic-gate /*
31257c478bd9Sstevel@tonic-gate  * Print details about the nfs_cb_resop4 that is next in the XDR stream.
31267c478bd9Sstevel@tonic-gate  */
31277c478bd9Sstevel@tonic-gate 
31287c478bd9Sstevel@tonic-gate static void
detail_cb_resop4(void)31297c478bd9Sstevel@tonic-gate detail_cb_resop4(void)
31307c478bd9Sstevel@tonic-gate {
31317c478bd9Sstevel@tonic-gate 	int numres;
31327c478bd9Sstevel@tonic-gate 	nfs_cb_resop4 one_res;
31337c478bd9Sstevel@tonic-gate 	void (*fmtproc)(void *);
31347c478bd9Sstevel@tonic-gate 
31357c478bd9Sstevel@tonic-gate 	numres = getxdr_long();
31367c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line(0, 0), "Number of results = %d",
31372f172c55SRobert Thurlow 	    numres);
31387c478bd9Sstevel@tonic-gate 
31397c478bd9Sstevel@tonic-gate 	while (numres-- > 0) {
31407c478bd9Sstevel@tonic-gate 		bzero(&one_res, sizeof (one_res));
31417c478bd9Sstevel@tonic-gate 		if (!xdr_nfs_cb_resop4(&xdrm, &one_res))
31427c478bd9Sstevel@tonic-gate 			longjmp(xdr_err, 1);
31437c478bd9Sstevel@tonic-gate 
31447c478bd9Sstevel@tonic-gate 		get_line(0, 0);		/* blank line to separate ops */
31457c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Op = %d (%s)",
31462f172c55SRobert Thurlow 		    one_res.resop, cb_opcode_name(one_res.resop));
31477c478bd9Sstevel@tonic-gate 		if (one_res.resop < cb_num_opcodes)
31487c478bd9Sstevel@tonic-gate 			fmtproc = cb_opcode_info[one_res.resop].dtlres;
31497c478bd9Sstevel@tonic-gate 		else if (one_res.resop == OP_CB_ILLEGAL)
31507c478bd9Sstevel@tonic-gate 			fmtproc = dtl_nfsstat4;
31517c478bd9Sstevel@tonic-gate 		else
31527c478bd9Sstevel@tonic-gate 			fmtproc = NULL;
31537c478bd9Sstevel@tonic-gate 
31547c478bd9Sstevel@tonic-gate 		if (fmtproc != NULL)
31557c478bd9Sstevel@tonic-gate 			fmtproc(&one_res.nfs_cb_resop4_u);
31567c478bd9Sstevel@tonic-gate 
31577c478bd9Sstevel@tonic-gate 		xdr_free(xdr_nfs_cb_resop4, (char *)&one_res);
31587c478bd9Sstevel@tonic-gate 	}
31597c478bd9Sstevel@tonic-gate }
31607c478bd9Sstevel@tonic-gate 
31617c478bd9Sstevel@tonic-gate 
31627c478bd9Sstevel@tonic-gate /*
31637c478bd9Sstevel@tonic-gate  * Return the name of a lock type.
31647c478bd9Sstevel@tonic-gate  */
31657c478bd9Sstevel@tonic-gate static char *
lock_type_name(enum nfs_lock_type4 type)31667c478bd9Sstevel@tonic-gate lock_type_name(enum nfs_lock_type4 type)
31677c478bd9Sstevel@tonic-gate {
31687c478bd9Sstevel@tonic-gate 	char *result;
31697c478bd9Sstevel@tonic-gate 
31707c478bd9Sstevel@tonic-gate 	switch (type) {
31717c478bd9Sstevel@tonic-gate 	case READ_LT:
31727c478bd9Sstevel@tonic-gate 		result = "READ";
31737c478bd9Sstevel@tonic-gate 		break;
31747c478bd9Sstevel@tonic-gate 	case WRITE_LT:
31757c478bd9Sstevel@tonic-gate 		result = "WRITE";
31767c478bd9Sstevel@tonic-gate 		break;
31777c478bd9Sstevel@tonic-gate 	case READW_LT:
31787c478bd9Sstevel@tonic-gate 		result = "READW";
31797c478bd9Sstevel@tonic-gate 		break;
31807c478bd9Sstevel@tonic-gate 	case WRITEW_LT:
31817c478bd9Sstevel@tonic-gate 		result = "WRITEW";
31827c478bd9Sstevel@tonic-gate 		break;
31837c478bd9Sstevel@tonic-gate 	default:
31847c478bd9Sstevel@tonic-gate 		result = "?";
31857c478bd9Sstevel@tonic-gate 		break;
31867c478bd9Sstevel@tonic-gate 	}
31877c478bd9Sstevel@tonic-gate 
31887c478bd9Sstevel@tonic-gate 	return (result);
31897c478bd9Sstevel@tonic-gate }
31907c478bd9Sstevel@tonic-gate 
31917c478bd9Sstevel@tonic-gate /*
31927c478bd9Sstevel@tonic-gate  * Return the name of an opcode.
31937c478bd9Sstevel@tonic-gate  */
31947c478bd9Sstevel@tonic-gate 
31957c478bd9Sstevel@tonic-gate static char *
opcode_name(uint_t opnum)31967c478bd9Sstevel@tonic-gate opcode_name(uint_t opnum)
31977c478bd9Sstevel@tonic-gate {
31987c478bd9Sstevel@tonic-gate 	static char buf[20];
31997c478bd9Sstevel@tonic-gate 
32007c478bd9Sstevel@tonic-gate 	if (opnum < num_opcodes)
32017c478bd9Sstevel@tonic-gate 		return (opcode_info[opnum].name);
32027c478bd9Sstevel@tonic-gate 
32037c478bd9Sstevel@tonic-gate 	if (opnum == OP_ILLEGAL)
32047c478bd9Sstevel@tonic-gate 		return ("ILLEGAL");
32057c478bd9Sstevel@tonic-gate 
32067c478bd9Sstevel@tonic-gate 	sprintf(buf, "op %d", opnum);
32077c478bd9Sstevel@tonic-gate 	return (buf);
32087c478bd9Sstevel@tonic-gate }
32097c478bd9Sstevel@tonic-gate 
32107c478bd9Sstevel@tonic-gate /*
32117c478bd9Sstevel@tonic-gate  * Return the name of an opcode.
32127c478bd9Sstevel@tonic-gate  */
32137c478bd9Sstevel@tonic-gate static char *
cb_opcode_name(uint_t opnum)32147c478bd9Sstevel@tonic-gate cb_opcode_name(uint_t opnum)
32157c478bd9Sstevel@tonic-gate {
32167c478bd9Sstevel@tonic-gate 	static char buf[20];
32177c478bd9Sstevel@tonic-gate 
32187c478bd9Sstevel@tonic-gate 	if (opnum < cb_num_opcodes)
32197c478bd9Sstevel@tonic-gate 		return (cb_opcode_info[opnum].name);
32207c478bd9Sstevel@tonic-gate 
32217c478bd9Sstevel@tonic-gate 	if (opnum == OP_CB_ILLEGAL)
32227c478bd9Sstevel@tonic-gate 		return ("CB_ILLEGAL");
32237c478bd9Sstevel@tonic-gate 
32247c478bd9Sstevel@tonic-gate 	sprintf(buf, "op %d", opnum);
32257c478bd9Sstevel@tonic-gate 	return (buf);
32267c478bd9Sstevel@tonic-gate }
32277c478bd9Sstevel@tonic-gate 
32287c478bd9Sstevel@tonic-gate 
32297c478bd9Sstevel@tonic-gate /*
32307c478bd9Sstevel@tonic-gate  * Fill in a summary string for the given access bitmask.
32317c478bd9Sstevel@tonic-gate  */
32327c478bd9Sstevel@tonic-gate 
32337c478bd9Sstevel@tonic-gate static void
sum_access4(char * buf,size_t buflen,uint32_t bits)32347c478bd9Sstevel@tonic-gate sum_access4(char *buf, size_t buflen, uint32_t bits)
32357c478bd9Sstevel@tonic-gate {
32367c478bd9Sstevel@tonic-gate 	buf[0] = '\0';
32377c478bd9Sstevel@tonic-gate 
32387c478bd9Sstevel@tonic-gate 	if (bits & ACCESS4_READ)
32397c478bd9Sstevel@tonic-gate 		(void) strncat(buf, "rd,", buflen);
32407c478bd9Sstevel@tonic-gate 	if (bits & ACCESS4_LOOKUP)
32417c478bd9Sstevel@tonic-gate 		(void) strncat(buf, "lk,", buflen);
32427c478bd9Sstevel@tonic-gate 	if (bits & ACCESS4_MODIFY)
32437c478bd9Sstevel@tonic-gate 		(void) strncat(buf, "mo,", buflen);
32447c478bd9Sstevel@tonic-gate 	if (bits & ACCESS4_EXTEND)
32457c478bd9Sstevel@tonic-gate 		(void) strncat(buf, "ext,", buflen);
32467c478bd9Sstevel@tonic-gate 	if (bits & ACCESS4_DELETE)
32477c478bd9Sstevel@tonic-gate 		(void) strncat(buf, "dl,", buflen);
32487c478bd9Sstevel@tonic-gate 	if (bits & ACCESS4_EXECUTE)
32497c478bd9Sstevel@tonic-gate 		(void) strncat(buf, "exc,", buflen);
32507c478bd9Sstevel@tonic-gate 	if (buf[0] != '\0')
32517c478bd9Sstevel@tonic-gate 		buf[strlen(buf) - 1] = '\0';
32527c478bd9Sstevel@tonic-gate }
32537c478bd9Sstevel@tonic-gate 
32547c478bd9Sstevel@tonic-gate /*
32557c478bd9Sstevel@tonic-gate  * Print detail information about the given access bitmask.
32567c478bd9Sstevel@tonic-gate  */
32577c478bd9Sstevel@tonic-gate 
32587c478bd9Sstevel@tonic-gate static void
detail_access4(char * descrip,uint32_t bits)32597c478bd9Sstevel@tonic-gate detail_access4(char *descrip, uint32_t bits)
32607c478bd9Sstevel@tonic-gate {
32617c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "%s = 0x%08x", descrip, bits);
32627c478bd9Sstevel@tonic-gate 
32637c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line(0, 0), "	%s",
32642f172c55SRobert Thurlow 	    getflag(bits, ACCESS4_READ, "Read", "(no read)"));
32657c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line(0, 0), "	%s",
32662f172c55SRobert Thurlow 	    getflag(bits, ACCESS4_LOOKUP, "Lookup", "(no lookup)"));
32677c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line(0, 0), "	%s",
32682f172c55SRobert Thurlow 	    getflag(bits, ACCESS4_MODIFY, "Modify", "(no modify)"));
32697c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line(0, 0), "	%s",
32702f172c55SRobert Thurlow 	    getflag(bits, ACCESS4_EXTEND, "Extend", "(no extend)"));
32717c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line(0, 0), "	%s",
32722f172c55SRobert Thurlow 	    getflag(bits, ACCESS4_DELETE, "Delete", "(no delete)"));
32737c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line(0, 0), "	%s",
32742f172c55SRobert Thurlow 	    getflag(bits, ACCESS4_EXECUTE, "Execute", "(no execute)"));
32757c478bd9Sstevel@tonic-gate }
32767c478bd9Sstevel@tonic-gate 
32777c478bd9Sstevel@tonic-gate 
32787c478bd9Sstevel@tonic-gate /*
32797c478bd9Sstevel@tonic-gate  * Fill in a summary string for the given open_claim4.
32807c478bd9Sstevel@tonic-gate  */
32817c478bd9Sstevel@tonic-gate static void
sum_name(char * buf,size_t buflen,open_claim4 * claim)32827c478bd9Sstevel@tonic-gate sum_name(char *buf, size_t buflen, open_claim4 *claim)
32837c478bd9Sstevel@tonic-gate {
32847c478bd9Sstevel@tonic-gate 	char *bp = buf;
32857c478bd9Sstevel@tonic-gate 
32867c478bd9Sstevel@tonic-gate 	switch (claim->claim) {
32877c478bd9Sstevel@tonic-gate 	case CLAIM_NULL:
32887c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen, "%s ",
32892f172c55SRobert Thurlow 		    component_name(&claim->open_claim4_u.file));
32907c478bd9Sstevel@tonic-gate 		break;
32917c478bd9Sstevel@tonic-gate 	case CLAIM_PREVIOUS:
32927c478bd9Sstevel@tonic-gate 		break;
32937c478bd9Sstevel@tonic-gate 	case CLAIM_DELEGATE_CUR:
32947c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen, "%s ",
32952f172c55SRobert Thurlow 		    component_name(&claim->open_claim4_u.
32962f172c55SRobert Thurlow 		    delegate_cur_info.file));
32977c478bd9Sstevel@tonic-gate 		break;
32987c478bd9Sstevel@tonic-gate 	case CLAIM_DELEGATE_PREV:
32997c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen, "%s ",
33002f172c55SRobert Thurlow 		    component_name(&claim->open_claim4_u.
33012f172c55SRobert Thurlow 		    file_delegate_prev));
33027c478bd9Sstevel@tonic-gate 		break;
33037c478bd9Sstevel@tonic-gate 	}
33047c478bd9Sstevel@tonic-gate }
33057c478bd9Sstevel@tonic-gate 
33067c478bd9Sstevel@tonic-gate /*
33077c478bd9Sstevel@tonic-gate  * Fill in a summary string for the given open_claim4.
33087c478bd9Sstevel@tonic-gate  */
33097c478bd9Sstevel@tonic-gate static void
sum_claim(char * buf,size_t buflen,open_claim4 * claim)33107c478bd9Sstevel@tonic-gate sum_claim(char *buf, size_t buflen, open_claim4 *claim)
33117c478bd9Sstevel@tonic-gate {
33127c478bd9Sstevel@tonic-gate 	char *bp = buf;
33137c478bd9Sstevel@tonic-gate 
33147c478bd9Sstevel@tonic-gate 	switch (claim->claim) {
33157c478bd9Sstevel@tonic-gate 	case CLAIM_NULL:
33167c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen, " CT=N");
33177c478bd9Sstevel@tonic-gate 		break;
33187c478bd9Sstevel@tonic-gate 	case CLAIM_PREVIOUS:
33197c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen, " CT=P DT=%s",
33202f172c55SRobert Thurlow 		    get_deleg_typestr(claim->open_claim4_u.delegate_type));
33217c478bd9Sstevel@tonic-gate 		break;
33227c478bd9Sstevel@tonic-gate 	case CLAIM_DELEGATE_CUR:
33237c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen, " CT=DC %s",
33242f172c55SRobert Thurlow 		    sum_deleg_stateid(&claim->open_claim4_u.
33252f172c55SRobert Thurlow 		    delegate_cur_info.delegate_stateid));
33267c478bd9Sstevel@tonic-gate 		break;
33277c478bd9Sstevel@tonic-gate 	case CLAIM_DELEGATE_PREV:
33287c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen, " CT=DP");
33297c478bd9Sstevel@tonic-gate 		break;
33307c478bd9Sstevel@tonic-gate 	default:
33317c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen, " CT=?");
33327c478bd9Sstevel@tonic-gate 		break;
33337c478bd9Sstevel@tonic-gate 	}
33347c478bd9Sstevel@tonic-gate }
33357c478bd9Sstevel@tonic-gate 
33367c478bd9Sstevel@tonic-gate static char *
get_deleg_typestr(open_delegation_type4 dt)33377c478bd9Sstevel@tonic-gate get_deleg_typestr(open_delegation_type4 dt)
33387c478bd9Sstevel@tonic-gate {
33397c478bd9Sstevel@tonic-gate 	char *str = "";
33407c478bd9Sstevel@tonic-gate 
33417c478bd9Sstevel@tonic-gate 	switch (dt) {
33427c478bd9Sstevel@tonic-gate 	case OPEN_DELEGATE_NONE:
33437c478bd9Sstevel@tonic-gate 		str = "N";
33447c478bd9Sstevel@tonic-gate 		break;
33457c478bd9Sstevel@tonic-gate 	case OPEN_DELEGATE_READ:
33467c478bd9Sstevel@tonic-gate 		str = "R";
33477c478bd9Sstevel@tonic-gate 		break;
33487c478bd9Sstevel@tonic-gate 	case OPEN_DELEGATE_WRITE:
33497c478bd9Sstevel@tonic-gate 		str = "W";
33507c478bd9Sstevel@tonic-gate 		break;
33517c478bd9Sstevel@tonic-gate 	default:
33527c478bd9Sstevel@tonic-gate 		str = "?";
33537c478bd9Sstevel@tonic-gate 	}
33547c478bd9Sstevel@tonic-gate 
33557c478bd9Sstevel@tonic-gate 	return (str);
33567c478bd9Sstevel@tonic-gate }
33577c478bd9Sstevel@tonic-gate 
33587c478bd9Sstevel@tonic-gate /*
33597c478bd9Sstevel@tonic-gate  * Print detail information for the given open_claim4.
33607c478bd9Sstevel@tonic-gate  */
33617c478bd9Sstevel@tonic-gate 
33627c478bd9Sstevel@tonic-gate static void
detail_claim(open_claim4 * claim)33637c478bd9Sstevel@tonic-gate detail_claim(open_claim4 *claim)
33647c478bd9Sstevel@tonic-gate {
33657c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Claim Type = %d (%s)",
33662f172c55SRobert Thurlow 	    claim->claim, claim_name(claim->claim));
33677c478bd9Sstevel@tonic-gate 
33687c478bd9Sstevel@tonic-gate 	switch (claim->claim) {
33697c478bd9Sstevel@tonic-gate 	case CLAIM_NULL:
33707c478bd9Sstevel@tonic-gate 		detail_compname4(&claim->open_claim4_u.file);
33717c478bd9Sstevel@tonic-gate 		break;
33727c478bd9Sstevel@tonic-gate 	case CLAIM_PREVIOUS:
33737c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Delegate Type = %s (val = %d)",
33742f172c55SRobert Thurlow 		    get_deleg_typestr(claim->open_claim4_u.delegate_type),
33752f172c55SRobert Thurlow 		    claim->open_claim4_u.delegate_type);
33767c478bd9Sstevel@tonic-gate 		break;
33777c478bd9Sstevel@tonic-gate 	case CLAIM_DELEGATE_CUR:
33787c478bd9Sstevel@tonic-gate 		detail_compname4(&claim->open_claim4_u.delegate_cur_info.file);
33797c478bd9Sstevel@tonic-gate 		detail_deleg_stateid(&claim->open_claim4_u.delegate_cur_info.
33802f172c55SRobert Thurlow 		    delegate_stateid);
33817c478bd9Sstevel@tonic-gate 		break;
33827c478bd9Sstevel@tonic-gate 	case CLAIM_DELEGATE_PREV:
33837c478bd9Sstevel@tonic-gate 		detail_compname4(&claim->open_claim4_u.file_delegate_prev);
33847c478bd9Sstevel@tonic-gate 		break;
33857c478bd9Sstevel@tonic-gate 	}
33867c478bd9Sstevel@tonic-gate }
33877c478bd9Sstevel@tonic-gate 
33887c478bd9Sstevel@tonic-gate /*
33897c478bd9Sstevel@tonic-gate  * Return a summary string for the given clientid4.
33907c478bd9Sstevel@tonic-gate  */
33917c478bd9Sstevel@tonic-gate static char *
sum_clientid(clientid4 client)33927c478bd9Sstevel@tonic-gate sum_clientid(clientid4 client)
33937c478bd9Sstevel@tonic-gate {
33947c478bd9Sstevel@tonic-gate 	static char buf[50];
33957c478bd9Sstevel@tonic-gate 
33967c478bd9Sstevel@tonic-gate 	snprintf(buf, sizeof (buf), "CL=%llx", client);
33977c478bd9Sstevel@tonic-gate 
33987c478bd9Sstevel@tonic-gate 	return (buf);
33997c478bd9Sstevel@tonic-gate }
34007c478bd9Sstevel@tonic-gate 
34017c478bd9Sstevel@tonic-gate /*
34027c478bd9Sstevel@tonic-gate  * Print a detail string for the given clientid4.
34037c478bd9Sstevel@tonic-gate  */
34047c478bd9Sstevel@tonic-gate static void
detail_clientid(clientid4 client)34057c478bd9Sstevel@tonic-gate detail_clientid(clientid4 client)
34067c478bd9Sstevel@tonic-gate {
34077c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Client ID = %llx", client);
34087c478bd9Sstevel@tonic-gate }
34097c478bd9Sstevel@tonic-gate 
34107c478bd9Sstevel@tonic-gate /*
34117c478bd9Sstevel@tonic-gate  * Write a summary string for the given delegation into buf.
34127c478bd9Sstevel@tonic-gate  */
34137c478bd9Sstevel@tonic-gate 
34147c478bd9Sstevel@tonic-gate static void
sum_delegation(char * buf,size_t buflen,open_delegation4 * delp)34157c478bd9Sstevel@tonic-gate sum_delegation(char *buf, size_t buflen, open_delegation4 *delp)
34167c478bd9Sstevel@tonic-gate {
34177c478bd9Sstevel@tonic-gate 	switch (delp->delegation_type) {
34187c478bd9Sstevel@tonic-gate 	case OPEN_DELEGATE_NONE:
34197c478bd9Sstevel@tonic-gate 		snprintf(buf, buflen, " DT=N");
34207c478bd9Sstevel@tonic-gate 		break;
34217c478bd9Sstevel@tonic-gate 	case OPEN_DELEGATE_READ:
34227c478bd9Sstevel@tonic-gate 		snprintf(buf, buflen, " DT=R %s",
34232f172c55SRobert Thurlow 		    sum_deleg_stateid(&delp->open_delegation4_u.write.
34242f172c55SRobert Thurlow 		    stateid));
34257c478bd9Sstevel@tonic-gate 		break;
34267c478bd9Sstevel@tonic-gate 	case OPEN_DELEGATE_WRITE:
34277c478bd9Sstevel@tonic-gate 		snprintf(buf, buflen, " DT=W %s %s",
34282f172c55SRobert Thurlow 		    sum_deleg_stateid(&delp->open_delegation4_u.write.
34292f172c55SRobert Thurlow 		    stateid),
34302f172c55SRobert Thurlow 		    sum_space_limit(&delp->open_delegation4_u.write.
34312f172c55SRobert Thurlow 		    space_limit));
34327c478bd9Sstevel@tonic-gate 		break;
34337c478bd9Sstevel@tonic-gate 	default:
34347c478bd9Sstevel@tonic-gate 		snprintf(buf, buflen, " DT=?");
34357c478bd9Sstevel@tonic-gate 		break;
34367c478bd9Sstevel@tonic-gate 	}
34377c478bd9Sstevel@tonic-gate }
34387c478bd9Sstevel@tonic-gate 
34397c478bd9Sstevel@tonic-gate static void
detail_delegation(open_delegation4 * delp)34407c478bd9Sstevel@tonic-gate detail_delegation(open_delegation4 *delp)
34417c478bd9Sstevel@tonic-gate {
34427c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Delegation Type = %d (%s)",
34432f172c55SRobert Thurlow 	    delp->delegation_type,
34442f172c55SRobert Thurlow 	    delegation_type_name(delp->delegation_type));
34457c478bd9Sstevel@tonic-gate 
34467c478bd9Sstevel@tonic-gate 	switch (delp->delegation_type) {
34477c478bd9Sstevel@tonic-gate 	case OPEN_DELEGATE_NONE:
34487c478bd9Sstevel@tonic-gate 		/* no-op */
34497c478bd9Sstevel@tonic-gate 		break;
34507c478bd9Sstevel@tonic-gate 	case OPEN_DELEGATE_READ:
34517c478bd9Sstevel@tonic-gate 		detail_deleg_stateid(&delp->open_delegation4_u.read.stateid);
34527c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Recall = %s",
34532f172c55SRobert Thurlow 		    delp->open_delegation4_u.read.recall ?
34542f172c55SRobert Thurlow 		    "TRUE" : "FALSE");
34557c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "[nfsacl4]");
34567c478bd9Sstevel@tonic-gate 		break;
34577c478bd9Sstevel@tonic-gate 	case OPEN_DELEGATE_WRITE:
34587c478bd9Sstevel@tonic-gate 		detail_deleg_stateid(&delp->open_delegation4_u.write.stateid);
34597c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Recall = %s",
34602f172c55SRobert Thurlow 		    delp->open_delegation4_u.write.recall ?
34612f172c55SRobert Thurlow 		    "TRUE" : "FALSE");
34627c478bd9Sstevel@tonic-gate 		detail_space_limit(&delp->open_delegation4_u.write.
34632f172c55SRobert Thurlow 		    space_limit);
34647c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "[nfsacl4]");
34657c478bd9Sstevel@tonic-gate 		break;
34667c478bd9Sstevel@tonic-gate 	}
34677c478bd9Sstevel@tonic-gate }
34687c478bd9Sstevel@tonic-gate 
34697c478bd9Sstevel@tonic-gate 
34707c478bd9Sstevel@tonic-gate static void
detail_open_owner(open_owner4 * owner)34717c478bd9Sstevel@tonic-gate detail_open_owner(open_owner4 *owner)
34727c478bd9Sstevel@tonic-gate {
34737c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Open Owner hash = [%04X] ",
34742f172c55SRobert Thurlow 	    owner_hash(&owner->owner));
34757c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "    len = %u   val = %s ",
34762f172c55SRobert Thurlow 	    owner->owner.owner_len,
34772f172c55SRobert Thurlow 	    tohex(owner->owner.owner_val, owner->owner.owner_len));
34787c478bd9Sstevel@tonic-gate 	detail_clientid(owner->clientid);
34797c478bd9Sstevel@tonic-gate }
34807c478bd9Sstevel@tonic-gate 
34817c478bd9Sstevel@tonic-gate static void
detail_lock_owner(lock_owner4 * owner)34827c478bd9Sstevel@tonic-gate detail_lock_owner(lock_owner4 *owner)
34837c478bd9Sstevel@tonic-gate {
34847c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Lock Owner hash = [%04X] ",
34852f172c55SRobert Thurlow 	    owner_hash(&owner->owner));
34867c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "    len = %u   val = %s ",
34872f172c55SRobert Thurlow 	    owner->owner.owner_len,
34882f172c55SRobert Thurlow 	    tohex(owner->owner.owner_val, owner->owner.owner_len));
34897c478bd9Sstevel@tonic-gate 	detail_clientid(owner->clientid);
34907c478bd9Sstevel@tonic-gate }
34917c478bd9Sstevel@tonic-gate 
34927c478bd9Sstevel@tonic-gate static void
sum_openflag(char * bufp,int buflen,openflag4 * flagp)34937c478bd9Sstevel@tonic-gate sum_openflag(char *bufp, int buflen, openflag4 *flagp)
34947c478bd9Sstevel@tonic-gate {
34957c478bd9Sstevel@tonic-gate 	if (flagp->opentype == OPEN4_CREATE) {
34967c478bd9Sstevel@tonic-gate 		switch (flagp->openflag4_u.how.mode) {
34977c478bd9Sstevel@tonic-gate 		case UNCHECKED4:
34987c478bd9Sstevel@tonic-gate 			snprintf(bufp, buflen, "OT=CR(U)");
34997c478bd9Sstevel@tonic-gate 			break;
35007c478bd9Sstevel@tonic-gate 		case GUARDED4:
35017c478bd9Sstevel@tonic-gate 			snprintf(bufp, buflen, "OT=CR(G)");
35027c478bd9Sstevel@tonic-gate 			break;
35037c478bd9Sstevel@tonic-gate 		case EXCLUSIVE4:
35047c478bd9Sstevel@tonic-gate 			snprintf(bufp, buflen, "OT=CR(E)");
35057c478bd9Sstevel@tonic-gate 			break;
35067c478bd9Sstevel@tonic-gate 		default:
35077c478bd9Sstevel@tonic-gate 			snprintf(bufp, buflen, "OT=CR(?:%d)",
35082f172c55SRobert Thurlow 			    flagp->openflag4_u.how.mode);
35097c478bd9Sstevel@tonic-gate 			break;
35107c478bd9Sstevel@tonic-gate 		}
35117c478bd9Sstevel@tonic-gate 	} else
35127c478bd9Sstevel@tonic-gate 		snprintf(bufp, buflen, "OT=NC");
35137c478bd9Sstevel@tonic-gate }
35147c478bd9Sstevel@tonic-gate 
35157c478bd9Sstevel@tonic-gate static void
detail_openflag(openflag4 * flagp)35167c478bd9Sstevel@tonic-gate detail_openflag(openflag4 *flagp)
35177c478bd9Sstevel@tonic-gate {
35187c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Open Type = %s",
35192f172c55SRobert Thurlow 	    flagp->opentype == OPEN4_CREATE ? "CREATE" : "NOCREATE");
35207c478bd9Sstevel@tonic-gate 	if (flagp->opentype == OPEN4_CREATE)
35217c478bd9Sstevel@tonic-gate 		detail_createhow4(&flagp->openflag4_u.how);
35227c478bd9Sstevel@tonic-gate }
35237c478bd9Sstevel@tonic-gate 
35247c478bd9Sstevel@tonic-gate /*
35257c478bd9Sstevel@tonic-gate  * Fill in buf with the given path.
35267c478bd9Sstevel@tonic-gate  */
35277c478bd9Sstevel@tonic-gate static void
sum_pathname4(char * buf,size_t buflen,pathname4 * pathp)35287c478bd9Sstevel@tonic-gate sum_pathname4(char *buf, size_t buflen, pathname4 *pathp)
35297c478bd9Sstevel@tonic-gate {
35307c478bd9Sstevel@tonic-gate 	char *bp = buf;
35317c478bd9Sstevel@tonic-gate 	uint_t component;
35327c478bd9Sstevel@tonic-gate 
35337c478bd9Sstevel@tonic-gate 	for (component = 0; component < pathp->pathname4_len;
35347c478bd9Sstevel@tonic-gate 	    component++) {
35357c478bd9Sstevel@tonic-gate 		snprintf(bp, buflen - (bp - buf),
35362f172c55SRobert Thurlow 		    component == 0 ? "%s" : "/%s",
35372f172c55SRobert Thurlow 		    component_name(&pathp->pathname4_val[component]));
35387c478bd9Sstevel@tonic-gate 		bp += strlen(bp);
35397c478bd9Sstevel@tonic-gate 	}
35407c478bd9Sstevel@tonic-gate }
35417c478bd9Sstevel@tonic-gate 
35427c478bd9Sstevel@tonic-gate static void
sum_compname4(char * buf,size_t buflen,component4 * comp)35437c478bd9Sstevel@tonic-gate sum_compname4(char *buf, size_t buflen, component4 *comp)
35447c478bd9Sstevel@tonic-gate {
35457c478bd9Sstevel@tonic-gate 	snprintf(buf, buflen, "%s", component_name(comp));
35467c478bd9Sstevel@tonic-gate }
35477c478bd9Sstevel@tonic-gate 
35487c478bd9Sstevel@tonic-gate static void
detail_compname4(component4 * comp)35497c478bd9Sstevel@tonic-gate detail_compname4(component4 *comp)
35507c478bd9Sstevel@tonic-gate {
35517c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "%s", component_name(comp));
35527c478bd9Sstevel@tonic-gate }
35537c478bd9Sstevel@tonic-gate 
35547c478bd9Sstevel@tonic-gate static void
detail_pathname4(pathname4 * pathp,char * what)35552f172c55SRobert Thurlow detail_pathname4(pathname4 *pathp, char *what)
35567c478bd9Sstevel@tonic-gate {
35577c478bd9Sstevel@tonic-gate 	char *bp = get_line(0, 0);
35587c478bd9Sstevel@tonic-gate 	uint_t component;
35597c478bd9Sstevel@tonic-gate 
35602f172c55SRobert Thurlow 	sprintf(bp, what);
35617c478bd9Sstevel@tonic-gate 	bp += strlen(bp);
35627c478bd9Sstevel@tonic-gate 
35637c478bd9Sstevel@tonic-gate 	for (component = 0; component < pathp->pathname4_len; component++) {
35647c478bd9Sstevel@tonic-gate 		sprintf(bp, component == 0 ? "%s" : "/%s",
35652f172c55SRobert Thurlow 		    component_name(&pathp->pathname4_val[component]));
35667c478bd9Sstevel@tonic-gate 		bp += strlen(bp);
35677c478bd9Sstevel@tonic-gate 	}
35687c478bd9Sstevel@tonic-gate }
35697c478bd9Sstevel@tonic-gate 
35707c478bd9Sstevel@tonic-gate /*
35717c478bd9Sstevel@tonic-gate  * Print detail information about the rpcsec_gss_info that is XDR-encoded
35727c478bd9Sstevel@tonic-gate  * at mem.
35737c478bd9Sstevel@tonic-gate  */
35747c478bd9Sstevel@tonic-gate 
35757c478bd9Sstevel@tonic-gate static void
detail_rpcsec_gss(rpcsec_gss_info * info)35767c478bd9Sstevel@tonic-gate detail_rpcsec_gss(rpcsec_gss_info *info)
35777c478bd9Sstevel@tonic-gate {
35787c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "OID = %s",
35792f172c55SRobert Thurlow 	    tohex(info->oid.sec_oid4_val, info->oid.sec_oid4_len));
35807c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "QOP = %u", info->qop);
35817c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Service = %d (%s)",
35822f172c55SRobert Thurlow 	    info->service, gss_svc_name(info->service));
35837c478bd9Sstevel@tonic-gate }
35847c478bd9Sstevel@tonic-gate 
35857c478bd9Sstevel@tonic-gate /*
35867c478bd9Sstevel@tonic-gate  * Print detail information about the given secinfo4.
35877c478bd9Sstevel@tonic-gate  */
35887c478bd9Sstevel@tonic-gate 
35897c478bd9Sstevel@tonic-gate static void
detail_secinfo4(secinfo4 * infop)35907c478bd9Sstevel@tonic-gate detail_secinfo4(secinfo4 *infop)
35917c478bd9Sstevel@tonic-gate {
35927c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Flavor = %d (%s)",
35932f172c55SRobert Thurlow 	    infop->flavor, flavor_name(infop->flavor));
35947c478bd9Sstevel@tonic-gate 	switch (infop->flavor) {
35957c478bd9Sstevel@tonic-gate 	case RPCSEC_GSS:
35967c478bd9Sstevel@tonic-gate 		detail_rpcsec_gss(&infop->secinfo4_u.flavor_info);
35977c478bd9Sstevel@tonic-gate 		break;
35987c478bd9Sstevel@tonic-gate 	}
35997c478bd9Sstevel@tonic-gate }
36007c478bd9Sstevel@tonic-gate 
36017c478bd9Sstevel@tonic-gate 
36027c478bd9Sstevel@tonic-gate /*
36037c478bd9Sstevel@tonic-gate  * Return a summary string corresponding to the given nfs_space_limit4.
36047c478bd9Sstevel@tonic-gate  */
36057c478bd9Sstevel@tonic-gate 
36067c478bd9Sstevel@tonic-gate static char *
sum_space_limit(nfs_space_limit4 * limitp)36077c478bd9Sstevel@tonic-gate sum_space_limit(nfs_space_limit4 *limitp)
36087c478bd9Sstevel@tonic-gate {
36097c478bd9Sstevel@tonic-gate 	static char buf[64];
36107c478bd9Sstevel@tonic-gate 	int buflen = sizeof (buf);
36117c478bd9Sstevel@tonic-gate 
36127c478bd9Sstevel@tonic-gate 	buf[0] = '\0';
36137c478bd9Sstevel@tonic-gate 	switch (limitp->limitby) {
36147c478bd9Sstevel@tonic-gate 	case NFS_LIMIT_SIZE:
36157c478bd9Sstevel@tonic-gate 		snprintf(buf, buflen, "LB=SZ(%llu)",
36162f172c55SRobert Thurlow 		    limitp->nfs_space_limit4_u.filesize);
36177c478bd9Sstevel@tonic-gate 		break;
36187c478bd9Sstevel@tonic-gate 	case NFS_LIMIT_BLOCKS:
36197c478bd9Sstevel@tonic-gate 		snprintf(buf, buflen, "LB=BL(%u*%u)",
36202f172c55SRobert Thurlow 		    limitp->nfs_space_limit4_u.mod_blocks.num_blocks,
36212f172c55SRobert Thurlow 		    limitp->nfs_space_limit4_u.mod_blocks.bytes_per_block);
36227c478bd9Sstevel@tonic-gate 		break;
36237c478bd9Sstevel@tonic-gate 	default:
36247c478bd9Sstevel@tonic-gate 		snprintf(buf, buflen, "LB=?(%d)", limitp->limitby);
36257c478bd9Sstevel@tonic-gate 		break;
36267c478bd9Sstevel@tonic-gate 	}
36277c478bd9Sstevel@tonic-gate 
36287c478bd9Sstevel@tonic-gate 	return (buf);
36297c478bd9Sstevel@tonic-gate }
36307c478bd9Sstevel@tonic-gate 
36317c478bd9Sstevel@tonic-gate /*
36327c478bd9Sstevel@tonic-gate  * Print detail information about the given nfs_space_limit4.
36337c478bd9Sstevel@tonic-gate  */
36347c478bd9Sstevel@tonic-gate 
36357c478bd9Sstevel@tonic-gate static void
detail_space_limit(nfs_space_limit4 * limitp)36367c478bd9Sstevel@tonic-gate detail_space_limit(nfs_space_limit4 *limitp)
36377c478bd9Sstevel@tonic-gate {
36387c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "LimitBy = %d (%s)",
36392f172c55SRobert Thurlow 	    limitp->limitby,
36402f172c55SRobert Thurlow 	    limitby_name(limitp->limitby));
36417c478bd9Sstevel@tonic-gate 
36427c478bd9Sstevel@tonic-gate 	switch (limitp->limitby) {
36437c478bd9Sstevel@tonic-gate 	case NFS_LIMIT_SIZE:
36447c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Bytes = %llu",
36452f172c55SRobert Thurlow 		    limitp->nfs_space_limit4_u.filesize);
36467c478bd9Sstevel@tonic-gate 		break;
36477c478bd9Sstevel@tonic-gate 	case NFS_LIMIT_BLOCKS:
36487c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Blocks = %u",
36492f172c55SRobert Thurlow 		    limitp->nfs_space_limit4_u.mod_blocks.num_blocks);
36507c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Bytes Per Block = %u",
36512f172c55SRobert Thurlow 		    limitp->nfs_space_limit4_u.mod_blocks.bytes_per_block);
36527c478bd9Sstevel@tonic-gate 		break;
36537c478bd9Sstevel@tonic-gate 	}
36547c478bd9Sstevel@tonic-gate }
36557c478bd9Sstevel@tonic-gate 
36567c478bd9Sstevel@tonic-gate 
36577c478bd9Sstevel@tonic-gate /*
36587c478bd9Sstevel@tonic-gate  * Return the short name of a file type.
36597c478bd9Sstevel@tonic-gate  */
36607c478bd9Sstevel@tonic-gate 
36617c478bd9Sstevel@tonic-gate static char *
sum_type_name(nfs_ftype4 type)36627c478bd9Sstevel@tonic-gate sum_type_name(nfs_ftype4 type)
36637c478bd9Sstevel@tonic-gate {
36647c478bd9Sstevel@tonic-gate 	static char buf[20];
36657c478bd9Sstevel@tonic-gate 
36667c478bd9Sstevel@tonic-gate 	if (type < num_ftypes)
36677c478bd9Sstevel@tonic-gate 		return (ftype_names[type].short_name);
36687c478bd9Sstevel@tonic-gate 	else {
36697c478bd9Sstevel@tonic-gate 		sprintf(buf, "type %d", type);
36707c478bd9Sstevel@tonic-gate 		return (buf);
36717c478bd9Sstevel@tonic-gate 	}
36727c478bd9Sstevel@tonic-gate }
36737c478bd9Sstevel@tonic-gate 
36747c478bd9Sstevel@tonic-gate 
36757c478bd9Sstevel@tonic-gate /*
36767c478bd9Sstevel@tonic-gate  * Return string with long/short flag names
36777c478bd9Sstevel@tonic-gate  */
36787c478bd9Sstevel@tonic-gate 
36797c478bd9Sstevel@tonic-gate static char *
get_flags(uint_t flag,ftype_names_t * names,uint_t num_flags,int shortname,char * prefix)36807c478bd9Sstevel@tonic-gate get_flags(uint_t flag, ftype_names_t *names, uint_t num_flags, int shortname,
36812d8dae53SMarcel Telka     char *prefix)
36827c478bd9Sstevel@tonic-gate {
36837c478bd9Sstevel@tonic-gate 	static char buf[200];
36847c478bd9Sstevel@tonic-gate 	char *bp = buf, *str;
36857c478bd9Sstevel@tonic-gate 	int i, len, blen = sizeof (buf);
36867c478bd9Sstevel@tonic-gate 	ftype_names_t *fn = NULL;
36877c478bd9Sstevel@tonic-gate 
36887c478bd9Sstevel@tonic-gate 	*bp = '\0';
36897c478bd9Sstevel@tonic-gate 
36907c478bd9Sstevel@tonic-gate 	if (prefix) {
36917c478bd9Sstevel@tonic-gate 		snprintf(bp, blen, "%s", prefix);
36927c478bd9Sstevel@tonic-gate 		bp += (len = sizeof (bp));
36937c478bd9Sstevel@tonic-gate 		blen -= len;
36947c478bd9Sstevel@tonic-gate 	}
36957c478bd9Sstevel@tonic-gate 
36967c478bd9Sstevel@tonic-gate 	for (i = 0; i < 32; i++)
36977c478bd9Sstevel@tonic-gate 		if (flag & (1 << i)) {
36987c478bd9Sstevel@tonic-gate 			fn = names + (i < num_flags ? i : num_flags);
36997c478bd9Sstevel@tonic-gate 			str = (shortname ? fn->short_name : fn->long_name);
37007c478bd9Sstevel@tonic-gate 
37017c478bd9Sstevel@tonic-gate 			snprintf(bp, blen, "%s,", str);
37027c478bd9Sstevel@tonic-gate 			bp += (len = strlen(bp));
37037c478bd9Sstevel@tonic-gate 			blen -= len;
37047c478bd9Sstevel@tonic-gate 		}
37057c478bd9Sstevel@tonic-gate 
37067c478bd9Sstevel@tonic-gate 	if (fn)
37077c478bd9Sstevel@tonic-gate 		*(bp - 1) = '\0';
37087c478bd9Sstevel@tonic-gate 	else
37097c478bd9Sstevel@tonic-gate 		*buf = '\0';
37107c478bd9Sstevel@tonic-gate 
37117c478bd9Sstevel@tonic-gate 	return (buf);
37127c478bd9Sstevel@tonic-gate }
37137c478bd9Sstevel@tonic-gate 
37147c478bd9Sstevel@tonic-gate 
37157c478bd9Sstevel@tonic-gate /*
37167c478bd9Sstevel@tonic-gate  * Return the long name of a file type.
37177c478bd9Sstevel@tonic-gate  */
37187c478bd9Sstevel@tonic-gate 
37197c478bd9Sstevel@tonic-gate static char *
detail_type_name(nfs_ftype4 type)37207c478bd9Sstevel@tonic-gate detail_type_name(nfs_ftype4 type)
37217c478bd9Sstevel@tonic-gate {
37227c478bd9Sstevel@tonic-gate 	static char buf[20];
37237c478bd9Sstevel@tonic-gate 
37247c478bd9Sstevel@tonic-gate 	if (type < num_ftypes)
37257c478bd9Sstevel@tonic-gate 		return (ftype_names[type].long_name);
37267c478bd9Sstevel@tonic-gate 	else {
37277c478bd9Sstevel@tonic-gate 		sprintf(buf, "type %d", type);
37287c478bd9Sstevel@tonic-gate 		return (buf);
37297c478bd9Sstevel@tonic-gate 	}
37307c478bd9Sstevel@tonic-gate }
37317c478bd9Sstevel@tonic-gate 
37327c478bd9Sstevel@tonic-gate /*
37337c478bd9Sstevel@tonic-gate  * Return the name of an attribute.
37347c478bd9Sstevel@tonic-gate  */
37357c478bd9Sstevel@tonic-gate 
37367c478bd9Sstevel@tonic-gate static char *
attr_name(uint_t attrnum)37377c478bd9Sstevel@tonic-gate attr_name(uint_t attrnum)
37387c478bd9Sstevel@tonic-gate {
37397c478bd9Sstevel@tonic-gate 	static char buf[20];
37407c478bd9Sstevel@tonic-gate 
37417c478bd9Sstevel@tonic-gate 	if (attrnum < MAX_ATTRIBUTES)
37427c478bd9Sstevel@tonic-gate 		return (attr_info[attrnum].name);
37437c478bd9Sstevel@tonic-gate 	else {
37447c478bd9Sstevel@tonic-gate 		sprintf(buf, "attr #%d", attrnum);
37457c478bd9Sstevel@tonic-gate 		return (buf);
37467c478bd9Sstevel@tonic-gate 	}
37477c478bd9Sstevel@tonic-gate }
37487c478bd9Sstevel@tonic-gate 
37497c478bd9Sstevel@tonic-gate /*
37507c478bd9Sstevel@tonic-gate  * Return the name of the given open_claim_type4.
37517c478bd9Sstevel@tonic-gate  */
37527c478bd9Sstevel@tonic-gate 
37537c478bd9Sstevel@tonic-gate static char *
claim_name(enum open_claim_type4 claim_type)37547c478bd9Sstevel@tonic-gate claim_name(enum open_claim_type4 claim_type)
37557c478bd9Sstevel@tonic-gate {
37567c478bd9Sstevel@tonic-gate 	char *result;
37577c478bd9Sstevel@tonic-gate 
37587c478bd9Sstevel@tonic-gate 	switch (claim_type) {
37597c478bd9Sstevel@tonic-gate 	case CLAIM_NULL:
37607c478bd9Sstevel@tonic-gate 		result = "NULL";
37617c478bd9Sstevel@tonic-gate 		break;
37627c478bd9Sstevel@tonic-gate 	case CLAIM_PREVIOUS:
37637c478bd9Sstevel@tonic-gate 		result = "PREVIOUS";
37647c478bd9Sstevel@tonic-gate 		break;
37657c478bd9Sstevel@tonic-gate 	case CLAIM_DELEGATE_CUR:
37667c478bd9Sstevel@tonic-gate 		result = "DELEGATE CURRENT";
37677c478bd9Sstevel@tonic-gate 		break;
37687c478bd9Sstevel@tonic-gate 	case CLAIM_DELEGATE_PREV:
37697c478bd9Sstevel@tonic-gate 		result = "DELEGATE PREVIOUS";
37707c478bd9Sstevel@tonic-gate 		break;
37717c478bd9Sstevel@tonic-gate 	default:
37727c478bd9Sstevel@tonic-gate 		result = "?";
37737c478bd9Sstevel@tonic-gate 		break;
37747c478bd9Sstevel@tonic-gate 	}
37757c478bd9Sstevel@tonic-gate 
37767c478bd9Sstevel@tonic-gate 	return (result);
37777c478bd9Sstevel@tonic-gate }
37787c478bd9Sstevel@tonic-gate 
37797c478bd9Sstevel@tonic-gate /*
37807c478bd9Sstevel@tonic-gate  * Return a string naming the given delegation.
37817c478bd9Sstevel@tonic-gate  */
37827c478bd9Sstevel@tonic-gate 
37837c478bd9Sstevel@tonic-gate static char *
delegation_type_name(enum open_delegation_type4 type)37847c478bd9Sstevel@tonic-gate delegation_type_name(enum open_delegation_type4 type)
37857c478bd9Sstevel@tonic-gate {
37867c478bd9Sstevel@tonic-gate 	char *result;
37877c478bd9Sstevel@tonic-gate 
37887c478bd9Sstevel@tonic-gate 	switch (type) {
37897c478bd9Sstevel@tonic-gate 	case OPEN_DELEGATE_NONE:
37907c478bd9Sstevel@tonic-gate 		result = "NONE";
37917c478bd9Sstevel@tonic-gate 		break;
37927c478bd9Sstevel@tonic-gate 	case OPEN_DELEGATE_READ:
37937c478bd9Sstevel@tonic-gate 		result = "READ";
37947c478bd9Sstevel@tonic-gate 		break;
37957c478bd9Sstevel@tonic-gate 	case OPEN_DELEGATE_WRITE:
37967c478bd9Sstevel@tonic-gate 		result = "WRITE";
37977c478bd9Sstevel@tonic-gate 		break;
37987c478bd9Sstevel@tonic-gate 	default:
37997c478bd9Sstevel@tonic-gate 		result = "?";
38007c478bd9Sstevel@tonic-gate 		break;
38017c478bd9Sstevel@tonic-gate 	}
38027c478bd9Sstevel@tonic-gate 
38037c478bd9Sstevel@tonic-gate 	return (result);
38047c478bd9Sstevel@tonic-gate }
38057c478bd9Sstevel@tonic-gate 
38067c478bd9Sstevel@tonic-gate /*
38077c478bd9Sstevel@tonic-gate  * Return the name of the given authentication flavor.
38087c478bd9Sstevel@tonic-gate  */
38097c478bd9Sstevel@tonic-gate 
38107c478bd9Sstevel@tonic-gate static char *
flavor_name(uint_t flavor)38117c478bd9Sstevel@tonic-gate flavor_name(uint_t flavor)
38127c478bd9Sstevel@tonic-gate {
38137c478bd9Sstevel@tonic-gate 	char *result;
38147c478bd9Sstevel@tonic-gate 	static char buf[50];
38157c478bd9Sstevel@tonic-gate 
38167c478bd9Sstevel@tonic-gate 	switch (flavor) {
38177c478bd9Sstevel@tonic-gate 	case AUTH_SYS:
38187c478bd9Sstevel@tonic-gate 		result = "AUTH_SYS";
38197c478bd9Sstevel@tonic-gate 		break;
38207c478bd9Sstevel@tonic-gate 	case AUTH_NONE:
38217c478bd9Sstevel@tonic-gate 		result = "AUTH_NONE";
38227c478bd9Sstevel@tonic-gate 		break;
38237c478bd9Sstevel@tonic-gate 	case AUTH_DH:
38247c478bd9Sstevel@tonic-gate 		result = "AUTH_DH";
38257c478bd9Sstevel@tonic-gate 		break;
38267c478bd9Sstevel@tonic-gate 	case RPCSEC_GSS:
38277c478bd9Sstevel@tonic-gate 		result = "RPCSEC_GSS";
38287c478bd9Sstevel@tonic-gate 		break;
38297c478bd9Sstevel@tonic-gate 	default:
38307c478bd9Sstevel@tonic-gate 		sprintf(buf, "[flavor %d]", flavor);
38317c478bd9Sstevel@tonic-gate 		result = buf;
38327c478bd9Sstevel@tonic-gate 		break;
38337c478bd9Sstevel@tonic-gate 	}
38347c478bd9Sstevel@tonic-gate 
38357c478bd9Sstevel@tonic-gate 	return (result);
38367c478bd9Sstevel@tonic-gate }
38377c478bd9Sstevel@tonic-gate 
38387c478bd9Sstevel@tonic-gate /*
38397c478bd9Sstevel@tonic-gate  * Return the name of the given rpc_gss_svc_t.
38407c478bd9Sstevel@tonic-gate  */
38417c478bd9Sstevel@tonic-gate 
38427c478bd9Sstevel@tonic-gate static char *
gss_svc_name(rpc_gss_svc_t svc)38437c478bd9Sstevel@tonic-gate gss_svc_name(rpc_gss_svc_t svc)
38447c478bd9Sstevel@tonic-gate {
38457c478bd9Sstevel@tonic-gate 	char *result;
38467c478bd9Sstevel@tonic-gate 	static char buf[50];
38477c478bd9Sstevel@tonic-gate 
38487c478bd9Sstevel@tonic-gate 	switch (svc) {
38497c478bd9Sstevel@tonic-gate 	case RPC_GSS_SVC_NONE:
38507c478bd9Sstevel@tonic-gate 		result = "NONE";
38517c478bd9Sstevel@tonic-gate 		break;
38527c478bd9Sstevel@tonic-gate 	case RPC_GSS_SVC_INTEGRITY:
38537c478bd9Sstevel@tonic-gate 		result = "INTEGRITY";
38547c478bd9Sstevel@tonic-gate 		break;
38557c478bd9Sstevel@tonic-gate 	case RPC_GSS_SVC_PRIVACY:
38567c478bd9Sstevel@tonic-gate 		result = "PRIVACY";
38577c478bd9Sstevel@tonic-gate 		break;
38587c478bd9Sstevel@tonic-gate 	default:
38597c478bd9Sstevel@tonic-gate 		sprintf(buf, "Service %d", svc);
38607c478bd9Sstevel@tonic-gate 		result = buf;
38617c478bd9Sstevel@tonic-gate 		break;
38627c478bd9Sstevel@tonic-gate 	}
38637c478bd9Sstevel@tonic-gate 
38647c478bd9Sstevel@tonic-gate 	return (result);
38657c478bd9Sstevel@tonic-gate }
38667c478bd9Sstevel@tonic-gate 
38677c478bd9Sstevel@tonic-gate /*
38687c478bd9Sstevel@tonic-gate  * Return a string name for the given limit_by4.
38697c478bd9Sstevel@tonic-gate  */
38707c478bd9Sstevel@tonic-gate 
38717c478bd9Sstevel@tonic-gate static char *
limitby_name(enum limit_by4 limitby)38727c478bd9Sstevel@tonic-gate limitby_name(enum limit_by4 limitby)
38737c478bd9Sstevel@tonic-gate {
38747c478bd9Sstevel@tonic-gate 	char *result;
38757c478bd9Sstevel@tonic-gate 
38767c478bd9Sstevel@tonic-gate 	switch (limitby) {
38777c478bd9Sstevel@tonic-gate 	case NFS_LIMIT_SIZE:
38787c478bd9Sstevel@tonic-gate 		result = "SIZE";
38797c478bd9Sstevel@tonic-gate 		break;
38807c478bd9Sstevel@tonic-gate 	case NFS_LIMIT_BLOCKS:
38817c478bd9Sstevel@tonic-gate 		result = "BLOCKS";
38827c478bd9Sstevel@tonic-gate 		break;
38837c478bd9Sstevel@tonic-gate 	default:
38847c478bd9Sstevel@tonic-gate 		result = "?";
38857c478bd9Sstevel@tonic-gate 		break;
38867c478bd9Sstevel@tonic-gate 	}
38877c478bd9Sstevel@tonic-gate 
38887c478bd9Sstevel@tonic-gate 	return (result);
38897c478bd9Sstevel@tonic-gate }
38907c478bd9Sstevel@tonic-gate 
38917c478bd9Sstevel@tonic-gate static char *
status_name(int status)38927c478bd9Sstevel@tonic-gate status_name(int status)
38937c478bd9Sstevel@tonic-gate {
38947c478bd9Sstevel@tonic-gate 	char *p;
38957c478bd9Sstevel@tonic-gate 
38967c478bd9Sstevel@tonic-gate 	switch (status) {
38977c478bd9Sstevel@tonic-gate 	case NFS4_OK:		p = "NFS4_OK"; break;
38987c478bd9Sstevel@tonic-gate 	case NFS4ERR_PERM:	p = "NFS4ERR_PERM"; break;
38997c478bd9Sstevel@tonic-gate 	case NFS4ERR_NOENT:	p = "NFS4ERR_NOENT"; break;
39007c478bd9Sstevel@tonic-gate 	case NFS4ERR_IO:	p = "NFS4ERR_IO"; break;
39017c478bd9Sstevel@tonic-gate 	case NFS4ERR_NXIO:	p = "NFS4ERR_NXIO"; break;
39027c478bd9Sstevel@tonic-gate 	case NFS4ERR_ACCESS:	p = "NFS4ERR_ACCESS"; break;
39037c478bd9Sstevel@tonic-gate 	case NFS4ERR_EXIST:	p = "NFS4ERR_EXIST"; break;
39047c478bd9Sstevel@tonic-gate 	case NFS4ERR_XDEV:	p = "NFS4ERR_XDEV"; break;
39057c478bd9Sstevel@tonic-gate 	case NFS4ERR_NOTDIR:	p = "NFS4ERR_NOTDIR"; break;
39067c478bd9Sstevel@tonic-gate 	case NFS4ERR_ISDIR:	p = "NFS4ERR_ISDIR"; break;
39077c478bd9Sstevel@tonic-gate 	case NFS4ERR_INVAL:	p = "NFS4ERR_INVAL"; break;
39087c478bd9Sstevel@tonic-gate 	case NFS4ERR_FBIG:	p = "NFS4ERR_FBIG"; break;
39097c478bd9Sstevel@tonic-gate 	case NFS4ERR_NOSPC:	p = "NFS4ERR_NOSPC"; break;
39107c478bd9Sstevel@tonic-gate 	case NFS4ERR_ROFS:	p = "NFS4ERR_ROFS"; break;
39117c478bd9Sstevel@tonic-gate 	case NFS4ERR_MLINK:	p = "NFS4ERR_MLINK"; break;
39127c478bd9Sstevel@tonic-gate 	case NFS4ERR_NAMETOOLONG:p = "NFS4ERR_NAMETOOLONG"; break;
39137c478bd9Sstevel@tonic-gate 	case NFS4ERR_NOTEMPTY:	p = "NFS4ERR_NOTEMPTY"; break;
39147c478bd9Sstevel@tonic-gate 	case NFS4ERR_DQUOT:	p = "NFS4ERR_DQUOT"; break;
39157c478bd9Sstevel@tonic-gate 	case NFS4ERR_STALE:	p = "NFS4ERR_STALE"; break;
39167c478bd9Sstevel@tonic-gate 	case NFS4ERR_BADHANDLE:	p = "NFS4ERR_BADHANDLE"; break;
39177c478bd9Sstevel@tonic-gate 	case NFS4ERR_BAD_COOKIE:p = "NFS4ERR_BAD_COOKIE"; break;
39187c478bd9Sstevel@tonic-gate 	case NFS4ERR_NOTSUPP:	p = "NFS4ERR_NOTSUPP"; break;
39197c478bd9Sstevel@tonic-gate 	case NFS4ERR_TOOSMALL:	p = "NFS4ERR_TOOSMALL"; break;
39207c478bd9Sstevel@tonic-gate 	case NFS4ERR_SERVERFAULT:p = "NFS4ERR_SERVERFAULT"; break;
39217c478bd9Sstevel@tonic-gate 	case NFS4ERR_BADTYPE:	p = "NFS4ERR_BADTYPE"; break;
39227c478bd9Sstevel@tonic-gate 	case NFS4ERR_DELAY:	p = "NFS4ERR_DELAY"; break;
39237c478bd9Sstevel@tonic-gate 	case NFS4ERR_SAME:	p = "NFS4ERR_SAME"; break;
39247c478bd9Sstevel@tonic-gate 	case NFS4ERR_DENIED:	p = "NFS4ERR_DENIED"; break;
39257c478bd9Sstevel@tonic-gate 	case NFS4ERR_EXPIRED:	p = "NFS4ERR_EXPIRED"; break;
39267c478bd9Sstevel@tonic-gate 	case NFS4ERR_LOCKED:	p = "NFS4ERR_LOCKED"; break;
39277c478bd9Sstevel@tonic-gate 	case NFS4ERR_GRACE:	p = "NFS4ERR_GRACE"; break;
39287c478bd9Sstevel@tonic-gate 	case NFS4ERR_FHEXPIRED:	p = "NFS4ERR_FHEXPIRED"; break;
39297c478bd9Sstevel@tonic-gate 	case NFS4ERR_SHARE_DENIED: p = "NFS4ERR_SHARE_DENIED"; break;
39307c478bd9Sstevel@tonic-gate 	case NFS4ERR_WRONGSEC:	p = "NFS4ERR_WRONGSEC"; break;
39317c478bd9Sstevel@tonic-gate 	case NFS4ERR_CLID_INUSE: p = "NFS4ERR_CLID_INUSE"; break;
39327c478bd9Sstevel@tonic-gate 	case NFS4ERR_RESOURCE:	p = "NFS4ERR_RESOURCE"; break;
39337c478bd9Sstevel@tonic-gate 	case NFS4ERR_MOVED:	p = "NFS4ERR_MOVED"; break;
39347c478bd9Sstevel@tonic-gate 	case NFS4ERR_NOFILEHANDLE: p = "NFS4ERR_NOFILEHANDLE"; break;
39352f172c55SRobert Thurlow 	case NFS4ERR_MINOR_VERS_MISMATCH: p = "NFS4ERR_MINOR_VERS_MISMATCH";
39362f172c55SRobert Thurlow 	break;
39377c478bd9Sstevel@tonic-gate 	case NFS4ERR_STALE_CLIENTID: p = "NFS4ERR_STALE_CLIENTID"; break;
39387c478bd9Sstevel@tonic-gate 	case NFS4ERR_STALE_STATEID: p = "NFS4ERR_STALE_STATEID"; break;
39397c478bd9Sstevel@tonic-gate 	case NFS4ERR_OLD_STATEID: p = "NFS4ERR_OLD_STATEID"; break;
39407c478bd9Sstevel@tonic-gate 	case NFS4ERR_BAD_STATEID: p = "NFS4ERR_BAD_STATEID"; break;
39417c478bd9Sstevel@tonic-gate 	case NFS4ERR_BAD_SEQID: p = "NFS4ERR_BAD_SEQID"; break;
39427c478bd9Sstevel@tonic-gate 	case NFS4ERR_NOT_SAME: p = "NFS4ERR_NOT_SAME"; break;
39437c478bd9Sstevel@tonic-gate 	case NFS4ERR_LOCK_RANGE: p = "NFS4ERR_LOCK_RANGE"; break;
39447c478bd9Sstevel@tonic-gate 	case NFS4ERR_SYMLINK: p = "NFS4ERR_SYMLINK"; break;
39457c478bd9Sstevel@tonic-gate 	case NFS4ERR_RESTOREFH: p = "NFS4ERR_RESTOREFH"; break;
39467c478bd9Sstevel@tonic-gate 	case NFS4ERR_LEASE_MOVED: p = "NFS4ERR_LEASE_MOVED"; break;
39477c478bd9Sstevel@tonic-gate 	case NFS4ERR_ATTRNOTSUPP: p = "NFS4ERR_ATTRNOTSUPP"; break;
39487c478bd9Sstevel@tonic-gate 	case NFS4ERR_NO_GRACE: p = "NFS4ERR_NO_GRACE"; break;
39497c478bd9Sstevel@tonic-gate 	case NFS4ERR_RECLAIM_BAD: p = "NFS4ERR_RECLAIM_BAD"; break;
39507c478bd9Sstevel@tonic-gate 	case NFS4ERR_RECLAIM_CONFLICT: p = "NFS4ERR_RECLAIM_CONFLICT"; break;
39517c478bd9Sstevel@tonic-gate 	case NFS4ERR_BADXDR: p = "NFS4ERR_BADXDR"; break;
39527c478bd9Sstevel@tonic-gate 	case NFS4ERR_LOCKS_HELD: p = "NFS4ERR_LOCKS_HELD"; break;
39537c478bd9Sstevel@tonic-gate 	case NFS4ERR_OPENMODE: p = "NFS4ERR_OPENMODE"; break;
39547c478bd9Sstevel@tonic-gate 	case NFS4ERR_BADOWNER: p = "NFS4ERR_BADOWNER"; break;
39557c478bd9Sstevel@tonic-gate 	case NFS4ERR_BADCHAR: p = "NFS4ERR_BADCHAR"; break;
39567c478bd9Sstevel@tonic-gate 	case NFS4ERR_BADNAME: p = "NFS4ERR_BADNAME"; break;
39577c478bd9Sstevel@tonic-gate 	case NFS4ERR_BAD_RANGE: p = "NFS4ERR_BAD_RANGE"; break;
39587c478bd9Sstevel@tonic-gate 	case NFS4ERR_LOCK_NOTSUPP: p = "NFS4ERR_LOCK_NOTSUPP"; break;
39597c478bd9Sstevel@tonic-gate 	case NFS4ERR_OP_ILLEGAL: p = "NFS4ERR_OP_ILLEGAL"; break;
39607c478bd9Sstevel@tonic-gate 	case NFS4ERR_DEADLOCK: p = "NFS4ERR_DEADLOCK"; break;
39617c478bd9Sstevel@tonic-gate 	case NFS4ERR_FILE_OPEN: p = "NFS4ERR_FILE_OPEN"; break;
39627c478bd9Sstevel@tonic-gate 	case NFS4ERR_ADMIN_REVOKED: p = "NFS4ERR_ADMIN_REVOKED"; break;
39637c478bd9Sstevel@tonic-gate 	case NFS4ERR_CB_PATH_DOWN: p = "NFS4ERR_CB_PATH_DOWN"; break;
39647c478bd9Sstevel@tonic-gate 	default:		p = "(unknown error)"; break;
39657c478bd9Sstevel@tonic-gate 	}
39667c478bd9Sstevel@tonic-gate 
39677c478bd9Sstevel@tonic-gate 	return (p);
39687c478bd9Sstevel@tonic-gate }
39697c478bd9Sstevel@tonic-gate 
39707c478bd9Sstevel@tonic-gate char *
nfsstat4_to_name(int status)39717c478bd9Sstevel@tonic-gate nfsstat4_to_name(int status)
39727c478bd9Sstevel@tonic-gate {
39737c478bd9Sstevel@tonic-gate 	return (status_name(status));
39747c478bd9Sstevel@tonic-gate }
39757c478bd9Sstevel@tonic-gate 
39767c478bd9Sstevel@tonic-gate /*
39777c478bd9Sstevel@tonic-gate  * Attribute print functions.  See attr_info_t.
39787c478bd9Sstevel@tonic-gate  */
39797c478bd9Sstevel@tonic-gate 
39807c478bd9Sstevel@tonic-gate static void
prt_supported_attrs(XDR * xdr)39817c478bd9Sstevel@tonic-gate prt_supported_attrs(XDR *xdr)
39827c478bd9Sstevel@tonic-gate {
39837c478bd9Sstevel@tonic-gate 	static bitmap4 val;
39847c478bd9Sstevel@tonic-gate 
39857c478bd9Sstevel@tonic-gate 	if (!xdr_bitmap4(xdr, &val))
39867c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
39877c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Supported Attributes:");
39887c478bd9Sstevel@tonic-gate 	detail_attr_bitmap("\t", &val, NULL);
39897c478bd9Sstevel@tonic-gate 	xdr_free(xdr_bitmap4, (char *)&val);
39907c478bd9Sstevel@tonic-gate }
39917c478bd9Sstevel@tonic-gate 
39927c478bd9Sstevel@tonic-gate static void
prt_type(XDR * xdr)39937c478bd9Sstevel@tonic-gate prt_type(XDR *xdr)
39947c478bd9Sstevel@tonic-gate {
39957c478bd9Sstevel@tonic-gate 	nfs_ftype4 val;
39967c478bd9Sstevel@tonic-gate 
39977c478bd9Sstevel@tonic-gate 	if (!xdr_nfs_ftype4(xdr, &val))
39987c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
39997c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Type = %s", sum_type_name(val));
40007c478bd9Sstevel@tonic-gate }
40017c478bd9Sstevel@tonic-gate 
40027c478bd9Sstevel@tonic-gate static void
prt_fh_expire_type(XDR * xdr)40037c478bd9Sstevel@tonic-gate prt_fh_expire_type(XDR *xdr)
40047c478bd9Sstevel@tonic-gate {
40057c478bd9Sstevel@tonic-gate 	fattr4_fh_expire_type val;
40067c478bd9Sstevel@tonic-gate 	char *buf;
40077c478bd9Sstevel@tonic-gate 	bool_t first = TRUE;
40087c478bd9Sstevel@tonic-gate 
40097c478bd9Sstevel@tonic-gate 	if (!xdr_fattr4_fh_expire_type(xdr, &val))
40107c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
40117c478bd9Sstevel@tonic-gate 	buf = get_line(0, 0);
40127c478bd9Sstevel@tonic-gate 
40137c478bd9Sstevel@tonic-gate 	sprintf(buf, "Filehandle expire type = ");
40147c478bd9Sstevel@tonic-gate 	if ((val & (FH4_NOEXPIRE_WITH_OPEN | FH4_VOLATILE_ANY |
40152f172c55SRobert Thurlow 	    FH4_VOL_MIGRATION | FH4_VOL_RENAME)) == 0) {
40167c478bd9Sstevel@tonic-gate 		strcat(buf, "Persistent");
40177c478bd9Sstevel@tonic-gate 		return;
40187c478bd9Sstevel@tonic-gate 	}
40197c478bd9Sstevel@tonic-gate 	if (val & FH4_NOEXPIRE_WITH_OPEN) {
40207c478bd9Sstevel@tonic-gate 		strcat(buf, "No Expire With OPEN");
40217c478bd9Sstevel@tonic-gate 		first = FALSE;
40227c478bd9Sstevel@tonic-gate 	}
40237c478bd9Sstevel@tonic-gate 	if (val & FH4_VOLATILE_ANY) {
40247c478bd9Sstevel@tonic-gate 		if (first)
40257c478bd9Sstevel@tonic-gate 			first = FALSE;
40267c478bd9Sstevel@tonic-gate 		else
40277c478bd9Sstevel@tonic-gate 			strcat(buf, ", ");
40287c478bd9Sstevel@tonic-gate 		strcat(buf, "Volatile at any time");
40297c478bd9Sstevel@tonic-gate 	}
40307c478bd9Sstevel@tonic-gate 	if (val & FH4_VOL_MIGRATION) {
40317c478bd9Sstevel@tonic-gate 		if (first)
40327c478bd9Sstevel@tonic-gate 			first = FALSE;
40337c478bd9Sstevel@tonic-gate 		else
40347c478bd9Sstevel@tonic-gate 			strcat(buf, ", ");
40357c478bd9Sstevel@tonic-gate 		strcat(buf, "Volatile at Migration");
40367c478bd9Sstevel@tonic-gate 	}
40377c478bd9Sstevel@tonic-gate 	if (val & FH4_VOL_RENAME) {
40387c478bd9Sstevel@tonic-gate 		if (first)
40397c478bd9Sstevel@tonic-gate 			first = FALSE;
40407c478bd9Sstevel@tonic-gate 		else
40417c478bd9Sstevel@tonic-gate 			strcat(buf, ", ");
40427c478bd9Sstevel@tonic-gate 		strcat(buf, "Volatile at Rename");
40437c478bd9Sstevel@tonic-gate 	}
40447c478bd9Sstevel@tonic-gate }
40457c478bd9Sstevel@tonic-gate 
40467c478bd9Sstevel@tonic-gate static void
prt_change(XDR * xdr)40477c478bd9Sstevel@tonic-gate prt_change(XDR *xdr)
40487c478bd9Sstevel@tonic-gate {
40497c478bd9Sstevel@tonic-gate 	changeid4 val;
40507c478bd9Sstevel@tonic-gate 
40517c478bd9Sstevel@tonic-gate 	if (!xdr_changeid4(xdr, &val))
40527c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
40537c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Change ID = 0x%llx", val);
40547c478bd9Sstevel@tonic-gate 					/* XXX print as time_t, too? */
40557c478bd9Sstevel@tonic-gate }
40567c478bd9Sstevel@tonic-gate 
40577c478bd9Sstevel@tonic-gate static void
prt_size(XDR * xdr)40587c478bd9Sstevel@tonic-gate prt_size(XDR *xdr)
40597c478bd9Sstevel@tonic-gate {
40607c478bd9Sstevel@tonic-gate 	uint64_t val;
40617c478bd9Sstevel@tonic-gate 
40627c478bd9Sstevel@tonic-gate 	if (!xdr_uint64_t(xdr, &val))
40637c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
40647c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Size = %llu", val);
40657c478bd9Sstevel@tonic-gate }
40667c478bd9Sstevel@tonic-gate 
40677c478bd9Sstevel@tonic-gate static void
prt_link_support(XDR * xdr)40687c478bd9Sstevel@tonic-gate prt_link_support(XDR *xdr)
40697c478bd9Sstevel@tonic-gate {
40707c478bd9Sstevel@tonic-gate 	bool_t val;
40717c478bd9Sstevel@tonic-gate 
40727c478bd9Sstevel@tonic-gate 	if (!xdr_bool(xdr, &val))
40737c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
40747c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Link Support = %s",
40752f172c55SRobert Thurlow 	    val ? "TRUE" : "FALSE");
40767c478bd9Sstevel@tonic-gate }
40777c478bd9Sstevel@tonic-gate 
40787c478bd9Sstevel@tonic-gate static void
prt_symlink_support(XDR * xdr)40797c478bd9Sstevel@tonic-gate prt_symlink_support(XDR *xdr)
40807c478bd9Sstevel@tonic-gate {
40817c478bd9Sstevel@tonic-gate 	bool_t val;
40827c478bd9Sstevel@tonic-gate 
40837c478bd9Sstevel@tonic-gate 	if (!xdr_bool(xdr, &val))
40847c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
40857c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Symlink Support = %s",
40862f172c55SRobert Thurlow 	    val ? "TRUE" : "FALSE");
40877c478bd9Sstevel@tonic-gate }
40887c478bd9Sstevel@tonic-gate 
40897c478bd9Sstevel@tonic-gate static void
prt_named_attr(XDR * xdr)40907c478bd9Sstevel@tonic-gate prt_named_attr(XDR *xdr)
40917c478bd9Sstevel@tonic-gate {
40927c478bd9Sstevel@tonic-gate 	bool_t val;
40937c478bd9Sstevel@tonic-gate 
40947c478bd9Sstevel@tonic-gate 	if (!xdr_bool(xdr, &val))
40957c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
40967c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Has Named Attributes = %s",
40972f172c55SRobert Thurlow 	    val ? "TRUE" : "FALSE");
40987c478bd9Sstevel@tonic-gate }
40997c478bd9Sstevel@tonic-gate 
41007c478bd9Sstevel@tonic-gate static void
prt_fsid(XDR * xdr)41017c478bd9Sstevel@tonic-gate prt_fsid(XDR *xdr)
41027c478bd9Sstevel@tonic-gate {
41037c478bd9Sstevel@tonic-gate 	fsid4 val;
41047c478bd9Sstevel@tonic-gate 
41057c478bd9Sstevel@tonic-gate 	if (!xdr_fsid4(xdr, &val))
41067c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
41077c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "FS ID: Major = %llx, Minor = %llx",
41082f172c55SRobert Thurlow 	    val.major, val.minor);
41097c478bd9Sstevel@tonic-gate }
41107c478bd9Sstevel@tonic-gate 
41117c478bd9Sstevel@tonic-gate static void
prt_unique_handles(XDR * xdr)41127c478bd9Sstevel@tonic-gate prt_unique_handles(XDR *xdr)
41137c478bd9Sstevel@tonic-gate {
41147c478bd9Sstevel@tonic-gate 	bool_t val;
41157c478bd9Sstevel@tonic-gate 
41167c478bd9Sstevel@tonic-gate 	if (!xdr_bool(xdr, &val))
41177c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
41187c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Unique Handles = %s",
41192f172c55SRobert Thurlow 	    val ? "TRUE" : "FALSE");
41207c478bd9Sstevel@tonic-gate }
41217c478bd9Sstevel@tonic-gate 
41227c478bd9Sstevel@tonic-gate static void
prt_lease_time(XDR * xdr)41237c478bd9Sstevel@tonic-gate prt_lease_time(XDR *xdr)
41247c478bd9Sstevel@tonic-gate {
41257c478bd9Sstevel@tonic-gate 	uint32_t val;
41267c478bd9Sstevel@tonic-gate 
41277c478bd9Sstevel@tonic-gate 	if (!xdr_uint32_t(xdr, &val))
41287c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
41297c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Lease Time = %u", val);
41307c478bd9Sstevel@tonic-gate }
41317c478bd9Sstevel@tonic-gate 
41327c478bd9Sstevel@tonic-gate static void
prt_rdattr_error(XDR * xdr)41337c478bd9Sstevel@tonic-gate prt_rdattr_error(XDR *xdr)
41347c478bd9Sstevel@tonic-gate {
41357c478bd9Sstevel@tonic-gate 	nfsstat4 val;
41367c478bd9Sstevel@tonic-gate 
41377c478bd9Sstevel@tonic-gate 	if (!xdr_nfsstat4(xdr, &val))
41387c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
41397c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Rdattr Error = %u (%s)",
41402f172c55SRobert Thurlow 	    val, status_name(val));
41417c478bd9Sstevel@tonic-gate }
41427c478bd9Sstevel@tonic-gate 
41437c478bd9Sstevel@tonic-gate static void
prt_acl(XDR * xdr)41447c478bd9Sstevel@tonic-gate prt_acl(XDR *xdr)
41457c478bd9Sstevel@tonic-gate {
41467c478bd9Sstevel@tonic-gate 	static fattr4_acl val;
41477c478bd9Sstevel@tonic-gate 	char buffy[NFS4_OPAQUE_LIMIT];
41487c478bd9Sstevel@tonic-gate 	int i, len;
41497c478bd9Sstevel@tonic-gate 
41507c478bd9Sstevel@tonic-gate 	if (!xdr_fattr4_acl(xdr, &val))
41517c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
41527c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "ACL of %d entries", val.fattr4_acl_len);
41537c478bd9Sstevel@tonic-gate 	for (i = 0; i < val.fattr4_acl_len; i++) {
41547c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "nfsace4[%d]", i);
41557c478bd9Sstevel@tonic-gate 
41567c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "  type = %x",
41577c478bd9Sstevel@tonic-gate 		    val.fattr4_acl_val[i].type);
41587c478bd9Sstevel@tonic-gate 		detail_acetype4(val.fattr4_acl_val[i].type);
41597c478bd9Sstevel@tonic-gate 
41607c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "  flags = %x",
41617c478bd9Sstevel@tonic-gate 		    val.fattr4_acl_val[i].flag);
41627c478bd9Sstevel@tonic-gate 		detail_aceflag4(val.fattr4_acl_val[i].flag);
41637c478bd9Sstevel@tonic-gate 
41647c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "  mask = %x",
41657c478bd9Sstevel@tonic-gate 		    val.fattr4_acl_val[i].access_mask);
41667c478bd9Sstevel@tonic-gate 		detail_acemask4(val.fattr4_acl_val[i].access_mask);
41677c478bd9Sstevel@tonic-gate 
41687c478bd9Sstevel@tonic-gate 		len = val.fattr4_acl_val[i].who.utf8string_len;
41697c478bd9Sstevel@tonic-gate 		if (len >= NFS4_OPAQUE_LIMIT)
41707c478bd9Sstevel@tonic-gate 			len = NFS4_OPAQUE_LIMIT - 1;
41717c478bd9Sstevel@tonic-gate 		(void) strncpy(buffy, val.fattr4_acl_val[i].who.utf8string_val,
41727c478bd9Sstevel@tonic-gate 		    len);
41737c478bd9Sstevel@tonic-gate 		buffy[len] = '\0';
41747c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "  who = %s", buffy);
41757c478bd9Sstevel@tonic-gate 	}
41767c478bd9Sstevel@tonic-gate 	xdr_free(xdr_fattr4_acl, (char *)&val);
41777c478bd9Sstevel@tonic-gate }
41787c478bd9Sstevel@tonic-gate 
41797c478bd9Sstevel@tonic-gate static void
detail_acetype4(acetype4 type)41807c478bd9Sstevel@tonic-gate detail_acetype4(acetype4 type)
41817c478bd9Sstevel@tonic-gate {
41827c478bd9Sstevel@tonic-gate 	if (type >= ACETYPE4_NAMES_MAX) {
41837c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "     unknown type");
41847c478bd9Sstevel@tonic-gate 	} else {
41857c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "     %s", acetype4_names[type]);
41867c478bd9Sstevel@tonic-gate 	}
41877c478bd9Sstevel@tonic-gate }
41887c478bd9Sstevel@tonic-gate 
41897c478bd9Sstevel@tonic-gate static void
detail_uint32_bitmap(uint32_t mask,char * mask_names[],int names_max)41907c478bd9Sstevel@tonic-gate detail_uint32_bitmap(uint32_t mask, char *mask_names[], int names_max)
41917c478bd9Sstevel@tonic-gate {
41927c478bd9Sstevel@tonic-gate 	char buffy[BUFSIZ], *name;
41937c478bd9Sstevel@tonic-gate 	char *indent = "     ";
41947c478bd9Sstevel@tonic-gate 	char *spacer = "  ";
41957c478bd9Sstevel@tonic-gate 	int pending = 0;
41967c478bd9Sstevel@tonic-gate 	int bit;
41977c478bd9Sstevel@tonic-gate 	int len, namelen, spacelen;
41987c478bd9Sstevel@tonic-gate 
41997c478bd9Sstevel@tonic-gate 	strcpy(buffy, indent);
42007c478bd9Sstevel@tonic-gate 	len = strlen(buffy);
42017c478bd9Sstevel@tonic-gate 	spacelen = strlen(spacer);
42027c478bd9Sstevel@tonic-gate 
42037c478bd9Sstevel@tonic-gate 	for (bit = 0; bit < names_max; bit++) {
42047c478bd9Sstevel@tonic-gate 		if (mask & (1 << bit)) {
42057c478bd9Sstevel@tonic-gate 			name = mask_names[bit];
42067c478bd9Sstevel@tonic-gate 			namelen = strlen(name);
42077c478bd9Sstevel@tonic-gate 			/* 80 - 6 for "NFS:  " = 74 */
42087c478bd9Sstevel@tonic-gate 			if ((len + spacelen + namelen) >= 74) {
42097c478bd9Sstevel@tonic-gate 				sprintf(get_line(0, 0), "%s", buffy);
42107c478bd9Sstevel@tonic-gate 				strcpy(buffy, indent);
42117c478bd9Sstevel@tonic-gate 				len = strlen(buffy);
42127c478bd9Sstevel@tonic-gate 				pending = 0;
42137c478bd9Sstevel@tonic-gate 			}
42147c478bd9Sstevel@tonic-gate 			(void) strlcat(buffy, spacer, sizeof (buffy));
42157c478bd9Sstevel@tonic-gate 			(void) strlcat(buffy, name, sizeof (buffy));
42167c478bd9Sstevel@tonic-gate 			pending = 1;
42177c478bd9Sstevel@tonic-gate 			len += spacelen + namelen;
42187c478bd9Sstevel@tonic-gate 		}
42197c478bd9Sstevel@tonic-gate 	}
42207c478bd9Sstevel@tonic-gate 	if (pending)
42217c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "%s", buffy);
42227c478bd9Sstevel@tonic-gate }
42237c478bd9Sstevel@tonic-gate 
42247c478bd9Sstevel@tonic-gate static void
detail_aceflag4(aceflag4 flag)42257c478bd9Sstevel@tonic-gate detail_aceflag4(aceflag4 flag)
42267c478bd9Sstevel@tonic-gate {
42277c478bd9Sstevel@tonic-gate 	detail_uint32_bitmap(flag, aceflag4_names, ACEFLAG4_NAMES_MAX);
42287c478bd9Sstevel@tonic-gate }
42297c478bd9Sstevel@tonic-gate 
42307c478bd9Sstevel@tonic-gate static void
detail_acemask4(acemask4 mask)42317c478bd9Sstevel@tonic-gate detail_acemask4(acemask4 mask)
42327c478bd9Sstevel@tonic-gate {
42337c478bd9Sstevel@tonic-gate 	detail_uint32_bitmap(mask, acemask4_names, ACEMASK4_NAMES_MAX);
42347c478bd9Sstevel@tonic-gate }
42357c478bd9Sstevel@tonic-gate 
42367c478bd9Sstevel@tonic-gate static void
prt_aclsupport(XDR * xdr)42377c478bd9Sstevel@tonic-gate prt_aclsupport(XDR *xdr)
42387c478bd9Sstevel@tonic-gate {
42397c478bd9Sstevel@tonic-gate 	fattr4_aclsupport val;
42407c478bd9Sstevel@tonic-gate 
42417c478bd9Sstevel@tonic-gate 	if (!xdr_fattr4_aclsupport(xdr, &val))
42427c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
42437c478bd9Sstevel@tonic-gate 	if (val & ACL4_SUPPORT_ALLOW_ACL)
42447c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "ALLOW ACL Supported");
42457c478bd9Sstevel@tonic-gate 	if (val & ACL4_SUPPORT_DENY_ACL)
42467c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "DENY ACL Supported");
42477c478bd9Sstevel@tonic-gate 	if (val & ACL4_SUPPORT_AUDIT_ACL)
42487c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "AUDIT ACL Supported");
42497c478bd9Sstevel@tonic-gate 	if (val & ACL4_SUPPORT_ALARM_ACL)
42507c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "ALARM ACL Supported");
42517c478bd9Sstevel@tonic-gate }
42527c478bd9Sstevel@tonic-gate 
42537c478bd9Sstevel@tonic-gate static void
prt_archive(XDR * xdr)42547c478bd9Sstevel@tonic-gate prt_archive(XDR *xdr)
42557c478bd9Sstevel@tonic-gate {
42567c478bd9Sstevel@tonic-gate 	bool_t val;
42577c478bd9Sstevel@tonic-gate 
42587c478bd9Sstevel@tonic-gate 	if (!xdr_bool(xdr, &val))
42597c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
42607c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Archived = %s",
42612f172c55SRobert Thurlow 	    val ? "TRUE" : "FALSE");
42627c478bd9Sstevel@tonic-gate }
42637c478bd9Sstevel@tonic-gate 
42647c478bd9Sstevel@tonic-gate static void
prt_cansettime(XDR * xdr)42657c478bd9Sstevel@tonic-gate prt_cansettime(XDR *xdr)
42667c478bd9Sstevel@tonic-gate {
42677c478bd9Sstevel@tonic-gate 	bool_t val;
42687c478bd9Sstevel@tonic-gate 
42697c478bd9Sstevel@tonic-gate 	if (!xdr_bool(xdr, &val))
42707c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
42717c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Server Can Set Time = %s",
42722f172c55SRobert Thurlow 	    val ? "TRUE" : "FALSE");
42737c478bd9Sstevel@tonic-gate }
42747c478bd9Sstevel@tonic-gate 
42757c478bd9Sstevel@tonic-gate static void
prt_case_insensitive(XDR * xdr)42767c478bd9Sstevel@tonic-gate prt_case_insensitive(XDR *xdr)
42777c478bd9Sstevel@tonic-gate {
42787c478bd9Sstevel@tonic-gate 	bool_t val;
42797c478bd9Sstevel@tonic-gate 
42807c478bd9Sstevel@tonic-gate 	if (!xdr_bool(xdr, &val))
42817c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
42827c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Case Insensitive Lookups = %s",
42832f172c55SRobert Thurlow 	    val ? "TRUE" : "FALSE");
42847c478bd9Sstevel@tonic-gate }
42857c478bd9Sstevel@tonic-gate 
42867c478bd9Sstevel@tonic-gate static void
prt_case_preserving(XDR * xdr)42877c478bd9Sstevel@tonic-gate prt_case_preserving(XDR *xdr)
42887c478bd9Sstevel@tonic-gate {
42897c478bd9Sstevel@tonic-gate 	bool_t val;
42907c478bd9Sstevel@tonic-gate 
42917c478bd9Sstevel@tonic-gate 	if (!xdr_bool(xdr, &val))
42927c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
42937c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Case Preserving = %s",
42942f172c55SRobert Thurlow 	    val ? "TRUE" : "FALSE");
42957c478bd9Sstevel@tonic-gate }
42967c478bd9Sstevel@tonic-gate 
42977c478bd9Sstevel@tonic-gate static void
prt_chown_restricted(XDR * xdr)42987c478bd9Sstevel@tonic-gate prt_chown_restricted(XDR *xdr)
42997c478bd9Sstevel@tonic-gate {
43007c478bd9Sstevel@tonic-gate 	bool_t val;
43017c478bd9Sstevel@tonic-gate 
43027c478bd9Sstevel@tonic-gate 	if (!xdr_bool(xdr, &val))
43037c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
43047c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Chown Is Restricted = %s",
43052f172c55SRobert Thurlow 	    val ? "TRUE" : "FALSE");
43067c478bd9Sstevel@tonic-gate }
43077c478bd9Sstevel@tonic-gate 
43087c478bd9Sstevel@tonic-gate static void
prt_filehandle(XDR * xdr)43097c478bd9Sstevel@tonic-gate prt_filehandle(XDR *xdr)
43107c478bd9Sstevel@tonic-gate {
43117c478bd9Sstevel@tonic-gate 	static nfs_fh4 val;
43127c478bd9Sstevel@tonic-gate 
43137c478bd9Sstevel@tonic-gate 	if (!xdr_nfs_fh4(xdr, &val))
43147c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
43157c478bd9Sstevel@tonic-gate 	detail_fh4(&val);
43167c478bd9Sstevel@tonic-gate 	xdr_free(xdr_nfs_fh4, (char *)&val);
43177c478bd9Sstevel@tonic-gate }
43187c478bd9Sstevel@tonic-gate 
43197c478bd9Sstevel@tonic-gate static void
prt_fileid(XDR * xdr)43207c478bd9Sstevel@tonic-gate prt_fileid(XDR *xdr)
43217c478bd9Sstevel@tonic-gate {
43227c478bd9Sstevel@tonic-gate 	uint64_t val;
43237c478bd9Sstevel@tonic-gate 
43247c478bd9Sstevel@tonic-gate 	if (!xdr_uint64_t(xdr, &val))
43257c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
43267c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "File ID = %llu", val);
43277c478bd9Sstevel@tonic-gate }
43287c478bd9Sstevel@tonic-gate 
43297c478bd9Sstevel@tonic-gate static void
prt_mounted_on_fileid(XDR * xdr)43307c478bd9Sstevel@tonic-gate prt_mounted_on_fileid(XDR *xdr)
43317c478bd9Sstevel@tonic-gate {
43327c478bd9Sstevel@tonic-gate 	uint64_t val;
43337c478bd9Sstevel@tonic-gate 
43347c478bd9Sstevel@tonic-gate 	if (!xdr_uint64_t(xdr, &val))
43357c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
43367c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Mounted On File ID = %llu", val);
43377c478bd9Sstevel@tonic-gate }
43387c478bd9Sstevel@tonic-gate 
43397c478bd9Sstevel@tonic-gate static void
prt_files_avail(XDR * xdr)43407c478bd9Sstevel@tonic-gate prt_files_avail(XDR *xdr)
43417c478bd9Sstevel@tonic-gate {
43427c478bd9Sstevel@tonic-gate 	uint64_t val;
43437c478bd9Sstevel@tonic-gate 
43447c478bd9Sstevel@tonic-gate 	if (!xdr_uint64_t(xdr, &val))
43457c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
43467c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Files Available = %llu", val);
43477c478bd9Sstevel@tonic-gate }
43487c478bd9Sstevel@tonic-gate 
43497c478bd9Sstevel@tonic-gate static void
prt_files_free(XDR * xdr)43507c478bd9Sstevel@tonic-gate prt_files_free(XDR *xdr)
43517c478bd9Sstevel@tonic-gate {
43527c478bd9Sstevel@tonic-gate 	uint64_t val;
43537c478bd9Sstevel@tonic-gate 
43547c478bd9Sstevel@tonic-gate 	if (!xdr_uint64_t(xdr, &val))
43557c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
43567c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Files Free = %llu", val);
43577c478bd9Sstevel@tonic-gate }
43587c478bd9Sstevel@tonic-gate 
43597c478bd9Sstevel@tonic-gate static void
prt_files_total(XDR * xdr)43607c478bd9Sstevel@tonic-gate prt_files_total(XDR *xdr)
43617c478bd9Sstevel@tonic-gate {
43627c478bd9Sstevel@tonic-gate 	uint64_t val;
43637c478bd9Sstevel@tonic-gate 
43647c478bd9Sstevel@tonic-gate 	if (!xdr_uint64_t(xdr, &val))
43657c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
43667c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Files Total = %llu", val);
43677c478bd9Sstevel@tonic-gate }
43687c478bd9Sstevel@tonic-gate 
43692f172c55SRobert Thurlow static void
prt_fs_location(fs_location4 * fsl)43702f172c55SRobert Thurlow prt_fs_location(fs_location4 *fsl)
43712f172c55SRobert Thurlow {
43722f172c55SRobert Thurlow 	int i;
43732f172c55SRobert Thurlow 
43742f172c55SRobert Thurlow 	for (i = 0; i < fsl->server.server_len; i++)
43752f172c55SRobert Thurlow 		sprintf(get_line(0, 0), "server: %s",
43762f172c55SRobert Thurlow 		    utf8localize(&fsl->server.server_val[i]));
43772f172c55SRobert Thurlow 
43782f172c55SRobert Thurlow 	detail_pathname4(&fsl->rootpath, "rootpath: ");
43792f172c55SRobert Thurlow }
43802f172c55SRobert Thurlow 
43817c478bd9Sstevel@tonic-gate static void
prt_fs_locations(XDR * xdr)43827c478bd9Sstevel@tonic-gate prt_fs_locations(XDR *xdr)
43837c478bd9Sstevel@tonic-gate {
43847c478bd9Sstevel@tonic-gate 	static fs_locations4 val;
43852f172c55SRobert Thurlow 	int i;
43867c478bd9Sstevel@tonic-gate 
43877c478bd9Sstevel@tonic-gate 	if (!xdr_fs_locations4(xdr, &val))
43887c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
43892f172c55SRobert Thurlow 	sprintf(get_line(0, 0), "[fs_locations]");
43902f172c55SRobert Thurlow 	detail_pathname4(&val.fs_root, "fs_root: ");
43912f172c55SRobert Thurlow 	for (i = 0; i < val.locations.locations_len; i++)
43922f172c55SRobert Thurlow 		prt_fs_location(&val.locations.locations_val[i]);
43937c478bd9Sstevel@tonic-gate 	xdr_free(xdr_fs_locations4, (char *)&val);
43947c478bd9Sstevel@tonic-gate }
43957c478bd9Sstevel@tonic-gate 
43967c478bd9Sstevel@tonic-gate static void
prt_hidden(XDR * xdr)43977c478bd9Sstevel@tonic-gate prt_hidden(XDR *xdr)
43987c478bd9Sstevel@tonic-gate {
43997c478bd9Sstevel@tonic-gate 	bool_t val;
44007c478bd9Sstevel@tonic-gate 
44017c478bd9Sstevel@tonic-gate 	if (!xdr_bool(xdr, &val))
44027c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
44037c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Hidden = %s",
44042f172c55SRobert Thurlow 	    val ? "TRUE" : "FALSE");
44057c478bd9Sstevel@tonic-gate }
44067c478bd9Sstevel@tonic-gate 
44077c478bd9Sstevel@tonic-gate static void
prt_homogeneous(XDR * xdr)44087c478bd9Sstevel@tonic-gate prt_homogeneous(XDR *xdr)
44097c478bd9Sstevel@tonic-gate {
44107c478bd9Sstevel@tonic-gate 	bool_t val;
44117c478bd9Sstevel@tonic-gate 
44127c478bd9Sstevel@tonic-gate 	if (!xdr_bool(xdr, &val))
44137c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
44147c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "FS Is Homogeneous = %s",
44152f172c55SRobert Thurlow 	    val ? "TRUE" : "FALSE");
44167c478bd9Sstevel@tonic-gate }
44177c478bd9Sstevel@tonic-gate 
44187c478bd9Sstevel@tonic-gate static void
prt_maxfilesize(XDR * xdr)44197c478bd9Sstevel@tonic-gate prt_maxfilesize(XDR *xdr)
44207c478bd9Sstevel@tonic-gate {
44217c478bd9Sstevel@tonic-gate 	uint64_t val;
44227c478bd9Sstevel@tonic-gate 
44237c478bd9Sstevel@tonic-gate 	if (!xdr_uint64_t(xdr, &val))
44247c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
44257c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Maximum File Size = %llu", val);
44267c478bd9Sstevel@tonic-gate }
44277c478bd9Sstevel@tonic-gate 
44287c478bd9Sstevel@tonic-gate static void
prt_maxlink(XDR * xdr)44297c478bd9Sstevel@tonic-gate prt_maxlink(XDR *xdr)
44307c478bd9Sstevel@tonic-gate {
44317c478bd9Sstevel@tonic-gate 	uint32_t val;
44327c478bd9Sstevel@tonic-gate 
44337c478bd9Sstevel@tonic-gate 	if (!xdr_uint32_t(xdr, &val))
44347c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
44357c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Maximum Number of Links = %u", val);
44367c478bd9Sstevel@tonic-gate }
44377c478bd9Sstevel@tonic-gate 
44387c478bd9Sstevel@tonic-gate static void
prt_maxname(XDR * xdr)44397c478bd9Sstevel@tonic-gate prt_maxname(XDR *xdr)
44407c478bd9Sstevel@tonic-gate {
44417c478bd9Sstevel@tonic-gate 	uint32_t val;
44427c478bd9Sstevel@tonic-gate 
44437c478bd9Sstevel@tonic-gate 	if (!xdr_uint32_t(xdr, &val))
44447c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
44457c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Maximum File Name Length = %u", val);
44467c478bd9Sstevel@tonic-gate }
44477c478bd9Sstevel@tonic-gate 
44487c478bd9Sstevel@tonic-gate static void
prt_maxread(XDR * xdr)44497c478bd9Sstevel@tonic-gate prt_maxread(XDR *xdr)
44507c478bd9Sstevel@tonic-gate {
44517c478bd9Sstevel@tonic-gate 	uint64_t val;
44527c478bd9Sstevel@tonic-gate 
44537c478bd9Sstevel@tonic-gate 	if (!xdr_uint64_t(xdr, &val))
44547c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
44557c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Maximum Read Size = %llu", val);
44567c478bd9Sstevel@tonic-gate }
44577c478bd9Sstevel@tonic-gate 
44587c478bd9Sstevel@tonic-gate static void
prt_maxwrite(XDR * xdr)44597c478bd9Sstevel@tonic-gate prt_maxwrite(XDR *xdr)
44607c478bd9Sstevel@tonic-gate {
44617c478bd9Sstevel@tonic-gate 	uint64_t val;
44627c478bd9Sstevel@tonic-gate 
44637c478bd9Sstevel@tonic-gate 	if (!xdr_uint64_t(xdr, &val))
44647c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
44657c478bd9Sstevel@tonic-gate 
44667c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Maximum Write Size = %llu", val);
44677c478bd9Sstevel@tonic-gate }
44687c478bd9Sstevel@tonic-gate 
44697c478bd9Sstevel@tonic-gate static void
prt_mimetype(XDR * xdr)44707c478bd9Sstevel@tonic-gate prt_mimetype(XDR *xdr)
44717c478bd9Sstevel@tonic-gate {
44727c478bd9Sstevel@tonic-gate 	static utf8string val;
44737c478bd9Sstevel@tonic-gate 
44747c478bd9Sstevel@tonic-gate 	if (!xdr_utf8string(xdr, &val))
44757c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
44767c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "MIME Type = %s", utf8localize(&val));
44777c478bd9Sstevel@tonic-gate 	xdr_free(xdr_utf8string, (char *)&val);
44787c478bd9Sstevel@tonic-gate }
44797c478bd9Sstevel@tonic-gate 
44807c478bd9Sstevel@tonic-gate static void
prt_mode(XDR * xdr)44817c478bd9Sstevel@tonic-gate prt_mode(XDR *xdr)
44827c478bd9Sstevel@tonic-gate {
44837c478bd9Sstevel@tonic-gate 	mode4 val;
44847c478bd9Sstevel@tonic-gate 
44857c478bd9Sstevel@tonic-gate 	if (!xdr_mode4(xdr, &val))
44867c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
44877c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Mode = 0%03o", val);
44887c478bd9Sstevel@tonic-gate }
44897c478bd9Sstevel@tonic-gate 
44907c478bd9Sstevel@tonic-gate static void
prt_no_trunc(XDR * xdr)44917c478bd9Sstevel@tonic-gate prt_no_trunc(XDR *xdr)
44927c478bd9Sstevel@tonic-gate {
44937c478bd9Sstevel@tonic-gate 	bool_t val;
44947c478bd9Sstevel@tonic-gate 
44957c478bd9Sstevel@tonic-gate 	if (!xdr_bool(xdr, &val))
44967c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
44977c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Long Names Are Error (no_trunc) = %s",
44982f172c55SRobert Thurlow 	    val ? "TRUE" : "FALSE");
44997c478bd9Sstevel@tonic-gate }
45007c478bd9Sstevel@tonic-gate 
45017c478bd9Sstevel@tonic-gate static void
prt_numlinks(XDR * xdr)45027c478bd9Sstevel@tonic-gate prt_numlinks(XDR *xdr)
45037c478bd9Sstevel@tonic-gate {
45047c478bd9Sstevel@tonic-gate 	uint32_t val;
45057c478bd9Sstevel@tonic-gate 
45067c478bd9Sstevel@tonic-gate 	if (!xdr_uint32_t(xdr, &val))
45077c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
45087c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Number of Links = %u", val);
45097c478bd9Sstevel@tonic-gate }
45107c478bd9Sstevel@tonic-gate 
45117c478bd9Sstevel@tonic-gate static void
prt_owner(XDR * xdr)45127c478bd9Sstevel@tonic-gate prt_owner(XDR *xdr)
45137c478bd9Sstevel@tonic-gate {
45147c478bd9Sstevel@tonic-gate 	static utf8string val;
45157c478bd9Sstevel@tonic-gate 
45167c478bd9Sstevel@tonic-gate 	if (!xdr_utf8string(xdr, &val))
45177c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
45187c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Owner = %s", utf8localize(&val));
45197c478bd9Sstevel@tonic-gate 	xdr_free(xdr_utf8string, (char *)&val);
45207c478bd9Sstevel@tonic-gate }
45217c478bd9Sstevel@tonic-gate 
45227c478bd9Sstevel@tonic-gate static void
prt_owner_group(XDR * xdr)45237c478bd9Sstevel@tonic-gate prt_owner_group(XDR *xdr)
45247c478bd9Sstevel@tonic-gate {
45257c478bd9Sstevel@tonic-gate 	static utf8string val;
45267c478bd9Sstevel@tonic-gate 
45277c478bd9Sstevel@tonic-gate 	if (!xdr_utf8string(xdr, &val))
45287c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
45297c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Group = %s", utf8localize(&val));
45307c478bd9Sstevel@tonic-gate 	xdr_free(xdr_utf8string, (char *)&val);
45317c478bd9Sstevel@tonic-gate }
45327c478bd9Sstevel@tonic-gate 
45337c478bd9Sstevel@tonic-gate static void
prt_quota_avail_hard(XDR * xdr)45347c478bd9Sstevel@tonic-gate prt_quota_avail_hard(XDR *xdr)
45357c478bd9Sstevel@tonic-gate {
45367c478bd9Sstevel@tonic-gate 	uint64_t val;
45377c478bd9Sstevel@tonic-gate 
45387c478bd9Sstevel@tonic-gate 	if (!xdr_uint64_t(xdr, &val))
45397c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
45407c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Quota Hard Limit = %llu", val);
45417c478bd9Sstevel@tonic-gate }
45427c478bd9Sstevel@tonic-gate 
45437c478bd9Sstevel@tonic-gate static void
prt_quota_avail_soft(XDR * xdr)45447c478bd9Sstevel@tonic-gate prt_quota_avail_soft(XDR *xdr)
45457c478bd9Sstevel@tonic-gate {
45467c478bd9Sstevel@tonic-gate 	uint64_t val;
45477c478bd9Sstevel@tonic-gate 
45487c478bd9Sstevel@tonic-gate 	if (!xdr_uint64_t(xdr, &val))
45497c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
45507c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Quota Soft Limit = %llu", val);
45517c478bd9Sstevel@tonic-gate }
45527c478bd9Sstevel@tonic-gate 
45537c478bd9Sstevel@tonic-gate static void
prt_quota_used(XDR * xdr)45547c478bd9Sstevel@tonic-gate prt_quota_used(XDR *xdr)
45557c478bd9Sstevel@tonic-gate {
45567c478bd9Sstevel@tonic-gate 	uint64_t val;
45577c478bd9Sstevel@tonic-gate 
45587c478bd9Sstevel@tonic-gate 	if (!xdr_uint64_t(xdr, &val))
45597c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
45607c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Quota Used = %llu", val);
45617c478bd9Sstevel@tonic-gate }
45627c478bd9Sstevel@tonic-gate 
45637c478bd9Sstevel@tonic-gate static void
prt_rawdev(XDR * xdr)45647c478bd9Sstevel@tonic-gate prt_rawdev(XDR *xdr)
45657c478bd9Sstevel@tonic-gate {
45667c478bd9Sstevel@tonic-gate 	specdata4 val;
45677c478bd9Sstevel@tonic-gate 
45687c478bd9Sstevel@tonic-gate 	if (!xdr_specdata4(xdr, &val))
45697c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
45707c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Raw Device ID = %u, %u",
45712f172c55SRobert Thurlow 	    val.specdata1, val.specdata2);
45727c478bd9Sstevel@tonic-gate }
45737c478bd9Sstevel@tonic-gate 
45747c478bd9Sstevel@tonic-gate static void
prt_space_avail(XDR * xdr)45757c478bd9Sstevel@tonic-gate prt_space_avail(XDR *xdr)
45767c478bd9Sstevel@tonic-gate {
45777c478bd9Sstevel@tonic-gate 	uint64_t val;
45787c478bd9Sstevel@tonic-gate 
45797c478bd9Sstevel@tonic-gate 	if (!xdr_uint64_t(xdr, &val))
45807c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
45817c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Space Available = %llu", val);
45827c478bd9Sstevel@tonic-gate }
45837c478bd9Sstevel@tonic-gate 
45847c478bd9Sstevel@tonic-gate static void
prt_space_free(XDR * xdr)45857c478bd9Sstevel@tonic-gate prt_space_free(XDR *xdr)
45867c478bd9Sstevel@tonic-gate {
45877c478bd9Sstevel@tonic-gate 	uint64_t val;
45887c478bd9Sstevel@tonic-gate 
45897c478bd9Sstevel@tonic-gate 	if (!xdr_uint64_t(xdr, &val))
45907c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
4591cef4cb45San 	sprintf(get_line(0, 0), "Space Free = %llu", val);
45927c478bd9Sstevel@tonic-gate }
45937c478bd9Sstevel@tonic-gate 
45947c478bd9Sstevel@tonic-gate static void
prt_space_total(XDR * xdr)45957c478bd9Sstevel@tonic-gate prt_space_total(XDR *xdr)
45967c478bd9Sstevel@tonic-gate {
45977c478bd9Sstevel@tonic-gate 	uint64_t val;
45987c478bd9Sstevel@tonic-gate 
45997c478bd9Sstevel@tonic-gate 	if (!xdr_uint64_t(xdr, &val))
46007c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
46017c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Total Disk Space = %llu", val);
46027c478bd9Sstevel@tonic-gate }
46037c478bd9Sstevel@tonic-gate 
46047c478bd9Sstevel@tonic-gate static void
prt_space_used(XDR * xdr)46057c478bd9Sstevel@tonic-gate prt_space_used(XDR *xdr)
46067c478bd9Sstevel@tonic-gate {
46077c478bd9Sstevel@tonic-gate 	uint64_t val;
46087c478bd9Sstevel@tonic-gate 
46097c478bd9Sstevel@tonic-gate 	if (!xdr_uint64_t(xdr, &val))
46107c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
46117c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Space Used (this object) = %llu", val);
46127c478bd9Sstevel@tonic-gate }
46137c478bd9Sstevel@tonic-gate 
46147c478bd9Sstevel@tonic-gate static void
prt_system(XDR * xdr)46157c478bd9Sstevel@tonic-gate prt_system(XDR *xdr)
46167c478bd9Sstevel@tonic-gate {
46177c478bd9Sstevel@tonic-gate 	bool_t val;
46187c478bd9Sstevel@tonic-gate 
46197c478bd9Sstevel@tonic-gate 	if (!xdr_bool(xdr, &val))
46207c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
46217c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "System File = %s",
46222f172c55SRobert Thurlow 	    val ? "TRUE" : "FALSE");
46237c478bd9Sstevel@tonic-gate }
46247c478bd9Sstevel@tonic-gate 
46257c478bd9Sstevel@tonic-gate static void
prt_time_access(XDR * xdr)46267c478bd9Sstevel@tonic-gate prt_time_access(XDR *xdr)
46277c478bd9Sstevel@tonic-gate {
46287c478bd9Sstevel@tonic-gate 	nfstime4 val;
46297c478bd9Sstevel@tonic-gate 
46307c478bd9Sstevel@tonic-gate 	if (!xdr_nfstime4(xdr, &val))
46317c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
46327c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Last Access Time = %s",
46332f172c55SRobert Thurlow 	    format_time(val.seconds, val.nseconds));
46347c478bd9Sstevel@tonic-gate }
46357c478bd9Sstevel@tonic-gate 
46367c478bd9Sstevel@tonic-gate static void
prt_time_access_set(XDR * xdr)46377c478bd9Sstevel@tonic-gate prt_time_access_set(XDR *xdr)
46387c478bd9Sstevel@tonic-gate {
46397c478bd9Sstevel@tonic-gate 	settime4 val;
46407c478bd9Sstevel@tonic-gate 
46417c478bd9Sstevel@tonic-gate 	if (!xdr_settime4(xdr, &val))
46427c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
46437c478bd9Sstevel@tonic-gate 	if (val.set_it == SET_TO_CLIENT_TIME4) {
46447c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Access Time = %s (set to client time)",
46452f172c55SRobert Thurlow 		    format_time(val.settime4_u.time.seconds,
46462f172c55SRobert Thurlow 		    val.settime4_u.time.nseconds));
46477c478bd9Sstevel@tonic-gate 	} else if (val.set_it == SET_TO_SERVER_TIME4) {
46487c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0), "Access Time (set to server time)");
46497c478bd9Sstevel@tonic-gate 	} else
46507c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
46517c478bd9Sstevel@tonic-gate }
46527c478bd9Sstevel@tonic-gate 
46537c478bd9Sstevel@tonic-gate static void
prt_time_backup(XDR * xdr)46547c478bd9Sstevel@tonic-gate prt_time_backup(XDR *xdr)
46557c478bd9Sstevel@tonic-gate {
46567c478bd9Sstevel@tonic-gate 	nfstime4 val;
46577c478bd9Sstevel@tonic-gate 
46587c478bd9Sstevel@tonic-gate 	if (!xdr_nfstime4(xdr, &val))
46597c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
46607c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Last Backup Time = %s",
46612f172c55SRobert Thurlow 	    format_time(val.seconds, val.nseconds));
46627c478bd9Sstevel@tonic-gate }
46637c478bd9Sstevel@tonic-gate 
46647c478bd9Sstevel@tonic-gate static void
prt_time_create(XDR * xdr)46657c478bd9Sstevel@tonic-gate prt_time_create(XDR *xdr)
46667c478bd9Sstevel@tonic-gate {
46677c478bd9Sstevel@tonic-gate 	nfstime4 val;
46687c478bd9Sstevel@tonic-gate 
46697c478bd9Sstevel@tonic-gate 	if (!xdr_nfstime4(xdr, &val))
46707c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
46717c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Creation Time = %s",
46722f172c55SRobert Thurlow 	    format_time(val.seconds, val.nseconds));
46737c478bd9Sstevel@tonic-gate }
46747c478bd9Sstevel@tonic-gate 
46757c478bd9Sstevel@tonic-gate static void
prt_time_delta(XDR * xdr)46767c478bd9Sstevel@tonic-gate prt_time_delta(XDR *xdr)
46777c478bd9Sstevel@tonic-gate {
46787c478bd9Sstevel@tonic-gate 	nfstime4 val;
46797c478bd9Sstevel@tonic-gate 
46807c478bd9Sstevel@tonic-gate 	if (!xdr_nfstime4(xdr, &val))
46817c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
46827c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Server Time Granularity = %lld.%09d sec",
46832f172c55SRobert Thurlow 	    val.seconds, val.nseconds);
46847c478bd9Sstevel@tonic-gate }
46857c478bd9Sstevel@tonic-gate 
46867c478bd9Sstevel@tonic-gate static void
prt_time_metadata(XDR * xdr)46877c478bd9Sstevel@tonic-gate prt_time_metadata(XDR *xdr)
46887c478bd9Sstevel@tonic-gate {
46897c478bd9Sstevel@tonic-gate 	nfstime4 val;
46907c478bd9Sstevel@tonic-gate 
46917c478bd9Sstevel@tonic-gate 	if (!xdr_nfstime4(xdr, &val))
46927c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
46937c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Last Metadata Change Time = %s",
46942f172c55SRobert Thurlow 	    format_time(val.seconds, val.nseconds));
46957c478bd9Sstevel@tonic-gate }
46967c478bd9Sstevel@tonic-gate 
46977c478bd9Sstevel@tonic-gate static void
prt_time_modify(XDR * xdr)46987c478bd9Sstevel@tonic-gate prt_time_modify(XDR *xdr)
46997c478bd9Sstevel@tonic-gate {
47007c478bd9Sstevel@tonic-gate 	nfstime4 val;
47017c478bd9Sstevel@tonic-gate 
47027c478bd9Sstevel@tonic-gate 	if (!xdr_nfstime4(xdr, &val))
47037c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
47047c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), "Last Modification Time = %s",
47052f172c55SRobert Thurlow 	    format_time(val.seconds, val.nseconds));
47067c478bd9Sstevel@tonic-gate }
47077c478bd9Sstevel@tonic-gate 
47087c478bd9Sstevel@tonic-gate static void
prt_time_modify_set(XDR * xdr)47097c478bd9Sstevel@tonic-gate prt_time_modify_set(XDR *xdr)
47107c478bd9Sstevel@tonic-gate {
47117c478bd9Sstevel@tonic-gate 	settime4 val;
47127c478bd9Sstevel@tonic-gate 
47137c478bd9Sstevel@tonic-gate 	if (!xdr_settime4(xdr, &val))
47147c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
47157c478bd9Sstevel@tonic-gate 	if (val.set_it == SET_TO_CLIENT_TIME4) {
47167c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0),
47172f172c55SRobert Thurlow 		    "Modification Time = %s (set to client time)",
47182f172c55SRobert Thurlow 		    format_time(val.settime4_u.time.seconds,
47192f172c55SRobert Thurlow 		    val.settime4_u.time.nseconds));
47207c478bd9Sstevel@tonic-gate 	} else if (val.set_it == SET_TO_SERVER_TIME4) {
47217c478bd9Sstevel@tonic-gate 		sprintf(get_line(0, 0),
47222f172c55SRobert Thurlow 		    "Modification Time (set to server time)");
47237c478bd9Sstevel@tonic-gate 	} else
47247c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
47257c478bd9Sstevel@tonic-gate }
47267c478bd9Sstevel@tonic-gate 
47277c478bd9Sstevel@tonic-gate /*
47287c478bd9Sstevel@tonic-gate  * Display the UTF8 string that is next in the XDR stream.
47297c478bd9Sstevel@tonic-gate  */
47307c478bd9Sstevel@tonic-gate 
47317c478bd9Sstevel@tonic-gate static void
showxdr_utf8string(char * fmt)47327c478bd9Sstevel@tonic-gate showxdr_utf8string(char *fmt)
47337c478bd9Sstevel@tonic-gate {
47347c478bd9Sstevel@tonic-gate 	static utf8string string;
47357c478bd9Sstevel@tonic-gate 
47367c478bd9Sstevel@tonic-gate 	if (!xdr_utf8string(&xdrm, &string))
47377c478bd9Sstevel@tonic-gate 		longjmp(xdr_err, 1);
47387c478bd9Sstevel@tonic-gate 	sprintf(get_line(0, 0), fmt, utf8localize(&string));
47397c478bd9Sstevel@tonic-gate 	xdr_free(xdr_utf8string, (char *)&string);
47407c478bd9Sstevel@tonic-gate }
47417c478bd9Sstevel@tonic-gate 
47427c478bd9Sstevel@tonic-gate /*
47437c478bd9Sstevel@tonic-gate  * utf8string is defined in nfs4_prot.x as an opaque array, which means
47447c478bd9Sstevel@tonic-gate  * when it is decoded into a string, the string might not have a trailing
47457c478bd9Sstevel@tonic-gate  * null.  Also, the string will still be encoded in UTF-8, rather than
47467c478bd9Sstevel@tonic-gate  * whatever character encoding is associated with the current locale.  This
47477c478bd9Sstevel@tonic-gate  * routine converts a utf8string into a (null-terminated) C string.  One day
47487c478bd9Sstevel@tonic-gate  * it will convert into the current character encoding, too.  To avoid
47497c478bd9Sstevel@tonic-gate  * dealing with storage management issues, it allocates storage for each
47507c478bd9Sstevel@tonic-gate  * new string, then this storage is "freed" when the packet has been
47517c478bd9Sstevel@tonic-gate  * processed.
47527c478bd9Sstevel@tonic-gate  */
47537c478bd9Sstevel@tonic-gate 
47547c478bd9Sstevel@tonic-gate #define	MAX_UTF8_STRINGS	512
47557c478bd9Sstevel@tonic-gate 
47567c478bd9Sstevel@tonic-gate static char *utf_buf[MAX_UTF8_STRINGS];
47577c478bd9Sstevel@tonic-gate static size_t utf_buflen[MAX_UTF8_STRINGS];
47587c478bd9Sstevel@tonic-gate static uint_t cur_utf_buf = 0;
47597c478bd9Sstevel@tonic-gate 
47607c478bd9Sstevel@tonic-gate static char *
utf8localize(utf8string * utf8str)47617c478bd9Sstevel@tonic-gate utf8localize(utf8string *utf8str)
47627c478bd9Sstevel@tonic-gate {
47637c478bd9Sstevel@tonic-gate 	size_t newsize, oldsize, len;
47647c478bd9Sstevel@tonic-gate 	char *result, *cp;
47657c478bd9Sstevel@tonic-gate 
47667c478bd9Sstevel@tonic-gate 	len = utf8str->utf8string_len;
47677c478bd9Sstevel@tonic-gate 	if (len == 0)
47687c478bd9Sstevel@tonic-gate 		return ("");
47697c478bd9Sstevel@tonic-gate 	if (cur_utf_buf >= MAX_UTF8_STRINGS)
47707c478bd9Sstevel@tonic-gate 		return ("[Too Many UTF-8 Strings]");
47717c478bd9Sstevel@tonic-gate 
47727c478bd9Sstevel@tonic-gate 	newsize = oldsize = utf_buflen[cur_utf_buf];
47737c478bd9Sstevel@tonic-gate 
47747c478bd9Sstevel@tonic-gate 
47757c478bd9Sstevel@tonic-gate 	if (oldsize < len + 1) {
47767c478bd9Sstevel@tonic-gate 		/* truncate opaques at NFS4_OPAQUE_LIMIT */
47777c478bd9Sstevel@tonic-gate 		if (len > NFS4_OPAQUE_LIMIT)
47787c478bd9Sstevel@tonic-gate 			len = NFS4_OPAQUE_LIMIT;
47797c478bd9Sstevel@tonic-gate 		newsize = len + 1;
47807c478bd9Sstevel@tonic-gate 	}
47817c478bd9Sstevel@tonic-gate 	if (newsize != oldsize) {
47827c478bd9Sstevel@tonic-gate 		utf_buf[cur_utf_buf] = realloc(utf_buf[cur_utf_buf],
47832f172c55SRobert Thurlow 		    newsize);
47847c478bd9Sstevel@tonic-gate 		if (utf_buf[cur_utf_buf] == NULL) {
47857c478bd9Sstevel@tonic-gate 			pr_err("out of memory\n");
47867c478bd9Sstevel@tonic-gate 			utf_buflen[cur_utf_buf] = 0;
47877c478bd9Sstevel@tonic-gate 			return ("");
47887c478bd9Sstevel@tonic-gate 		}
47897c478bd9Sstevel@tonic-gate 		utf_buflen[cur_utf_buf] = newsize;
47907c478bd9Sstevel@tonic-gate 	}
47917c478bd9Sstevel@tonic-gate 
47927c478bd9Sstevel@tonic-gate 	result = utf_buf[cur_utf_buf];
47937c478bd9Sstevel@tonic-gate 	strncpy(result, utf8str->utf8string_val, len);
47947c478bd9Sstevel@tonic-gate 	result[len] = '\0';
47957c478bd9Sstevel@tonic-gate 	for (cp = result; cp < result + len; cp++) {
47967c478bd9Sstevel@tonic-gate 		if (!isprint(*cp)) {
47977c478bd9Sstevel@tonic-gate 			*cp = '.';
47987c478bd9Sstevel@tonic-gate 		}
47997c478bd9Sstevel@tonic-gate 	}
48007c478bd9Sstevel@tonic-gate 
48017c478bd9Sstevel@tonic-gate 	cur_utf_buf++;
48027c478bd9Sstevel@tonic-gate 
48037c478bd9Sstevel@tonic-gate 	return (result);
48047c478bd9Sstevel@tonic-gate }
48057c478bd9Sstevel@tonic-gate 
48067c478bd9Sstevel@tonic-gate static void
utf8free()48077c478bd9Sstevel@tonic-gate utf8free()
48087c478bd9Sstevel@tonic-gate {
48097c478bd9Sstevel@tonic-gate 	cur_utf_buf = 0;
48107c478bd9Sstevel@tonic-gate }
48117c478bd9Sstevel@tonic-gate 
48127c478bd9Sstevel@tonic-gate 
48137c478bd9Sstevel@tonic-gate /*
48147c478bd9Sstevel@tonic-gate  * adler16(): adler32 hash code shamelessly copied and mutiliated from
48157c478bd9Sstevel@tonic-gate  * usr/src/uts/common/io/ppp/spppcomp/zlib.[ch]
48167c478bd9Sstevel@tonic-gate  *
48177c478bd9Sstevel@tonic-gate  * The alg was originally created to provide a running
48187c478bd9Sstevel@tonic-gate  * checksum, but we don't need that -- we just want to
48197c478bd9Sstevel@tonic-gate  * chksum data described by buf,len; therefore, the first
48207c478bd9Sstevel@tonic-gate  * parameter was removed (held the running checksum),
48217c478bd9Sstevel@tonic-gate  * and s1/s2 are always set to their required initial
48227c478bd9Sstevel@tonic-gate  * values (1 and 0).  I also ripped out code which only
48237c478bd9Sstevel@tonic-gate  * applied to large data sets (bufs larger than 5k).  All
48247c478bd9Sstevel@tonic-gate  * I wanted was their core checksum alg (which is supposed
48257c478bd9Sstevel@tonic-gate  * to do really well).  The v2/v3 hash alg didn't work well
48267c478bd9Sstevel@tonic-gate  * at all for v4 stuff -- it produced too many collisions.
48277c478bd9Sstevel@tonic-gate  *
48287c478bd9Sstevel@tonic-gate  * The copyright info from uts/common/io/ppp/spppcomp/zlib.[ch]
48297c478bd9Sstevel@tonic-gate  * is included below.
48307c478bd9Sstevel@tonic-gate  */
48317c478bd9Sstevel@tonic-gate 
48327c478bd9Sstevel@tonic-gate /* -----zlib.c copyright info below */
48337c478bd9Sstevel@tonic-gate /*
48347c478bd9Sstevel@tonic-gate  * Copyright 2000 Sun Microsystems, Inc.
48357c478bd9Sstevel@tonic-gate  * All rights reserved.
48367c478bd9Sstevel@tonic-gate  *
48377c478bd9Sstevel@tonic-gate  * Updated from zlib-1.0.4 to zlib-1.1.3 by James Carlson.
48387c478bd9Sstevel@tonic-gate  *
48397c478bd9Sstevel@tonic-gate  * This file is derived from various .h and .c files from the zlib-1.0.4
48407c478bd9Sstevel@tonic-gate  * distribution by Jean-loup Gailly and Mark Adler, with some additions
48417c478bd9Sstevel@tonic-gate  * by Paul Mackerras to aid in implementing Deflate compression and
48427c478bd9Sstevel@tonic-gate  * decompression for PPP packets.  See zlib.h for conditions of
48437c478bd9Sstevel@tonic-gate  * distribution and use.
48447c478bd9Sstevel@tonic-gate  *
48457c478bd9Sstevel@tonic-gate  * Changes that have been made include:
48467c478bd9Sstevel@tonic-gate  * - added Z_PACKET_FLUSH (see zlib.h for details)
48477c478bd9Sstevel@tonic-gate  * - added inflateIncomp and deflateOutputPending
48487c478bd9Sstevel@tonic-gate  * - allow strm->next_out to be NULL, meaning discard the output
48497c478bd9Sstevel@tonic-gate  *
48507c478bd9Sstevel@tonic-gate  * $Id: zlib.c,v 1.11 1998/09/13 23:37:12 paulus Exp $
48517c478bd9Sstevel@tonic-gate  */
48527c478bd9Sstevel@tonic-gate /* +++ adler32.c */
48537c478bd9Sstevel@tonic-gate /*
48547c478bd9Sstevel@tonic-gate  * adler32.c -- compute the Adler-32 checksum of a data stream
48557c478bd9Sstevel@tonic-gate  * Copyright (C) 1995-1998 Mark Adler
48567c478bd9Sstevel@tonic-gate  * For conditions of distribution and use, see copyright notice in zlib.h
48577c478bd9Sstevel@tonic-gate  */
48587c478bd9Sstevel@tonic-gate /* From: adler32.c,v 1.10 1996/05/22 11:52:18 me Exp $ */
48597c478bd9Sstevel@tonic-gate /* -----zlib.c copyright info above */
48607c478bd9Sstevel@tonic-gate 
48617c478bd9Sstevel@tonic-gate /* -----zlib.h copyright info below */
48627c478bd9Sstevel@tonic-gate /*
48637c478bd9Sstevel@tonic-gate  * Copyright 2000 Sun Microsystems, Inc.
48647c478bd9Sstevel@tonic-gate  * All rights reserved.
48657c478bd9Sstevel@tonic-gate  *
48667c478bd9Sstevel@tonic-gate  * Permission to use, copy, modify, and distribute this software and
48677c478bd9Sstevel@tonic-gate  * its documentation is hereby granted, provided that the above
48687c478bd9Sstevel@tonic-gate  * copyright notice appears in all copies.
48697c478bd9Sstevel@tonic-gate  *
48707c478bd9Sstevel@tonic-gate  * SUN MAKES NO REPRESENTATION OR WARRANTIES ABOUT THE SUITABILITY OF
48717c478bd9Sstevel@tonic-gate  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
48727c478bd9Sstevel@tonic-gate  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
48737c478bd9Sstevel@tonic-gate  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT.  SUN SHALL NOT BE LIABLE
48747c478bd9Sstevel@tonic-gate  * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
48757c478bd9Sstevel@tonic-gate  * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES
48767c478bd9Sstevel@tonic-gate  *
48777c478bd9Sstevel@tonic-gate  * This file has been altered from its original by Sun Microsystems to
48787c478bd9Sstevel@tonic-gate  * fit local coding style.
48797c478bd9Sstevel@tonic-gate  */
48807c478bd9Sstevel@tonic-gate /* -----zlib.h copyright info above */
48817c478bd9Sstevel@tonic-gate 
48827c478bd9Sstevel@tonic-gate #define	DO1(buf, i)  {s1 += buf[i]; s2 += s1; }
48837c478bd9Sstevel@tonic-gate #define	DO2(buf, i)  DO1(buf, i); DO1(buf, i+1);
48847c478bd9Sstevel@tonic-gate #define	DO4(buf, i)  DO2(buf, i); DO2(buf, i+2);
48857c478bd9Sstevel@tonic-gate #define	DO8(buf, i)  DO4(buf, i); DO4(buf, i+4);
48867c478bd9Sstevel@tonic-gate #define	DO16(buf)   DO8(buf, 0); DO8(buf, 8);
48877c478bd9Sstevel@tonic-gate 
48887c478bd9Sstevel@tonic-gate static uint32_t
adler16(void * p,int len)48897c478bd9Sstevel@tonic-gate adler16(void *p, int len)
48907c478bd9Sstevel@tonic-gate {
48917c478bd9Sstevel@tonic-gate 	uint32_t s1 = 1;
48927c478bd9Sstevel@tonic-gate 	uint32_t s2 = 0;
48937c478bd9Sstevel@tonic-gate 	uchar_t *buf = p;
48947c478bd9Sstevel@tonic-gate 
48957c478bd9Sstevel@tonic-gate 	while (len >= 16) {
48967c478bd9Sstevel@tonic-gate 		DO16(buf);
48977c478bd9Sstevel@tonic-gate 		buf += 16;
48987c478bd9Sstevel@tonic-gate 		len -= 16;
48997c478bd9Sstevel@tonic-gate 	}
49007c478bd9Sstevel@tonic-gate 
49017c478bd9Sstevel@tonic-gate 	while (len > 0) {
49027c478bd9Sstevel@tonic-gate 		s1 += *buf++;
49037c478bd9Sstevel@tonic-gate 		s2 += s1;
49047c478bd9Sstevel@tonic-gate 		len--;
49057c478bd9Sstevel@tonic-gate 	}
49067c478bd9Sstevel@tonic-gate 
49077c478bd9Sstevel@tonic-gate 	return ((uint32_t)(s2 ^ s1) & 0xFFFFU);
49087c478bd9Sstevel@tonic-gate }
4909