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