xref: /original-bsd/sys/nfs/nfsnode.h (revision 1e395994)
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  * %sccs.include.redist.c%
9  *
10  *	@(#)nfsnode.h	7.11 (Berkeley) 06/28/90
11  */
12 
13 /*
14  * The nfsnode is the nfs equivalent to ufs's inode. Any similarity
15  * is purely coincidental.
16  * There is a unique nfsnode allocated for each active file,
17  * each current directory, each mounted-on file, text file, and the root.
18  * An nfsnode is 'named' by its file handle. (nget/nfs_node.c)
19  */
20 
21 struct nfsnode {
22 	struct	nfsnode *n_chain[2];	/* must be first */
23 	nfsv2fh_t n_fh;			/* NFS File Handle */
24 	long	n_flag;			/* Flag for locking.. */
25 	struct	vnode *n_vnode;	/* vnode associated with this nfsnode */
26 	time_t	n_attrstamp;	/* Time stamp (sec) for attributes */
27 	struct	vattr n_vattr;	/* Vnode attribute cache */
28 	struct	sillyrename *n_sillyrename;	/* Ptr to silly rename struct */
29 	u_long	n_size;		/* Current size of file */
30 	time_t	n_mtime;	/* Prev modify time to maintain data cache consistency*/
31 	time_t	n_ctime;	/* Prev create time for name cache consistency*/
32 	int	n_error;	/* Save write error value */
33 	pid_t	n_lockholder;	/* holder of nfsnode lock */
34 	pid_t	n_lockwaiter;	/* most recent waiter for nfsnode lock */
35 	u_long	n_direofoffset;	/* Dir. EOF offset cache */
36 };
37 
38 #define	n_forw		n_chain[0]
39 #define	n_back		n_chain[1]
40 
41 #ifdef KERNEL
42 /*
43  * Convert between nfsnode pointers and vnode pointers
44  */
45 #define VTONFS(vp)	((struct nfsnode *)(vp)->v_data)
46 #define NFSTOV(np)	((struct vnode *)(np)->n_vnode)
47 #endif
48 /*
49  * Flags for n_flag
50  */
51 #define	NLOCKED		0x1	/* Lock the node for other local accesses */
52 #define	NWANT		0x2	/* Want above lock */
53 #define	NMODIFIED	0x4	/* Might have a modified buffer in bio */
54 #define	NWRITEERR	0x8	/* Flag write errors so close will know */
55