VOP_TRUNCATE now takes a cred argument
[unix-history] / usr / src / sys / nfs / nfsnode.h
index 956d931..ec117a5 100644 (file)
@@ -7,9 +7,20 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)nfsnode.h   7.12 (Berkeley) %G%
+ *     @(#)nfsnode.h   7.19 (Berkeley) %G%
  */
 
  */
 
+/*
+ * Silly rename structure that hangs off the nfsnode until the name
+ * can be removed by nfs_inactive()
+ */
+struct sillyrename {
+       struct  ucred *s_cred;
+       struct  vnode *s_dvp;
+       long    s_namlen;
+       char    s_name[20];
+};
+
 /*
  * The nfsnode is the nfs equivalent to ufs's inode. Any similarity
  * is purely coincidental.
 /*
  * The nfsnode is the nfs equivalent to ufs's inode. Any similarity
  * is purely coincidental.
@@ -22,19 +33,38 @@ struct nfsnode {
        struct  nfsnode *n_chain[2];    /* must be first */
        nfsv2fh_t n_fh;                 /* NFS File Handle */
        long    n_flag;                 /* Flag for locking.. */
        struct  nfsnode *n_chain[2];    /* must be first */
        nfsv2fh_t n_fh;                 /* NFS File Handle */
        long    n_flag;                 /* Flag for locking.. */
-       struct  vnode *n_vnode; /* vnode associated with this nfsnode */
-       time_t  n_attrstamp;    /* Time stamp (sec) for attributes */
-       struct  vattr n_vattr;  /* Vnode attribute cache */
-       struct  sillyrename *n_sillyrename;     /* Ptr to silly rename struct */
-       u_long  n_size;         /* Current size of file */
-       time_t  n_mtime;        /* Prev modify time to maintain data cache consistency*/
-       time_t  n_ctime;        /* Prev create time for name cache consistency*/
-       int     n_error;        /* Save write error value */
-       pid_t   n_lockholder;   /* holder of nfsnode lock */
-       pid_t   n_lockwaiter;   /* most recent waiter for nfsnode lock */
-       u_long  n_direofoffset; /* Dir. EOF offset cache */
+       struct  vnode *n_vnode;         /* vnode associated with this node */
+       time_t  n_attrstamp;            /* Time stamp for cached attributes */
+       struct  vattr n_vattr;          /* Vnode attribute cache */
+       struct  sillyrename *n_sillyrename; /* Ptr to silly rename struct */
+       u_long  n_size;                 /* Current size of file */
+       int     n_error;                /* Save write error value */
+       u_long  n_direofoffset;         /* Dir. EOF offset cache */
+       union {
+               struct {
+                       time_t  un_mtime; /* Prev modify time. */
+                       time_t  un_ctime; /* Prev create time. */
+               } un_nfs;
+               struct {
+                       u_quad_t un_brev; /* Modify rev when cached */
+                       u_quad_t un_lrev; /* Modify rev for lease */
+                       time_t  un_expiry; /* Lease expiry time */
+                       struct  nfsnode *un_tnext; /* Nqnfs timer chain */
+                       struct  nfsnode *un_tprev;
+               } un_nqnfs;
+       } n_un;
+       struct  sillyrename n_silly;    /* Silly rename struct */
+       long    n_spare[11];            /* Up to a power of 2 */
 };
 
 };
 
+#define        n_mtime         n_un.un_nfs.un_mtime
+#define        n_ctime         n_un.un_nfs.un_ctime
+#define        n_brev          n_un.un_nqnfs.un_brev
+#define        n_lrev          n_un.un_nqnfs.un_lrev
+#define        n_expiry        n_un.un_nqnfs.un_expiry
+#define        n_tnext         n_un.un_nqnfs.un_tnext
+#define        n_tprev         n_un.un_nqnfs.un_tprev
+
 #define        n_forw          n_chain[0]
 #define        n_back          n_chain[1]
 
 #define        n_forw          n_chain[0]
 #define        n_back          n_chain[1]
 
@@ -48,27 +78,29 @@ struct nfsnode {
 /*
  * Flags for n_flag
  */
 /*
  * Flags for n_flag
  */
-#define        NLOCKED         0x1     /* Lock the node for other local accesses */
-#define        NWANT           0x2     /* Want above lock */
-#define        NMODIFIED       0x4     /* Might have a modified buffer in bio */
-#define        NWRITEERR       0x8     /* Flag write errors so close will know */
+#define        NMODIFIED       0x0004  /* Might have a modified buffer in bio */
+#define        NWRITEERR       0x0008  /* Flag write errors so close will know */
+#define        NQNFSNONCACHE   0x0020  /* Non-cachable lease */
+#define        NQNFSWRITE      0x0040  /* Write lease */
+#define        NQNFSEVICTED    0x0080  /* Has been evicted */
 
 /*
  * Prototypes for NFS vnode operations
  */
 int    nfs_lookup __P((
 
 /*
  * Prototypes for NFS vnode operations
  */
 int    nfs_lookup __P((
-               struct vnode *vp,
-               struct nameidata *ndp,
-               struct proc *p));
+               struct vnode *dvp,
+               struct vnode **vpp,
+               struct componentname *cnp));
 int    nfs_create __P((
 int    nfs_create __P((
-               struct nameidata *ndp,
-               struct vattr *vap,
-               struct proc *p));
+               struct vnode *dvp,
+               struct vnode **vpp,
+               struct componentname *cnp,
+               struct vattr *vap));
 int    nfs_mknod __P((
 int    nfs_mknod __P((
-               struct nameidata *ndp,
-               struct vattr *vap,
-               struct ucred *cred,
-               struct proc *p));
+               struct vnode *dvp,
+               struct vnode **vpp,
+               struct componentname *cnp,
+               struct vattr *vap));
 int    nfs_open __P((
                struct vnode *vp,
                int mode,
 int    nfs_open __P((
                struct vnode *vp,
                int mode,
@@ -134,28 +166,35 @@ int       nfs_fsync __P((
                off_t newoff, \
                struct ucred *cred))) nullop)
 int    nfs_remove __P((
                off_t newoff, \
                struct ucred *cred))) nullop)
 int    nfs_remove __P((
-               struct nameidata *ndp,
-               struct proc *p));
-int    nfs_link __P((
+               struct vnode *dvp,
                struct vnode *vp,
                struct vnode *vp,
-               struct nameidata *ndp,
-               struct proc *p));
+               struct componentname *cnp));
+int    nfs_link __P((
+               register struct vnode *vp,
+               struct vnode *tdvp,
+               struct componentname *cnp));
 int    nfs_rename __P((
 int    nfs_rename __P((
-               struct nameidata *fndp,
-               struct nameidata *tdnp,
-               struct proc *p));
+               struct vnode *fdvp,
+               struct vnode *fvp,
+               struct componentname *fcnp,
+               struct vnode *tdvp,
+               struct vnode *tvp,
+               struct componentname *tcnp));
 int    nfs_mkdir __P((
 int    nfs_mkdir __P((
-               struct nameidata *ndp,
-               struct vattr *vap,
-               struct proc *p));
+               struct vnode *dvp,
+               struct vnode **vpp,
+               struct componentname *cnp,
+               struct vattr *vap));
 int    nfs_rmdir __P((
 int    nfs_rmdir __P((
-               struct nameidata *ndp,
-               struct proc *p));
+               struct vnode *dvp,
+               struct vnode *vp,
+               struct componentname *cnp));
 int    nfs_symlink __P((
 int    nfs_symlink __P((
-               struct nameidata *ndp,
+               struct vnode *dvp,
+               struct vnode **vpp,
+               struct componentname *cnp,
                struct vattr *vap,
                struct vattr *vap,
-               char *target,
-               struct proc *p));
+               char *nm));
 int    nfs_readdir __P((
                struct vnode *vp,
                struct uio *uio,
 int    nfs_readdir __P((
                struct vnode *vp,
                struct uio *uio,
@@ -166,7 +205,8 @@ int nfs_readlink __P((
                struct uio *uio,
                struct ucred *cred));
 int    nfs_abortop __P((
                struct uio *uio,
                struct ucred *cred));
 int    nfs_abortop __P((
-               struct nameidata *ndp));
+               struct vnode *,
+               struct componentname *));
 int    nfs_inactive __P((
                struct vnode *vp,
                struct proc *p));
 int    nfs_inactive __P((
                struct vnode *vp,
                struct proc *p));
@@ -193,3 +233,32 @@ int        nfs_advlock __P((
                int op,
                struct flock *fl,
                int flags));
                int op,
                struct flock *fl,
                int flags));
+int    nfs_blkatoff __P((
+               struct vnode *vp,
+               off_t offset,
+               char **res,
+               struct buf **bpp));
+int    nfs_vget __P((
+               struct mount *mp,
+               ino_t ino,
+               struct vnode **vpp));
+int    nfs_valloc __P((
+               struct vnode *pvp,
+               int mode,
+               struct ucred *cred,
+               struct vnode **vpp));
+void   nfs_vfree __P((
+               struct vnode *pvp,
+               ino_t ino,
+               int mode));
+int    nfs_truncate __P((
+               struct vnode *vp,
+               off_t length,
+               int flags,
+               struct ucred *cred));
+int    nfs_update __P((
+               struct vnode *vp,
+               struct timeval *ta,
+               struct timeval *tm,
+               int waitfor));
+int    bwrite();               /* NFS needs a bwrite routine */