xref: /csrg-svn/sys/nfs/nfsnode.h (revision 57776)
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  *
844515Sbostic  * %sccs.include.redist.c%
938414Smckusick  *
10*57776Smckusick  *	@(#)nfsnode.h	7.32 (Berkeley) 02/02/93
1138414Smckusick  */
1238414Smckusick 
1338414Smckusick /*
1452196Smckusick  * Silly rename structure that hangs off the nfsnode until the name
1552196Smckusick  * can be removed by nfs_inactive()
1652196Smckusick  */
1752196Smckusick struct sillyrename {
1852196Smckusick 	struct	ucred *s_cred;
1952196Smckusick 	struct	vnode *s_dvp;
2052196Smckusick 	long	s_namlen;
2152196Smckusick 	char	s_name[20];
2252196Smckusick };
2352196Smckusick 
2452196Smckusick /*
2538414Smckusick  * The nfsnode is the nfs equivalent to ufs's inode. Any similarity
2638414Smckusick  * is purely coincidental.
2738414Smckusick  * There is a unique nfsnode allocated for each active file,
2838414Smckusick  * each current directory, each mounted-on file, text file, and the root.
2938414Smckusick  * An nfsnode is 'named' by its file handle. (nget/nfs_node.c)
3038414Smckusick  */
3138414Smckusick 
3238414Smckusick struct nfsnode {
3355519Smckusick 	struct	nfsnode *n_forw;	/* hash, forward */
3455519Smckusick 	struct	nfsnode **n_back;	/* hash, backward */
3538414Smckusick 	nfsv2fh_t n_fh;			/* NFS File Handle */
3638414Smckusick 	long	n_flag;			/* Flag for locking.. */
3752196Smckusick 	struct	vnode *n_vnode;		/* vnode associated with this node */
3853803Smckusick 	struct	vattr n_vattr;		/* Vnode attribute cache */
3952196Smckusick 	time_t	n_attrstamp;		/* Time stamp for cached attributes */
4052196Smckusick 	struct	sillyrename *n_sillyrename; /* Ptr to silly rename struct */
4153479Smckusick 	off_t	n_size;			/* Current size of file */
4252196Smckusick 	int	n_error;		/* Save write error value */
4352196Smckusick 	u_long	n_direofoffset;		/* Dir. EOF offset cache */
4456278Smckusick 	time_t	n_mtime;		 /* Prev modify time. */
4556278Smckusick 	time_t	n_ctime;		 /* Prev create time. */
4656278Smckusick 	u_quad_t n_brev;		 /* Modify rev when cached */
4756278Smckusick 	u_quad_t n_lrev;		 /* Modify rev for lease */
4856278Smckusick 	time_t	n_expiry;		 /* Lease expiry time */
4956278Smckusick 	struct	nfsnode *n_tnext;	 /* Nqnfs timer chain */
5056278Smckusick 	struct	nfsnode *n_tprev;
5156278Smckusick 	long	spare1;			/* To 8 byte boundary */
5252196Smckusick 	struct	sillyrename n_silly;	/* Silly rename struct */
5353626Smckusick 	struct	timeval n_atim;		/* Special file times */
5453626Smckusick 	struct	timeval n_mtim;
5556278Smckusick 	long	n_spare[2];		/* Up to a power of 2 */
5638414Smckusick };
5738414Smckusick 
5838414Smckusick /*
5938414Smckusick  * Flags for n_flag
6038414Smckusick  */
61*57776Smckusick #define	NFLUSHWANT	0x0001	/* Want wakeup from a flush in prog. */
6256660Smckusick #define	NFLUSHINPROG	0x0002	/* Avoid multiple calls to vinvalbuf() */
6352196Smckusick #define	NMODIFIED	0x0004	/* Might have a modified buffer in bio */
6452196Smckusick #define	NWRITEERR	0x0008	/* Flag write errors so close will know */
6552196Smckusick #define	NQNFSNONCACHE	0x0020	/* Non-cachable lease */
6652196Smckusick #define	NQNFSWRITE	0x0040	/* Write lease */
6752196Smckusick #define	NQNFSEVICTED	0x0080	/* Has been evicted */
6853626Smckusick #define	NACC		0x0100	/* Special file accessed */
6953626Smckusick #define	NUPD		0x0200	/* Special file updated */
7053626Smckusick #define	NCHG		0x0400	/* Special file times changed */
7148043Smckusick 
7248043Smckusick /*
7355658Sbostic  * Convert between nfsnode pointers and vnode pointers
7455658Sbostic  */
7555658Sbostic #define VTONFS(vp)	((struct nfsnode *)(vp)->v_data)
7655658Sbostic #define NFSTOV(np)	((struct vnode *)(np)->n_vnode)
7755658Sbostic 
7855658Sbostic #ifdef KERNEL
7955658Sbostic /*
8048043Smckusick  * Prototypes for NFS vnode operations
8148043Smckusick  */
8253556Sheideman int	nfs_lookup __P((struct vop_lookup_args *));
8353556Sheideman int	nfs_create __P((struct vop_create_args *));
8453556Sheideman int	nfs_mknod __P((struct vop_mknod_args *));
8553556Sheideman int	nfs_open __P((struct vop_open_args *));
8653556Sheideman int	nfs_close __P((struct vop_close_args *));
8753626Smckusick int	nfsspec_close __P((struct vop_close_args *));
8853626Smckusick #ifdef FIFO
8953626Smckusick int	nfsfifo_close __P((struct vop_close_args *));
9053626Smckusick #endif
9153556Sheideman int	nfs_access __P((struct vop_access_args *));
9256365Smckusick int	nfsspec_access __P((struct vop_access_args *));
9353556Sheideman int	nfs_getattr __P((struct vop_getattr_args *));
9453556Sheideman int	nfs_setattr __P((struct vop_setattr_args *));
9553556Sheideman int	nfs_read __P((struct vop_read_args *));
9653556Sheideman int	nfs_write __P((struct vop_write_args *));
9753626Smckusick int	nfsspec_read __P((struct vop_read_args *));
9853626Smckusick int	nfsspec_write __P((struct vop_write_args *));
9953626Smckusick #ifdef FIFO
10053626Smckusick int	nfsfifo_read __P((struct vop_read_args *));
10153626Smckusick int	nfsfifo_write __P((struct vop_write_args *));
10253626Smckusick #endif
10353556Sheideman #define nfs_ioctl ((int (*) __P((struct  vop_ioctl_args *)))enoioctl)
10453556Sheideman #define nfs_select ((int (*) __P((struct  vop_select_args *)))seltrue)
10553556Sheideman int	nfs_mmap __P((struct vop_mmap_args *));
10653556Sheideman int	nfs_fsync __P((struct vop_fsync_args *));
10753556Sheideman #define nfs_seek ((int (*) __P((struct  vop_seek_args *)))nullop)
10853556Sheideman int	nfs_remove __P((struct vop_remove_args *));
10953556Sheideman int	nfs_link __P((struct vop_link_args *));
11053556Sheideman int	nfs_rename __P((struct vop_rename_args *));
11153556Sheideman int	nfs_mkdir __P((struct vop_mkdir_args *));
11253556Sheideman int	nfs_rmdir __P((struct vop_rmdir_args *));
11353556Sheideman int	nfs_symlink __P((struct vop_symlink_args *));
11453556Sheideman int	nfs_readdir __P((struct vop_readdir_args *));
11553556Sheideman int	nfs_readlink __P((struct vop_readlink_args *));
11653556Sheideman int	nfs_abortop __P((struct vop_abortop_args *));
11753556Sheideman int	nfs_inactive __P((struct vop_inactive_args *));
11853556Sheideman int	nfs_reclaim __P((struct vop_reclaim_args *));
11953556Sheideman int	nfs_lock __P((struct vop_lock_args *));
12053556Sheideman int	nfs_unlock __P((struct vop_unlock_args *));
12153556Sheideman int	nfs_bmap __P((struct vop_bmap_args *));
12253556Sheideman int	nfs_strategy __P((struct vop_strategy_args *));
12353556Sheideman int	nfs_print __P((struct vop_print_args *));
12453556Sheideman int	nfs_islocked __P((struct vop_islocked_args *));
12553556Sheideman int	nfs_advlock __P((struct vop_advlock_args *));
12653556Sheideman int	nfs_blkatoff __P((struct vop_blkatoff_args *));
12754663Smckusick int	nfs_vget __P((struct mount *, ino_t, struct vnode **));
12853556Sheideman int	nfs_valloc __P((struct vop_valloc_args *));
12953581Sheideman int	nfs_vfree __P((struct vop_vfree_args *));
13053556Sheideman int	nfs_truncate __P((struct vop_truncate_args *));
13153556Sheideman int	nfs_update __P((struct vop_update_args *));
132*57776Smckusick int	nfs_bwrite __P((struct vop_bwrite_args *));
13355658Sbostic #endif /* KERNEL */
134