d9ad96c1d1e6612641c338d86699f5700fca7217rg/*
d9ad96c1d1e6612641c338d86699f5700fca7217rg * CDDL HEADER START
d9ad96c1d1e6612641c338d86699f5700fca7217rg *
d9ad96c1d1e6612641c338d86699f5700fca7217rg * The contents of this file are subject to the terms of the
48a344074403d73a2e38d76ad47299c16c89e0dcrmesta * Common Development and Distribution License (the "License").
48a344074403d73a2e38d76ad47299c16c89e0dcrmesta * You may not use this file except in compliance with the License.
d9ad96c1d1e6612641c338d86699f5700fca7217rg *
d9ad96c1d1e6612641c338d86699f5700fca7217rg * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
d9ad96c1d1e6612641c338d86699f5700fca7217rg * or http://www.opensolaris.org/os/licensing.
d9ad96c1d1e6612641c338d86699f5700fca7217rg * See the License for the specific language governing permissions
d9ad96c1d1e6612641c338d86699f5700fca7217rg * and limitations under the License.
d9ad96c1d1e6612641c338d86699f5700fca7217rg *
d9ad96c1d1e6612641c338d86699f5700fca7217rg * When distributing Covered Code, include this CDDL HEADER in each
d9ad96c1d1e6612641c338d86699f5700fca7217rg * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d9ad96c1d1e6612641c338d86699f5700fca7217rg * If applicable, add the following below this CDDL HEADER, with the
d9ad96c1d1e6612641c338d86699f5700fca7217rg * fields enclosed by brackets "[]" replaced with your own identifying
d9ad96c1d1e6612641c338d86699f5700fca7217rg * information: Portions Copyright [yyyy] [name of copyright owner]
d9ad96c1d1e6612641c338d86699f5700fca7217rg *
d9ad96c1d1e6612641c338d86699f5700fca7217rg * CDDL HEADER END
d9ad96c1d1e6612641c338d86699f5700fca7217rg */
d9ad96c1d1e6612641c338d86699f5700fca7217rg/*
b44672165bacece424461fb91f365ba590c50426pf * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
d9ad96c1d1e6612641c338d86699f5700fca7217rg * Use is subject to license terms.
d9ad96c1d1e6612641c338d86699f5700fca7217rg */
d9ad96c1d1e6612641c338d86699f5700fca7217rg
d9ad96c1d1e6612641c338d86699f5700fca7217rg#ifndef _NFS4_DRC_H
d9ad96c1d1e6612641c338d86699f5700fca7217rg#define _NFS4_DRC_H
d9ad96c1d1e6612641c338d86699f5700fca7217rg
d9ad96c1d1e6612641c338d86699f5700fca7217rg#pragma ident "%Z%%M% %I% %E% SMI"
d9ad96c1d1e6612641c338d86699f5700fca7217rg
d9ad96c1d1e6612641c338d86699f5700fca7217rg#ifdef __cplusplus
d9ad96c1d1e6612641c338d86699f5700fca7217rgextern "C" {
d9ad96c1d1e6612641c338d86699f5700fca7217rg#endif
d9ad96c1d1e6612641c338d86699f5700fca7217rg
d9ad96c1d1e6612641c338d86699f5700fca7217rg/*
d9ad96c1d1e6612641c338d86699f5700fca7217rg * NFSv4 Duplicate Request cache.
d9ad96c1d1e6612641c338d86699f5700fca7217rg */
d9ad96c1d1e6612641c338d86699f5700fca7217rgtypedef struct rfs4_drc {
d9ad96c1d1e6612641c338d86699f5700fca7217rg kmutex_t lock;
d9ad96c1d1e6612641c338d86699f5700fca7217rg uint32_t dr_hash;
d9ad96c1d1e6612641c338d86699f5700fca7217rg uint32_t max_size;
d9ad96c1d1e6612641c338d86699f5700fca7217rg uint32_t in_use;
d9ad96c1d1e6612641c338d86699f5700fca7217rg list_t dr_cache;
d9ad96c1d1e6612641c338d86699f5700fca7217rg list_t *dr_buckets;
d9ad96c1d1e6612641c338d86699f5700fca7217rg} rfs4_drc_t;
d9ad96c1d1e6612641c338d86699f5700fca7217rg
d9ad96c1d1e6612641c338d86699f5700fca7217rg/*
d9ad96c1d1e6612641c338d86699f5700fca7217rg * NFSv4 Duplicate request cache entry.
d9ad96c1d1e6612641c338d86699f5700fca7217rg */
d9ad96c1d1e6612641c338d86699f5700fca7217rgtypedef struct rfs4_dupreq {
d9ad96c1d1e6612641c338d86699f5700fca7217rg list_node_t dr_bkt_next;
d9ad96c1d1e6612641c338d86699f5700fca7217rg list_node_t dr_next;
d9ad96c1d1e6612641c338d86699f5700fca7217rg list_t *dr_bkt;
d9ad96c1d1e6612641c338d86699f5700fca7217rg rfs4_drc_t *drc;
d9ad96c1d1e6612641c338d86699f5700fca7217rg int dr_state;
d9ad96c1d1e6612641c338d86699f5700fca7217rg uint32_t dr_xid;
d9ad96c1d1e6612641c338d86699f5700fca7217rg struct netbuf dr_addr;
d9ad96c1d1e6612641c338d86699f5700fca7217rg COMPOUND4res dr_res;
d9ad96c1d1e6612641c338d86699f5700fca7217rg} rfs4_dupreq_t;
d9ad96c1d1e6612641c338d86699f5700fca7217rg
d9ad96c1d1e6612641c338d86699f5700fca7217rg/*
d9ad96c1d1e6612641c338d86699f5700fca7217rg * State of rfs4_dupreq.
d9ad96c1d1e6612641c338d86699f5700fca7217rg */
d9ad96c1d1e6612641c338d86699f5700fca7217rg#define NFS4_DUP_ERROR -1
d9ad96c1d1e6612641c338d86699f5700fca7217rg#define NFS4_NOT_DUP 0
d9ad96c1d1e6612641c338d86699f5700fca7217rg#define NFS4_DUP_NEW 1
d9ad96c1d1e6612641c338d86699f5700fca7217rg#define NFS4_DUP_PENDING 2
d9ad96c1d1e6612641c338d86699f5700fca7217rg#define NFS4_DUP_FREE 3
d9ad96c1d1e6612641c338d86699f5700fca7217rg
d9ad96c1d1e6612641c338d86699f5700fca7217rg#define NFS4_DUP_REPLAY 4
48a344074403d73a2e38d76ad47299c16c89e0dcrmesta#define NFS4_DUP_INUSE 5
d9ad96c1d1e6612641c338d86699f5700fca7217rg
d9ad96c1d1e6612641c338d86699f5700fca7217rgextern rfs4_drc_t *nfs4_drc;
d9ad96c1d1e6612641c338d86699f5700fca7217rgextern uint32_t nfs4_drc_max;
d9ad96c1d1e6612641c338d86699f5700fca7217rgextern uint32_t nfs4_drc_hash;
d9ad96c1d1e6612641c338d86699f5700fca7217rg
48a344074403d73a2e38d76ad47299c16c89e0dcrmestarfs4_drc_t *rfs4_init_drc(uint32_t, uint32_t);
d9ad96c1d1e6612641c338d86699f5700fca7217rgvoid rfs4_fini_drc(rfs4_drc_t *);
d9ad96c1d1e6612641c338d86699f5700fca7217rgvoid rfs4_dr_chstate(rfs4_dupreq_t *, int);
d9ad96c1d1e6612641c338d86699f5700fca7217rgrfs4_dupreq_t *rfs4_alloc_dr(rfs4_drc_t *);
d9ad96c1d1e6612641c338d86699f5700fca7217rgint rfs4_find_dr(struct svc_req *, rfs4_drc_t *, rfs4_dupreq_t **);
d9ad96c1d1e6612641c338d86699f5700fca7217rg
d9ad96c1d1e6612641c338d86699f5700fca7217rg#ifdef __cplusplus
d9ad96c1d1e6612641c338d86699f5700fca7217rg}
d9ad96c1d1e6612641c338d86699f5700fca7217rg#endif
d9ad96c1d1e6612641c338d86699f5700fca7217rg
d9ad96c1d1e6612641c338d86699f5700fca7217rg#endif /* _NFS4_DRC_H */