]> git.saurik.com Git - apple/xnu.git/blob - bsd/hfs/hfs_macos_defs.h
xnu-517.3.7.tar.gz
[apple/xnu.git] / bsd / hfs / hfs_macos_defs.h
1 /*
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25
26 #ifndef __HFS_MACOS_TYPES__
27 #define __HFS_MACOS_TYPES__
28
29 #include <sys/appleapiopts.h>
30
31 #ifdef KERNEL
32 #ifdef __APPLE_API_PRIVATE
33
34 #include <sys/param.h>
35 #ifdef KERNEL
36 #include <libkern/libkern.h>
37 #include <sys/systm.h>
38 #endif
39
40 #include <sys/types.h>
41 #include <sys/time.h>
42 #include <sys/proc.h>
43 #include <sys/lock.h>
44
45
46 #define TARGET_OS_MAC 0
47 #define TARGET_OS_WIN32 0
48 #define TARGET_OS_UNIX 0
49
50 #define PRAGMA_IMPORT 0
51 #define PRAGMA_STRUCT_ALIGN 1
52 #define PRAGMA_ONCE 0
53 #define PRAGMA_STRUCT_PACK 0
54 #define PRAGMA_STRUCT_PACKPUSH 0
55
56 #if __GNUC__ >= 2
57 #define TYPE_LONGLONG 1
58 #else
59 #define TYPE_LONGLONG 0
60 #endif
61 #ifdef __cplusplus
62 #define TYPE_BOOL 1
63 #else
64 #define TYPE_BOOL 0
65 #endif
66
67 #define EXTERN_API(_type) extern _type
68 #define EXTERN_API_C(_type) extern _type
69
70 #define CALLBACK_API_C(_type, _name) _type ( * _name)
71
72 #define TARGET_API_MACOS_X 1
73 #define TARGET_API_MAC_OS8 0
74 #define TARGET_API_MAC_CARBON 0
75
76
77
78 /****** START OF MACOSTYPES *********/
79
80
81 /*
82 4.4BSD's sys/types.h defines size_t without defining __size_t__:
83 Things are a lot clearer from here on if we define __size_t__ now.
84 */
85 #define __size_t__
86
87 /*
88 Convert kernel's diagnostic flag to MacOS's
89 */
90 #if HFS_DIAGNOSTIC
91 #define DEBUG_BUILD 1
92 #else
93 #define DEBUG_BUILD 0
94 #endif /* DIAGNOSTIC */
95
96 /********************************************************************************
97
98 Special values in C
99
100 NULL The C standard for an impossible pointer value
101 nil A carry over from pascal, NULL is prefered for C
102
103 *********************************************************************************/
104 #ifndef NULL
105 #define NULL 0
106 #endif
107
108 #ifndef nil
109 #define nil NULL
110 #endif
111
112
113 typedef u_int8_t UInt8;
114 typedef int8_t SInt8;
115 typedef u_int16_t UInt16;
116 typedef int16_t SInt16;
117 typedef u_int32_t UInt32;
118 typedef int32_t SInt32;
119 typedef u_int64_t UInt64;
120 typedef int64_t SInt64;
121
122 typedef char * Ptr;
123 typedef long Size;
124
125 typedef SInt16 OSErr;
126 typedef SInt32 OSStatus;
127 typedef UInt32 ItemCount;
128 typedef void * LogicalAddress;
129 typedef UInt32 ByteCount;
130 typedef UInt8 * BytePtr;
131 typedef UInt32 ByteOffset;
132 typedef UInt32 OptionBits;
133 typedef unsigned long FourCharCode;
134 typedef FourCharCode OSType;
135
136 typedef UInt16 UniChar;
137 typedef unsigned char Str255[256];
138 typedef unsigned char Str31[32];
139 typedef unsigned char * StringPtr;
140 typedef const unsigned char * ConstStr255Param;
141 typedef const unsigned char * ConstStr31Param;
142 typedef const unsigned char * ConstUTF8Param;
143
144 typedef UInt8 Byte;
145
146 typedef UInt32 TextEncoding;
147 typedef UniChar * UniCharArrayPtr;
148 typedef const UniChar * ConstUniCharArrayPtr;
149
150
151 /********************************************************************************
152
153 Boolean types and values
154
155 Boolean A one byte value, holds "false" (0) or "true" (1)
156 false The Boolean value of zero (0)
157 true The Boolean value of one (1)
158
159 *********************************************************************************/
160 /*
161 The identifiers "true" and "false" are becoming keywords in C++
162 and work with the new built-in type "bool"
163 "Boolean" will remain an unsigned char for compatibility with source
164 code written before "bool" existed.
165 */
166 #if !TYPE_BOOL
167
168 enum {
169 false = 0,
170 true = 1
171 };
172
173 #endif /* !TYPE_BOOL */
174
175 typedef unsigned char Boolean;
176
177
178
179
180 EXTERN_API( void ) DebugStr(ConstStr255Param debuggerMsg);
181
182 /*********************************************************************************
183
184 Added types for HFSPlus MacOS X functionality. Needs to be incorporated to
185 other places
186
187 *********************************************************************************/
188
189 typedef struct vnode* FileReference;
190
191
192 /***** START OF MACOSSTUBS ********/
193
194
195 /*
196 SizeTDef.h -- Common definitions
197
198 size_t - this type is defined by several ANSI headers.
199 */
200 #if ! defined (__size_t__)
201 #define __size_t__
202 #if defined (__xlc) || defined (__xlC) || defined (__xlC__) || defined (__MWERKS__)
203 typedef unsigned long size_t;
204 #else /* __xlC */
205 typedef unsigned int size_t;
206 #endif /* __xlC */
207 #endif /* __size_t__ */
208
209
210 /*
211 File: Errors.h
212
213 */
214 enum {
215 noErr = 0,
216 dskFulErr = -34, /*disk full*/
217 bdNamErr = -37, /*there may be no bad names in the final system!*/
218 paramErr = -50, /*error in user parameter list*/
219 memFullErr = -108, /*Not enough room in heap zone*/
220 fileBoundsErr = -1309, /*file's EOF, offset, mark or size is too big*/
221 kTECUsedFallbacksStatus = -8783,
222
223 };
224
225
226 enum {
227 /* Finder Flags */
228 kHasBeenInited = 0x0100,
229 kHasCustomIcon = 0x0400,
230 kIsStationery = 0x0800,
231 kNameLocked = 0x1000,
232 kHasBundle = 0x2000,
233 kIsInvisible = 0x4000,
234 kIsAlias = 0x8000
235 };
236
237 enum {
238 fsRtParID = 1,
239 fsRtDirID = 2
240 };
241
242
243 enum {
244 /* Mac OS encodings*/
245 kTextEncodingMacRoman = 0L,
246 kTextEncodingMacJapanese = 1,
247 kTextEncodingMacChineseTrad = 2,
248 kTextEncodingMacKorean = 3,
249 kTextEncodingMacArabic = 4,
250 kTextEncodingMacHebrew = 5,
251 kTextEncodingMacGreek = 6,
252 kTextEncodingMacCyrillic = 7,
253 kTextEncodingMacDevanagari = 9,
254 kTextEncodingMacGurmukhi = 10,
255 kTextEncodingMacGujarati = 11,
256 kTextEncodingMacOriya = 12,
257 kTextEncodingMacBengali = 13,
258 kTextEncodingMacTamil = 14,
259 kTextEncodingMacTelugu = 15,
260 kTextEncodingMacKannada = 16,
261 kTextEncodingMacMalayalam = 17,
262 kTextEncodingMacSinhalese = 18,
263 kTextEncodingMacBurmese = 19,
264 kTextEncodingMacKhmer = 20,
265 kTextEncodingMacThai = 21,
266 kTextEncodingMacLaotian = 22,
267 kTextEncodingMacGeorgian = 23,
268 kTextEncodingMacArmenian = 24,
269 kTextEncodingMacChineseSimp = 25,
270 kTextEncodingMacTibetan = 26,
271 kTextEncodingMacMongolian = 27,
272 kTextEncodingMacEthiopic = 28,
273 kTextEncodingMacCentralEurRoman = 29,
274 kTextEncodingMacVietnamese = 30,
275 kTextEncodingMacExtArabic = 31, /* The following use script code 0, smRoman*/
276 kTextEncodingMacSymbol = 33,
277 kTextEncodingMacDingbats = 34,
278 kTextEncodingMacTurkish = 35,
279 kTextEncodingMacCroatian = 36,
280 kTextEncodingMacIcelandic = 37,
281 kTextEncodingMacRomanian = 38,
282 kTextEncodingMacUnicode = 0x7E,
283
284 kTextEncodingMacFarsi = 0x8C, /* Like MacArabic but uses Farsi digits */ /* The following use script code 7, smCyrillic */
285 kTextEncodingMacUkrainian = 0x98, /* The following use script code 32, smUnimplemented */
286 };
287
288
289 /* PROTOTYPES */
290
291 #if HFS_DIAGNOSTIC
292 extern void RequireFileLock(FileReference vp, int shareable);
293 #define REQUIRE_FILE_LOCK(vp,s) RequireFileLock((vp),(s))
294 #else
295 #define REQUIRE_FILE_LOCK(vp,s)
296 #endif
297
298
299 EXTERN_API( void )
300 BlockMoveData(const void * srcPtr, void * destPtr, Size byteCount);
301
302 #define BlockMoveData(src, dest, len) bcopy((src), (dest), (len))
303
304 EXTERN_API_C( void )
305 ClearMemory(void * start, UInt32 length);
306
307 #define ClearMemory(start, length) bzero((start), (size_t)(length));
308
309
310 EXTERN_API( Ptr )
311 NewPtr(Size byteCount);
312
313 EXTERN_API( Ptr )
314 NewPtrSysClear(Size byteCount);
315
316 EXTERN_API( void )
317 DisposePtr(Ptr p);
318
319 #endif /* __APPLE_API_PRIVATE */
320 #endif /* KERNEL */
321 #endif /* __HFS_MACOS_TYPES__ */