home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / os / bsdss4.tz / bsdss4 / bsdss / server / nfs / nfs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-22  |  6.8 KB  |  199 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:    nfs.h,v $
  29.  * Revision 2.1  92/04/21  17:15:04  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.  *    @(#)nfs.h    7.11 (Berkeley) 4/19/91
  71.  */
  72.  
  73. /*
  74.  * Tunable constants for nfs
  75.  */
  76.  
  77. #define    NFS_MAXIOVEC    34
  78. #define NFS_HZ        10        /* Ticks per second for NFS timeouts */
  79. #define    NFS_TIMEO    (1*NFS_HZ)    /* Default timeout = 1 second */
  80. #define    NFS_MINTIMEO    (NFS_HZ)    /* Min timeout to use */
  81. #define    NFS_MAXTIMEO    (60*NFS_HZ)    /* Max timeout to backoff to */
  82. #define    NFS_MINIDEMTIMEO (2*NFS_HZ)    /* Min timeout for non-idempotent ops*/
  83. #define    NFS_RELIABLETIMEO (5*NFS_HZ)    /* Min timeout on reliable sockets */
  84. #define    NFS_MAXREXMIT    100        /* Stop counting after this many */
  85. #define    NFS_MAXWINDOW    1024        /* Max number of outstanding requests */
  86. #define    NFS_RETRANS    10        /* Num of retrans for soft mounts */
  87. #define NFS_FISHY    8        /* Host not responding at this count */
  88. #define    NFS_ATTRTIMEO    5        /* Attribute cache timeout in sec */
  89. #define    NFS_WSIZE    8192        /* Def. write data size <= 8192 */
  90. #define    NFS_RSIZE    8192        /* Def. read data size <= 8192 */
  91. #define    NFS_MAXREADDIR    NFS_MAXDATA    /* Max. size of directory read */
  92. #define    NFS_MAXASYNCDAEMON 20        /* Max. number async_daemons runable */
  93. #define    NFS_DIRBLKSIZ    1024        /* Size of an NFS directory block */
  94. #define    NMOD(a)        ((a) % nfs_asyncdaemons)
  95.  
  96. /*
  97.  * The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts.
  98.  * What should be in this set is open to debate, but I believe that since
  99.  * I/O system calls on ufs are never interrupted by signals the set should
  100.  * be minimal. My reasoning is that many current programs that use signals
  101.  * such as SIGALRM will not expect file I/O system calls to be interrupted
  102.  * by them and break.
  103.  */
  104. #define    NFSINT_SIGMASK    (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \
  105.              sigmask(SIGHUP)|sigmask(SIGQUIT))
  106.  
  107. /*
  108.  * Socket errors ignored for connectionless sockets??
  109.  * For now, ignore them all
  110.  */
  111. #define    NFSIGNORE_SOERROR(s, e) \
  112.         ((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \
  113.         ((s) & PR_CONNREQUIRED) == 0)
  114.  
  115. /*
  116.  * Nfs outstanding request list element
  117.  */
  118. struct nfsreq {
  119.     struct nfsreq    *r_next;
  120.     struct nfsreq    *r_prev;
  121.     struct mbuf    *r_mreq;
  122.     struct mbuf    *r_mrep;
  123.     struct nfsmount *r_nmp;
  124.     struct vnode    *r_vp;
  125.     u_long        r_xid;
  126.     short        r_flags;    /* flags on request, see below */
  127.     short        r_retry;    /* max retransmission count */
  128.     short        r_rexmit;    /* current retrans count */
  129.     short        r_timer;    /* tick counter on reply */
  130.     short        r_timerinit;    /* reinit tick counter on reply */
  131.     struct proc    *r_procp;    /* Proc that did I/O system call */
  132. };
  133.  
  134. /* Flag values for r_flags */
  135. #define R_TIMING    0x01        /* timing request (in mntp) */
  136. #define R_SENT        0x02        /* request has been sent */
  137. #define    R_SOFTTERM    0x04        /* soft mnt, too many retries */
  138. #define    R_INTR        0x08        /* intr mnt, signal pending */
  139. #define    R_SOCKERR    0x10        /* Fatal error on socket */
  140. #define    R_TPRINTFMSG    0x20        /* Did a tprintf msg. */
  141. #define    R_MUSTRESEND    0x40        /* Must resend request */
  142.  
  143. #ifdef    KERNEL
  144. /*
  145.  * Silly rename structure that hangs off the nfsnode until the name
  146.  * can be removed by nfs_inactive()
  147.  */
  148. struct sillyrename {
  149.     nfsv2fh_t s_fh;
  150.     struct    ucred *s_cred;
  151.     struct    vnode *s_dvp;
  152.     u_short    s_namlen;
  153.     char    s_name[20];
  154. };
  155.  
  156. /* And its flag values */
  157. #define REMOVE        0
  158. #define    RMDIR        1
  159. #endif    /* KERNEL */
  160.  
  161. /*
  162.  * Stats structure
  163.  */
  164. struct nfsstats {
  165.     int    attrcache_hits;
  166.     int    attrcache_misses;
  167.     int    lookupcache_hits;
  168.     int    lookupcache_misses;
  169.     int    direofcache_hits;
  170.     int    direofcache_misses;
  171.     int    biocache_reads;
  172.     int    read_bios;
  173.     int    read_physios;
  174.     int    biocache_writes;
  175.     int    write_bios;
  176.     int    write_physios;
  177.     int    biocache_readlinks;
  178.     int    readlink_bios;
  179.     int    biocache_readdirs;
  180.     int    readdir_bios;
  181.     int    rpccnt[NFS_NPROCS];
  182.     int    rpcretries;
  183.     int    srvrpccnt[NFS_NPROCS];
  184.     int    srvrpc_errs;
  185.     int    srv_errs;
  186.     int    rpcrequests;
  187.     int    rpctimeouts;
  188.     int    rpcunexpected;
  189.     int    rpcinvalid;
  190.     int    srvcache_inproghits;
  191.     int    srvcache_idemdonehits;
  192.     int    srvcache_nonidemdonehits;
  193.     int    srvcache_misses;
  194. };
  195.  
  196. #ifdef KERNEL
  197. struct nfsstats nfsstats;
  198. #endif /* KERNEL */
  199.