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