diff options
author | Sergei Antonov <saproj@gmail.com> | 2014-03-10 18:49:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-03-10 20:26:21 -0400 |
commit | d7d673a591701f131e53d4fd4e2b9352f1316642 (patch) | |
tree | 0aa921b14417385e422f01237a6dad23d163c2da /fs/hfsplus/hfsplus_raw.h | |
parent | 53942232369ec317f77dc8c2d5a0637bb85a6e84 (diff) |
hfsplus: add HFSX subfolder count support
Adds support for HFSX 'HasFolderCount' flag and a corresponding
'folderCount' field in folder records. (For reference see
HFS_FOLDERCOUNT and kHFSHasFolderCountBit/kHFSHasFolderCountMask in
Apple's source code.)
Ignoring subfolder count leads to fs errors found by Mac:
...
Checking catalog hierarchy.
HasFolderCount flag needs to be set (id = 105)
(It should be 0x10 instead of 0)
Incorrect folder count in a directory (id = 2)
(It should be 7 instead of 6)
...
Steps to reproduce:
Format with "newfs_hfs -s /dev/diskXXX".
Mount in Linux.
Create a new directory in root.
Unmount.
Run "fsck_hfs /dev/diskXXX".
The patch handles directory creation, deletion, and rename.
Signed-off-by: Sergei Antonov <saproj@gmail.com>
Reviewed-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/hfsplus/hfsplus_raw.h')
-rw-r--r-- | fs/hfsplus/hfsplus_raw.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/hfsplus/hfsplus_raw.h b/fs/hfsplus/hfsplus_raw.h index 8ffb3a8ffe75..5a126828d85e 100644 --- a/fs/hfsplus/hfsplus_raw.h +++ b/fs/hfsplus/hfsplus_raw.h | |||
@@ -261,7 +261,7 @@ struct hfsplus_cat_folder { | |||
261 | struct DInfo user_info; | 261 | struct DInfo user_info; |
262 | struct DXInfo finder_info; | 262 | struct DXInfo finder_info; |
263 | __be32 text_encoding; | 263 | __be32 text_encoding; |
264 | u32 reserved; | 264 | __be32 subfolders; /* Subfolder count in HFSX. Reserved in HFS+. */ |
265 | } __packed; | 265 | } __packed; |
266 | 266 | ||
267 | /* HFS file info (stolen from hfs.h) */ | 267 | /* HFS file info (stolen from hfs.h) */ |
@@ -301,11 +301,13 @@ struct hfsplus_cat_file { | |||
301 | struct hfsplus_fork_raw rsrc_fork; | 301 | struct hfsplus_fork_raw rsrc_fork; |
302 | } __packed; | 302 | } __packed; |
303 | 303 | ||
304 | /* File attribute bits */ | 304 | /* File and folder flag bits */ |
305 | #define HFSPLUS_FILE_LOCKED 0x0001 | 305 | #define HFSPLUS_FILE_LOCKED 0x0001 |
306 | #define HFSPLUS_FILE_THREAD_EXISTS 0x0002 | 306 | #define HFSPLUS_FILE_THREAD_EXISTS 0x0002 |
307 | #define HFSPLUS_XATTR_EXISTS 0x0004 | 307 | #define HFSPLUS_XATTR_EXISTS 0x0004 |
308 | #define HFSPLUS_ACL_EXISTS 0x0008 | 308 | #define HFSPLUS_ACL_EXISTS 0x0008 |
309 | #define HFSPLUS_HAS_FOLDER_COUNT 0x0010 /* Folder has subfolder count | ||
310 | * (HFSX only) */ | ||
309 | 311 | ||
310 | /* HFS+ catalog thread (part of a cat_entry) */ | 312 | /* HFS+ catalog thread (part of a cat_entry) */ |
311 | struct hfsplus_cat_thread { | 313 | struct hfsplus_cat_thread { |