mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] hfsplus: make hidden directory name independent from nls
@ 2026-11-04  3:46 Viacheslav Dubeyko
  2026-11-04  3:46 ` [PATCH 1/2] hfsplus: make hidden directory name independent from mount's nls Viacheslav Dubeyko
  2026-11-04  3:46 ` [PATCH 2/2] hfsplus: add KUnit check for hidden directory name Viacheslav Dubeyko
  0 siblings, 2 replies; 3+ messages in thread
From: Viacheslav Dubeyko @ 2026-11-04  3:46 UTC (permalink / raw)
  To: glaubitz, frank.li
  Cc: linux-fsdevel, linux-kernel, vdubeyko, Viacheslav Dubeyko

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
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-04  3:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04  3:46 [PATCH 0/2] hfsplus: make hidden directory name independent from nls Viacheslav Dubeyko
2026-11-04  3:46 ` [PATCH 1/2] hfsplus: make hidden directory name independent from mount's nls Viacheslav Dubeyko
2026-11-04  3:46 ` [PATCH 2/2] hfsplus: add KUnit check for hidden directory name Viacheslav Dubeyko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®