3e3a1725197d1015c6314dfecc9f6fe69992fa49
[openafs.git] / src / afs / sysincludes.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  *
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #ifdef UKERNEL
11 # include <UKERNEL/sysincludes.h>
12 #else
13
14 #ifndef __AFS_SYSINCLUDESH__
15 #define __AFS_SYSINCLUDESH__ 1
16
17 #ifdef AFS_OBSD_ENV
18 # include <sys/errno.h>
19 # include <sys/types.h>
20 # include <sys/param.h>
21 # include <sys/lock.h>
22 # include <sys/queue.h>
23 # include <sys/resourcevar.h>
24 # include <sys/kernel.h>
25 # include <sys/proc.h>
26 # include <sys/time.h>
27 # include <sys/filedesc.h>
28 # include <sys/file.h>
29 # include <sys/socket.h>
30 # include <sys/socketvar.h>
31 # include <sys/dirent.h>
32 # include <sys/user.h>
33 # include <sys/uio.h>
34 # include <sys/buf.h>
35 # include <sys/stat.h>
36 # include <sys/mount.h>
37 # include <sys/vnode.h>
38 # include <sys/malloc.h>
39 # include <ufs/ffs/fs.h>
40 # include <ufs/ufs/quota.h>
41 # include <ufs/ufs/inode.h>
42 # ifndef AFS_OBSD38_ENV
43 #  include <ufs/ufs/extattr.h>
44 # endif
45 # include <ufs/ufs/ufsmount.h>
46 # ifndef MLEN
47 #  include <sys/mbuf.h>
48 #  include <net/if.h>
49 # endif
50 # include <sys/protosw.h>
51 # include <sys/ioctl.h>
52 # include <sys/timeout.h>
53
54 #elif defined(AFS_NBSD40_ENV)
55 # ifdef AFS_NBSD50_ENV
56 #  include <sys/simplelock.h>
57 # endif
58 # include <sys/errno.h>
59 # include <sys/types.h>
60 # include <sys/mount.h> /* may define MOUNT_AFS */
61 # include <sys/param.h>
62 # include <sys/systm.h>
63 # include <sys/conf.h>
64 # include <sys/exec.h>
65 # include <sys/lock.h>
66 # include <sys/syscall.h>
67 # include <sys/syscallargs.h>
68 # include <sys/queue.h>
69 # include <sys/resourcevar.h>
70 # include <sys/kernel.h>
71 # include <sys/proc.h>
72 # include <sys/time.h>
73 # include <sys/filedesc.h>
74 # include <sys/exec.h>
75 # include <sys/lock.h>
76 # include <sys/syscall.h>
77 # include <sys/syscallargs.h>
78 # include <sys/queue.h>
79 # include <sys/resourcevar.h>
80 # include <sys/kernel.h>
81 # include <sys/proc.h>
82 # include <sys/time.h>
83 # include <sys/filedesc.h>
84 # include <sys/file.h>
85 # include <sys/socket.h>
86 # include <sys/socketvar.h>
87 # include <sys/dirent.h>
88 # include <sys/kauth.h>
89 # include <sys/uio.h>
90 # include <sys/buf.h>
91 # include <sys/stat.h>
92 # include <sys/file.h>
93 # include <sys/namei.h>
94 # include <sys/uio.h>
95 # include <sys/buf.h>
96 # include <sys/file.h>
97 # include <sys/namei.h>
98 # include <sys/vnode.h>
99 # include <ufs/ffs/fs.h>
100 # include <ufs/ufs/quota.h>
101 # include <ufs/ufs/inode.h>
102 # include <ufs/ufs/extattr.h>
103 # include <ufs/ufs/ufsmount.h>
104 # ifndef MLEN
105 #  include <sys/mbuf.h>
106 #  include <net/if.h>
107 # endif /* !MLEN */
108 # include <sys/protosw.h>
109 # include <sys/ioctl.h>
110
111 #elif defined(AFS_LINUX22_ENV)
112 # include <linux/version.h>
113 # ifdef HAVE_LINUX_CONFIG_H
114 #  include <linux/config.h>
115 # endif
116 # include <linux/linkage.h>
117 # include <linux/limits.h>
118 # include <linux/wait.h>
119 # include <linux/types.h>
120 # include <linux/vfs.h>
121 # include <linux/net.h>
122 # include <linux/kdev_t.h>
123 # include <linux/ioctl.h>
124 # if defined(AFS_LINUX26_ENV)
125 #  include <linux/backing-dev.h>
126 #  include <linux/pagemap.h>
127 #  include <linux/namei.h>
128 #  ifdef STRUCT_INODE_HAS_I_SECURITY
129 #   include <linux/security.h>
130 #  endif
131 #  include <linux/suspend.h>
132 # endif
133 /* Avoid conflicts with coda overloading AFS type namespace. Must precede
134  * inclusion of uaccess.h.
135  */
136 # ifndef _LINUX_CODA_FS_I
137 #  define _LINUX_CODA_FS_I
138 #  define _CODA_HEADER_
139 #  define _CFS_HEADER_
140 struct coda_inode_info {
141 };
142 # endif
143 # ifndef _LINUX_XFS_FS_I
144 #  define _LINUX_XFS_FS_I
145 struct xfs_inode_info {
146 };
147 # endif
148 # include <asm/uaccess.h>
149 # include <linux/list.h>
150 # include <linux/dcache.h>
151 # include <linux/mount.h>
152 # include <linux/fs.h>
153 # include <linux/quota.h>
154 # include <linux/sched.h>
155 # include <linux/mm.h>
156 # include <linux/slab.h>
157 # include <linux/proc_fs.h>
158 # include <linux/string.h>
159 # if defined(HAVE_LINUX_SEMAPHORE_H)
160 #  include <linux/semaphore.h>
161 # else
162 #  include <asm/semaphore.h>
163 # endif
164 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
165 #  include <linux/mutex.h>
166 # endif
167 # include <linux/errno.h>
168 # ifdef HAVE_LINUX_COMPLETION_H
169 #  include <linux/completion.h>
170 # endif
171 # if defined(HAVE_LINUX_EXPORTFS_H)
172 #  include <linux/exportfs.h>
173 # endif
174 # ifdef AFS_LINUX24_ENV
175 #  include <linux/pagemap.h>
176 # endif
177
178 #else /* AFS_LINUX22_ENV */
179 # if defined(AFS_DARWIN_ENV)
180 #  ifndef _MACH_ETAP_H_
181 #   define _MACH_ETAP_H_
182 typedef unsigned short etap_event_t;
183 #  endif
184 # endif
185
186 # include "h/errno.h"
187 # include "h/types.h"
188 # include "h/param.h"
189
190 # ifdef AFS_AUX_ENV
191 #  ifdef        PAGING
192 #   include "h/mmu.h"
193 #   include "h/seg.h"
194 #   include "h/page.h"
195 #   include "h/region.h"
196 #  endif /* PAGING */
197 #  include "h/sysmacros.h"
198 #  include "h/signal.h"
199 #  include "h/var.h"
200 # endif /* AFS_AUX_ENV */
201
202 # include "h/systm.h"
203 # include "h/time.h"
204
205 # ifdef AFS_AIX_ENV
206 #  ifdef AFS_AIX41_ENV
207 #   include "sys/statfs.h"
208 #  endif
209 #  ifdef AFS_AIX51_ENV
210 #   include "sys/acl.h"
211 #  endif
212 #  include "../h/file.h"
213 #  include "../h/fullstat.h"
214 #  include "../h/vattr.h"
215 #  include "../h/var.h"
216 #  include "../h/access.h"
217 # endif /* AFS_AIX_ENV */
218
219 # if defined(AFS_SGI_ENV)
220 #  include "values.h"
221 #  include "sys/sema.h"
222 #  include "sys/cmn_err.h"
223 #  ifdef AFS_SGI64_ENV
224 #   include <ksys/behavior.h>
225 /* in 6.5.20f, ksys/behavior.h doesn't bother to define BHV_IS_BHVL,
226  * but sys/vnode.h uses it in VNODE_TO_FIRST_BHV. It looks like from
227  * older headers like we want the old behavior, so we fake it. */
228 #   if defined(BHV_PREPARE) && !defined(CELL_CAPABLE)
229 #    define BHV_IS_BHVL(bhp) (0)
230 #   endif
231 #  endif /* AFS_SGI64_ENV */
232 #  include "fs/efs_inode.h"
233 #  include "sys/kmem.h"
234 #  include "sys/cred.h"
235 #  include "sys/resource.h"
236
237 /*
238  * ../sys/debug.h defines ASSERT(), but it is nontrivial only if DEBUG
239  * is on (see afs_osi.h).
240  * In IRIX 6.5 we cannot have DEBUG turned on since certain
241  * system-defined structures have different members with DEBUG on, and
242  * this breaks our ability to interact with the rest of the kernel.
243  *
244  * Instead of using ASSERT(), we use our own osi_Assert().
245  */
246 #  if defined(AFS_SGI65_ENV) && !defined(DEBUG)
247 #   define DEBUG
248 #   include "sys/debug.h"
249 #   undef DEBUG
250 #  else
251 #   include "sys/debug.h"
252 #  endif
253
254 #  include "sys/statvfs.h"
255 #  include "sys/sysmacros.h"
256 #  include "sys/fs_subr.h"
257 #  include "sys/siginfo.h"
258 #  include "limits.h"
259 # endif /* AFS_SGI_ENV */
260
261 # if !defined(AFS_AIX_ENV) && !defined(AFS_SUN5_ENV) && !defined(AFS_SGI_ENV)
262 #  include "h/kernel.h"
263 # endif /* !SUN5 && !SGI */
264
265 # ifdef AFS_SUN5_ENV
266 #  include <sys/cmn_err.h>      /* for kernel printf() prototype */
267 #  include "h/vfs.h"            /* stops SUN5 socketvar.h warnings */
268 #  include "h/stropts.h"                /* stops SUN5 socketvar.h warnings */
269 #  include "h/stream.h"         /* stops SUN5 socketvar.h errors */
270 # endif
271
272 # ifdef AFS_SUN510_ENV
273 #  include <sys/cred_impl.h>
274 #  include <sys/policy.h>
275 # endif
276
277 # include "h/socket.h"
278 # include "h/socketvar.h"
279 # include "h/protosw.h"
280
281 # if defined(AFS_FBSD_ENV)
282 #  include "sys/limits.h"
283 # endif
284
285 # ifdef AFS_HPUX_ENV
286 #  include "limits.h"
287 # endif
288
289 # if defined(AFS_SGI_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV) || \
290   defined(AFS_FBSD_ENV) || defined(AFS_NBSD40_ENV)
291 #  include "h/dirent.h"
292 #  ifdef        AFS_SUN5_ENV
293 #   include "h/sysmacros.h"
294 #   include "h/fs/ufs_fsdir.h"
295 #  endif /* AFS_SUN5_ENV */
296 # else
297 #  include "h/dir.h"
298 # endif /* SGI || SUN || HPUX */
299
300 # if !defined(AFS_SGI64_ENV) && !defined(AFS_FBSD_ENV) && !defined(AFS_DARWIN80_ENV) && \
301   !defined(AFS_NBSD40_ENV)
302 #  include "h/user.h"
303 # endif /* AFS_SGI64_ENV */
304 # define        MACH_USER_API   1
305 # if defined(AFS_FBSD_ENV)
306 #  include "h/bio.h"
307 #  include "h/filedesc.h"
308 # endif
309 # include "h/file.h"
310 # include "h/uio.h"
311 # include "h/buf.h"
312 # include "h/stat.h"
313
314
315 /* ----- The following mainly deal with vnodes/inodes stuff ------ */
316 # ifdef AFS_SUN5_ENV
317 #  include "h/statvfs.h"
318 # endif /* AFS_SUN5_ENV */
319 # ifdef AFS_HPUX_ENV
320 struct vfspage;         /* for vnode.h compiler warnings */
321 #  include "h/swap.h"   /* for struct swpdbd, for vnode.h compiler warnings */
322 #  include "h/dbd.h"    /* for union idbd, for vnode.h compiler warnings */
323 #  ifdef AFS_HPUX110_ENV
324 #   include "h/resource.h"
325 #  endif
326 #  ifdef AFS_HPUX1123_ENV
327 #   include <sys/user.h>
328 #   include <sys/cred.h>
329 #  endif
330 # endif /* AFS_HPUX_ENV */
331 # if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
332 #  if defined(AFS_FBSD_ENV)
333 struct vop_getwritemount_args;
334 #  endif
335 #  include <sys/uio.h>
336 #  include <sys/mount.h>
337 #  include <sys/namei.h>
338 #  ifdef AFS_DARWIN80_ENV
339 #   include <sys/kauth.h>
340 #   include <string.h>
341 #  endif
342 #  include <sys/vnode.h>
343 #  include <sys/queue.h>
344 #  ifndef AFS_NBSD40_ENV
345 #   include <sys/malloc.h>
346 #  endif
347 #  ifdef AFS_FBSD_ENV
348 MALLOC_DECLARE(M_AFS);
349 #   include <ufs/ufs/dinode.h>
350 #   include <vm/vm.h>
351 #   include <vm/vm_extern.h>
352 #   include <vm/pmap.h>
353 #   include <vm/vm_map.h>
354 #   include <sys/lock.h>
355 #   include <sys/user.h>
356 #  else
357 #   include <sys/ubc.h>
358 #   define timeout_fcn_t mach_timeout_fcn_t
359 #   include <kern/sched_prim.h>
360 #  endif
361 #  undef timeout_fcn_t
362 #  define _DIR_H_
363 #  define doff_t          int32_t
364 #  ifndef AFS_DARWIN80_ENV
365 #   include <ufs/ufs/quota.h>
366 #   include <ufs/ufs/inode.h>
367 #   include <ufs/ffs/fs.h>
368 #  endif
369 # else
370 #  ifndef AFS_NBSD40_ENV
371 #   include "h/vfs.h"
372 #   include "h/vnode.h"
373 #  endif
374 #  ifdef        AFS_SUN5_ENV
375 #   include "h/fs/ufs_inode.h"
376 #   include "h/fs/ufs_mount.h"
377 #  else
378 #   if !defined(AFS_SGI_ENV) && !defined(AFS_AIX32_ENV) && !defined(AFS_NBSD40_ENV)
379 #    include "ufs/inode.h"
380 #    if !defined(AFS_SGI_ENV) && !defined(AFS_HPUX_ENV) && !defined(AFS_NBSD40_ENV)
381 #     include "ufs/mount.h"
382 #    endif /* !AFS_HPUX_ENV */
383 #   endif /* !AFS_AIX32_ENV */
384 #  endif /* AFS_SUN5_ENV */
385 # endif /* AFS_DARWIN_ENV || AFS_FBSD_ENV */
386
387 /* These mainly deal with networking and rpc headers */
388 # include "netinet/in.h"
389 # undef MFREE                   /* defined at mount.h for AIX */
390 # ifdef AFS_SUN5_ENV
391 #  include "h/time.h"
392 # else
393 #  if !defined(AFS_HPUX_ENV)
394 #   include "h/mbuf.h"
395 #  endif
396 # endif /* AFS_SUN5_ENV */
397
398 # include "rpc/types.h"
399 # include "rx/xdr.h"
400
401 /* Miscellaneous headers */
402 # include "h/proc.h"
403 # if !defined(AFS_FBSD_ENV)
404 #  include "h/ioctl.h"
405 # endif /* AFS_FBSD_ENV */
406
407 # if    defined(AFS_HPUX101_ENV) && !defined(AFS_HPUX1123_ENV)
408 #  include "h/proc_iface.h"
409 #  include "h/vas.h"
410 # endif
411
412 # if    defined(AFS_HPUX102_ENV)
413 #  include "h/unistd.h"
414 #  include "h/tty.h"
415 # endif
416
417 # if !defined(AFS_SGI_ENV) && !defined(AFS_AIX32_ENV) && !defined(AFS_HPUX_ENV) && !defined(AFS_SUN5_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV) && !defined(AFS_NBSD40_ENV)
418
419 #  include "h/text.h"
420 # endif
421
422
423 # if    defined(AFS_AIX_ENV)
424 #  include "h/flock.h"          /* fcntl.h is a user-level include in aix */
425 # else
426 #  include "h/fcntl.h"
427 # endif /* AIX */
428
429 # if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV)
430 #  include "h/unistd.h"
431 # endif /* SGI || SUN */
432
433 # ifdef AFS_AIX32_ENV
434 #  include "h/vmuser.h"
435 # endif /* AFS_AIX32_ENV */
436
437 # if    defined(AFS_SUN5_ENV)
438 #  include <sys/tiuser.h>
439 #  include <sys/t_lock.h>
440 #  include <sys/mutex.h>
441 #  include <sys/vtrace.h>
442 #  include <sys/pathname.h>
443 #  include <sys/debug.h>
444 # endif
445
446 #endif /* AFS_LINUX22_ENV */
447
448 #endif /* __AFS_SYSINCLUDESH__  so idempotent */
449
450 #endif