1*d9ad96c1Srg137905 /* 2*d9ad96c1Srg137905 * CDDL HEADER START 3*d9ad96c1Srg137905 * 4*d9ad96c1Srg137905 * The contents of this file are subject to the terms of the 5*d9ad96c1Srg137905 * Common Development and Distribution License, Version 1.0 only 6*d9ad96c1Srg137905 * (the "License"). You may not use this file except in compliance 7*d9ad96c1Srg137905 * with the License. 8*d9ad96c1Srg137905 * 9*d9ad96c1Srg137905 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*d9ad96c1Srg137905 * or http://www.opensolaris.org/os/licensing. 11*d9ad96c1Srg137905 * See the License for the specific language governing permissions 12*d9ad96c1Srg137905 * and limitations under the License. 13*d9ad96c1Srg137905 * 14*d9ad96c1Srg137905 * When distributing Covered Code, include this CDDL HEADER in each 15*d9ad96c1Srg137905 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*d9ad96c1Srg137905 * If applicable, add the following below this CDDL HEADER, with the 17*d9ad96c1Srg137905 * fields enclosed by brackets "[]" replaced with your own identifying 18*d9ad96c1Srg137905 * information: Portions Copyright [yyyy] [name of copyright owner] 19*d9ad96c1Srg137905 * 20*d9ad96c1Srg137905 * CDDL HEADER END 21*d9ad96c1Srg137905 */ 22*d9ad96c1Srg137905 /* 23*d9ad96c1Srg137905 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*d9ad96c1Srg137905 * Use is subject to license terms. 25*d9ad96c1Srg137905 */ 26*d9ad96c1Srg137905 27*d9ad96c1Srg137905 #ifndef _NFS4_DRC_H 28*d9ad96c1Srg137905 #define _NFS4_DRC_H 29*d9ad96c1Srg137905 30*d9ad96c1Srg137905 #pragma ident "%Z%%M% %I% %E% SMI" 31*d9ad96c1Srg137905 32*d9ad96c1Srg137905 #ifdef __cplusplus 33*d9ad96c1Srg137905 extern "C" { 34*d9ad96c1Srg137905 #endif 35*d9ad96c1Srg137905 36*d9ad96c1Srg137905 /* 37*d9ad96c1Srg137905 * NFSv4 Duplicate Request cache. 38*d9ad96c1Srg137905 */ 39*d9ad96c1Srg137905 typedef struct rfs4_drc { 40*d9ad96c1Srg137905 kmutex_t lock; 41*d9ad96c1Srg137905 uint32_t dr_hash; 42*d9ad96c1Srg137905 uint32_t max_size; 43*d9ad96c1Srg137905 uint32_t in_use; 44*d9ad96c1Srg137905 unsigned drc_ttl; 45*d9ad96c1Srg137905 list_t dr_cache; 46*d9ad96c1Srg137905 list_t *dr_buckets; 47*d9ad96c1Srg137905 } rfs4_drc_t; 48*d9ad96c1Srg137905 49*d9ad96c1Srg137905 /* 50*d9ad96c1Srg137905 * NFSv4 Duplicate request cache entry. 51*d9ad96c1Srg137905 */ 52*d9ad96c1Srg137905 typedef struct rfs4_dupreq { 53*d9ad96c1Srg137905 list_node_t dr_bkt_next; 54*d9ad96c1Srg137905 list_node_t dr_next; 55*d9ad96c1Srg137905 list_t *dr_bkt; 56*d9ad96c1Srg137905 rfs4_drc_t *drc; 57*d9ad96c1Srg137905 int dr_state; 58*d9ad96c1Srg137905 timestruc_t dr_time_created; 59*d9ad96c1Srg137905 timestruc_t dr_time_used; 60*d9ad96c1Srg137905 uint32_t dr_xid; 61*d9ad96c1Srg137905 struct netbuf dr_addr; 62*d9ad96c1Srg137905 COMPOUND4res dr_res; 63*d9ad96c1Srg137905 } rfs4_dupreq_t; 64*d9ad96c1Srg137905 65*d9ad96c1Srg137905 /* 66*d9ad96c1Srg137905 * State of rfs4_dupreq. 67*d9ad96c1Srg137905 */ 68*d9ad96c1Srg137905 #define NFS4_DUP_ERROR -1 69*d9ad96c1Srg137905 #define NFS4_NOT_DUP 0 70*d9ad96c1Srg137905 #define NFS4_DUP_NEW 1 71*d9ad96c1Srg137905 #define NFS4_DUP_PENDING 2 72*d9ad96c1Srg137905 #define NFS4_DUP_FREE 3 73*d9ad96c1Srg137905 74*d9ad96c1Srg137905 #define NFS4_DUP_REPLAY 4 75*d9ad96c1Srg137905 76*d9ad96c1Srg137905 extern rfs4_drc_t *nfs4_drc; 77*d9ad96c1Srg137905 extern unsigned nfs4_drc_lifetime; 78*d9ad96c1Srg137905 extern uint32_t nfs4_drc_max; 79*d9ad96c1Srg137905 extern uint32_t nfs4_drc_hash; 80*d9ad96c1Srg137905 81*d9ad96c1Srg137905 rfs4_drc_t *rfs4_init_drc(uint32_t, uint32_t, unsigned); 82*d9ad96c1Srg137905 void rfs4_fini_drc(rfs4_drc_t *); 83*d9ad96c1Srg137905 void rfs4_dr_chstate(rfs4_dupreq_t *, int); 84*d9ad96c1Srg137905 rfs4_dupreq_t *rfs4_alloc_dr(rfs4_drc_t *); 85*d9ad96c1Srg137905 int rfs4_find_dr(struct svc_req *, rfs4_drc_t *, rfs4_dupreq_t **); 86*d9ad96c1Srg137905 87*d9ad96c1Srg137905 #ifdef __cplusplus 88*d9ad96c1Srg137905 } 89*d9ad96c1Srg137905 #endif 90*d9ad96c1Srg137905 91*d9ad96c1Srg137905 #endif /* _NFS4_DRC_H */ 92