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/nfsm_subs.h

Version: -  FREEBSD  -  FREEBSD11  -  FREEBSD10  -  FREEBSD9  -  FREEBSD92  -  FREEBSD91  -  FREEBSD90  -  FREEBSD8  -  FREEBSD82  -  FREEBSD81  -  FREEBSD80  -  FREEBSD7  -  FREEBSD74  -  FREEBSD73  -  FREEBSD72  -  FREEBSD71  -  FREEBSD70  -  FREEBSD6  -  FREEBSD64  -  FREEBSD63  -  FREEBSD62  -  FREEBSD61  -  FREEBSD60  -  FREEBSD5  -  FREEBSD55  -  FREEBSD54  -  FREEBSD53  -  FREEBSD52  -  FREEBSD51  -  FREEBSD50  -  FREEBSD4  -  FREEBSD3  -  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
    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  * 4. Neither the name of the University nor the names of its contributors
   17  *    may be used to endorse or promote products derived from this software
   18  *    without specific prior written permission.
   19  *
   20  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   30  * SUCH DAMAGE.
   31  *
   32  *      @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95
   33  * $FreeBSD: src/sys/nfsclient/nfsm_subs.h,v 1.34.2.1 2005/01/31 23:26:46 imp Exp $
   34  */
   35 
   36 #ifndef _NFSCLIENT_NFSM_SUBS_H_
   37 #define _NFSCLIENT_NFSM_SUBS_H_
   38 
   39 #include <nfs/nfs_common.h>
   40 
   41 #define nfsv2tov_type(a)        nv2tov_type[fxdr_unsigned(u_int32_t,(a))&0x7]
   42 
   43 struct ucred;
   44 struct vnode;
   45 
   46 /*
   47  * These macros do strange and peculiar things to mbuf chains for
   48  * the assistance of the nfs code. To attempt to use them for any
   49  * other purpose will be dangerous. (they make weird assumptions)
   50  */
   51 
   52 /*
   53  * First define what the actual subs. return
   54  */
   55 struct mbuf *nfsm_reqhead(struct vnode *vp, u_long procid, int hsiz);
   56 struct mbuf *nfsm_rpchead(struct ucred *cr, int nmflag, int procid,
   57                           int auth_type, int auth_len,
   58                           struct mbuf *mrest, int mrest_len,
   59                           struct mbuf **mbp, u_int32_t *xidp);
   60 
   61 #define M_HASCL(m)      ((m)->m_flags & M_EXT)
   62 #define NFSMINOFF(m) \
   63         do { \
   64                 if (M_HASCL(m)) \
   65                         (m)->m_data = (m)->m_ext.ext_buf; \
   66                 else if ((m)->m_flags & M_PKTHDR) \
   67                         (m)->m_data = (m)->m_pktdat; \
   68                 else \
   69                         (m)->m_data = (m)->m_dat; \
   70         } while (0)
   71 #define NFSMSIZ(m)      ((M_HASCL(m))?MCLBYTES: \
   72                                 (((m)->m_flags & M_PKTHDR)?MHLEN:MLEN))
   73 
   74 /*
   75  * Now for the macros that do the simple stuff and call the functions
   76  * for the hard stuff.
   77  * These macros use several vars. declared in nfsm_reqhead and these
   78  * vars. must not be used elsewhere unless you are careful not to corrupt
   79  * them. The vars. starting with pN and tN (N=1,2,3,..) are temporaries
   80  * that may be used so long as the value is not expected to retained
   81  * after a macro.
   82  * I know, this is kind of dorkey, but it makes the actual op functions
   83  * fairly clean and deals with the mess caused by the xdr discriminating
   84  * unions.
   85  */
   86 
   87 
   88 /* *********************************** */
   89 /* Request generation phase macros */
   90 
   91 int     nfsm_fhtom_xx(struct vnode *v, int v3, struct mbuf **mb,
   92             caddr_t *bpos);
   93 void    nfsm_v3attrbuild_xx(struct vattr *va, int full, struct mbuf **mb,
   94             caddr_t *bpos);
   95 int     nfsm_strtom_xx(const char *a, int s, int m, struct mbuf **mb,
   96             caddr_t *bpos);
   97 
   98 #define nfsm_bcheck(t1, mreq) \
   99 do { \
  100         if (t1) { \
  101                 error = t1; \
  102                 m_freem(mreq); \
  103                 goto nfsmout; \
  104         } \
  105 } while (0)
  106 
  107 #define nfsm_fhtom(v, v3) \
  108 do { \
  109         int32_t t1; \
  110         t1 = nfsm_fhtom_xx((v), (v3), &mb, &bpos); \
  111         nfsm_bcheck(t1, mreq); \
  112 } while (0)
  113 
  114 /* If full is true, set all fields, otherwise just set mode and time fields */
  115 #define nfsm_v3attrbuild(a, full) \
  116         nfsm_v3attrbuild_xx(a, full, &mb, &bpos)
  117 
  118 #define nfsm_uiotom(p, s) \
  119 do { \
  120         int t1; \
  121         t1 = nfsm_uiotombuf((p), &mb, (s), &bpos); \
  122         nfsm_bcheck(t1, mreq); \
  123 } while (0)
  124 
  125 #define nfsm_strtom(a, s, m) \
  126 do { \
  127         int t1; \
  128         t1 = nfsm_strtom_xx((a), (s), (m), &mb, &bpos); \
  129         nfsm_bcheck(t1, mreq); \
  130 } while (0)
  131 
  132 /* *********************************** */
  133 /* Send the request */
  134 
  135 #define nfsm_request(v, t, p, c) \
  136 do { \
  137         error = nfs_request((v), mreq, (t), (p), (c), &mrep, &md, &dpos); \
  138         if (error != 0) { \
  139                 if (error & NFSERR_RETERR) \
  140                         error &= ~NFSERR_RETERR; \
  141                 else \
  142                         goto nfsmout; \
  143         } \
  144 } while (0)
  145 
  146 #define nfsm_request_mnt(n, t, p, c) \
  147 do { \
  148         error = nfs4_request_mnt((n), mreq, (t), (p), (c), &mrep, &md, &dpos); \
  149         if (error != 0) { \
  150                 if (error & NFSERR_RETERR) \
  151                         error &= ~NFSERR_RETERR; \
  152                 else \
  153                         goto nfsmout; \
  154         } \
  155 } while (0)
  156 
  157 /* *********************************** */
  158 /* Reply interpretation phase macros */
  159 
  160 int     nfsm_mtofh_xx(struct vnode *d, struct vnode **v, int v3, int *f,
  161             struct mbuf **md, caddr_t *dpos);
  162 int     nfsm_getfh_xx(nfsfh_t **f, int *s, int v3, struct mbuf **md,
  163             caddr_t *dpos);
  164 int     nfsm_loadattr_xx(struct vnode **v, struct vattr *va, struct mbuf **md,
  165             caddr_t *dpos);
  166 int     nfsm_postop_attr_xx(struct vnode **v, int *f, struct mbuf **md,
  167             caddr_t *dpos);
  168 int     nfsm_wcc_data_xx(struct vnode **v, int *f, struct mbuf **md,
  169             caddr_t *dpos);
  170 
  171 #define nfsm_mtofh(d, v, v3, f) \
  172 do { \
  173         int32_t t1; \
  174         t1 = nfsm_mtofh_xx((d), &(v), (v3), &(f), &md, &dpos); \
  175         nfsm_dcheck(t1, mrep); \
  176 } while (0)
  177 
  178 #define nfsm_getfh(f, s, v3) \
  179 do { \
  180         int32_t t1; \
  181         t1 = nfsm_getfh_xx(&(f), &(s), (v3), &md, &dpos); \
  182         nfsm_dcheck(t1, mrep); \
  183 } while (0)
  184 
  185 #define nfsm_loadattr(v, a) \
  186 do { \
  187         int32_t t1; \
  188         t1 = nfsm_loadattr_xx(&v, a, &md, &dpos); \
  189         nfsm_dcheck(t1, mrep); \
  190 } while (0)
  191 
  192 #define nfsm_postop_attr(v, f) \
  193 do { \
  194         int32_t t1; \
  195         t1 = nfsm_postop_attr_xx(&v, &f, &md, &dpos); \
  196         nfsm_dcheck(t1, mrep); \
  197 } while (0)
  198 
  199 /* Used as (f) for nfsm_wcc_data() */
  200 #define NFSV3_WCCRATTR  0
  201 #define NFSV3_WCCCHK    1
  202 
  203 #define nfsm_wcc_data(v, f) \
  204 do { \
  205         int32_t t1; \
  206         t1 = nfsm_wcc_data_xx(&v, &f, &md, &dpos); \
  207         nfsm_dcheck(t1, mrep); \
  208 } while (0)
  209 
  210 #endif

Cache object: 6c8751b5649387ab09c0418d9e429797


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