]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/platform_defs.h.in
xfsprogs: use <>-style includes in installed headers
[thirdparty/xfsprogs-dev.git] / include / platform_defs.h.in
1 /*
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public License
7 * as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 * @configure_input@
19 */
20 #ifndef __XFS_PLATFORM_DEFS_H__
21 #define __XFS_PLATFORM_DEFS_H__
22
23 #include <stdio.h>
24 #include <errno.h>
25 #include <fcntl.h>
26 #include <stdarg.h>
27 #include <assert.h>
28 #include <stddef.h>
29 #include <stdlib.h>
30 #include <string.h>
31 #include <stdint.h>
32 #include <unistd.h>
33 #include <pthread.h>
34 #include <ctype.h>
35 #include <sys/types.h>
36 #include <limits.h>
37 #include <stdbool.h>
38
39 #undef HAVE___U32
40 #ifdef HAVE___U32
41 #include <asm/types.h>
42 #else
43 typedef unsigned char __u8;
44 typedef signed char __s8;
45 typedef unsigned short __u16;
46 typedef signed short __s16;
47 typedef unsigned int __u32;
48 typedef signed int __s32;
49 typedef unsigned long long int __u64;
50 typedef signed long long int __s64;
51 #endif
52
53 #ifdef __CHECKER__
54 #define __bitwise __attribute__((bitwise))
55 #define __force __attribute__((force))
56 #else
57 #define __bitwise
58 #define __force
59 #endif
60
61 typedef __u16 __bitwise __le16;
62 typedef __u32 __bitwise __le32;
63 typedef __u64 __bitwise __le64;
64
65 typedef __u16 __bitwise __be16;
66 typedef __u32 __bitwise __be32;
67 typedef __u64 __bitwise __be64;
68
69 typedef struct filldir filldir_t;
70
71 #if defined(__linux__)
72 #include <xfs/linux.h>
73 #elif defined(__FreeBSD__)
74 #include <xfs/freebsd.h>
75 #elif defined(__FreeBSD_kernel__)
76 #include <xfs/gnukfreebsd.h>
77 #elif defined(__APPLE__)
78 #include <xfs/darwin.h>
79 #elif defined(__sgi__) || defined(__sgi)
80 #include <xfs/irix.h>
81 #else
82 # error unknown platform... have fun porting!
83 #endif
84
85 /* long and pointer must be either 32 bit or 64 bit */
86 #undef SIZEOF_LONG
87 #undef SIZEOF_CHAR_P
88 #define BITS_PER_LONG (SIZEOF_LONG * CHAR_BIT)
89
90 /* Check whether to define umode_t ourselves. */
91 #ifndef HAVE_UMODE_T
92 typedef unsigned short umode_t;
93 #endif
94
95 /* Define if you want gettext (I18N) support */
96 #undef ENABLE_GETTEXT
97 #ifdef ENABLE_GETTEXT
98 # include <libintl.h>
99 # define _(x) gettext(x)
100 # define N_(x) x
101 #else
102 # define _(x) (x)
103 # define N_(x) x
104 # define textdomain(d) do { } while (0)
105 # define bindtextdomain(d,dir) do { } while (0)
106 #endif
107 #include <locale.h>
108
109 #ifdef DEBUG
110 # define ASSERT(EX) assert(EX)
111 #else
112 # define ASSERT(EX) ((void) 0)
113 #endif
114
115 /*
116 * sparse kernel source annotations
117 */
118 #ifndef __user
119 #define __user
120 #endif
121
122 #define IRIX_DEV_BITSMAJOR 14
123 #define IRIX_DEV_BITSMINOR 18
124 #define IRIX_DEV_MAXMAJ 0x1ff
125 #define IRIX_DEV_MAXMIN 0x3ffff
126 #define IRIX_DEV_MAJOR(dev) ((int)(((unsigned)(dev) >> IRIX_DEV_BITSMINOR) \
127 & IRIX_DEV_MAXMAJ))
128 #define IRIX_DEV_MINOR(dev) ((int)((dev) & IRIX_DEV_MAXMIN))
129 #define IRIX_MKDEV(major,minor) ((xfs_dev_t)(((major) << IRIX_DEV_BITSMINOR) \
130 | (minor&IRIX_DEV_MAXMIN)))
131 #define IRIX_DEV_TO_KDEVT(dev) makedev(IRIX_DEV_MAJOR(dev),IRIX_DEV_MINOR(dev))
132
133 /* ARM old ABI has some weird alignment/padding */
134 #if defined(__arm__) && !defined(__ARM_EABI__)
135 #define __arch_pack __attribute__((packed))
136 #else
137 #define __arch_pack
138 #endif
139
140 #ifndef min
141 #define min(a,b) (((a)<(b))?(a):(b))
142 #define max(a,b) (((a)>(b))?(a):(b))
143 #endif
144
145 #endif /* __XFS_PLATFORM_DEFS_H__ */