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*60399Smckusick * @(#)nfsnode.h 7.34 (Berkeley) 05/25/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; 5538414Smckusick }; 5638414Smckusick 5738414Smckusick /* 5838414Smckusick * Flags for n_flag 5938414Smckusick */ 6057776Smckusick #define NFLUSHWANT 0x0001 /* Want wakeup from a flush in prog. */ 6156660Smckusick #define NFLUSHINPROG 0x0002 /* Avoid multiple calls to vinvalbuf() */ 6252196Smckusick #define NMODIFIED 0x0004 /* Might have a modified buffer in bio */ 6352196Smckusick #define NWRITEERR 0x0008 /* Flag write errors so close will know */ 6452196Smckusick #define NQNFSNONCACHE 0x0020 /* Non-cachable lease */ 6552196Smckusick #define NQNFSWRITE 0x0040 /* Write lease */ 6652196Smckusick #define NQNFSEVICTED 0x0080 /* Has been evicted */ 6753626Smckusick #define NACC 0x0100 /* Special file accessed */ 6853626Smckusick #define NUPD 0x0200 /* Special file updated */ 6953626Smckusick #define NCHG 0x0400 /* Special file times changed */ 7048043Smckusick 7148043Smckusick /* 7255658Sbostic * Convert between nfsnode pointers and vnode pointers 7355658Sbostic */ 7455658Sbostic #define VTONFS(vp) ((struct nfsnode *)(vp)->v_data) 7555658Sbostic #define NFSTOV(np) ((struct vnode *)(np)->n_vnode) 7655658Sbostic 7755658Sbostic #ifdef KERNEL 7855658Sbostic /* 7948043Smckusick * Prototypes for NFS vnode operations 8048043Smckusick */ 8153556Sheideman int nfs_lookup __P((struct vop_lookup_args *)); 8253556Sheideman int nfs_create __P((struct vop_create_args *)); 8353556Sheideman int nfs_mknod __P((struct vop_mknod_args *)); 8453556Sheideman int nfs_open __P((struct vop_open_args *)); 8553556Sheideman int nfs_close __P((struct vop_close_args *)); 8653626Smckusick int nfsspec_close __P((struct vop_close_args *)); 8753626Smckusick #ifdef FIFO 8853626Smckusick int nfsfifo_close __P((struct vop_close_args *)); 8953626Smckusick #endif 9053556Sheideman int nfs_access __P((struct vop_access_args *)); 9156365Smckusick int nfsspec_access __P((struct vop_access_args *)); 9253556Sheideman int nfs_getattr __P((struct vop_getattr_args *)); 9353556Sheideman int nfs_setattr __P((struct vop_setattr_args *)); 9453556Sheideman int nfs_read __P((struct vop_read_args *)); 9553556Sheideman int nfs_write __P((struct vop_write_args *)); 9653626Smckusick int nfsspec_read __P((struct vop_read_args *)); 9753626Smckusick int nfsspec_write __P((struct vop_write_args *)); 9853626Smckusick #ifdef FIFO 9953626Smckusick int nfsfifo_read __P((struct vop_read_args *)); 10053626Smckusick int nfsfifo_write __P((struct vop_write_args *)); 10153626Smckusick #endif 10253556Sheideman #define nfs_ioctl ((int (*) __P((struct vop_ioctl_args *)))enoioctl) 10353556Sheideman #define nfs_select ((int (*) __P((struct vop_select_args *)))seltrue) 10453556Sheideman int nfs_mmap __P((struct vop_mmap_args *)); 10553556Sheideman int nfs_fsync __P((struct vop_fsync_args *)); 10653556Sheideman #define nfs_seek ((int (*) __P((struct vop_seek_args *)))nullop) 10753556Sheideman int nfs_remove __P((struct vop_remove_args *)); 10853556Sheideman int nfs_link __P((struct vop_link_args *)); 10953556Sheideman int nfs_rename __P((struct vop_rename_args *)); 11053556Sheideman int nfs_mkdir __P((struct vop_mkdir_args *)); 11153556Sheideman int nfs_rmdir __P((struct vop_rmdir_args *)); 11253556Sheideman int nfs_symlink __P((struct vop_symlink_args *)); 11353556Sheideman int nfs_readdir __P((struct vop_readdir_args *)); 11453556Sheideman int nfs_readlink __P((struct vop_readlink_args *)); 11553556Sheideman int nfs_abortop __P((struct vop_abortop_args *)); 11653556Sheideman int nfs_inactive __P((struct vop_inactive_args *)); 11753556Sheideman int nfs_reclaim __P((struct vop_reclaim_args *)); 11853556Sheideman int nfs_lock __P((struct vop_lock_args *)); 11953556Sheideman int nfs_unlock __P((struct vop_unlock_args *)); 12053556Sheideman int nfs_bmap __P((struct vop_bmap_args *)); 12153556Sheideman int nfs_strategy __P((struct vop_strategy_args *)); 12253556Sheideman int nfs_print __P((struct vop_print_args *)); 12353556Sheideman int nfs_islocked __P((struct vop_islocked_args *)); 124*60399Smckusick int nfs_pathconf __P((struct vop_pathconf_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 *)); 13257776Smckusick int nfs_bwrite __P((struct vop_bwrite_args *)); 13355658Sbostic #endif /* KERNEL */ 134