]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - include/platform_defs.h.in
xfsprogs: Die dir1 Die!
[thirdparty/xfsprogs-dev.git] / include / platform_defs.h.in
CommitLineData
2bd0ea18 1/*
f302e9e4
NS
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
2bd0ea18 4 *
f302e9e4
NS
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.
2bd0ea18 8 *
f302e9e4
NS
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.
2bd0ea18 13 *
f302e9e4
NS
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
2bd0ea18
NS
17 *
18 * @configure_input@
19 */
20#ifndef __XFS_PLATFORM_DEFS_H__
21#define __XFS_PLATFORM_DEFS_H__
22
23#include <stdio.h>
6bef826c
NS
24#include <errno.h>
25#include <fcntl.h>
b26ade3f 26#include <stdarg.h>
2bd0ea18 27#include <assert.h>
2bd0ea18
NS
28#include <stddef.h>
29#include <stdlib.h>
30#include <string.h>
5e656dbb 31#include <stdint.h>
2bd0ea18 32#include <unistd.h>
5e656dbb
BN
33#include <pthread.h>
34#include <ctype.h>
2bd0ea18 35#include <sys/types.h>
865f1075 36#include <limits.h>
6bef826c 37
8dd34538
TS
38#undef HAVE___U32
39#ifdef HAVE___U32
40#include <asm/types.h>
41#else
d026b19e
NS
42typedef unsigned char __u8;
43typedef signed char __s8;
44typedef unsigned short __u16;
45typedef signed short __s16;
46typedef unsigned int __u32;
47typedef signed int __s32;
48typedef unsigned long long int __u64;
49typedef signed long long int __s64;
8dd34538 50#endif
d026b19e 51
5e656dbb
BN
52#ifdef __CHECKER__
53#define __bitwise __attribute__((bitwise))
54#define __force __attribute__((force))
55#else
56#define __bitwise
57#define __force
58#endif
59
60typedef __u16 __bitwise __be16;
61typedef __u32 __bitwise __be32;
62typedef __u64 __bitwise __be64;
63
64typedef struct filldir filldir_t;
1707056a 65
6bef826c 66#if defined(__linux__)
c0211f67 67#include <xfs/linux.h>
4f1631ae 68#elif defined(__FreeBSD__)
c0211f67 69#include <xfs/freebsd.h>
2ee06c8d
PS
70#elif defined(__FreeBSD_kernel__)
71#include <xfs/gnukfreebsd.h>
c0211f67
NS
72#elif defined(__APPLE__)
73#include <xfs/darwin.h>
d026b19e 74#elif defined(__sgi__) || defined(__sgi)
c0211f67 75#include <xfs/irix.h>
93d9f139
NS
76#else
77# error unknown platform... have fun porting!
6bef826c
NS
78#endif
79
2bd0ea18 80/* long and pointer must be either 32 bit or 64 bit */
865f1075
JE
81#undef SIZEOF_LONG
82#undef SIZEOF_CHAR_P
83#define BITS_PER_LONG (SIZEOF_LONG * CHAR_BIT)
044fe078 84
2bd0ea18
NS
85/* Check if __psint_t is set to something meaningful */
86#undef HAVE___PSINT_T
87#ifndef HAVE___PSINT_T
865f1075 88# if (SIZEOF_CHAR_P * CHAR_BIT) == 32
2bd0ea18 89typedef int __psint_t;
865f1075
JE
90# elif (SIZEOF_CHAR_P * CHAR_BIT) == 64
91# if BITS_PER_LONG == 64
2bd0ea18
NS
92typedef long __psint_t;
93# else
9440d84d
NS
94/* This is a very strange architecture, which has 64 bit pointers but */
95/* not 64 bit longs. So, just punt here and assume long long is OK. */
2bd0ea18
NS
96typedef long long __psint_t;
97# endif
98# else
99# error Unknown pointer size
100# endif
101#endif
102
103/* Check if __psunsigned_t is set to something meaningful */
104#undef HAVE___PSUNSIGNED_T
105#ifndef HAVE___PSUNSIGNED_T
865f1075 106# if (SIZEOF_CHAR_P * CHAR_BIT) == 32
2bd0ea18 107typedef unsigned int __psunsigned_t;
865f1075
JE
108# elif (SIZEOF_CHAR_P * CHAR_BIT) == 64
109# if BITS_PER_LONG == 64
2bd0ea18
NS
110typedef long __psunsigned_t;
111# else
9440d84d
NS
112/* This is a very strange architecture, which has 64 bit pointers but */
113/* not 64 bit longs. So, just punt here and assume long long is OK. */
2bd0ea18
NS
114typedef unsigned long long __psunsigned_t;
115# endif
116# else
117# error Unknown pointer size
118# endif
119#endif
120
9440d84d
NS
121/* Define if you want gettext (I18N) support */
122#undef ENABLE_GETTEXT
123#ifdef ENABLE_GETTEXT
124# include <libintl.h>
125# define _(x) gettext(x)
97294b22 126# define N_(x) x
9440d84d
NS
127#else
128# define _(x) (x)
97294b22 129# define N_(x) x
9440d84d
NS
130# define textdomain(d) do { } while (0)
131# define bindtextdomain(d,dir) do { } while (0)
132#endif
6ef2febc 133#include <locale.h>
9440d84d 134
2bd0ea18 135#ifdef DEBUG
5e656dbb 136# define ASSERT(EX) assert(EX)
2bd0ea18
NS
137#else
138# define ASSERT(EX) ((void) 0)
139#endif
140
f302e9e4
NS
141/*
142 * sparse kernel source annotations
143 */
062998e3
NS
144#ifndef __user
145#define __user
146#endif
147
32181a02
NS
148#define IRIX_DEV_BITSMAJOR 14
149#define IRIX_DEV_BITSMINOR 18
150#define IRIX_DEV_MAXMAJ 0x1ff
151#define IRIX_DEV_MAXMIN 0x3ffff
152#define IRIX_DEV_MAJOR(dev) ((int)(((unsigned)(dev) >> IRIX_DEV_BITSMINOR) \
153 & IRIX_DEV_MAXMAJ))
154#define IRIX_DEV_MINOR(dev) ((int)((dev) & IRIX_DEV_MAXMIN))
63899e27 155#define IRIX_MKDEV(major,minor) ((xfs_dev_t)(((major) << IRIX_DEV_BITSMINOR) \
32181a02 156 | (minor&IRIX_DEV_MAXMIN)))
f97e76b0 157#define IRIX_DEV_TO_KDEVT(dev) makedev(IRIX_DEV_MAJOR(dev),IRIX_DEV_MINOR(dev))
32181a02 158
cfbb7abd
TS
159/* ARM old ABI has some weird alignment/padding */
160#if defined(__arm__) && !defined(__ARM_EABI__)
161#define __arch_pack __attribute__((packed))
162#else
163#define __arch_pack
164#endif
165
2bd0ea18 166#endif /* __XFS_PLATFORM_DEFS_H__ */