Line 0
Link Here
|
|
|
1 |
/* |
2 |
* Copyright (c) 2000-2015 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 _FAKE_PLATFORM_DEFS_H |
21 |
#define _FAKE_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 if __psint_t is set to something meaningful */ |
91 |
#undef HAVE___PSINT_T |
92 |
#ifndef HAVE___PSINT_T |
93 |
# if (SIZEOF_CHAR_P * CHAR_BIT) == 32 |
94 |
typedef int __psint_t; |
95 |
# elif (SIZEOF_CHAR_P * CHAR_BIT) == 64 |
96 |
# if BITS_PER_LONG == 64 |
97 |
typedef long __psint_t; |
98 |
# else |
99 |
/* This is a very strange architecture, which has 64 bit pointers but */ |
100 |
/* not 64 bit longs. So, just punt here and assume long long is OK. */ |
101 |
typedef long long __psint_t; |
102 |
# endif |
103 |
# else |
104 |
# error Unknown pointer size |
105 |
# endif |
106 |
#endif |
107 |
|
108 |
/* Check whether to define umode_t ourselves. */ |
109 |
#ifndef HAVE_UMODE_T |
110 |
typedef unsigned short umode_t; |
111 |
#endif |
112 |
|
113 |
/* Define if you want gettext (I18N) support */ |
114 |
#undef ENABLE_GETTEXT |
115 |
#ifdef ENABLE_GETTEXT |
116 |
# include <libintl.h> |
117 |
# define _(x) gettext(x) |
118 |
# define N_(x) x |
119 |
#else |
120 |
# define _(x) (x) |
121 |
# define N_(x) x |
122 |
# define textdomain(d) do { } while (0) |
123 |
# define bindtextdomain(d,dir) do { } while (0) |
124 |
#endif |
125 |
#include <locale.h> |
126 |
|
127 |
#ifdef DEBUG |
128 |
# define ASSERT(EX) assert(EX) |
129 |
#else |
130 |
# define ASSERT(EX) ((void) 0) |
131 |
#endif |
132 |
|
133 |
/* |
134 |
* sparse kernel source annotations |
135 |
*/ |
136 |
#ifndef __user |
137 |
#define __user |
138 |
#endif |
139 |
|
140 |
#define IRIX_DEV_BITSMAJOR 14 |
141 |
#define IRIX_DEV_BITSMINOR 18 |
142 |
#define IRIX_DEV_MAXMAJ 0x1ff |
143 |
#define IRIX_DEV_MAXMIN 0x3ffff |
144 |
#define IRIX_DEV_MAJOR(dev) ((int)(((unsigned)(dev) >> IRIX_DEV_BITSMINOR) \ |
145 |
& IRIX_DEV_MAXMAJ)) |
146 |
#define IRIX_DEV_MINOR(dev) ((int)((dev) & IRIX_DEV_MAXMIN)) |
147 |
#define IRIX_MKDEV(major,minor) ((xfs_dev_t)(((major) << IRIX_DEV_BITSMINOR) \ |
148 |
| (minor&IRIX_DEV_MAXMIN))) |
149 |
#define IRIX_DEV_TO_KDEVT(dev) makedev(IRIX_DEV_MAJOR(dev),IRIX_DEV_MINOR(dev)) |
150 |
|
151 |
/* ARM old ABI has some weird alignment/padding */ |
152 |
#if defined(__arm__) && !defined(__ARM_EABI__) |
153 |
#define __arch_pack __attribute__((packed)) |
154 |
#else |
155 |
#define __arch_pack |
156 |
#endif |
157 |
|
158 |
#ifndef min |
159 |
#define min(a,b) (((a)<(b))?(a):(b)) |
160 |
#define max(a,b) (((a)>(b))?(a):(b)) |
161 |
#endif |
162 |
|
163 |
#endif /* !defined(_FAKE_PLATFORM_DEFS_H) */ |