Home | History | Annotate | Line # | Download | only in include
      1 /*	$NetBSD: nfs_common.h,v 1.1.1.1 2015/01/17 16:34:18 christos Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 2011 Christos Zoulas
      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  * 3. Neither the name of the University nor the names of its contributors
     16  *    may be used to endorse or promote products derived from this software
     17  *    without specific prior written permission.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29  * SUCH DAMAGE.
     30  *
     31  *
     32  * File: am-utils/include/nfs_common.c
     33  *
     34  */
     35 struct nfs_common_args {
     36   u_long flags;
     37   u_long acdirmin;
     38   u_long acdirmax;
     39   u_long acregmin;
     40   u_long acregmax;
     41   u_long timeo;
     42   u_long retrans;
     43   u_long rsize;
     44   u_long wsize;
     45 };
     46 
     47 #ifdef HAVE_NFS_ARGS_T_ACREGMIN
     48 #define GET_ACREGMIN(nap, a) nap->acregmin = a.acregmin;
     49 #define PUT_ACREGMIN(nap, a) a.acregmin = nap->acregmin;
     50 #else
     51 #define GET_ACREGMIN(nap, a)
     52 #define PUT_ACREGMIN(nap, a)
     53 #endif
     54 #ifdef HAVE_NFS_ARGS_T_ACREGMAX
     55 #define GET_ACREGMAX(nap, a) nap->acregmax = a.acregmax;
     56 #define PUT_ACREGMAX(nap, a) a.acregmax = nap->acregmax;
     57 #else
     58 #define GET_ACREGMAX(nap, a)
     59 #define PUT_ACREGMAX(nap, a)
     60 #endif
     61 
     62 #ifdef HAVE_NFS_ARGS_T_ACDIRMIN
     63 #define GET_ACDIRMIN(nap, a) nap->acdirmin = a.acdirmin;
     64 #define PUT_ACDIRMIN(nap, a) a.acdirmin = nap->acdirmin;
     65 #else
     66 #define GET_ACDIRMIN(nap, a)
     67 #define PUT_ACDIRMIN(nap, a)
     68 #endif
     69 #ifdef HAVE_NFS_ARGS_T_ACDIRMAX
     70 #define GET_ACDIRMAX(nap, a) nap->acdirmax = a.acdirmax;
     71 #define PUT_ACDIRMAX(nap, a) a.acdirmax = nap->acdirmax;
     72 #else
     73 #define GET_ACDIRMAX(nap, a)
     74 #define PUT_ACDIRMAX(nap, a)
     75 #endif
     76 
     77 #define get_nfs_common_args(nap, a) \
     78   do { \
     79     nap->flags = a.flags; \
     80     GET_ACREGMIN(nap, a) \
     81     GET_ACREGMAX(nap, a) \
     82     GET_ACDIRMIN(nap, a) \
     83     GET_ACDIRMAX(nap, a) \
     84     nap->timeo = a.timeo; \
     85     nap->retrans = a.retrans; \
     86     nap->rsize = a.rsize; \
     87     nap->wsize = a.wsize; \
     88   } while (/*CONSTCOND*/0)
     89 
     90 #define put_nfs_common_args(nap, a) \
     91   do { \
     92     a.flags = nap->flags; \
     93     PUT_ACREGMIN(nap, a) \
     94     PUT_ACREGMAX(nap, a) \
     95     PUT_ACDIRMIN(nap, a) \
     96     PUT_ACDIRMAX(nap, a) \
     97     a.timeo = nap->timeo; \
     98     a.retrans = nap->retrans; \
     99     a.rsize = nap->rsize; \
    100     a.wsize = nap->wsize; \
    101   } while (/*CONSTCOND*/0)
    102