hfsplus: make hidden directory name independent from nls
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | hfsplus: make hidden directory name independent from mount's nlsfs/ fs/ fs/ +1 more | +124 | 0 replies | |
| 2/2 | hfsplus: add KUnit check for hidden directory namefs/ fs/ fs/ | +59 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] hfsplus: make hidden directory name independent from nls
HFS+ keeps the indirect node files of hard links in the hidden directory of the root folder. On disk, its name is four U+0000 (NUL) characters followed by "HFS+ Private Data". Currently, the catalog key of this directory is built from the UTF-8 string HFSP_HIDDENDIR_NAME by means of the nls table of the mount. hfsplus_fill_super() works around it by temporarily replacing sbi->nls with utf8 table, but hfsplus_reconfigure() creates the hidden directory on remount read-write with the mount's nls table. As a result, with nls=cp437, for example, the hidden directory is created with garbled name that neither macOS nor the next mount recognizes.
At first, define the on-disk name of the hidden directory as constant UTF-16 string hfsplus_hidden_dir_name_utf16, introduces hfsplus_create_cat_uni() that creates catalog records for already converted name, and removes the temporary nls replacement from hfsplus_fill_super(). The length of the name is calculated from named constants, and the UTF-8 and UTF-16 representations of the name are distinguished by the HFSP_HIDDENDIR_NAME_UTF8* and HFSP_HIDDENDIR_NAME_UTF16_LEN macros.
Secondly, add KUnit test that checks that hfsplus_asc2uni() converts HFSP_HIDDENDIR_NAME_UTF8 with utf8 nls table into exactly hfsplus_hidden_dir_name_utf16, with decomposition enabled and disabled.
The hfsplus_unicode KUnit suite passes (35 tests) under UML.
Viacheslav Dubeyko (2):
hfsplus: make hidden directory name independent from mount's nls
hfsplus: add KUnit check for hidden directory name
fs/hfsplus/catalog.c | 83 ++++++++++++++++++++++++++++++-------- fs/hfsplus/hfsplus_fs.h | 6 +++ fs/hfsplus/super.c | 68 +++++++++++++++++-------------- fs/hfsplus/unicode_test.c | 55 +++++++++++++++++++++++++ include/linux/hfs_common.h | 20 ++++++++- 5 files changed, 182 insertions(+), 50 deletions(-)
base-commit: 71d5a8a05c83b61bce1884905c192eed34ed3069
Signature · 1 line
2.43.0