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