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/fs/nfs/nfsdport.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
    3  *
    4  * Copyright (c) 2009 Rick Macklem, University of Guelph
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  *
   16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   26  * SUCH DAMAGE.
   27  *
   28  * $FreeBSD$
   29  */
   30 
   31 /*
   32  * These macros handle nfsvattr fields. They look a bit silly here, but
   33  * are quite different for the Darwin port.
   34  */
   35 #define NFSVNO_ATTRINIT(n)              (VATTR_NULL(&((n)->na_vattr)))
   36 #define NFSVNO_SETATTRVAL(n, f, v)      ((n)->na_##f = (v))
   37 #define NFSVNO_SETACTIVE(n, f)
   38 #define NFSVNO_UNSET(n, f)              ((n)->na_##f = VNOVAL)
   39 #define NFSVNO_NOTSETMODE(n)            ((n)->na_mode == ((mode_t)VNOVAL))
   40 #define NFSVNO_ISSETMODE(n)             ((n)->na_mode != ((mode_t)VNOVAL))
   41 #define NFSVNO_NOTSETUID(n)             ((n)->na_uid == ((uid_t)VNOVAL))
   42 #define NFSVNO_ISSETUID(n)              ((n)->na_uid != ((uid_t)VNOVAL))
   43 #define NFSVNO_NOTSETGID(n)             ((n)->na_gid == ((gid_t)VNOVAL))
   44 #define NFSVNO_ISSETGID(n)              ((n)->na_gid != ((gid_t)VNOVAL))
   45 #define NFSVNO_NOTSETSIZE(n)            ((n)->na_size == VNOVAL)
   46 #define NFSVNO_ISSETSIZE(n)             ((n)->na_size != VNOVAL)
   47 #define NFSVNO_NOTSETATIME(n)           ((n)->na_atime.tv_sec == VNOVAL)
   48 #define NFSVNO_ISSETATIME(n)            ((n)->na_atime.tv_sec != VNOVAL)
   49 #define NFSVNO_NOTSETMTIME(n)           ((n)->na_mtime.tv_sec == VNOVAL)
   50 #define NFSVNO_ISSETMTIME(n)            ((n)->na_mtime.tv_sec != VNOVAL)
   51 
   52 /*
   53  * This structure acts as a "catch-all" for information that
   54  * needs to be returned by nfsd_fhtovp().
   55  */
   56 struct nfsexstuff {
   57         int     nes_exflag;                     /* export flags */
   58         int     nes_numsecflavor;               /* # of security flavors */
   59         int     nes_secflavors[MAXSECFLAVORS];  /* and the flavors */
   60 };
   61 
   62 /*
   63  * These are NO-OPS for BSD until Isilon upstreams EXITCODE support.
   64  * EXITCODE is an in-memory ring buffer that holds the routines failing status.
   65  * This is a valuable tool to use when debugging and analyzing issues.
   66  * In addition to recording a routine's failing status, it offers
   67  * logging of routines for call stack tracing.
   68  * EXITCODE should be used only in routines that return a true errno value, as
   69  * that value will be formatted to a displayable errno string.  Routines that 
   70  * return regular int status that are not true errno should not set EXITCODE.
   71  * If you want to log routine tracing, you can add EXITCODE(0) to any routine.
   72  * NFS extended the EXITCODE with EXITCODE2 to record either the routine's
   73  * exit errno status or the nd_repstat.
   74  */
   75 #define NFSEXITCODE(error)
   76 #define NFSEXITCODE2(error, nd)
   77 
   78 #define NFSVNO_EXINIT(e)                ((e)->nes_exflag = 0)
   79 #define NFSVNO_EXPORTED(e)              ((e)->nes_exflag & MNT_EXPORTED)
   80 #define NFSVNO_EXRDONLY(e)              ((e)->nes_exflag & MNT_EXRDONLY)
   81 #define NFSVNO_EXPORTANON(e)            ((e)->nes_exflag & MNT_EXPORTANON)
   82 #define NFSVNO_EXSTRICTACCESS(e)        ((e)->nes_exflag & MNT_EXSTRICTACCESS)
   83 #define NFSVNO_EXV4ONLY(e)              ((e)->nes_exflag & MNT_EXV4ONLY)
   84 
   85 #define NFSVNO_SETEXRDONLY(e)   ((e)->nes_exflag = (MNT_EXPORTED|MNT_EXRDONLY))
   86 
   87 #define NFSVNO_CMPFH(f1, f2)                                            \
   88     (fsidcmp(&(f1)->fh_fsid, &(f2)->fh_fsid) == 0 &&                    \
   89      bcmp(&(f1)->fh_fid, &(f2)->fh_fid, sizeof(struct fid)) == 0)
   90 
   91 #define NFSLOCKHASH(f)                                                  \
   92         (&nfslockhash[nfsrv_hashfh(f) % nfsrv_lockhashsize])
   93 
   94 #define NFSFPVNODE(f)   ((struct vnode *)((f)->f_data))
   95 #define NFSFPCRED(f)    ((f)->f_cred)
   96 #define NFSFPFLAG(f)    ((f)->f_flag)
   97 
   98 #define NFSNAMEICNDSET(n, c, o, f)      do {                            \
   99         (n)->cn_cred = (c);                                             \
  100         (n)->cn_nameiop = (o);                                          \
  101         (n)->cn_flags = (f);                                            \
  102     } while (0)
  103 
  104 /*
  105  * A little bit of Darwin vfs kpi.
  106  */
  107 #define vnode_mount(v)  ((v)->v_mount)
  108 #define vfs_statfs(m)   (&((m)->mnt_stat))
  109 
  110 #define NFSPATHLEN_T    size_t
  111 
  112 /*
  113  * These are set to the minimum and maximum size of a server file
  114  * handle.
  115  */
  116 #define NFSRV_MINFH     (sizeof (fhandle_t))
  117 #define NFSRV_MAXFH     (sizeof (fhandle_t))
  118 
  119 /* Use this macro for debug printfs. */
  120 #define NFSD_DEBUG(level, ...)  do {                                    \
  121                 if (nfsd_debuglevel >= (level))                         \
  122                         printf(__VA_ARGS__);                            \
  123         } while (0)
  124 

Cache object: 88c8374bed5e5c19820bc5eb560cc54d


[ 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.