]>
Commit | Line | Data |
---|---|---|
2bd0ea18 | 1 | /* |
0d3e0b37 | 2 | * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. |
2bd0ea18 NS |
3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | |
5 | * under the terms of version 2 of the GNU General Public License as | |
6 | * published by the Free Software Foundation. | |
7 | * | |
8 | * This program is distributed in the hope that it would be useful, but | |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
11 | * | |
12 | * Further, this software is distributed without any warranty that it is | |
13 | * free of the rightful claim of any third person regarding infringement | |
14 | * or the like. Any license provided herein, whether implied or | |
15 | * otherwise, applies only to this software file. Patent licenses, if | |
16 | * any, provided herein do not apply to combinations of this program with | |
17 | * other software, or any other product whatsoever. | |
18 | * | |
19 | * You should have received a copy of the GNU General Public License along | |
20 | * with this program; if not, write the Free Software Foundation, Inc., 59 | |
21 | * Temple Place - Suite 330, Boston MA 02111-1307, USA. | |
22 | * | |
23 | * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, | |
24 | * Mountain View, CA 94043, or: | |
25 | * | |
26 | * http://www.sgi.com | |
27 | * | |
28 | * For further information regarding this notice, see: | |
29 | * | |
30 | * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ | |
31 | * | |
32 | * @configure_input@ | |
33 | */ | |
34 | #ifndef __XFS_PLATFORM_DEFS_H__ | |
35 | #define __XFS_PLATFORM_DEFS_H__ | |
36 | ||
37 | #include <stdio.h> | |
b26ade3f | 38 | #include <stdarg.h> |
2bd0ea18 NS |
39 | #include <assert.h> |
40 | #include <endian.h> | |
41 | #include <stddef.h> | |
42 | #include <stdlib.h> | |
43 | #include <string.h> | |
44 | #include <unistd.h> | |
45 | #include <sys/param.h> | |
46 | #include <sys/types.h> | |
f91dde66 | 47 | #include <uuid/uuid.h> |
2bd0ea18 | 48 | |
f91dde66 NS |
49 | #if defined (__powerpc__) /* ppc fix from: Robert Ramiega (jedi@plukwa.net) */ |
50 | # define __BYTEORDER_HAS_U64__ | |
2bd0ea18 | 51 | #endif |
f91dde66 NS |
52 | #include <asm/byteorder.h> |
53 | ||
54 | #include <errno.h> | |
55 | #include <fcntl.h> | |
2bd0ea18 | 56 | |
f91dde66 NS |
57 | #ifndef O_DIRECT |
58 | # if defined (__powerpc__) | |
59 | # define O_DIRECT 0400000 | |
60 | # elif defined (__sparc__) | |
61ecf6c2 NS |
61 | # define O_DIRECT 0x100000 |
62 | # endif | |
63 | #endif | |
64 | ||
f91dde66 NS |
65 | #if (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ <= 1)) |
66 | # define constpp const char * const * | |
67 | #else | |
68 | # define constpp char * const * | |
69 | #endif | |
70 | ||
2bd0ea18 NS |
71 | typedef loff_t xfs_off_t; |
72 | typedef __uint64_t xfs_ino_t; | |
73 | typedef __uint32_t xfs_dev_t; | |
74 | typedef __int64_t xfs_daddr_t; | |
75 | typedef char* xfs_caddr_t; | |
76 | ||
43a8fc1e NS |
77 | typedef unsigned char uchar_t; |
78 | ||
2bd0ea18 | 79 | /* long and pointer must be either 32 bit or 64 bit */ |
2bd0ea18 | 80 | #undef HAVE_32BIT_LONG |
044fe078 | 81 | #undef HAVE_64BIT_LONG |
2bd0ea18 NS |
82 | #undef HAVE_32BIT_PTR |
83 | #undef HAVE_64BIT_PTR | |
84 | ||
044fe078 NS |
85 | #if defined(HAVE_32BIT_LONG) |
86 | # define BITS_PER_LONG 32 | |
87 | #elif defined(HAVE_64BIT_LONG) | |
88 | # define BITS_PER_LONG 64 | |
89 | #else | |
90 | # error Unknown long size | |
91 | #endif | |
92 | ||
2bd0ea18 NS |
93 | /* Check if __psint_t is set to something meaningful */ |
94 | #undef HAVE___PSINT_T | |
95 | #ifndef HAVE___PSINT_T | |
96 | # ifdef HAVE_32BIT_PTR | |
97 | typedef int __psint_t; | |
98 | # elif defined HAVE_64BIT_PTR | |
99 | # ifdef HAVE_64BIT_LONG | |
100 | typedef long __psint_t; | |
101 | # else | |
102 | /* This is a very strange architecture, which has 64 bit pointers but | |
103 | * not 64 bit longs. So, I'd just punt here and assume long long is Ok */ | |
104 | typedef long long __psint_t; | |
105 | # endif | |
106 | # else | |
107 | # error Unknown pointer size | |
108 | # endif | |
109 | #endif | |
110 | ||
111 | /* Check if __psunsigned_t is set to something meaningful */ | |
112 | #undef HAVE___PSUNSIGNED_T | |
113 | #ifndef HAVE___PSUNSIGNED_T | |
114 | # ifdef HAVE_32BIT_PTR | |
115 | typedef unsigned int __psunsigned_t; | |
116 | # elif defined HAVE_64BIT_PTR | |
117 | # ifdef HAVE_64BIT_LONG | |
118 | typedef long __psunsigned_t; | |
119 | # else | |
120 | /* This is a very strange architecture, which has 64 bit pointers but | |
121 | * not 64 bit longs. So, I'd just punt here and assume long long is Ok */ | |
122 | typedef unsigned long long __psunsigned_t; | |
123 | # endif | |
124 | # else | |
125 | # error Unknown pointer size | |
126 | # endif | |
127 | #endif | |
128 | ||
129 | #ifdef DEBUG | |
130 | # define ASSERT assert | |
131 | #else | |
132 | # define ASSERT(EX) ((void) 0) | |
133 | #endif | |
134 | ||
32181a02 NS |
135 | #define IRIX_DEV_BITSMAJOR 14 |
136 | #define IRIX_DEV_BITSMINOR 18 | |
137 | #define IRIX_DEV_MAXMAJ 0x1ff | |
138 | #define IRIX_DEV_MAXMIN 0x3ffff | |
139 | #define IRIX_DEV_MAJOR(dev) ((int)(((unsigned)(dev) >> IRIX_DEV_BITSMINOR) \ | |
140 | & IRIX_DEV_MAXMAJ)) | |
141 | #define IRIX_DEV_MINOR(dev) ((int)((dev) & IRIX_DEV_MAXMIN)) | |
142 | #define IRIX_MKDEV(major,minor) ((dev_t)(((major) << IRIX_DEV_BITSMINOR) \ | |
143 | | (minor&IRIX_DEV_MAXMIN))) | |
144 | #define IRIX_DEV_TO_KDEVT(dev) makedev(IRIX_DEV_MAJOR(dev),IRIX_DEV_MINOR(dev)) | |
145 | ||
2bd0ea18 | 146 | #endif /* __XFS_PLATFORM_DEFS_H__ */ |