home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / sys / nfs / nfs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-09  |  5.7 KB  |  165 lines

  1. /*
  2.  * Copyright (c) 1989 The Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * This code is derived from software contributed to Berkeley by
  6.  * Rick Macklem at The University of Guelph.
  7.  *
  8.  * Redistribution and use in source and binary forms, with or without
  9.  * modification, are permitted provided that the following conditions
  10.  * are met:
  11.  * 1. Redistributions of source code must retain the above copyright
  12.  *    notice, this list of conditions and the following disclaimer.
  13.  * 2. Redistributions in binary form must reproduce the above copyright
  14.  *    notice, this list of conditions and the following disclaimer in the
  15.  *    documentation and/or other materials provided with the distribution.
  16.  * 3. All advertising materials mentioning features or use of this software
  17.  *    must display the following acknowledgement:
  18.  *    This product includes software developed by the University of
  19.  *    California, Berkeley and its contributors.
  20.  * 4. Neither the name of the University nor the names of its contributors
  21.  *    may be used to endorse or promote products derived from this software
  22.  *    without specific prior written permission.
  23.  *
  24.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  25.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  27.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  28.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  30.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  31.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  32.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  33.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  34.  * SUCH DAMAGE.
  35.  *
  36.  *    @(#)nfs.h    7.11 (Berkeley) 4/19/91
  37.  */
  38.  
  39. /*
  40.  * Tunable constants for nfs
  41.  */
  42.  
  43. #define    NFS_MAXIOVEC    34
  44. #define NFS_HZ        10        /* Ticks per second for NFS timeouts */
  45. #define    NFS_TIMEO    (1*NFS_HZ)    /* Default timeout = 1 second */
  46. #define    NFS_MINTIMEO    (NFS_HZ)    /* Min timeout to use */
  47. #define    NFS_MAXTIMEO    (60*NFS_HZ)    /* Max timeout to backoff to */
  48. #define    NFS_MINIDEMTIMEO (2*NFS_HZ)    /* Min timeout for non-idempotent ops*/
  49. #define    NFS_RELIABLETIMEO (5*NFS_HZ)    /* Min timeout on reliable sockets */
  50. #define    NFS_MAXREXMIT    100        /* Stop counting after this many */
  51. #define    NFS_MAXWINDOW    1024        /* Max number of outstanding requests */
  52. #define    NFS_RETRANS    10        /* Num of retrans for soft mounts */
  53. #define NFS_FISHY    8        /* Host not responding at this count */
  54. #define    NFS_ATTRTIMEO    5        /* Attribute cache timeout in sec */
  55. #define    NFS_WSIZE    8192        /* Def. write data size <= 8192 */
  56. #define    NFS_RSIZE    8192        /* Def. read data size <= 8192 */
  57. #define    NFS_MAXREADDIR    NFS_MAXDATA    /* Max. size of directory read */
  58. #define    NFS_MAXASYNCDAEMON 20        /* Max. number async_daemons runable */
  59. #define    NFS_DIRBLKSIZ    1024        /* Size of an NFS directory block */
  60. #define    NMOD(a)        ((a) % nfs_asyncdaemons)
  61.  
  62. /*
  63.  * The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts.
  64.  * What should be in this set is open to debate, but I believe that since
  65.  * I/O system calls on ufs are never interrupted by signals the set should
  66.  * be minimal. My reasoning is that many current programs that use signals
  67.  * such as SIGALRM will not expect file I/O system calls to be interrupted
  68.  * by them and break.
  69.  */
  70. #define    NFSINT_SIGMASK    (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \
  71.              sigmask(SIGHUP)|sigmask(SIGQUIT))
  72.  
  73. /*
  74.  * Socket errors ignored for connectionless sockets??
  75.  * For now, ignore them all
  76.  */
  77. #define    NFSIGNORE_SOERROR(s, e) \
  78.         ((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \
  79.         ((s) & PR_CONNREQUIRED) == 0)
  80.  
  81. /*
  82.  * Nfs outstanding request list element
  83.  */
  84. struct nfsreq {
  85.     struct nfsreq    *r_next;
  86.     struct nfsreq    *r_prev;
  87.     struct mbuf    *r_mreq;
  88.     struct mbuf    *r_mrep;
  89.     struct nfsmount *r_nmp;
  90.     struct vnode    *r_vp;
  91.     u_long        r_xid;
  92.     short        r_flags;    /* flags on request, see below */
  93.     short        r_retry;    /* max retransmission count */
  94.     short        r_rexmit;    /* current retrans count */
  95.     short        r_timer;    /* tick counter on reply */
  96.     short        r_timerinit;    /* reinit tick counter on reply */
  97.     struct proc    *r_procp;    /* Proc that did I/O system call */
  98. };
  99.  
  100. /* Flag values for r_flags */
  101. #define R_TIMING    0x01        /* timing request (in mntp) */
  102. #define R_SENT        0x02        /* request has been sent */
  103. #define    R_SOFTTERM    0x04        /* soft mnt, too many retries */
  104. #define    R_INTR        0x08        /* intr mnt, signal pending */
  105. #define    R_SOCKERR    0x10        /* Fatal error on socket */
  106. #define    R_TPRINTFMSG    0x20        /* Did a tprintf msg. */
  107. #define    R_MUSTRESEND    0x40        /* Must resend request */
  108.  
  109. #ifdef    KERNEL
  110. /*
  111.  * Silly rename structure that hangs off the nfsnode until the name
  112.  * can be removed by nfs_inactive()
  113.  */
  114. struct sillyrename {
  115.     nfsv2fh_t s_fh;
  116.     struct    ucred *s_cred;
  117.     struct    vnode *s_dvp;
  118.     u_short    s_namlen;
  119.     char    s_name[20];
  120. };
  121.  
  122. /* And its flag values */
  123. #define REMOVE        0
  124. #define    RMDIR        1
  125. #endif    /* KERNEL */
  126.  
  127. /*
  128.  * Stats structure
  129.  */
  130. struct nfsstats {
  131.     int    attrcache_hits;
  132.     int    attrcache_misses;
  133.     int    lookupcache_hits;
  134.     int    lookupcache_misses;
  135.     int    direofcache_hits;
  136.     int    direofcache_misses;
  137.     int    biocache_reads;
  138.     int    read_bios;
  139.     int    read_physios;
  140.     int    biocache_writes;
  141.     int    write_bios;
  142.     int    write_physios;
  143.     int    biocache_readlinks;
  144.     int    readlink_bios;
  145.     int    biocache_readdirs;
  146.     int    readdir_bios;
  147.     int    rpccnt[NFS_NPROCS];
  148.     int    rpcretries;
  149.     int    srvrpccnt[NFS_NPROCS];
  150.     int    srvrpc_errs;
  151.     int    srv_errs;
  152.     int    rpcrequests;
  153.     int    rpctimeouts;
  154.     int    rpcunexpected;
  155.     int    rpcinvalid;
  156.     int    srvcache_inproghits;
  157.     int    srvcache_idemdonehits;
  158.     int    srvcache_nonidemdonehits;
  159.     int    srvcache_misses;
  160. };
  161.  
  162. #ifdef KERNEL
  163. struct nfsstats nfsstats;
  164. #endif /* KERNEL */
  165.