aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfsplus/hfsplus_raw.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /fs/hfsplus/hfsplus_raw.h
Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'fs/hfsplus/hfsplus_raw.h')
-rw-r--r--fs/hfsplus/hfsplus_raw.h326
1 files changed, 326 insertions, 0 deletions
diff --git a/fs/hfsplus/hfsplus_raw.h b/fs/hfsplus/hfsplus_raw.h
new file mode 100644
index 00000000000..5bad37cfdb2
--- /dev/null
+++ b/fs/hfsplus/hfsplus_raw.h
@@ -0,0 +1,326 @@
1/*
2 * linux/include/linux/hfsplus_raw.h
3 *
4 * Copyright (C) 1999
5 * Brad Boyer (flar@pants.nu)
6 * (C) 2003 Ardis Technologies <roman@ardistech.com>
7 *
8 * Format of structures on disk
9 * Information taken from Apple Technote #1150 (HFS Plus Volume Format)
10 *
11 */
12
13#ifndef _LINUX_HFSPLUS_RAW_H
14#define _LINUX_HFSPLUS_RAW_H
15
16#include <linux/types.h>
17
18#define __packed __attribute__ ((packed))
19
20/* Some constants */
21#define HFSPLUS_SECTOR_SIZE 512
22#define HFSPLUS_SECTOR_SHIFT 9
23#define HFSPLUS_VOLHEAD_SECTOR 2
24#define HFSPLUS_VOLHEAD_SIG 0x482b
25#define HFSPLUS_SUPER_MAGIC 0x482b
26#define HFSPLUS_CURRENT_VERSION 4
27
28#define HFSP_WRAP_MAGIC 0x4244
29#define HFSP_WRAP_ATTRIB_SLOCK 0x8000
30#define HFSP_WRAP_ATTRIB_SPARED 0x0200
31
32#define HFSP_WRAPOFF_SIG 0x00
33#define HFSP_WRAPOFF_ATTRIB 0x0A
34#define HFSP_WRAPOFF_ABLKSIZE 0x14
35#define HFSP_WRAPOFF_ABLKSTART 0x1C
36#define HFSP_WRAPOFF_EMBEDSIG 0x7C
37#define HFSP_WRAPOFF_EMBEDEXT 0x7E
38
39#define HFSP_HIDDENDIR_NAME "\xe2\x90\x80\xe2\x90\x80\xe2\x90\x80\xe2\x90\x80HFS+ Private Data"
40
41#define HFSP_HARDLINK_TYPE 0x686c6e6b /* 'hlnk' */
42#define HFSP_HFSPLUS_CREATOR 0x6866732b /* 'hfs+' */
43
44#define HFSP_MOUNT_VERSION 0x482b4c78 /* 'H+Lx' */
45
46/* Structures used on disk */
47
48typedef __be32 hfsplus_cnid;
49typedef __be16 hfsplus_unichr;
50
51/* A "string" as used in filenames, etc. */
52struct hfsplus_unistr {
53 __be16 length;
54 hfsplus_unichr unicode[255];
55} __packed;
56
57#define HFSPLUS_MAX_STRLEN 255
58
59/* POSIX permissions */
60struct hfsplus_perm {
61 __be32 owner;
62 __be32 group;
63 u8 rootflags;
64 u8 userflags;
65 __be16 mode;
66 __be32 dev;
67} __packed;
68
69#define HFSPLUS_FLG_NODUMP 0x01
70#define HFSPLUS_FLG_IMMUTABLE 0x02
71#define HFSPLUS_FLG_APPEND 0x04
72
73/* A single contiguous area of a file */
74struct hfsplus_extent {
75 __be32 start_block;
76 __be32 block_count;
77} __packed;
78typedef struct hfsplus_extent hfsplus_extent_rec[8];
79
80/* Information for a "Fork" in a file */
81struct hfsplus_fork_raw {
82 __be64 total_size;
83 __be32 clump_size;
84 __be32 total_blocks;
85 hfsplus_extent_rec extents;
86} __packed;
87
88/* HFS+ Volume Header */
89struct hfsplus_vh {
90 __be16 signature;
91 __be16 version;
92 __be32 attributes;
93 __be32 last_mount_vers;
94 u32 reserved;
95
96 __be32 create_date;
97 __be32 modify_date;
98 __be32 backup_date;
99 __be32 checked_date;
100
101 __be32 file_count;
102 __be32 folder_count;
103
104 __be32 blocksize;
105 __be32 total_blocks;
106 __be32 free_blocks;
107
108 __be32 next_alloc;
109 __be32 rsrc_clump_sz;
110 __be32 data_clump_sz;
111 hfsplus_cnid next_cnid;
112
113 __be32 write_count;
114 __be64 encodings_bmp;
115
116 u8 finder_info[32];
117
118 struct hfsplus_fork_raw alloc_file;
119 struct hfsplus_fork_raw ext_file;
120 struct hfsplus_fork_raw cat_file;
121 struct hfsplus_fork_raw attr_file;
122 struct hfsplus_fork_raw start_file;
123} __packed;
124
125/* HFS+ volume attributes */
126#define HFSPLUS_VOL_UNMNT (1 << 8)
127#define HFSPLUS_VOL_SPARE_BLK (1 << 9)
128#define HFSPLUS_VOL_NOCACHE (1 << 10)
129#define HFSPLUS_VOL_INCNSTNT (1 << 11)
130#define HFSPLUS_VOL_SOFTLOCK (1 << 15)
131
132/* HFS+ BTree node descriptor */
133struct hfs_bnode_desc {
134 __be32 next;
135 __be32 prev;
136 s8 type;
137 u8 height;
138 __be16 num_recs;
139 u16 reserved;
140} __packed;
141
142/* HFS+ BTree node types */
143#define HFS_NODE_INDEX 0x00
144#define HFS_NODE_HEADER 0x01
145#define HFS_NODE_MAP 0x02
146#define HFS_NODE_LEAF 0xFF
147
148/* HFS+ BTree header */
149struct hfs_btree_header_rec {
150 __be16 depth;
151 __be32 root;
152 __be32 leaf_count;
153 __be32 leaf_head;
154 __be32 leaf_tail;
155 __be16 node_size;
156 __be16 max_key_len;
157 __be32 node_count;
158 __be32 free_nodes;
159 u16 reserved1;
160 __be32 clump_size;
161 u8 btree_type;
162 u8 reserved2;
163 __be32 attributes;
164 u32 reserved3[16];
165} __packed;
166
167/* BTree attributes */
168#define HFS_TREE_BIGKEYS 2
169#define HFS_TREE_VARIDXKEYS 4
170
171/* HFS+ BTree misc info */
172#define HFSPLUS_TREE_HEAD 0
173#define HFSPLUS_NODE_MXSZ 32768
174
175/* Some special File ID numbers (stolen from hfs.h) */
176#define HFSPLUS_POR_CNID 1 /* Parent Of the Root */
177#define HFSPLUS_ROOT_CNID 2 /* ROOT directory */
178#define HFSPLUS_EXT_CNID 3 /* EXTents B-tree */
179#define HFSPLUS_CAT_CNID 4 /* CATalog B-tree */
180#define HFSPLUS_BAD_CNID 5 /* BAD blocks file */
181#define HFSPLUS_ALLOC_CNID 6 /* ALLOCation file */
182#define HFSPLUS_START_CNID 7 /* STARTup file */
183#define HFSPLUS_ATTR_CNID 8 /* ATTRibutes file */
184#define HFSPLUS_EXCH_CNID 15 /* ExchangeFiles temp id */
185#define HFSPLUS_FIRSTUSER_CNID 16 /* first available user id */
186
187/* HFS+ catalog entry key */
188struct hfsplus_cat_key {
189 __be16 key_len;
190 hfsplus_cnid parent;
191 struct hfsplus_unistr name;
192} __packed;
193
194
195/* Structs from hfs.h */
196struct hfsp_point {
197 __be16 v;
198 __be16 h;
199} __packed;
200
201struct hfsp_rect {
202 __be16 top;
203 __be16 left;
204 __be16 bottom;
205 __be16 right;
206} __packed;
207
208
209/* HFS directory info (stolen from hfs.h */
210struct DInfo {
211 struct hfsp_rect frRect;
212 __be16 frFlags;
213 struct hfsp_point frLocation;
214 __be16 frView;
215} __packed;
216
217struct DXInfo {
218 struct hfsp_point frScroll;
219 __be32 frOpenChain;
220 __be16 frUnused;
221 __be16 frComment;
222 __be32 frPutAway;
223} __packed;
224
225/* HFS+ folder data (part of an hfsplus_cat_entry) */
226struct hfsplus_cat_folder {
227 __be16 type;
228 __be16 flags;
229 __be32 valence;
230 hfsplus_cnid id;
231 __be32 create_date;
232 __be32 content_mod_date;
233 __be32 attribute_mod_date;
234 __be32 access_date;
235 __be32 backup_date;
236 struct hfsplus_perm permissions;
237 struct DInfo user_info;
238 struct DXInfo finder_info;
239 __be32 text_encoding;
240 u32 reserved;
241} __packed;
242
243/* HFS file info (stolen from hfs.h) */
244struct FInfo {
245 __be32 fdType;
246 __be32 fdCreator;
247 __be16 fdFlags;
248 struct hfsp_point fdLocation;
249 __be16 fdFldr;
250} __packed;
251
252struct FXInfo {
253 __be16 fdIconID;
254 u8 fdUnused[8];
255 __be16 fdComment;
256 __be32 fdPutAway;
257} __packed;
258
259/* HFS+ file data (part of a cat_entry) */
260struct hfsplus_cat_file {
261 __be16 type;
262 __be16 flags;
263 u32 reserved1;
264 hfsplus_cnid id;
265 __be32 create_date;
266 __be32 content_mod_date;
267 __be32 attribute_mod_date;
268 __be32 access_date;
269 __be32 backup_date;
270 struct hfsplus_perm permissions;
271 struct FInfo user_info;
272 struct FXInfo finder_info;
273 __be32 text_encoding;
274 u32 reserved2;
275
276 struct hfsplus_fork_raw data_fork;
277 struct hfsplus_fork_raw rsrc_fork;
278} __packed;
279
280/* File attribute bits */
281#define HFSPLUS_FILE_LOCKED 0x0001
282#define HFSPLUS_FILE_THREAD_EXISTS 0x0002
283
284/* HFS+ catalog thread (part of a cat_entry) */
285struct hfsplus_cat_thread {
286 __be16 type;
287 s16 reserved;
288 hfsplus_cnid parentID;
289 struct hfsplus_unistr nodeName;
290} __packed;
291
292#define HFSPLUS_MIN_THREAD_SZ 10
293
294/* A data record in the catalog tree */
295typedef union {
296 __be16 type;
297 struct hfsplus_cat_folder folder;
298 struct hfsplus_cat_file file;
299 struct hfsplus_cat_thread thread;
300} __packed hfsplus_cat_entry;
301
302/* HFS+ catalog entry type */
303#define HFSPLUS_FOLDER 0x0001
304#define HFSPLUS_FILE 0x0002
305#define HFSPLUS_FOLDER_THREAD 0x0003
306#define HFSPLUS_FILE_THREAD 0x0004
307
308/* HFS+ extents tree key */
309struct hfsplus_ext_key {
310 __be16 key_len;
311 u8 fork_type;
312 u8 pad;
313 hfsplus_cnid cnid;
314 __be32 start_block;
315} __packed;
316
317#define HFSPLUS_EXT_KEYLEN 12
318
319/* HFS+ generic BTree key */
320typedef union {
321 __be16 key_len;
322 struct hfsplus_cat_key cat;
323 struct hfsplus_ext_key ext;
324} __packed hfsplus_btree_key;
325
326#endif