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