]>
git.saurik.com Git - hfs.git/blob - newfs_hfs/newfs_hfs.h
2 * Copyright (c) 1999-2011 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
24 #include <CoreFoundation/CFBase.h>
30 kHasBeenInited
= 0x0100, /* Files only */
31 /* Clear if the file contains desktop database */
32 /* bit 0x0200 was the letter bit for AOCE, but is now reserved for future use */
33 kHasCustomIcon
= 0x0400, /* Files and folders */
34 kIsStationery
= 0x0800, /* Files only */
35 kNameLocked
= 0x1000, /* Files and folders */
36 kHasBundle
= 0x2000, /* Files only */
37 kIsInvisible
= 0x4000, /* Files and folders */
38 kIsAlias
= 0x8000 /* Files only */
42 /* Finder types (mostly opaque in our usage) */
44 uint32_t fileType
; /* The type of the file */
45 uint32_t fileCreator
; /* The file's creator */
46 UInt16 finderFlags
; /* ex: kHasBundle, kIsInvisible... */
47 UInt8 opaque
[6]; /* If set to {0, 0}, the Finder will place the item automatically */
49 typedef struct FInfo FInfo
;
54 typedef struct FXInfo FXInfo
;
59 typedef struct DInfo DInfo
;
64 typedef struct DXInfo DXInfo
;
68 kMinHFSPlusVolumeSize
= (512 * 1024),
70 kBytesPerSector
= 512,
71 kBitsPerSector
= 4096,
72 kBTreeHeaderUserBytes
= 128,
75 kHFSMaxAllocationBlks
= 65536,
77 kHFSPlusDataClumpFactor
= 16,
78 kHFSPlusRsrcClumpFactor
= 16,
84 kVolBitMapStart
= kHeaderBlocks
,
86 /* Desktop DB, Desktop DF, Finder, System, ReadMe */
88 /* Maximum wrapper size is 32MB */
89 kMaxWrapperSize
= 1024 * 1024 * 32,
90 /* Maximum volume that can be wrapped is 256GB */
91 kMaxWrapableSectors
= (kMaxWrapperSize
/8) * (65536/512)
94 /* B-tree key descriptor */
100 #define KD_SIGNWORD 5
102 #define KD_SIGNLONG 7
103 #define KD_FIXLENSTR 8
105 #define KD_USEPROC 10
109 kTextEncodingMacRoman
= 0L,
110 kTextEncodingMacJapanese
= 1
115 * The following constant sets the default block size.
116 * This constant must be a power of 2 and meet the following constraints:
117 * MINBSIZE <= DFL_BLKSIZE <= MAXBSIZE
118 * sectorsize <= DFL_BLKSIZE
120 #define HFSOPTIMALBLKSIZE 4096
121 #define HFSMINBSIZE 512
122 #define HFSMAXBSIZE 2147483648U
123 #define DFL_BLKSIZE HFSOPTIMALBLKSIZE
126 #define kDTDF_FileID 16
127 #define kDTDF_Name "Desktop DF"
128 #define kDTDF_Chars 10
129 #define kDTDF_Type 'DTFL'
130 #define kDTDF_Creator 'DMGR'
132 #define kDTDB_FileID 17
133 #define kDTDB_Name "Desktop DB"
134 #define kDTDB_Chars 10
135 #define kDTDB_Type 'BTFL'
136 #define kDTDB_Creator 'DMGR'
137 #define kDTDB_Size 1024
139 #define kReadMe_FileID 18
140 #define kReadMe_Name "ReadMe"
141 #define kReadMe_Chars 6
142 #define kReadMe_Type 'ttro'
143 #define kReadMe_Creator 'ttxt'
145 #define kFinder_FileID 19
146 #define kFinder_Name "Finder"
147 #define kFinder_Chars 6
148 #define kFinder_Type 'FNDR'
149 #define kFinder_Creator 'MACS'
151 #define kSystem_FileID 20
152 #define kSystem_Name "System"
153 #define kSystem_Chars 6
154 #define kSystem_Type 'zsys'
155 #define kSystem_Creator 'MACS'
159 #if !defined(FALSE) && !defined(TRUE)
167 #define kDefaultVolumeNameStr "untitled"
170 * This is the straight GMT conversion constant:
172 * 00:00:00 January 1, 1970 - 00:00:00 January 1, 1904
173 * (3600 * 24 * ((365 * (1970 - 1904)) + (((1970 - 1904) / 4) + 1)))
175 #define MAC_GMT_FACTOR 2082844800UL
178 /* sectorSize = kBytesPerSector = 512
179 sectorOffset and totalSectors are in terms of 512-byte sector size.
184 uint32_t sectorOffset
;
185 uint64_t totalSectors
;
187 /* actual device info. physSectorSize is necessary to de-block
188 * while using the raw device.
190 uint32_t physSectorSize
;
191 uint64_t physSectorsPerIO
;
192 uint64_t physTotalSectors
;
194 typedef struct DriveInfo DriveInfo
;
197 kMakeHFSWrapper
= 0x01,
198 kMakeMaxHFSBitmap
= 0x02,
199 kMakeStandardHFS
= 0x04,
200 kMakeCaseSensitive
= 0x08,
201 kUseAccessPerms
= 0x10,
202 kMakeContentProtect
= 0x20,
207 uint32_t flags
; /* kMakeHFSWrapper, ... */
209 uint32_t rsrcClumpSize
;
210 uint32_t dataClumpSize
;
211 uint32_t nextFreeFileID
;
213 uint32_t catalogClumpSize
;
214 uint32_t catalogNodeSize
;
215 uint32_t catalogExtsCount
;
216 uint32_t catalogStartBlock
;
218 uint32_t extentsClumpSize
;
219 uint32_t extentsNodeSize
;
220 uint32_t extentsExtsCount
;
221 uint32_t extentsStartBlock
;
223 uint32_t attributesClumpSize
;
224 uint32_t attributesNodeSize
;
225 uint32_t attributesExtsCount
;
226 uint32_t attributesStartBlock
;
228 uint32_t allocationClumpSize
;
229 uint32_t allocationExtsCount
;
230 uint32_t allocationStartBlock
;
232 uint32_t createDate
; /* in UTC */
233 uint32_t hfsAlignment
;
234 unsigned char volumeName
[kHFSPlusMaxFileNameChars
+ 1]; /* in UTF-8 */
235 uint32_t encodingHint
;
236 uint32_t journaledHFS
;
237 uint32_t journalSize
;
238 uint32_t journalInfoBlock
;
239 uint32_t journalBlock
;
245 uint16_t protectlevel
;
247 uint32_t fsStartBlock
; /* allocation block offset where the btree allocaiton should start */
248 uint32_t nextAllocBlock
; /* Set VH nextAllocationBlock */
250 typedef struct hfsparams hfsparams_t
;
252 extern int make_hfsplus(const DriveInfo
*driveInfo
, hfsparams_t
*defaults
);
256 void fatal(const char *fmt
, ...);