]>
git.saurik.com Git - apple/hfs.git/blob - newfs_hfs/newfs_hfs.h
2 * Copyright (c) 1999-2015 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 * Maximum number of bytes in an HFS+ filename.
179 * It's 255 characters; a UTF16 character may translate
180 * to 3 bytes. Plus one for NUL.
183 #define kHFSPlusMaxFileNameBytes (3 * 255 + 1)
185 /* sectorSize = kBytesPerSector = 512
186 sectorOffset and totalSectors are in terms of 512-byte sector size.
191 uint32_t sectorOffset
;
192 uint64_t totalSectors
;
194 /* actual device info. physSectorSize is necessary to de-block
195 * while using the raw device.
197 uint32_t physSectorSize
;
198 uint64_t physSectorsPerIO
;
199 uint64_t physTotalSectors
;
201 typedef struct DriveInfo DriveInfo
;
204 kMakeHFSWrapper
= 0x01,
205 kMakeMaxHFSBitmap
= 0x02,
206 kMakeStandardHFS
= 0x04,
207 kMakeCaseSensitive
= 0x08,
208 kUseAccessPerms
= 0x10,
209 kMakeContentProtect
= 0x20,
214 uint32_t flags
; /* kMakeHFSWrapper, ... */
216 uint32_t rsrcClumpSize
;
217 uint32_t dataClumpSize
;
218 uint32_t nextFreeFileID
;
220 uint32_t catalogClumpSize
;
221 uint32_t catalogInitialSize
;
222 uint32_t catalogNodeSize
;
223 uint32_t catalogExtsCount
;
224 uint32_t catalogStartBlock
;
226 uint32_t extentsClumpSize
;
227 uint32_t extentsInitialSize
;
228 uint32_t extentsNodeSize
;
229 uint32_t extentsExtsCount
;
230 uint32_t extentsStartBlock
;
232 uint32_t attributesClumpSize
;
233 uint32_t attributesInitialSize
;
234 uint32_t attributesNodeSize
;
235 uint32_t attributesExtsCount
;
236 uint32_t attributesStartBlock
;
238 uint32_t allocationClumpSize
;
239 uint32_t allocationExtsCount
;
240 uint32_t allocationStartBlock
;
242 uint32_t createDate
; /* in UTC */
243 uint32_t hfsAlignment
;
244 unsigned char *volumeName
; /* In UTF8, but we need to allocate space for it. */
245 uint32_t encodingHint
;
246 uint32_t journaledHFS
;
247 uint32_t journalSize
;
248 uint32_t journalInfoBlock
;
249 uint32_t journalBlock
;
255 uint16_t protectlevel
;
257 uint32_t fsStartBlock
; /* allocation block offset where the btree allocaiton should start */
258 uint32_t nextAllocBlock
; /* Set VH nextAllocationBlock */
260 typedef struct hfsparams hfsparams_t
;
262 extern int make_hfsplus(const DriveInfo
*driveInfo
, hfsparams_t
*defaults
);
266 void fatal(const char *fmt
, ...);