The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/nfsclient/nfs.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 1989, 1993, 1995
    3  *      The Regents of the University of California.  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       8.4 (Berkeley) 5/1/95
   37  * $FreeBSD: releng/5.0/sys/nfsclient/nfs.h 105563 2002-10-20 21:40:55Z phk $
   38  */
   39 
   40 #ifndef _NFSCLIENT_NFS_H_
   41 #define _NFSCLIENT_NFS_H_
   42 
   43 #ifdef _KERNEL
   44 #include "opt_nfs.h"
   45 #endif
   46 
   47 #include <nfsclient/nfsargs.h>
   48 
   49 /*
   50  * Tunable constants for nfs
   51  */
   52 
   53 #define NFS_TICKINTVL   5               /* Desired time for a tick (msec) */
   54 #define NFS_HZ          (hz / nfs_ticks) /* Ticks/sec */
   55 #define NFS_TIMEO       (1 * NFS_HZ)    /* Default timeout = 1 second */
   56 #define NFS_MINTIMEO    (1 * NFS_HZ)    /* Min timeout to use */
   57 #define NFS_MAXTIMEO    (60 * NFS_HZ)   /* Max timeout to backoff to */
   58 #define NFS_MINIDEMTIMEO (5 * NFS_HZ)   /* Min timeout for non-idempotent ops*/
   59 #define NFS_MAXREXMIT   100             /* Stop counting after this many */
   60 #define NFS_RETRANS     10              /* Num of retrans for soft mounts */
   61 #define NFS_MAXGRPS     16              /* Max. size of groups list */
   62 #ifndef NFS_MINATTRTIMO
   63 #define NFS_MINATTRTIMO 3               /* VREG attrib cache timeout in sec */
   64 #endif
   65 #ifndef NFS_MAXATTRTIMO
   66 #define NFS_MAXATTRTIMO 60
   67 #endif
   68 #ifndef NFS_MINDIRATTRTIMO
   69 #define NFS_MINDIRATTRTIMO 30           /* VDIR attrib cache timeout in sec */
   70 #endif
   71 #ifndef NFS_MAXDIRATTRTIMO
   72 #define NFS_MAXDIRATTRTIMO 60
   73 #endif
   74 #define NFS_WSIZE       8192            /* Def. write data size <= 8192 */
   75 #define NFS_RSIZE       8192            /* Def. read data size <= 8192 */
   76 #define NFS_READDIRSIZE 8192            /* Def. readdir size */
   77 #define NFS_DEFRAHEAD   1               /* Def. read ahead # blocks */
   78 #define NFS_MAXRAHEAD   4               /* Max. read ahead # blocks */
   79 #define NFS_MAXASYNCDAEMON      64      /* Max. number async_daemons runnable */
   80 #define NFS_DIRBLKSIZ   4096            /* Must be a multiple of DIRBLKSIZ */
   81 #ifdef _KERNEL
   82 #define DIRBLKSIZ       512             /* XXX we used to use ufs's DIRBLKSIZ */
   83 #endif
   84 #define NFS_MAXDEADTHRESH       9       /* How long till we say 'server not responding' */
   85 
   86 /*
   87  * Oddballs
   88  */
   89 #define NFS_CMPFH(n, f, s) \
   90         ((n)->n_fhsize == (s) && !bcmp((caddr_t)(n)->n_fhp, (caddr_t)(f), (s)))
   91 #define NFS_ISV3(v)     (VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV3)
   92 
   93 #define NFSSTA_HASWRITEVERF     0x00040000  /* Has write verifier for V3 */
   94 #define NFSSTA_GOTFSINFO        0x00100000  /* Got the V3 fsinfo */
   95 #define NFSSTA_SNDLOCK          0x01000000  /* Send socket lock */
   96 #define NFSSTA_WANTSND          0x02000000  /* Want above */
   97 #define NFSSTA_RCVLOCK          0x04000000  /* Rcv socket lock */
   98 #define NFSSTA_WANTRCV          0x08000000  /* Want above */
   99 
  100 /*
  101  * XXX to allow amd to include nfs.h without nfsproto.h
  102  */
  103 #ifdef NFS_NPROCS
  104 #include <nfsclient/nfsstats.h>
  105 #endif
  106 /*
  107  * Flags for nfsclnt() system call.
  108  */
  109 #define NFSCLNT_LOCKDANS 0x200
  110 
  111 /*
  112  * vfs.nfs sysctl(3) identifiers
  113  */
  114 #define NFS_NFSSTATS    1               /* struct: struct nfsstats */
  115 
  116 #ifdef _KERNEL
  117 
  118 #ifdef MALLOC_DECLARE
  119 MALLOC_DECLARE(M_NFSREQ);
  120 MALLOC_DECLARE(M_NFSDIROFF);
  121 MALLOC_DECLARE(M_NFSBIGFH);
  122 MALLOC_DECLARE(M_NFSHASH);
  123 #endif
  124 
  125 extern struct uma_zone *nfsmount_zone;
  126 
  127 extern struct callout_handle nfs_timer_handle;
  128 extern struct nfsstats nfsstats;
  129 
  130 extern int nfs_numasync;
  131 extern int nfs_pbuf_freecnt;
  132 extern int nfs_ticks;
  133 
  134 /* Data constants in XDR form */
  135 extern u_int32_t nfs_true, nfs_false, nfs_xdrneg1;
  136 extern u_int32_t rpc_reply, rpc_msgdenied, rpc_mismatch, rpc_vers;
  137 extern u_int32_t rpc_auth_unix, rpc_msgaccepted, rpc_call, rpc_autherr;
  138 
  139 extern int nfsv3_procid[NFS_NPROCS];
  140 
  141 struct uio;
  142 struct buf;
  143 struct vattr;
  144 struct nameidata;
  145 
  146 /*
  147  * The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts.
  148  * What should be in this set is open to debate, but I believe that since
  149  * I/O system calls on ufs are never interrupted by signals the set should
  150  * be minimal. My reasoning is that many current programs that use signals
  151  * such as SIGALRM will not expect file I/O system calls to be interrupted
  152  * by them and break.
  153  */
  154 #define NFSINT_SIGMASK(set)                                             \
  155         (SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) ||       \
  156          SIGISMEMBER(set, SIGHUP) || SIGISMEMBER(set, SIGKILL) ||       \
  157          SIGISMEMBER(set, SIGQUIT))
  158 
  159 /*
  160  * Socket errors ignored for connectionless sockets??
  161  * For now, ignore them all
  162  */
  163 #define NFSIGNORE_SOERROR(s, e) \
  164                 ((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \
  165                 ((s) & PR_CONNREQUIRED) == 0)
  166 
  167 /*
  168  * Nfs outstanding request list element
  169  */
  170 struct nfsreq {
  171         TAILQ_ENTRY(nfsreq) r_chain;
  172         struct mbuf     *r_mreq;
  173         struct mbuf     *r_mrep;
  174         struct mbuf     *r_md;
  175         caddr_t         r_dpos;
  176         struct nfsmount *r_nmp;
  177         struct vnode    *r_vp;
  178         u_int32_t       r_xid;
  179         int             r_flags;        /* flags on request, see below */
  180         int             r_retry;        /* max retransmission count */
  181         int             r_rexmit;       /* current retrans count */
  182         int             r_timer;        /* tick counter on reply */
  183         u_int32_t       r_procnum;      /* NFS procedure number */
  184         int             r_rtt;          /* RTT for rpc */
  185         struct thread   *r_td;          /* Proc that did I/O system call */
  186 };
  187 
  188 /*
  189  * Queue head for nfsreq's
  190  */
  191 extern TAILQ_HEAD(nfs_reqq, nfsreq) nfs_reqq;
  192 
  193 /* Flag values for r_flags */
  194 #define R_TIMING        0x01            /* timing request (in mntp) */
  195 #define R_SENT          0x02            /* request has been sent */
  196 #define R_SOFTTERM      0x04            /* soft mnt, too many retries */
  197 #define R_INTR          0x08            /* intr mnt, signal pending */
  198 #define R_SOCKERR       0x10            /* Fatal error on socket */
  199 #define R_TPRINTFMSG    0x20            /* Did a tprintf msg. */
  200 #define R_MUSTRESEND    0x40            /* Must resend request */
  201 #define R_GETONEREP     0x80            /* Probe for one reply only */
  202 
  203 /*
  204  * Defines for WebNFS
  205  */
  206 
  207 #define WEBNFS_ESC_CHAR         '%'
  208 #define WEBNFS_SPECCHAR_START   0x80
  209 
  210 #define WEBNFS_NATIVE_CHAR      0x80
  211 /*
  212  * ..
  213  * Possibly more here in the future.
  214  */
  215 
  216 /*
  217  * Macro for converting escape characters in WebNFS pathnames.
  218  * Should really be in libkern.
  219  */
  220 
  221 #define HEXTOC(c) \
  222         ((c) >= 'a' ? ((c) - ('a' - 10)) : \
  223             ((c) >= 'A' ? ((c) - ('A' - 10)) : ((c) - '')))
  224 #define HEXSTRTOI(p) \
  225         ((HEXTOC(p[0]) << 4) + HEXTOC(p[1]))
  226 
  227 #ifdef NFS_DEBUG
  228 
  229 extern int nfs_debug;
  230 #define NFS_DEBUG_ASYNCIO       1 /* asynchronous i/o */
  231 #define NFS_DEBUG_WG            2 /* server write gathering */
  232 #define NFS_DEBUG_RC            4 /* server request caching */
  233 
  234 #define NFS_DPF(cat, args)                                      \
  235         do {                                                    \
  236                 if (nfs_debug & NFS_DEBUG_##cat) printf args;   \
  237         } while (0)
  238 
  239 #else
  240 
  241 #define NFS_DPF(cat, args)
  242 
  243 #endif
  244 
  245 vfs_init_t nfs_init;
  246 vfs_uninit_t nfs_uninit;
  247 int     nfs_mountroot(struct mount *mp, struct thread *td);
  248 int     nfs_send(struct socket *, struct sockaddr *, struct mbuf *,
  249             struct nfsreq *);
  250 int     nfs_sndlock(struct nfsreq *);
  251 void    nfs_sndunlock(struct nfsreq *);
  252 int     nfs_vinvalbuf(struct vnode *, int, struct ucred *, struct thread *,
  253             int);
  254 int     nfs_readrpc(struct vnode *, struct uio *, struct ucred *);
  255 int     nfs_writerpc(struct vnode *, struct uio *, struct ucred *, int *,
  256             int *);
  257 int     nfs_commit(struct vnode *vp, u_quad_t offset, int cnt,
  258             struct ucred *cred, struct thread *td);
  259 int     nfs_readdirrpc(struct vnode *, struct uio *, struct ucred *);
  260 int     nfs_nfsiodnew(void);
  261 int     nfs_asyncio(struct buf *, struct ucred *, struct thread *);
  262 int     nfs_doio(struct buf *, struct ucred *, struct thread *);
  263 int     nfs_readlinkrpc(struct vnode *, struct uio *, struct ucred *);
  264 int     nfs_sigintr(struct nfsmount *, struct nfsreq *, struct thread *);
  265 int     nfs_readdirplusrpc(struct vnode *, struct uio *, struct ucred *);
  266 int     nfs_request(struct vnode *, struct mbuf *, int, struct thread *,
  267             struct ucred *, struct mbuf **, struct mbuf **, caddr_t *);
  268 int     nfs_loadattrcache(struct vnode **, struct mbuf **, caddr_t *,
  269             struct vattr *, int);
  270 int     nfsm_mbuftouio(struct mbuf **, struct uio *, int, caddr_t *);
  271 void    nfs_nhinit(void);
  272 int     nfs_nmcancelreqs(struct nfsmount *);
  273 void    nfs_timer(void*);
  274 int     nfs_connect(struct nfsmount *, struct nfsreq *);
  275 void    nfs_disconnect(struct nfsmount *);
  276 void    nfs_safedisconnect(struct nfsmount *);
  277 int     nfs_getattrcache(struct vnode *, struct vattr *);
  278 int     nfsm_strtmbuf(struct mbuf **, char **, const char *, long);
  279 int     nfs_bioread(struct vnode *, struct uio *, int, struct ucred *);
  280 int     nfsm_uiotombuf(struct uio *, struct mbuf **, int, caddr_t *);
  281 void    nfs_clearcommit(struct mount *);
  282 int     nfs_writebp(struct buf *, int, struct thread *);
  283 int     nfs_fsinfo(struct nfsmount *, struct vnode *, struct ucred *,
  284             struct thread *);
  285 int     nfs_meta_setsize (struct vnode *, struct ucred *,
  286             struct thread *, u_quad_t);
  287 
  288 #endif  /* _KERNEL */
  289 
  290 #endif

Cache object: dcd9a508e6f41833b5a8a4c33be7affd


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.