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 27 #ifndef _NFS4_CLNT_IMPL_H 28 #define _NFS4_CLNT_IMPL_H 29 30 #include <nfs/nfs4_kprot.h> 31 #include <nfs/nfs4.h> 32 #include <nfs/nfs4_clnt.h> 33 #include <rpc/types.h> 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 typedef enum minorop_type { 40 MINOROP_GET, 41 MINOROP_SET, 42 MINOROP_SYNC_START, 43 MINOROP_SYNC_END, 44 MINOROP_SETUP, 45 MINOROP_RELE 46 } minorop_type_t; 47 48 #define MINORVERS_OPS \ 49 uint32_t (*op_oseqid)(nfs4_open_owner_t *, mntinfo4_t *, \ 50 minorop_type_t, seqid4, nfs4_tag_type_t); \ 51 uint32_t (*op_lseqid)(nfs4_lock_owner_t *, mntinfo4_t *, \ 52 minorop_type_t, seqid4); \ 53 clientid4 (*op_clientid)(mntinfo4_t *, minorop_type_t, \ 54 servinfo4_t *, cred_t *, nfs4_server_t *, \ 55 nfs4_error_t *, int *) /* NB: No ";" */ 56 57 typedef struct nfs4_minorvers_ops { 58 const char *minor_vers; 59 MINORVERS_OPS; 60 } nfs4_minorvers_ops_t; 61 62 /* 63 * Minor version specific switch 64 */ 65 66 nfs4_minorvers_ops_t **nfs4protosw; 67 68 #define NFS4_GET_OSEQID(oop, mi) \ 69 (nfs4protosw[mi->mi_minorversion])->op_oseqid( \ 70 oop, mi, MINOROP_GET, 0, 0) 71 72 #define NFS4_SET_OSEQID(oop, mi, seqid, ctags) \ 73 (nfs4protosw[mi->mi_minorversion])->op_oseqid( \ 74 oop, mi, MINOROP_SET, seqid, ctags) 75 76 #define NFS4_START_OSEQID_SYNC(oop, mi) \ 77 (nfs4protosw[mi->mi_minorversion])->op_oseqid( \ 78 oop, mi, MINOROP_SYNC_START, 0, 0) 79 80 #define NFS4_END_OSEQID_SYNC(oop, mi) \ 81 (nfs4protosw[mi->mi_minorversion])->op_oseqid( \ 82 oop, mi, MINOROP_SYNC_END, 0, 0) 83 84 #define NFS4_GET_LSEQID(lop, mi) \ 85 (nfs4protosw[mi->mi_minorversion])->op_lseqid( \ 86 lop, mi, MINOROP_GET, 0) 87 88 #define NFS4_SET_LSEQID(lop, mi, seqid) \ 89 (nfs4protosw[mi->mi_minorversion])->op_lseqid( \ 90 lop, mi, MINOROP_SET, seqid) 91 92 #define NFS4_START_LSEQID_SYNC(lop, mi) \ 93 (nfs4protosw[mi->mi_minorversion])->op_lseqid( \ 94 lop, mi, MINOROP_SYNC_START, 0) 95 96 #define NFS4_END_LSEQID_SYNC(lop, mi) \ 97 (nfs4protosw[mi->mi_minorversion])->op_lseqid( \ 98 lop, mi, MINOROP_SYNC_END, 0) 99 #define NFS4_GET_CLIENTID(mi) \ 100 (nfs4protosw[mi->mi_minorversion])->op_clientid( \ 101 mi, MINOROP_GET, NULL, NULL, NULL, NULL, NULL) \ 102 103 #define NFS4_SET_CLIENTID(mi, svp, cr, np, ep, retinusep) \ 104 (nfs4protosw[mi->mi_minorversion])->op_clientid( \ 105 mi, MINOROP_SET, svp, cr, np, ep, retinusep) 106 107 #define NFS41_CHECK(mi, x) ((NFS4_MINORVERSION(mi) == 1) && x) 108 109 #if DEBUG 110 #define VERS40_ASSERT(EX, mi) \ 111 ((NFS4_MINORVERSION(mi) == 0) ? ASSERT(EX) : (void)0) 112 #else 113 #define VERS40_ASSERT(EX, mi) ((void)0) 114 #endif 115 116 void nfs4_protosw_init(nfs4_minorvers_ops_t **); 117 void nfs4_set_clientid(mntinfo4_t *, servinfo4_t *, cred_t *, bool_t, 118 nfs4_error_t *); 119 120 #ifdef __cplusplus 121 } 122 #endif 123 124 #endif /* _NFS4_CLNT_IMPL_H */ 125