home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / os / bsdss4.tz / bsdss4 / bsdss / server / nfs / nfsnode.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-22  |  7.4 KB  |  256 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1992 Carnegie Mellon University
  4.  * All Rights Reserved.
  5.  * 
  6.  * Permission to use, copy, modify and distribute this software and its
  7.  * documentation is hereby granted, provided that both the copyright
  8.  * notice and this permission notice appear in all copies of the
  9.  * software, derivative works or modified versions, and any portions
  10.  * thereof, and that both notices appear in supporting documentation.
  11.  * 
  12.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15.  * 
  16.  * Carnegie Mellon requests users of this software to return to
  17.  * 
  18.  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  19.  *  School of Computer Science
  20.  *  Carnegie Mellon University
  21.  *  Pittsburgh PA 15213-3890
  22.  * 
  23.  * any improvements or extensions that they make and grant Carnegie Mellon 
  24.  * the rights to redistribute these changes.
  25.  */
  26. /*
  27.  * HISTORY
  28.  * $Log:    nfsnode.h,v $
  29.  * Revision 2.1  92/04/21  17:15:10  rwd
  30.  * BSDSS
  31.  * 
  32.  *
  33.  */
  34.  
  35. /*
  36.  * Copyright (c) 1989 The Regents of the University of California.
  37.  * All rights reserved.
  38.  *
  39.  * This code is derived from software contributed to Berkeley by
  40.  * Rick Macklem at The University of Guelph.
  41.  *
  42.  * Redistribution and use in source and binary forms, with or without
  43.  * modification, are permitted provided that the following conditions
  44.  * are met:
  45.  * 1. Redistributions of source code must retain the above copyright
  46.  *    notice, this list of conditions and the following disclaimer.
  47.  * 2. Redistributions in binary form must reproduce the above copyright
  48.  *    notice, this list of conditions and the following disclaimer in the
  49.  *    documentation and/or other materials provided with the distribution.
  50.  * 3. All advertising materials mentioning features or use of this software
  51.  *    must display the following acknowledgement:
  52.  *    This product includes software developed by the University of
  53.  *    California, Berkeley and its contributors.
  54.  * 4. Neither the name of the University nor the names of its contributors
  55.  *    may be used to endorse or promote products derived from this software
  56.  *    without specific prior written permission.
  57.  *
  58.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  59.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  60.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  61.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  62.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  63.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  64.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  65.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  66.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  67.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  68.  * SUCH DAMAGE.
  69.  *
  70.  *    @(#)nfsnode.h    7.12 (Berkeley) 4/16/91
  71.  */
  72.  
  73. /*
  74.  * The nfsnode is the nfs equivalent to ufs's inode. Any similarity
  75.  * is purely coincidental.
  76.  * There is a unique nfsnode allocated for each active file,
  77.  * each current directory, each mounted-on file, text file, and the root.
  78.  * An nfsnode is 'named' by its file handle. (nget/nfs_node.c)
  79.  */
  80.  
  81. struct nfsnode {
  82.     struct    nfsnode *n_chain[2];    /* must be first */
  83.     nfsv2fh_t n_fh;            /* NFS File Handle */
  84.     long    n_flag;            /* Flag for locking.. */
  85.     struct    vnode *n_vnode;    /* vnode associated with this nfsnode */
  86.     time_t    n_attrstamp;    /* Time stamp (sec) for attributes */
  87.     struct    vattr n_vattr;    /* Vnode attribute cache */
  88.     struct    sillyrename *n_sillyrename;    /* Ptr to silly rename struct */
  89.     u_long    n_size;        /* Current size of file */
  90.     time_t    n_mtime;    /* Prev modify time to maintain data cache consistency*/
  91.     time_t    n_ctime;    /* Prev create time for name cache consistency*/
  92.     int    n_error;    /* Save write error value */
  93.     pid_t    n_lockholder;    /* holder of nfsnode lock */
  94.     pid_t    n_lockwaiter;    /* most recent waiter for nfsnode lock */
  95.     u_long    n_direofoffset;    /* Dir. EOF offset cache */
  96. };
  97.  
  98. #define    n_forw        n_chain[0]
  99. #define    n_back        n_chain[1]
  100.  
  101. #ifdef KERNEL
  102. /*
  103.  * Convert between nfsnode pointers and vnode pointers
  104.  */
  105. #define VTONFS(vp)    ((struct nfsnode *)(vp)->v_data)
  106. #define NFSTOV(np)    ((struct vnode *)(np)->n_vnode)
  107. #endif
  108. /*
  109.  * Flags for n_flag
  110.  */
  111. #define    NLOCKED        0x1    /* Lock the node for other local accesses */
  112. #define    NWANT        0x2    /* Want above lock */
  113. #define    NMODIFIED    0x4    /* Might have a modified buffer in bio */
  114. #define    NWRITEERR    0x8    /* Flag write errors so close will know */
  115.  
  116. /*
  117.  * Prototypes for NFS vnode operations
  118.  */
  119. int    nfs_lookup __P((
  120.         struct vnode *vp,
  121.         struct nameidata *ndp,
  122.         struct proc *p));
  123. int    nfs_create __P((
  124.         struct nameidata *ndp,
  125.         struct vattr *vap,
  126.         struct proc *p));
  127. int    nfs_mknod __P((
  128.         struct nameidata *ndp,
  129.         struct vattr *vap,
  130.         struct ucred *cred,
  131.         struct proc *p));
  132. int    nfs_open __P((
  133.         struct vnode *vp,
  134.         int mode,
  135.         struct ucred *cred,
  136.         struct proc *p));
  137. int    nfs_close __P((
  138.         struct vnode *vp,
  139.         int fflag,
  140.         struct ucred *cred,
  141.         struct proc *p));
  142. int    nfs_access __P((
  143.         struct vnode *vp,
  144.         int mode,
  145.         struct ucred *cred,
  146.         struct proc *p));
  147. int    nfs_getattr __P((
  148.         struct vnode *vp,
  149.         struct vattr *vap,
  150.         struct ucred *cred,
  151.         struct proc *p));
  152. int    nfs_setattr __P((
  153.         struct vnode *vp,
  154.         struct vattr *vap,
  155.         struct ucred *cred,
  156.         struct proc *p));
  157. int    nfs_read __P((
  158.         struct vnode *vp,
  159.         struct uio *uio,
  160.         int ioflag,
  161.         struct ucred *cred));
  162. int    nfs_write __P((
  163.         struct vnode *vp,
  164.         struct uio *uio,
  165.         int ioflag,
  166.         struct ucred *cred));
  167. #define nfs_ioctl ((int (*) __P(( \
  168.         struct vnode *vp, \
  169.         int command, \
  170.         caddr_t data, \
  171.         int fflag, \
  172.         struct ucred *cred, \
  173.         struct proc *p))) enoioctl)
  174. #define nfs_select ((int (*) __P(( \
  175.         struct vnode *vp, \
  176.         int which, \
  177.         int fflags, \
  178.         struct ucred *cred, \
  179.         struct proc *p))) seltrue)
  180. int    nfs_mmap __P((
  181.         struct vnode *vp,
  182.         int fflags,
  183.         struct ucred *cred,
  184.         struct proc *p));
  185. int    nfs_fsync __P((
  186.         struct vnode *vp,
  187.         int fflags,
  188.         struct ucred *cred,
  189.         int waitfor,
  190.         struct proc *p));
  191. #define nfs_seek ((int (*) __P(( \
  192.         struct vnode *vp, \
  193.         off_t oldoff, \
  194.         off_t newoff, \
  195.         struct ucred *cred))) nullop)
  196. int    nfs_remove __P((
  197.         struct nameidata *ndp,
  198.         struct proc *p));
  199. int    nfs_link __P((
  200.         struct vnode *vp,
  201.         struct nameidata *ndp,
  202.         struct proc *p));
  203. int    nfs_rename __P((
  204.         struct nameidata *fndp,
  205.         struct nameidata *tdnp,
  206.         struct proc *p));
  207. int    nfs_mkdir __P((
  208.         struct nameidata *ndp,
  209.         struct vattr *vap,
  210.         struct proc *p));
  211. int    nfs_rmdir __P((
  212.         struct nameidata *ndp,
  213.         struct proc *p));
  214. int    nfs_symlink __P((
  215.         struct nameidata *ndp,
  216.         struct vattr *vap,
  217.         char *target,
  218.         struct proc *p));
  219. int    nfs_readdir __P((
  220.         struct vnode *vp,
  221.         struct uio *uio,
  222.         struct ucred *cred,
  223.         int *eofflagp));
  224. int    nfs_readlink __P((
  225.         struct vnode *vp,
  226.         struct uio *uio,
  227.         struct ucred *cred));
  228. int    nfs_abortop __P((
  229.         struct nameidata *ndp));
  230. int    nfs_inactive __P((
  231.         struct vnode *vp,
  232.         struct proc *p));
  233. int    nfs_reclaim __P((
  234.         struct vnode *vp));
  235. int    nfs_lock __P((
  236.         struct vnode *vp));
  237. int    nfs_unlock __P((
  238.         struct vnode *vp));
  239. int    nfs_bmap __P((
  240.         struct vnode *vp,
  241.         daddr_t bn,
  242.         struct vnode **vpp,
  243.         daddr_t *bnp));
  244. int    nfs_strategy __P((
  245.         struct buf *bp));
  246. int    nfs_print __P((
  247.         struct vnode *vp));
  248. int    nfs_islocked __P((
  249.         struct vnode *vp));
  250. int    nfs_advlock __P((
  251.         struct vnode *vp,
  252.         caddr_t id,
  253.         int op,
  254.         struct flock *fl,
  255.         int flags));
  256.