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