xref: /csrg-svn/sys/nfs/nfsnode.h (revision 39393)
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  *
838414Smckusick  * Redistribution and use in source and binary forms are permitted
938414Smckusick  * provided that the above copyright notice and this paragraph are
1038414Smckusick  * duplicated in all such forms and that any documentation,
1138414Smckusick  * advertising materials, and other materials related to such
1238414Smckusick  * distribution and use acknowledge that the software was developed
1338414Smckusick  * by the University of California, Berkeley.  The name of the
1438414Smckusick  * University may not be used to endorse or promote products derived
1538414Smckusick  * from this software without specific prior written permission.
1638414Smckusick  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
1738414Smckusick  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1838414Smckusick  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1938414Smckusick  *
20*39393Smckusick  *	@(#)nfsnode.h	7.4 (Berkeley) 10/24/89
2138414Smckusick  */
2238414Smckusick 
2338414Smckusick /*
2438414Smckusick  * The nfsnode is the nfs equivalent to ufs's inode. Any similarity
2538414Smckusick  * is purely coincidental.
2638414Smckusick  * There is a unique nfsnode allocated for each active file,
2738414Smckusick  * each current directory, each mounted-on file, text file, and the root.
2838414Smckusick  * An nfsnode is 'named' by its file handle. (nget/nfs_node.c)
2938414Smckusick  */
3038414Smckusick 
3138414Smckusick struct nfsnode {
3238414Smckusick 	struct	nfsnode *n_chain[2];	/* must be first */
3338414Smckusick 	nfsv2fh_t n_fh;			/* NFS File Handle */
3438414Smckusick 	long	n_flag;			/* Flag for locking.. */
35*39393Smckusick 	struct	vnode *n_vnode;	/* vnode associated with this nfsnode */
3638414Smckusick 	long	n_attrstamp;	/* Time stamp (sec) for attributes */
3738414Smckusick 	struct	vattr n_vattr;	/* Vnode attribute cache */
3838414Smckusick 	struct	sillyrename *n_sillyrename;	/* Ptr to silly rename struct */
3938884Smacklem 	daddr_t	n_lastr;	/* Last block read for read ahead */
4038884Smacklem 	u_long	n_size;		/* Current size of file */
4138884Smacklem 	time_t	n_mtime;	/* Prev modify time to maintain data cache consistency*/
4239348Smckusick 	int	n_error;	/* Save write error value */
4338414Smckusick };
4438414Smckusick 
4538414Smckusick #define	n_forw		n_chain[0]
4638414Smckusick #define	n_back		n_chain[1]
4738414Smckusick 
4838414Smckusick #ifdef KERNEL
4938414Smckusick extern struct vnodeops nfsv2_vnodeops;	/* vnode operations for nfsv2 */
5038414Smckusick extern struct vnodeops nfsv2chr_vnodeops; /* vnode operations for chr devices */
5138414Smckusick 
5238414Smckusick /*
5338414Smckusick  * Convert between nfsnode pointers and vnode pointers
5438414Smckusick  */
5538414Smckusick #define VTONFS(vp)	((struct nfsnode *)(vp)->v_data)
56*39393Smckusick #define NFSTOV(np)	((struct vnode *)(np)->n_vnode)
5738414Smckusick #endif
5838414Smckusick /*
5938414Smckusick  * Flags for n_flag
6038414Smckusick  */
6139348Smckusick #define	NLOCKED		0x1	/* Lock the node for other local accesses */
6239348Smckusick #define	NWANT		0x2	/* Want above lock */
6339348Smckusick #define	NMODIFIED	0x4	/* Might have a modified buffer in bio */
6439348Smckusick #define	NBUFFERED	0x8	/* Might have a buffer in bio */
6539348Smckusick #define	NPAGEDON	0x10	/* Might have associated memory pages */
6639348Smckusick #define	NWRITEERR	0x20	/* Flag write errors so close will know */
67