xref: /onnv-gate/usr/src/uts/common/nfs/nfs4_drc.h (revision 6155:a308c3d50740)
174Srg137905 /*
274Srg137905  * CDDL HEADER START
374Srg137905  *
474Srg137905  * The contents of this file are subject to the terms of the
52822Srmesta  * Common Development and Distribution License (the "License").
62822Srmesta  * You may not use this file except in compliance with the License.
774Srg137905  *
874Srg137905  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
974Srg137905  * or http://www.opensolaris.org/os/licensing.
1074Srg137905  * See the License for the specific language governing permissions
1174Srg137905  * and limitations under the License.
1274Srg137905  *
1374Srg137905  * When distributing Covered Code, include this CDDL HEADER in each
1474Srg137905  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1574Srg137905  * If applicable, add the following below this CDDL HEADER, with the
1674Srg137905  * fields enclosed by brackets "[]" replaced with your own identifying
1774Srg137905  * information: Portions Copyright [yyyy] [name of copyright owner]
1874Srg137905  *
1974Srg137905  * CDDL HEADER END
2074Srg137905  */
2174Srg137905 /*
22*6155Spf199842  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
2374Srg137905  * Use is subject to license terms.
2474Srg137905  */
2574Srg137905 
2674Srg137905 #ifndef _NFS4_DRC_H
2774Srg137905 #define	_NFS4_DRC_H
2874Srg137905 
2974Srg137905 #pragma ident	"%Z%%M%	%I%	%E% SMI"
3074Srg137905 
3174Srg137905 #ifdef	__cplusplus
3274Srg137905 extern "C" {
3374Srg137905 #endif
3474Srg137905 
3574Srg137905 /*
3674Srg137905  * NFSv4 Duplicate Request cache.
3774Srg137905  */
3874Srg137905 typedef struct rfs4_drc {
3974Srg137905 	kmutex_t 	lock;
4074Srg137905 	uint32_t	dr_hash;
4174Srg137905 	uint32_t 	max_size;
4274Srg137905 	uint32_t 	in_use;
4374Srg137905 	list_t		dr_cache;
4474Srg137905 	list_t  	*dr_buckets;
4574Srg137905 } rfs4_drc_t;
4674Srg137905 
4774Srg137905 /*
4874Srg137905  * NFSv4 Duplicate request cache entry.
4974Srg137905  */
5074Srg137905 typedef struct rfs4_dupreq {
5174Srg137905 	list_node_t 	dr_bkt_next;
5274Srg137905 	list_node_t	dr_next;
5374Srg137905 	list_t		*dr_bkt;
5474Srg137905 	rfs4_drc_t	*drc;
5574Srg137905 	int		dr_state;
5674Srg137905 	uint32_t	dr_xid;
5774Srg137905 	struct netbuf	dr_addr;
5874Srg137905 	COMPOUND4res 	dr_res;
5974Srg137905 } rfs4_dupreq_t;
6074Srg137905 
6174Srg137905 /*
6274Srg137905  *  State of rfs4_dupreq.
6374Srg137905  */
6474Srg137905 #define	NFS4_DUP_ERROR		-1
6574Srg137905 #define	NFS4_NOT_DUP		0
6674Srg137905 #define	NFS4_DUP_NEW		1
6774Srg137905 #define	NFS4_DUP_PENDING	2
6874Srg137905 #define	NFS4_DUP_FREE		3
6974Srg137905 
7074Srg137905 #define	NFS4_DUP_REPLAY 	4
712822Srmesta #define	NFS4_DUP_INUSE		5
7274Srg137905 
7374Srg137905 extern rfs4_drc_t *nfs4_drc;
7474Srg137905 extern uint32_t nfs4_drc_max;
7574Srg137905 extern uint32_t nfs4_drc_hash;
7674Srg137905 
772822Srmesta rfs4_drc_t *rfs4_init_drc(uint32_t, uint32_t);
7874Srg137905 void rfs4_fini_drc(rfs4_drc_t *);
7974Srg137905 void rfs4_dr_chstate(rfs4_dupreq_t *, int);
8074Srg137905 rfs4_dupreq_t *rfs4_alloc_dr(rfs4_drc_t *);
8174Srg137905 int rfs4_find_dr(struct svc_req *, rfs4_drc_t *, rfs4_dupreq_t **);
8274Srg137905 
8374Srg137905 #ifdef	__cplusplus
8474Srg137905 }
8574Srg137905 #endif
8674Srg137905 
8774Srg137905 #endif /* _NFS4_DRC_H */
88