]>
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>
27 kMinHFSPlusVolumeSize
= (512 * 1024),
29 kBytesPerSector
= 512,
30 kBitsPerSector
= 4096,
31 kBTreeHeaderUserBytes
= 128,
34 kHFSMaxAllocationBlks
= 65536,
36 kHFSPlusDataClumpFactor
= 16,
37 kHFSPlusRsrcClumpFactor
= 16,
43 kVolBitMapStart
= kHeaderBlocks
,
45 /* Desktop DB, Desktop DF, Finder, System, ReadMe */
47 /* Maximum wrapper size is 32MB */
48 kMaxWrapperSize
= 1024 * 1024 * 32,
49 /* Maximum volume that can be wrapped is 256GB */
50 kMaxWrapableSectors
= (kMaxWrapperSize
/8) * (65536/512)
53 /* B-tree key descriptor */
62 #define KD_FIXLENSTR 8
67 * The following constant sets the default block size.
68 * This constant must be a power of 2 and meet the following constraints:
69 * MINBSIZE <= DFL_BLKSIZE <= MAXBSIZE
70 * sectorsize <= DFL_BLKSIZE
72 #define HFSOPTIMALBLKSIZE 4096
73 #define HFSMINBSIZE 512
74 #define HFSMAXBSIZE 2147483648U
75 #define DFL_BLKSIZE HFSOPTIMALBLKSIZE
78 #define kDTDF_FileID 16
79 #define kDTDF_Name "Desktop DF"
80 #define kDTDF_Chars 10
81 #define kDTDF_Type 'DTFL'
82 #define kDTDF_Creator 'DMGR'
84 #define kDTDB_FileID 17
85 #define kDTDB_Name "Desktop DB"
86 #define kDTDB_Chars 10
87 #define kDTDB_Type 'BTFL'
88 #define kDTDB_Creator 'DMGR'
89 #define kDTDB_Size 1024
91 #define kReadMe_FileID 18
92 #define kReadMe_Name "ReadMe"
93 #define kReadMe_Chars 6
94 #define kReadMe_Type 'ttro'
95 #define kReadMe_Creator 'ttxt'
97 #define kFinder_FileID 19
98 #define kFinder_Name "Finder"
99 #define kFinder_Chars 6
100 #define kFinder_Type 'FNDR'
101 #define kFinder_Creator 'MACS'
103 #define kSystem_FileID 20
104 #define kSystem_Name "System"
105 #define kSystem_Chars 6
106 #define kSystem_Type 'zsys'
107 #define kSystem_Creator 'MACS'
111 #if !defined(FALSE) && !defined(TRUE)
119 #define kDefaultVolumeNameStr "untitled"
122 * This is the straight GMT conversion constant:
124 * 00:00:00 January 1, 1970 - 00:00:00 January 1, 1904
125 * (3600 * 24 * ((365 * (1970 - 1904)) + (((1970 - 1904) / 4) + 1)))
127 #define MAC_GMT_FACTOR 2082844800UL
130 * Maximum number of bytes in an HFS+ filename.
131 * It's 255 characters; a UTF16 character may translate
132 * to 3 bytes. Plus one for NUL.
135 #define kHFSPlusMaxFileNameBytes (3 * 255 + 1)
137 /* sectorSize = kBytesPerSector = 512
138 sectorOffset and totalSectors are in terms of 512-byte sector size.
143 uint32_t sectorOffset
;
144 uint64_t totalSectors
;
146 /* actual device info. physSectorSize is necessary to de-block
147 * while using the raw device.
149 uint32_t physSectorSize
;
150 uint64_t physSectorsPerIO
;
151 uint64_t physTotalSectors
;
153 typedef struct DriveInfo DriveInfo
;
156 kMakeHFSWrapper
= 0x01,
157 kMakeMaxHFSBitmap
= 0x02,
158 kMakeStandardHFS
= 0x04,
159 kMakeCaseSensitive
= 0x08,
160 kUseAccessPerms
= 0x10,
161 kMakeContentProtect
= 0x20,
166 uint32_t flags
; /* kMakeHFSWrapper, ... */
168 uint32_t rsrcClumpSize
;
169 uint32_t dataClumpSize
;
170 uint32_t nextFreeFileID
;
172 uint32_t catalogClumpSize
;
173 uint32_t catalogInitialSize
;
174 uint32_t catalogNodeSize
;
175 uint32_t catalogExtsCount
;
176 uint32_t catalogStartBlock
;
178 uint32_t extentsClumpSize
;
179 uint32_t extentsInitialSize
;
180 uint32_t extentsNodeSize
;
181 uint32_t extentsExtsCount
;
182 uint32_t extentsStartBlock
;
184 uint32_t attributesClumpSize
;
185 uint32_t attributesInitialSize
;
186 uint32_t attributesNodeSize
;
187 uint32_t attributesExtsCount
;
188 uint32_t attributesStartBlock
;
190 uint32_t allocationClumpSize
;
191 uint32_t allocationExtsCount
;
192 uint32_t allocationStartBlock
;
194 uint32_t createDate
; /* in UTC */
195 uint32_t hfsAlignment
;
196 unsigned char *volumeName
; /* In UTF8, but we need to allocate space for it. */
197 uint32_t journaledHFS
;
198 uint32_t journalSize
;
199 uint32_t journalInfoBlock
;
200 uint32_t journalBlock
;
206 uint16_t protectlevel
;
208 uint32_t fsStartBlock
; /* allocation block offset where the btree allocaiton should start */
209 uint32_t nextAllocBlock
; /* Set VH nextAllocationBlock */
211 typedef struct hfsparams hfsparams_t
;
213 extern int make_hfsplus(const DriveInfo
*driveInfo
, hfsparams_t
*defaults
);
217 void fatal(const char *fmt
, ...);