aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVyacheslav Dubeyko <slava@dubeyko.com>2013-02-27 20:03:00 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-27 22:10:10 -0500
commit9ed083d8ccc6186448c3558c6f40b40ba0b1568a (patch)
treeb1e03c9aefe854b3c002fc516d9bf0c69091ce17
parent5841ca09b35df4ecb0fee4e8fbd21ef177509a71 (diff)
hfsplus: add on-disk layout declarations related to attributes tree
Add all necessary on-disk layout declarations related to attributes file. Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com> Reported-by: Hin-Tak Leung <htl10@users.sourceforge.net> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Christoph Hellwig <hch@lst.de> Cc: Jan Kara <jack@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/hfsplus/hfsplus_raw.h68
1 files changed, 66 insertions, 2 deletions
diff --git a/fs/hfsplus/hfsplus_raw.h b/fs/hfsplus/hfsplus_raw.h
index 921967e5abb1..452ede01b036 100644
--- a/fs/hfsplus/hfsplus_raw.h
+++ b/fs/hfsplus/hfsplus_raw.h
@@ -52,13 +52,23 @@
52typedef __be32 hfsplus_cnid; 52typedef __be32 hfsplus_cnid;
53typedef __be16 hfsplus_unichr; 53typedef __be16 hfsplus_unichr;
54 54
55#define HFSPLUS_MAX_STRLEN 255
56#define HFSPLUS_ATTR_MAX_STRLEN 127
57
55/* A "string" as used in filenames, etc. */ 58/* A "string" as used in filenames, etc. */
56struct hfsplus_unistr { 59struct hfsplus_unistr {
57 __be16 length; 60 __be16 length;
58 hfsplus_unichr unicode[255]; 61 hfsplus_unichr unicode[HFSPLUS_MAX_STRLEN];
59} __packed; 62} __packed;
60 63
61#define HFSPLUS_MAX_STRLEN 255 64/*
65 * A "string" is used in attributes file
66 * for name of extended attribute
67 */
68struct hfsplus_attr_unistr {
69 __be16 length;
70 hfsplus_unichr unicode[HFSPLUS_ATTR_MAX_STRLEN];
71} __packed;
62 72
63/* POSIX permissions */ 73/* POSIX permissions */
64struct hfsplus_perm { 74struct hfsplus_perm {
@@ -291,6 +301,8 @@ struct hfsplus_cat_file {
291/* File attribute bits */ 301/* File attribute bits */
292#define HFSPLUS_FILE_LOCKED 0x0001 302#define HFSPLUS_FILE_LOCKED 0x0001
293#define HFSPLUS_FILE_THREAD_EXISTS 0x0002 303#define HFSPLUS_FILE_THREAD_EXISTS 0x0002
304#define HFSPLUS_XATTR_EXISTS 0x0004
305#define HFSPLUS_ACL_EXISTS 0x0008
294 306
295/* HFS+ catalog thread (part of a cat_entry) */ 307/* HFS+ catalog thread (part of a cat_entry) */
296struct hfsplus_cat_thread { 308struct hfsplus_cat_thread {
@@ -327,11 +339,63 @@ struct hfsplus_ext_key {
327 339
328#define HFSPLUS_EXT_KEYLEN sizeof(struct hfsplus_ext_key) 340#define HFSPLUS_EXT_KEYLEN sizeof(struct hfsplus_ext_key)
329 341
342#define HFSPLUS_XATTR_FINDER_INFO_NAME "com.apple.FinderInfo"
343#define HFSPLUS_XATTR_ACL_NAME "com.apple.system.Security"
344
345#define HFSPLUS_ATTR_INLINE_DATA 0x10
346#define HFSPLUS_ATTR_FORK_DATA 0x20
347#define HFSPLUS_ATTR_EXTENTS 0x30
348
349/* HFS+ attributes tree key */
350struct hfsplus_attr_key {
351 __be16 key_len;
352 __be16 pad;
353 hfsplus_cnid cnid;
354 __be32 start_block;
355 struct hfsplus_attr_unistr key_name;
356} __packed;
357
358#define HFSPLUS_ATTR_KEYLEN sizeof(struct hfsplus_attr_key)
359
360/* HFS+ fork data attribute */
361struct hfsplus_attr_fork_data {
362 __be32 record_type;
363 __be32 reserved;
364 struct hfsplus_fork_raw the_fork;
365} __packed;
366
367/* HFS+ extension attribute */
368struct hfsplus_attr_extents {
369 __be32 record_type;
370 __be32 reserved;
371 struct hfsplus_extent extents;
372} __packed;
373
374#define HFSPLUS_MAX_INLINE_DATA_SIZE 3802
375
376/* HFS+ attribute inline data */
377struct hfsplus_attr_inline_data {
378 __be32 record_type;
379 __be32 reserved1;
380 u8 reserved2[6];
381 __be16 length;
382 u8 raw_bytes[HFSPLUS_MAX_INLINE_DATA_SIZE];
383} __packed;
384
385/* A data record in the attributes tree */
386typedef union {
387 __be32 record_type;
388 struct hfsplus_attr_fork_data fork_data;
389 struct hfsplus_attr_extents extents;
390 struct hfsplus_attr_inline_data inline_data;
391} __packed hfsplus_attr_entry;
392
330/* HFS+ generic BTree key */ 393/* HFS+ generic BTree key */
331typedef union { 394typedef union {
332 __be16 key_len; 395 __be16 key_len;
333 struct hfsplus_cat_key cat; 396 struct hfsplus_cat_key cat;
334 struct hfsplus_ext_key ext; 397 struct hfsplus_ext_key ext;
398 struct hfsplus_attr_key attr;
335} __packed hfsplus_btree_key; 399} __packed hfsplus_btree_key;
336 400
337#endif 401#endif