xref: /csrg-svn/sys/nfs/nfsnode.h (revision 44515)
138414Smckusick /*
238414Smckusick  * Copyright (c) 1989 The Regents of the University of California.
338414Smckusick  * All rights reserved.
438414Smckusick  *
538414Smckusick  * This code is derived from software contributed to Berkeley by
638414Smckusick  * Rick Macklem at The University of Guelph.
738414Smckusick  *
8*44515Sbostic  * %sccs.include.redist.c%
938414Smckusick  *
10*44515Sbostic  *	@(#)nfsnode.h	7.11 (Berkeley) 06/28/90
1138414Smckusick  */
1238414Smckusick 
1338414Smckusick /*
1438414Smckusick  * The nfsnode is the nfs equivalent to ufs's inode. Any similarity
1538414Smckusick  * is purely coincidental.
1638414Smckusick  * There is a unique nfsnode allocated for each active file,
1738414Smckusick  * each current directory, each mounted-on file, text file, and the root.
1838414Smckusick  * An nfsnode is 'named' by its file handle. (nget/nfs_node.c)
1938414Smckusick  */
2038414Smckusick 
2138414Smckusick struct nfsnode {
2238414Smckusick 	struct	nfsnode *n_chain[2];	/* must be first */
2338414Smckusick 	nfsv2fh_t n_fh;			/* NFS File Handle */
2438414Smckusick 	long	n_flag;			/* Flag for locking.. */
2539393Smckusick 	struct	vnode *n_vnode;	/* vnode associated with this nfsnode */
2640296Smckusick 	time_t	n_attrstamp;	/* Time stamp (sec) for attributes */
2738414Smckusick 	struct	vattr n_vattr;	/* Vnode attribute cache */
2838414Smckusick 	struct	sillyrename *n_sillyrename;	/* Ptr to silly rename struct */
2938884Smacklem 	u_long	n_size;		/* Current size of file */
3038884Smacklem 	time_t	n_mtime;	/* Prev modify time to maintain data cache consistency*/
3140250Smckusick 	time_t	n_ctime;	/* Prev create time for name cache consistency*/
3239348Smckusick 	int	n_error;	/* Save write error value */
3339903Smckusick 	pid_t	n_lockholder;	/* holder of nfsnode lock */
3439903Smckusick 	pid_t	n_lockwaiter;	/* most recent waiter for nfsnode lock */
3540296Smckusick 	u_long	n_direofoffset;	/* Dir. EOF offset cache */
3638414Smckusick };
3738414Smckusick 
3838414Smckusick #define	n_forw		n_chain[0]
3938414Smckusick #define	n_back		n_chain[1]
4038414Smckusick 
4138414Smckusick #ifdef KERNEL
4238414Smckusick /*
4338414Smckusick  * Convert between nfsnode pointers and vnode pointers
4438414Smckusick  */
4538414Smckusick #define VTONFS(vp)	((struct nfsnode *)(vp)->v_data)
4639393Smckusick #define NFSTOV(np)	((struct vnode *)(np)->n_vnode)
4738414Smckusick #endif
4838414Smckusick /*
4938414Smckusick  * Flags for n_flag
5038414Smckusick  */
5139348Smckusick #define	NLOCKED		0x1	/* Lock the node for other local accesses */
5239348Smckusick #define	NWANT		0x2	/* Want above lock */
5339348Smckusick #define	NMODIFIED	0x4	/* Might have a modified buffer in bio */
5441895Smckusick #define	NWRITEERR	0x8	/* Flag write errors so close will know */
55