]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/amd/include/nfs_common.h
MFC r308493, r308619: Update amd from am-utils 6.1.5 to 6.2.
[FreeBSD/stable/10.git] / contrib / amd / include / nfs_common.h
1 /*
2  * Copyright (c) 2011 Christos Zoulas
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the University nor the names of its contributors
14  *    may be used to endorse or promote products derived from this software
15  *    without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  *
30  * File: am-utils/include/nfs_common.c
31  *
32  */
33 struct nfs_common_args {
34   u_long flags;
35   u_long acdirmin;
36   u_long acdirmax;
37   u_long acregmin;
38   u_long acregmax;
39   u_long timeo;
40   u_long retrans;
41   u_long rsize;
42   u_long wsize;
43 };
44
45 #ifdef HAVE_NFS_ARGS_T_ACREGMIN
46 #define GET_ACREGMIN(nap, a) nap->acregmin = a.acregmin;
47 #define PUT_ACREGMIN(nap, a) a.acregmin = nap->acregmin;
48 #else
49 #define GET_ACREGMIN(nap, a)
50 #define PUT_ACREGMIN(nap, a)
51 #endif
52 #ifdef HAVE_NFS_ARGS_T_ACREGMAX
53 #define GET_ACREGMAX(nap, a) nap->acregmax = a.acregmax;
54 #define PUT_ACREGMAX(nap, a) a.acregmax = nap->acregmax;
55 #else
56 #define GET_ACREGMAX(nap, a)
57 #define PUT_ACREGMAX(nap, a)
58 #endif
59
60 #ifdef HAVE_NFS_ARGS_T_ACDIRMIN
61 #define GET_ACDIRMIN(nap, a) nap->acdirmin = a.acdirmin;
62 #define PUT_ACDIRMIN(nap, a) a.acdirmin = nap->acdirmin;
63 #else
64 #define GET_ACDIRMIN(nap, a)
65 #define PUT_ACDIRMIN(nap, a)
66 #endif
67 #ifdef HAVE_NFS_ARGS_T_ACDIRMAX
68 #define GET_ACDIRMAX(nap, a) nap->acdirmax = a.acdirmax;
69 #define PUT_ACDIRMAX(nap, a) a.acdirmax = nap->acdirmax;
70 #else
71 #define GET_ACDIRMAX(nap, a)
72 #define PUT_ACDIRMAX(nap, a)
73 #endif
74
75 #define get_nfs_common_args(nap, a) \
76   do { \
77     nap->flags = a.flags; \
78     GET_ACREGMIN(nap, a) \
79     GET_ACREGMAX(nap, a) \
80     GET_ACDIRMIN(nap, a) \
81     GET_ACDIRMAX(nap, a) \
82     nap->timeo = a.timeo; \
83     nap->retrans = a.retrans; \
84     nap->rsize = a.rsize; \
85     nap->wsize = a.wsize; \
86   } while (/*CONSTCOND*/0)
87
88 #define put_nfs_common_args(nap, a) \
89   do { \
90     a.flags = nap->flags; \
91     PUT_ACREGMIN(nap, a) \
92     PUT_ACREGMAX(nap, a) \
93     PUT_ACDIRMIN(nap, a) \
94     PUT_ACDIRMAX(nap, a) \
95     a.timeo = nap->timeo; \
96     a.retrans = nap->retrans; \
97     a.rsize = nap->rsize; \
98     a.wsize = nap->wsize; \
99   } while (/*CONSTCOND*/0)