1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _NFS4_CMN_H 27 #define _NFS4_CMN_H 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 extern uint32_t adler16(void *, int); 34 35 extern char *cmn_sum_stateid(stateid4 *, char *); 36 extern char *cmn_sum_stateid(stateid4 *, char *); 37 38 extern char *detail_iomode_name(layoutiomode4); 39 extern char *detail_lotype_name(layouttype4); 40 extern void detail_file_layout(layout4 *); 41 42 43 extern void detail_clientid(clientid4); 44 extern void detail_fh4(nfs_fh4 *, char *); 45 extern void detail_secinfo4(secinfo4 *); 46 47 extern char *sum_clientid(clientid4); 48 extern char *sum_fh4(nfs_fh4 *); 49 50 extern void utf8free(void); 51 extern char *utf8localize(utf8string *); 52 53 #define fh4_hash(fh) adler16((fh)->nfs_fh4_val, (fh)->nfs_fh4_len) 54 #define stateid_hash(st) adler16((st)->other, sizeof ((st)->other)) 55 #define owner_hash(own) adler16((own)->owner_val, (own)->owner_len) 56 #define sessionid_hash(sid) adler16(sid, 16) 57 #define deviceid_hash(did) adler16(did, 16) 58 #define cowner_hash(oid) adler16((oid)->co_ownerid_val, (oid)->co_ownerid_len) 59 60 #define sum_deleg_stateid(st) cmn_sum_stateid((st), "DST=") 61 #define sum_open_stateid(st) cmn_sum_stateid((st), "OST=") 62 #define sum_lock_stateid(st) cmn_sum_stateid((st), "LST=") 63 #define sum_stateid(st) cmn_sum_stateid((st), "ST=") 64 65 #define detail_deleg_stateid(st) cmn_detail_stateid((st), "Delegation ") 66 #define detail_open_stateid(st) cmn_detail_stateid((st), "Open ") 67 #define detail_lock_stateid(st) cmn_detail_stateid((st), "Lock ") 68 #define detail_stateid(st) cmn_detail_stateid((st), "") 69 70 #define SPECIAL_STATEID0 "SPC0" 71 #define SPECIAL_STATEID1 "SPC1" 72 73 #ifdef __cplusplus 74 } 75 #endif 76 77 #endif /* !_NFS4_CMN_H */ 78