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