138414Smckusick /* 263236Sbostic * Copyright (c) 1989, 1993 363236Sbostic * The Regents of the University of California. 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*66078Shibler * @(#)nfsnode.h 8.4 (Berkeley) 02/13/94 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 */ 4164855Shibler u_quad_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 7765247Smckusick /* 7865247Smckusick * Queue head for nfsiod's 7965247Smckusick */ 8065247Smckusick TAILQ_HEAD(nfsbufs, buf) nfs_bufq; 8165247Smckusick 8255658Sbostic #ifdef KERNEL 8355658Sbostic /* 8448043Smckusick * Prototypes for NFS vnode operations 8548043Smckusick */ 8653556Sheideman int nfs_lookup __P((struct vop_lookup_args *)); 8753556Sheideman int nfs_create __P((struct vop_create_args *)); 8853556Sheideman int nfs_mknod __P((struct vop_mknod_args *)); 8953556Sheideman int nfs_open __P((struct vop_open_args *)); 9053556Sheideman int nfs_close __P((struct vop_close_args *)); 9153626Smckusick int nfsspec_close __P((struct vop_close_args *)); 9253626Smckusick #ifdef FIFO 9353626Smckusick int nfsfifo_close __P((struct vop_close_args *)); 9453626Smckusick #endif 9553556Sheideman int nfs_access __P((struct vop_access_args *)); 9656365Smckusick int nfsspec_access __P((struct vop_access_args *)); 9753556Sheideman int nfs_getattr __P((struct vop_getattr_args *)); 9853556Sheideman int nfs_setattr __P((struct vop_setattr_args *)); 9953556Sheideman int nfs_read __P((struct vop_read_args *)); 10053556Sheideman int nfs_write __P((struct vop_write_args *)); 10153626Smckusick int nfsspec_read __P((struct vop_read_args *)); 10253626Smckusick int nfsspec_write __P((struct vop_write_args *)); 10353626Smckusick #ifdef FIFO 10453626Smckusick int nfsfifo_read __P((struct vop_read_args *)); 10553626Smckusick int nfsfifo_write __P((struct vop_write_args *)); 10653626Smckusick #endif 10753556Sheideman #define nfs_ioctl ((int (*) __P((struct vop_ioctl_args *)))enoioctl) 10853556Sheideman #define nfs_select ((int (*) __P((struct vop_select_args *)))seltrue) 10953556Sheideman int nfs_mmap __P((struct vop_mmap_args *)); 11053556Sheideman int nfs_fsync __P((struct vop_fsync_args *)); 11153556Sheideman #define nfs_seek ((int (*) __P((struct vop_seek_args *)))nullop) 11253556Sheideman int nfs_remove __P((struct vop_remove_args *)); 11353556Sheideman int nfs_link __P((struct vop_link_args *)); 11453556Sheideman int nfs_rename __P((struct vop_rename_args *)); 11553556Sheideman int nfs_mkdir __P((struct vop_mkdir_args *)); 11653556Sheideman int nfs_rmdir __P((struct vop_rmdir_args *)); 11753556Sheideman int nfs_symlink __P((struct vop_symlink_args *)); 11853556Sheideman int nfs_readdir __P((struct vop_readdir_args *)); 11953556Sheideman int nfs_readlink __P((struct vop_readlink_args *)); 12053556Sheideman int nfs_abortop __P((struct vop_abortop_args *)); 12153556Sheideman int nfs_inactive __P((struct vop_inactive_args *)); 12253556Sheideman int nfs_reclaim __P((struct vop_reclaim_args *)); 12353556Sheideman int nfs_lock __P((struct vop_lock_args *)); 12453556Sheideman int nfs_unlock __P((struct vop_unlock_args *)); 12553556Sheideman int nfs_bmap __P((struct vop_bmap_args *)); 12653556Sheideman int nfs_strategy __P((struct vop_strategy_args *)); 12753556Sheideman int nfs_print __P((struct vop_print_args *)); 12853556Sheideman int nfs_islocked __P((struct vop_islocked_args *)); 12960399Smckusick int nfs_pathconf __P((struct vop_pathconf_args *)); 13053556Sheideman int nfs_advlock __P((struct vop_advlock_args *)); 13153556Sheideman int nfs_blkatoff __P((struct vop_blkatoff_args *)); 13254663Smckusick int nfs_vget __P((struct mount *, ino_t, struct vnode **)); 13353556Sheideman int nfs_valloc __P((struct vop_valloc_args *)); 134*66078Shibler #define nfs_reallocblks \ 135*66078Shibler ((int (*) __P((struct vop_reallocblks_args *)))eopnotsupp) 13653581Sheideman int nfs_vfree __P((struct vop_vfree_args *)); 13753556Sheideman int nfs_truncate __P((struct vop_truncate_args *)); 13853556Sheideman int nfs_update __P((struct vop_update_args *)); 13957776Smckusick int nfs_bwrite __P((struct vop_bwrite_args *)); 14055658Sbostic #endif /* KERNEL */ 141