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/nfsserver/nfsm_subs.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-3-Clause
    3  *
    4  * Copyright (c) 1989, 1993
    5  *      The Regents of the University of California.  All rights reserved.
    6  *
    7  * This code is derived from software contributed to Berkeley by
    8  * Rick Macklem at The University of Guelph.
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions
   12  * are met:
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  * 2. Redistributions in binary form must reproduce the above copyright
   16  *    notice, this list of conditions and the following disclaimer in the
   17  *    documentation and/or other materials provided with the distribution.
   18  * 3. Neither the name of the University nor the names of its contributors
   19  *    may be used to endorse or promote products derived from this software
   20  *    without specific prior written permission.
   21  *
   22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   32  * SUCH DAMAGE.
   33  *
   34  *      @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95
   35  * $FreeBSD$
   36  */
   37 
   38 #ifndef _NFSSERVER_NFSM_SUBS_H_
   39 #define _NFSSERVER_NFSM_SUBS_H_
   40 
   41 #include <nfs/nfs_common.h>
   42 
   43 #define nfstov_mode(a)  (fxdr_unsigned(u_int32_t, (a)) & ALLPERMS)
   44 
   45 /*
   46  * These macros do strange and peculiar things to mbuf chains for
   47  * the assistance of the nfs code. To attempt to use them for any
   48  * other purpose will be dangerous. (they make weird assumptions)
   49  */
   50 
   51 /*
   52  * Now for the macros that do the simple stuff and call the functions
   53  * for the hard stuff.
   54  * These macros use several vars. declared in nfsm_reqhead and these
   55  * vars. must not be used elsewhere unless you are careful not to corrupt
   56  * them. The vars. starting with pN and tN (N=1,2,3,..) are temporaries
   57  * that may be used so long as the value is not expected to retained
   58  * after a macro.
   59  * I know, this is kind of dorkey, but it makes the actual op functions
   60  * fairly clean and deals with the mess caused by the xdr discriminating
   61  * unions.
   62  */
   63 
   64 
   65 
   66 /* ************************************* */
   67 /* Dissection phase macros */
   68 
   69 int     nfsm_srvstrsiz_xx(int *s, int m, struct mbuf **md, caddr_t *dpos);
   70 int     nfsm_srvnamesiz_xx(int *s, int m, struct mbuf **md, caddr_t *dpos);
   71 int     nfsm_srvnamesiz0_xx(int *s, int m, struct mbuf **md, caddr_t *dpos);
   72 int     nfsm_srvmtofh_xx(fhandle_t *f, int v3, struct mbuf **md, caddr_t *dpos);
   73 int     nfsm_srvsattr_xx(struct vattr *a, struct mbuf **md, caddr_t *dpos);
   74 
   75 #define nfsm_srvstrsiz(s, m) \
   76 do { \
   77         int t1; \
   78         t1 = nfsm_srvstrsiz_xx(&(s), (m), &md, &dpos); \
   79         if (t1) { \
   80                 error = t1; \
   81                 nfsm_reply(0); \
   82         } \
   83 } while (0)
   84 
   85 #define nfsm_srvnamesiz(s) \
   86 do { \
   87         int t1; \
   88         t1 = nfsm_srvnamesiz_xx(&(s), NFS_MAXNAMLEN, &md, &dpos); \
   89         if (t1) { \
   90                 error = t1; \
   91                 nfsm_reply(0); \
   92         } \
   93 } while (0)
   94 
   95 #define nfsm_srvpathsiz(s) \
   96 do { \
   97         int t1; \
   98         t1 = nfsm_srvnamesiz0_xx(&(s), NFS_MAXPATHLEN, &md, &dpos); \
   99         if (t1) { \
  100                 error = t1; \
  101                 nfsm_reply(0); \
  102         } \
  103 } while (0)
  104 
  105 #define nfsm_srvmtofh(f) \
  106 do { \
  107         int t1; \
  108         t1 = nfsm_srvmtofh_xx((f), nfsd->nd_flag & ND_NFSV3, &md, &dpos); \
  109         if (t1) { \
  110                 error = t1; \
  111                 nfsm_reply(0); \
  112         } \
  113 } while (0)
  114 
  115 /* XXX why is this different? */
  116 #define nfsm_srvsattr(a) \
  117 do { \
  118         int t1; \
  119         t1 = nfsm_srvsattr_xx((a), &md, &dpos); \
  120         if (t1) { \
  121                 error = t1; \
  122                 m_freem(mrep); \
  123                 mrep = NULL; \
  124                 goto nfsmout; \
  125         } \
  126 } while (0)
  127 
  128 /* ************************************* */
  129 /* Prepare the reply */
  130 
  131 #define nfsm_reply(s) \
  132 do { \
  133         if (mrep != NULL) { \
  134                 m_freem(mrep); \
  135                 mrep = NULL; \
  136         } \
  137         mreq = nfs_rephead((s), nfsd, error, &mb, &bpos); \
  138         *mrq = mreq; \
  139         if (error == EBADRPC) { \
  140                 error = 0; \
  141                 goto nfsmout; \
  142         } \
  143 } while (0)
  144 
  145 #define nfsm_writereply(s) \
  146 do { \
  147         mreq = nfs_rephead((s), nfsd, error, &mb, &bpos); \
  148 } while(0)
  149 
  150 /* ************************************* */
  151 /* Reply phase macros - add additional reply info */
  152 
  153 void    nfsm_srvfhtom_xx(fhandle_t *f, int v3, struct mbuf **mb,
  154             caddr_t *bpos);
  155 void    nfsm_srvpostop_fh_xx(fhandle_t *f, struct mbuf **mb, caddr_t *bpos);
  156 void    nfsm_clget_xx(u_int32_t **tl, struct mbuf *mb, struct mbuf **mp,
  157             char **bp, char **be, caddr_t bpos);
  158 
  159 #define nfsm_srvfhtom(f, v3) \
  160         nfsm_srvfhtom_xx((f), (v3), &mb, &bpos)
  161 
  162 #define nfsm_srvpostop_fh(f) \
  163         nfsm_srvpostop_fh_xx((f), &mb, &bpos)
  164 
  165 #define nfsm_srvwcc_data(br, b, ar, a) \
  166         nfsm_srvwcc(nfsd, (br), (b), (ar), (a), &mb, &bpos)
  167 
  168 #define nfsm_srvpostop_attr(r, a) \
  169         nfsm_srvpostopattr(nfsd, (r), (a), &mb, &bpos)
  170 
  171 #define nfsm_srvfillattr(a, f) \
  172         nfsm_srvfattr(nfsd, (a), (f))
  173 
  174 #define nfsm_clget \
  175         nfsm_clget_xx(&tl, mb, &mp, &bp, &be, bpos)
  176 
  177 #endif

Cache object: 2f655924e07ca1c3465ff3463d6b0317


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