1 |
/* |
2 |
* PearPC |
3 |
* hfsstruct.h |
4 |
* |
5 |
* Copyright (C) 2004 Stefan Weyergraf |
6 |
* |
7 |
* This program is free software; you can redistribute it and/or modify |
8 |
* it under the terms of the GNU General Public License version 2 as |
9 |
* published by the Free Software Foundation. |
10 |
* |
11 |
* This program is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 |
*/ |
20 |
|
21 |
#ifndef __HFSSTRUCT_H__ |
22 |
#define __HFSSTRUCT_H__ |
23 |
|
24 |
#define HFSSigWord MAGIC16("BD") |
25 |
|
26 |
struct HFSExtentDescriptor { |
27 |
uint16 startBlock; |
28 |
uint16 blockCount; |
29 |
} PACKED; |
30 |
|
31 |
struct HFSMDB { |
32 |
uint16 drSigWord; |
33 |
uint32 drCrDate; |
34 |
uint32 drLsMod; |
35 |
uint16 drAtrb; |
36 |
uint16 drNmFls; |
37 |
uint16 drVBMSt; |
38 |
uint16 drAllocPtr; |
39 |
uint16 drNmAlBlks; |
40 |
uint32 drAlblkSz; |
41 |
uint32 drClpSiz; |
42 |
uint16 drAlBlSt; |
43 |
uint32 drNxtCNID; |
44 |
uint16 drFreeBks; |
45 |
char drVN[28]; |
46 |
uint32 drVolBkUp; |
47 |
uint16 drVSeqNum; |
48 |
uint32 drWrCnt; |
49 |
uint32 drXTClpSiz; |
50 |
uint32 drCTClpSiz; |
51 |
uint16 drNmRtDirs; |
52 |
uint32 drFilCnt; |
53 |
uint32 drDirCnt; |
54 |
uint32 drFndrInfo[8]; |
55 |
uint16 drEmbedSigWord; |
56 |
HFSExtentDescriptor drEmbedExtent; |
57 |
uint32 drXtFlSize; |
58 |
HFSExtentDescriptor drXTExtRec[3]; |
59 |
uint32 drCTFlSize; |
60 |
HFSExtentDescriptor drCTExtRec[3]; |
61 |
} PACKED; |
62 |
|
63 |
#if 0 |
64 |
struct HFSNodeDescriptor { |
65 |
uint32 ndFLink; // forward link |
66 |
uint32 ndBLink; // backward link |
67 |
char ndType; // node type |
68 |
char ndNHeight; // node level |
69 |
uint16 ndNRecs; // number of records in node |
70 |
uint16 ndResv2; // reserved |
71 |
} PACKED; |
72 |
|
73 |
enum HFSNodeType { |
74 |
ndIndxNode = 0, |
75 |
ndHdrNode = 1, |
76 |
ndMapNode = 2, |
77 |
ndLeafNode = -1 |
78 |
}; |
79 |
|
80 |
union HFSNode { |
81 |
HFSNodeDescriptor desc; |
82 |
byte raw[512]; |
83 |
} PACKED; |
84 |
|
85 |
struct HFSBTHdrRec { |
86 |
uint16 bthDepth; |
87 |
uint32 bthRoot; |
88 |
uint32 bthNRecs; |
89 |
uint32 bthFNode; |
90 |
uint32 bthLNode; |
91 |
uint16 bthNodeSize; |
92 |
uint16 bthKeyLen; |
93 |
uint32 bthNNodes; |
94 |
uint32 bthFree; |
95 |
char bthResv[76]; |
96 |
} PACKED; |
97 |
|
98 |
struct HFSCatKeyRec { |
99 |
char ckrKeyLen; |
100 |
char ckrResrv1; |
101 |
uint32 ckrParID; |
102 |
char ckrCName[31]; |
103 |
} PACKED; |
104 |
|
105 |
enum HFSCatDataType { |
106 |
cdrDirRec = 1, |
107 |
cdrFilRec = 2, |
108 |
cdrThdRec = 3, |
109 |
cdrFThdRec = 4 |
110 |
}; |
111 |
|
112 |
struct HFSFXInfo { |
113 |
uint16 fdIconID; //icon ID |
114 |
uint16 fdUnused[3]; //unused but reserved 6 bytes |
115 |
char fdScript; //script flag and code |
116 |
char fdXFlags; //reserved |
117 |
uint16 fdComment; //comment ID |
118 |
uint32 fdPutAway; //home directory ID |
119 |
} PACKED; |
120 |
|
121 |
struct HFSFInfo { |
122 |
char fdType[4]; //file type |
123 |
char fdCreator[4]; //file creator |
124 |
uint16 fdFlags; //Finder flags |
125 |
uint16 fdLocation_v; //file's location in window |
126 |
uint16 fdLocation_h; |
127 |
uint16 fdFldr; //directory that contains file |
128 |
} PACKED; |
129 |
|
130 |
struct HFSCatDirRec { |
131 |
uint16 dirFlags; //directory flags |
132 |
uint16 dirVal; //directory valence |
133 |
uint32 dirDirID; //directory ID |
134 |
uint32 dirCrDat; //date and time of creation |
135 |
uint32 dirMdDat; //date and time of last modification |
136 |
uint32 dirBkDat; //date and time of last backup |
137 |
// dont care |
138 |
// dirUsrInfo:DInfo;//Finder information |
139 |
// dirFndrInfo:DXInfo;//additional Finder information |
140 |
// uint32 dirResrv[4]; |
141 |
} PACKED; |
142 |
|
143 |
struct HFSCatFileRec { |
144 |
char filFlags; //file flags |
145 |
char filTyp; //file type |
146 |
HFSFInfo filUsrWds; //Finder information |
147 |
uint32 filFlNum; //file ID |
148 |
uint16 filStBlk; //first alloc. blk. of data fork |
149 |
uint32 filLgLen; //logical EOF of data fork |
150 |
uint32 filPyLen; //physical EOF of data fork |
151 |
uint16 filRStBlk; //first alloc.blk.of resource fork |
152 |
uint32 filRLgLen; //logical EOF of resource fork |
153 |
uint32 filRPyLen; //physical EOF of resource fork |
154 |
uint32 filCrDat; //date and time of creation |
155 |
uint32 filMdDat; //date and time of last modification |
156 |
uint32 filBkDat; //date and time of last backup |
157 |
HFSFXInfo filFndrInfo; //additional Finder information |
158 |
uint16 filClpSize; //file clump size |
159 |
HFSExtentDescriptor filExtRec[3];//first data fork extent record |
160 |
HFSExtentDescriptor filRExtRec[3];//first resource fork extent record |
161 |
uint32 filResrv; //reserved |
162 |
} PACKED; |
163 |
|
164 |
struct HFSCatDataRec { |
165 |
char cdrType; |
166 |
char cdrResrv2; |
167 |
// layout depends on cdrType |
168 |
union { |
169 |
HFSCatDirRec dirRec; |
170 |
HFSCatFileRec fileRec; |
171 |
//directory thread record |
172 |
struct { |
173 |
uint32 thdResrv[2]; |
174 |
uint32 thdParID; //parent ID for this directory |
175 |
char thdCName[31]; //name of this directory |
176 |
} dirThreadRec; |
177 |
//file thread record |
178 |
struct { |
179 |
uint32 fthdResrv[2]; |
180 |
uint32 fthdParID; //parent ID for this file |
181 |
char fthdCName[31]; //name of this file |
182 |
} fileThreadRec; |
183 |
}; |
184 |
} PACKED; |
185 |
#endif |
186 |
|
187 |
#endif |