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