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 2009 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _NFS41_FILEHANDLE_H 27 #define _NFS41_FILEHANDLE_H 28 29 #ifdef USE_FOR_SNOOP 30 #define NFS_FH4MAXDATA 26 31 #include <sys/vfs.h> 32 #else 33 #include <nfs/nfs.h> 34 #include <nfs/nfs41_fhtype.h> 35 #include <nfs/nfs4.h> 36 #endif 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 typedef enum { 43 NFS41_FH_v1 = 1 44 } nfs41_fh_vers_t; 45 46 typedef struct { 47 uint_t len; 48 char val[NFS_FH4MAXDATA]; 49 } nfs41_fid_t; 50 51 typedef struct { 52 uint32_t flags; 53 uint32_t gen; 54 fsid_t export_fsid; 55 nfs41_fid_t export_fid; 56 nfs41_fid_t obj_fid; 57 } nfs41_fh_v1_t; 58 59 typedef struct { 60 nfs41_fh_type_t type; 61 nfs41_fh_vers_t vers; 62 union { 63 nfs41_fh_v1_t v1; 64 /* new versions will be added here */ 65 } fh; 66 } nfs41_fh_fmt_t; 67 68 #define NFS41_FH_LEN sizeof (nfs41_fh_fmt_t) 69 70 #define FH41_SET_FLAG(ptr, flag) ((ptr)->fh.v1.flags |= (flag)) 71 #define FH41_GET_FLAG(ptr, flag) ((ptr)->fh.v1.flags & (flag)) 72 #define FH41_CLR_FLAG(ptr, flag) ((ptr)->fh.v1.flags &= ~(flag)) 73 74 /* 75 * Possible Flag values 76 */ 77 #define FH41_NAMEDATTR 1 78 #define FH41_ATTRDIR 2 79 80 #ifndef USE_FOR_SNOOP 81 extern vnode_t *nfs41_fhtovp(nfs_fh4 *, compound_state_t *); 82 extern vnode_t *nfs41_fhtovp_exi(nfs_fh4 *, struct exportinfo *, nfsstat4 *); 83 extern int mknfs41_fh(nfs_fh4 *, vnode_t *, struct exportinfo *); 84 #endif 85 86 extern bool_t xdr_encode_nfs41_fh(XDR *, nfs_fh4 *); 87 extern bool_t xdr_decode_nfs41_fh(XDR *, nfs_fh4 *); 88 extern bool_t xdr_nfs41_fh_fmt(XDR *, nfs41_fh_fmt_t *); 89 90 #ifdef __cplusplus 91 } 92 #endif 93 94 #endif /* _NFS41_FILEHANDLE_H */ 95