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