Merge branch 'vendor/TNFTP'
[dragonfly.git] / contrib / amd / include / am_compat.h
1 /*
2  * am_compat.h:
3  *
4  * This file contains compatibility functions and macros, all of which
5  * should be auto-discovered, but for one reason or another (mostly
6  * brain-damage on the part of system designers and header files) they cannot.
7  *
8  * Each compatibility macro/function must include instructions on how/when
9  * it can be removed the am-utils code.
10  *
11  */
12
13 #ifndef _AM_COMPAT_H
14 # define _AM_COMPAT_H
15
16 /*
17  * incomplete mount options definitions (sunos4, irix6, linux, etc.)
18  */
19
20
21 /*
22  * Complete MNTTAB_OPT_* options based on MNT2_NFS_OPT_* mount options.
23  */
24 #if defined(MNT2_NFS_OPT_ACDIRMAX) && !defined(MNTTAB_OPT_ACDIRMAX)
25 # define MNTTAB_OPT_ACDIRMAX "acdirmax"
26 #endif /* defined(MNT2_NFS_OPT_ACDIRMAX) && !defined(MNTTAB_OPT_ACDIRMAX) */
27
28 #if defined(MNT2_NFS_OPT_ACDIRMIN) && !defined(MNTTAB_OPT_ACDIRMIN)
29 # define MNTTAB_OPT_ACDIRMIN "acdirmin"
30 #endif /* defined(MNT2_NFS_OPT_ACDIRMIN) && !defined(MNTTAB_OPT_ACDIRMIN) */
31
32 #if defined(MNT2_NFS_OPT_ACREGMAX) && !defined(MNTTAB_OPT_ACREGMAX)
33 # define MNTTAB_OPT_ACREGMAX "acregmax"
34 #endif /* defined(MNT2_NFS_OPT_ACREGMAX) && !defined(MNTTAB_OPT_ACREGMAX) */
35
36 #if defined(MNT2_NFS_OPT_ACREGMIN) && !defined(MNTTAB_OPT_ACREGMIN)
37 # define MNTTAB_OPT_ACREGMIN "acregmin"
38 #endif /* defined(MNT2_NFS_OPT_ACREGMIN) && !defined(MNTTAB_OPT_ACREGMIN) */
39
40 #if !defined(MNTTAB_OPT_IGNORE)
41 /* SunOS 4.1.x and others define "noauto" option, but not "auto" */
42 # if defined(MNTTAB_OPT_NOAUTO) && !defined(MNTTAB_OPT_AUTO)
43 #  define MNTTAB_OPT_AUTO "auto"
44 # endif /* defined(MNTTAB_OPT_NOAUTO) && !defined(MNTTAB_OPT_AUTO) */
45 #endif /* !defined(MNTTAB_OPT_IGNORE) */
46
47 #if defined(MNT2_NFS_OPT_NOAC) && !defined(MNTTAB_OPT_NOAC)
48 # define MNTTAB_OPT_NOAC "noac"
49 #endif /* defined(MNT2_NFS_OPT_NOAC) && !defined(MNTTAB_OPT_NOAC) */
50
51 #if defined(MNT2_NFS_OPT_NOCONN) && !defined(MNTTAB_OPT_NOCONN)
52 # define MNTTAB_OPT_NOCONN "noconn"
53 # ifndef MNTTAB_OPT_CONN
54 #  define MNTTAB_OPT_CONN "conn"
55 # endif /* MNTTAB_OPT_CONN */
56 #endif /* defined(MNT2_NFS_OPT_NOCONN) && !defined(MNTTAB_OPT_NOCONN) */
57
58 #if defined(MNT2_NFS_OPT_PGTHRESH) && !defined(MNTTAB_OPT_PGTHRESH)
59 # define MNTTAB_OPT_PGTHRESH "pgthresh"
60 #endif /* defined(MNT2_NFS_OPT_PGTHRESH) && !defined(MNTTAB_OPT_PGTHRESH) */
61
62 #if defined(MNT2_NFS_OPT_RETRANS) && !defined(MNTTAB_OPT_RETRANS)
63 # define MNTTAB_OPT_RETRANS "retrans"
64 #endif /* defined(MNT2_NFS_OPT_RETRANS) && !defined(MNTTAB_OPT_RETRANS) */
65
66 #if defined(MNT2_NFS_OPT_RSIZE) && !defined(MNTTAB_OPT_RSIZE)
67 # define MNTTAB_OPT_RSIZE "rsize"
68 #endif /* defined(MNT2_NFS_OPT_RSIZE) && !defined(MNTTAB_OPT_RSIZE) */
69
70 #if defined(MNT2_NFS_OPT_SOFT) && !defined(MNTTAB_OPT_SOFT)
71 # define MNTTAB_OPT_SOFT "soft"
72 # ifndef MNTTAB_OPT_HARD
73 #  define MNTTAB_OPT_HARD "hard"
74 # endif /* not MNTTAB_OPT_HARD */
75 #endif /* defined(MNT2_NFS_OPT_SOFT) && !defined(MNTTAB_OPT_SOFT) */
76
77 #if defined(MNT2_NFS_OPT_TIMEO) && !defined(MNTTAB_OPT_TIMEO)
78 # define MNTTAB_OPT_TIMEO "timeo"
79 #endif /* defined(MNT2_NFS_OPT_TIMEO) && !defined(MNTTAB_OPT_TIMEO) */
80
81 #if defined(MNT2_NFS_OPT_WSIZE) && !defined(MNTTAB_OPT_WSIZE)
82 # define MNTTAB_OPT_WSIZE "wsize"
83 #endif /* defined(MNT2_NFS_OPT_WSIZE) && !defined(MNTTAB_OPT_WSIZE) */
84
85 #if defined(MNT2_NFS_OPT_MAXGRPS) && !defined(MNTTAB_OPT_MAXGROUPS)
86 # define MNTTAB_OPT_MAXGROUPS "maxgroups"
87 #endif /* defined(MNT2_NFS_OPT_MAXGRPS) && !defined(MNTTAB_OPT_MAXGROUPS) */
88
89 /*
90  * Complete MNTTAB_OPT_* options based on MNT2_CDFS_OPT_* mount options.
91  */
92 #if defined(MNT2_CDFS_OPT_DEFPERM) && !defined(MNTTAB_OPT_DEFPERM)
93 # define MNTTAB_OPT_DEFPERM "defperm"
94 #endif /* defined(MNT2_CDFS_OPT_DEFPERM) && !defined(MNTTAB_OPT_DEFPERM) */
95
96 #if defined(MNT2_CDFS_OPT_NODEFPERM) && !defined(MNTTAB_OPT_NODEFPERM)
97 # define MNTTAB_OPT_NODEFPERM "nodefperm"
98 /*
99  * DEC OSF/1 V3.x/Digital UNIX V4.0 have M_NODEFPERM only, but
100  * both mnttab ops.
101  */
102 # ifndef MNTTAB_OPT_DEFPERM
103 #  define MNTTAB_OPT_DEFPERM "defperm"
104 # endif /* not MNTTAB_OPT_DEFPERM */
105 #endif /* defined(MNT2_CDFS_OPT_NODEFPERM) && !defined(MNTTAB_OPT_NODEFPERM) */
106
107 #if defined(MNT2_CDFS_OPT_NOVERSION) && !defined(MNTTAB_OPT_NOVERSION)
108 # define MNTTAB_OPT_NOVERSION "noversion"
109 #endif /* defined(MNT2_CDFS_OPT_NOVERSION) && !defined(MNTTAB_OPT_NOVERSION) */
110
111 #if defined(MNT2_CDFS_OPT_RRIP) && !defined(MNTTAB_OPT_RRIP)
112 # define MNTTAB_OPT_RRIP "rrip"
113 #endif /* defined(MNT2_CDFS_OPT_RRIP) && !defined(MNTTAB_OPT_RRIP) */
114 #if defined(MNT2_CDFS_OPT_NORRIP) && !defined(MNTTAB_OPT_NORRIP)
115 # define MNTTAB_OPT_NORRIP "norrip"
116 #endif /* defined(MNT2_CDFS_OPT_NORRIP) && !defined(MNTTAB_OPT_NORRIP) */
117
118 #if defined(MNT2_CDFS_OPT_GENS) && !defined(MNTTAB_OPT_GENS)
119 # define MNTTAB_OPT_GENS "gens"
120 #endif /* defined(MNT2_CDFS_OPT_GENS) && !defined(MNTTAB_OPT_GENS) */
121 #if defined(MNT2_CDFS_OPT_EXTATT) && !defined(MNTTAB_OPT_EXTATT)
122 # define MNTTAB_OPT_EXTATT "extatt"
123 #endif /* defined(MNT2_CDFS_OPT_EXTATT) && !defined(MNTTAB_OPT_EXTATT) */
124
125 /*
126  * Complete MNTTAB_OPT_* options based on MNT2_GEN_OPT_* mount options.
127  */
128 #if defined(MNT2_GEN_OPT_GRPID) && !defined(MNTTAB_OPT_GRPID)
129 # define MNTTAB_OPT_GRPID "grpid"
130 #endif /* defined(MNT2_GEN_OPT_GRPID) && !defined(MNTTAB_OPT_GRPID) */
131
132 #if defined(MNT2_GEN_OPT_NOCACHE) && !defined(MNTTAB_OPT_NOCACHE)
133 # define MNTTAB_OPT_NOCACHE "nocache"
134 #endif /* defined(MNT2_GEN_OPT_NOCACHE) && !defined(MNTTAB_OPT_NOCACHE) */
135
136 #if defined(MNT2_GEN_OPT_NOSUID) && !defined(MNTTAB_OPT_NOSUID)
137 # define MNTTAB_OPT_NOSUID "nosuid"
138 #endif /* defined(MNT2_GEN_OPT_NOSUID) && !defined(MNTTAB_OPT_NOSUID) */
139
140 #if defined(MNT2_GEN_OPT_OVERLAY) && !defined(MNTTAB_OPT_OVERLAY)
141 # define MNTTAB_OPT_OVERLAY "overlay"
142 #endif /* defined(MNT2_GEN_OPT_OVERLAY) && !defined(MNTTAB_OPT_OVERLAY) */
143
144 /*
145  * Complete MNTTAB_OPT_* options and their inverse based on MNT2_GEN_OPT_*
146  * options.
147  */
148 #if defined(MNT2_GEN_OPT_NODEV) && !defined(MNTTAB_OPT_NODEV)
149 # define MNTTAB_OPT_NODEV "nodev"
150 /* this is missing under some versions of Linux */
151 # ifndef MNTTAB_OPT_DEV
152 #  define MNTTAB_OPT_DEV "dev"
153 # endif /* not MNTTAB_OPT_DEV */
154 #endif /* defined(MNT2_GEN_OPT_NODEV) && !defined(MNTTAB_OPT_NODEV) */
155
156 #if defined(MNT2_GEN_OPT_NOEXEC) && !defined(MNTTAB_OPT_NOEXEC)
157 # define MNTTAB_OPT_NOEXEC "noexec"
158 /* this is missing under some versions of Linux */
159 # ifndef MNTTAB_OPT_EXEC
160 #  define MNTTAB_OPT_EXEC "exec"
161 # endif /* not MNTTAB_OPT_EXEC */
162 #endif /* defined(MNT2_GEN_OPT_NOEXEC) && !defined(MNTTAB_OPT_NOEXEC) */
163
164 #if defined(MNT2_GEN_OPT_QUOTA) && !defined(MNTTAB_OPT_QUOTA)
165 # define MNTTAB_OPT_QUOTA "quota"
166 #endif /* defined(MNT2_GEN_OPT_QUOTA) && !defined(MNTTAB_OPT_QUOTA) */
167
168 #if defined(MNT2_GEN_OPT_SYNC) && !defined(MNTTAB_OPT_SYNC)
169 # define MNTTAB_OPT_SYNC "sync"
170 #endif /* defined(MNT2_GEN_OPT_SYNC) && !defined(MNTTAB_OPT_SYNC) */
171
172
173 /*
174  * Add missing MNTTAB_OPT_* options.
175  */
176 #ifndef MNTTAB_OPT_ACTIMEO
177 # define MNTTAB_OPT_ACTIMEO "actimeo"
178 #endif /* not MNTTAB_OPT_ACTIMEO */
179
180 #ifndef MNTTAB_OPT_INTR
181 # define MNTTAB_OPT_INTR "intr"
182 #endif /* not MNTTAB_OPT_INTR */
183
184 #ifndef MNTTAB_OPT_PORT
185 # define MNTTAB_OPT_PORT "port"
186 #endif /* not MNTTAB_OPT_PORT */
187
188 #ifndef MNTTAB_OPT_RETRANS
189 # define MNTTAB_OPT_RETRANS "retrans"
190 #endif /* not MNTTAB_OPT_RETRANS */
191
192 #ifndef MNTTAB_OPT_RETRY
193 # define MNTTAB_OPT_RETRY "retry"
194 #endif /* not MNTTAB_OPT_RETRY */
195
196 #ifndef MNTTAB_OPT_RO
197 # define MNTTAB_OPT_RO "ro"
198 #endif /* not MNTTAB_OPT_RO */
199
200 #ifndef MNTTAB_OPT_RSIZE
201 # define MNTTAB_OPT_RSIZE "rsize"
202 #endif /* not MNTTAB_OPT_RSIZE */
203
204 #ifndef MNTTAB_OPT_RW
205 # define MNTTAB_OPT_RW "rw"
206 #endif /* not MNTTAB_OPT_RW */
207
208 #ifndef MNTTAB_OPT_TIMEO
209 # define MNTTAB_OPT_TIMEO "timeo"
210 #endif /* not MNTTAB_OPT_TIMEO */
211
212 #ifndef MNTTAB_OPT_WSIZE
213 # define MNTTAB_OPT_WSIZE "wsize"
214 #endif /* not MNTTAB_OPT_WSIZE */
215
216
217 /*
218  * Incomplete filesystem definitions (sunos4, irix6, solaris2)
219  */
220 #if defined(HAVE_FS_CDFS) && defined(MOUNT_TYPE_CDFS) && !defined(MNTTYPE_CDFS)
221 # define MNTTYPE_CDFS "hsfs"
222 #endif /* defined(HAVE_FS_CDFS) && defined(MOUNT_TYPE_CDFS) && !defined(MNTTYPE_CDFS) */
223
224 #ifndef cdfs_args_t
225 /*
226  * Solaris has an HSFS filesystem, but does not define hsfs_args.
227  * XXX: the definition here for solaris is wrong, since under solaris,
228  * hsfs_args should be a single integer used as a bit-field for options.
229  * so this code has to be fixed later.  -Erez.
230  */
231 struct hsfs_args {
232         char *fspec;    /* name of filesystem to mount */
233         int norrip;
234 };
235 # define cdfs_args_t struct hsfs_args
236 # define HAVE_FIELD_CDFS_ARGS_T_NORRIP
237 #endif /* not cdfs_args_t */
238
239 /*
240  * if does not define struct pc_args, assume integer bit-field (irix6)
241  */
242 #if defined(HAVE_FS_PCFS) && !defined(pcfs_args_t)
243 # define pcfs_args_t u_int
244 #endif /* defined(HAVE_FS_PCFS) && !defined(pcfs_args_t) */
245
246 /*
247  * if does not define struct ufs_args, assume integer bit-field (linux)
248  */
249 #if defined(HAVE_FS_UFS) && !defined(ufs_args_t)
250 # define ufs_args_t u_int
251 #endif /* defined(HAVE_FS_UFS) && !defined(ufs_args_t) */
252
253 #if defined(HAVE_FS_AUTOFS) && defined(MOUNT_TYPE_AUTOFS) && !defined(MNTTYPE_AUTOFS)
254 # define MNTTYPE_AUTOFS "autofs"
255 #endif /* defined(HAVE_FS_AUTOFS) && defined(MOUNT_TYPE_AUTOFS) && !defined(MNTTYPE_AUTOFS) */
256
257 /*
258  * If NFS3, then make sure that "proto" and "vers" mnttab options
259  * are available.
260  */
261 #ifdef HAVE_FS_NFS3
262 # ifndef MNTTAB_OPT_VERS
263 #  define MNTTAB_OPT_VERS "vers"
264 # endif /* not MNTTAB_OPT_VERS */
265 # ifndef MNTTAB_OPT_PROTO
266 #  define MNTTAB_OPT_PROTO "proto"
267 # endif /* not MNTTAB_OPT_PROTO */
268 #endif /* not HAVE_FS_NFS3 */
269
270 #endif /* not _AM_COMPAT_H */