xref: /csrg-svn/sys/nfs/nfsnode.h (revision 38884)
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*38884Smacklem  *	@(#)nfsnode.h	7.2 (Berkeley) 08/30/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.. */
3538414Smckusick 	long	n_id;		/* unique identifier */
3638414Smckusick 	struct	vnode n_vnode;	/* vnode associated with this nfsnode */
3738414Smckusick 	long	n_attrstamp;	/* Time stamp (sec) for attributes */
3838414Smckusick 	struct	vattr n_vattr;	/* Vnode attribute cache */
3938414Smckusick 	struct	sillyrename *n_sillyrename;	/* Ptr to silly rename struct */
4038414Smckusick 	struct nfsnode  *n_freef;	/* free list forward */
4138414Smckusick 	struct nfsnode **n_freeb;	/* free list back */
42*38884Smacklem 	daddr_t	n_lastr;	/* Last block read for read ahead */
43*38884Smacklem 	u_long	n_size;		/* Current size of file */
44*38884Smacklem 	time_t	n_mtime;	/* Prev modify time to maintain data cache consistency*/
4538414Smckusick };
4638414Smckusick 
4738414Smckusick #define	n_forw		n_chain[0]
4838414Smckusick #define	n_back		n_chain[1]
4938414Smckusick 
5038414Smckusick #ifdef KERNEL
5138414Smckusick struct nfsnode *nfsnode;		/* the nfsnode table itself */
5238414Smckusick struct nfsnode *nfsnodeNNFSNODE;	/* the end of the nfsnode table */
5338414Smckusick int	nnfsnode;			/* number of slots in the table */
5438414Smckusick long	nextnfsnodeid;		/* unique id generator */
5538414Smckusick 
5638414Smckusick extern struct vnodeops nfsv2_vnodeops;	/* vnode operations for nfsv2 */
5738414Smckusick extern struct vnodeops nfsv2chr_vnodeops; /* vnode operations for chr devices */
5838414Smckusick 
5938414Smckusick /*
6038414Smckusick  * Convert between nfsnode pointers and vnode pointers
6138414Smckusick  */
6238414Smckusick #define VTONFS(vp)	((struct nfsnode *)(vp)->v_data)
6338414Smckusick #define NFSTOV(np)	((struct vnode *)&(np)->n_vnode)
6438414Smckusick #endif
6538414Smckusick /*
6638414Smckusick  * Flags for n_flag
6738414Smckusick  */
6838414Smckusick #define	NLOCKED		0x1
6938414Smckusick #define	NWANT		0x2
70*38884Smacklem #define NMODIFIED	0x4
71