xref: /original-bsd/sys/nfs/nfsrvcache.h (revision 7717c4d4)
1 /*
2  * Copyright (c) 1989 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Rick Macklem at The University of Guelph.
7  *
8  * Redistribution and use in source and binary forms are permitted
9  * provided that the above copyright notice and this paragraph are
10  * duplicated in all such forms and that any documentation,
11  * advertising materials, and other materials related to such
12  * distribution and use acknowledge that the software was developed
13  * by the University of California, Berkeley.  The name of the
14  * University may not be used to endorse or promote products derived
15  * from this software without specific prior written permission.
16  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19  *
20  *	@(#)nfsrvcache.h	7.1 (Berkeley) 12/20/89
21  */
22 
23 /*
24  * Definitions for the server recent request cache
25  */
26 
27 #define	NFSRVCACHESIZ	128
28 #define	NFSRCHSZ	32
29 
30 struct nfsrvcache {
31 	struct	nfsrvcache *rc_chain[2];	/* Hash chain links */
32 	struct	nfsrvcache *rc_next;	/* Lru list */
33 	struct	nfsrvcache *rc_prev;
34 	int	rc_state;		/* Current state of request */
35 	int	rc_flag;		/* Flag bits */
36 	u_long	rc_saddr;		/* Internet addr. of requestor */
37 	u_long	rc_xid;			/* rpc id number */
38 	int	rc_proc;		/* rpc proc number */
39 	long	rc_timestamp;		/* Time stamp */
40 	union {
41 		struct mbuf *rc_repmb;	/* Reply mbuf list OR */
42 		int rc_repstat;		/* Reply status */
43 	} rc_un;
44 };
45 
46 #define	rc_forw		rc_chain[0]
47 #define	rc_back		rc_chain[1]
48 #define	rc_status	rc_un.rc_repstat
49 #define	rc_reply	rc_un.rc_repmb
50 
51 #define	put_at_head(rp) \
52 		(rp)->rc_prev->rc_next = (rp)->rc_next; \
53 		(rp)->rc_next->rc_prev = (rp)->rc_prev; \
54 		(rp)->rc_next = nfsrvcachehead.rc_next; \
55 		(rp)->rc_next->rc_prev = (rp); \
56 		nfsrvcachehead.rc_next = (rp); \
57 		(rp)->rc_prev = &nfsrvcachehead
58 
59 /* Cache entry states */
60 #define	RC_UNUSED	0
61 #define	RC_INPROG	1
62 #define	RC_DONE		2
63 
64 /* Return values */
65 #define	RC_DROPIT	0
66 #define	RC_REPLY	1
67 #define	RC_DOIT		2
68 
69 /* Flag bits */
70 #define	RC_LOCKED	0x1
71 #define	RC_WANTED	0x2
72 #define	RC_REPSTATUS	0x4
73 #define	RC_REPMBUF	0x8
74 
75 /* Delay time after completion that request is dropped */
76 #define	RC_DELAY	2		/* seconds */
77 
78