This patch reproduces the same interface from ext4/f2fs to have feature parity, so users don't need to rely on parsing dmesg or trying +F on a temporary directory just to check for support. Note there is no encoding_flags file, as none are supported by ovl. Assisted-by: LLM Signed-off-by: Gabriel Krisman Bertazi --- Documentation/ABI/testing/sysfs-fs-overlay | 7 +++++++ fs/overlayfs/sysfs.c | 15 +++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-fs-overlay b/Documentation/ABI/testing/sysfs-fs-overlay index 9060c39679ae..7f3c6403c4f8 100644 --- a/Documentation/ABI/testing/sysfs-fs-overlay +++ b/Documentation/ABI/testing/sysfs-fs-overlay @@ -4,3 +4,10 @@ Contact: linux-unionfs@vger.kernel.org Description: A directory is created for every mounted overlayfs instance. is set to the device major:minor. + +What: /sys/fs/overlay//encoding +Date: September 2026 +Contact: linux-unionfs@vger.kernel.org +Description: + Displays name and version of the encoding set for the + overlay. If no encoding is set, displays (none) diff --git a/fs/overlayfs/sysfs.c b/fs/overlayfs/sysfs.c index be83b57f637c..2144cbb418bc 100644 --- a/fs/overlayfs/sysfs.c +++ b/fs/overlayfs/sysfs.c @@ -22,7 +22,22 @@ struct ovl_sysfs_attr { .show = ovl_##_name##_show, \ } +static ssize_t ovl_encoding_show(struct ovl_fs *ofs, char *buf) +{ + struct unicode_map *um = sb_encoding(ofs->sb); + + if (!um) + return sysfs_emit(buf, "(none)\n"); + + return sysfs_emit(buf, "UTF-8 (%d.%d.%d)\n", + unicode_major(um->version), + unicode_minor(um->version), + unicode_rev(um->version)); +} +OVL_SYSFS_ATTR_RO(encoding); + static struct attribute *ovl_sysfs_attrs[] = { + &ovl_sysfs_attr_encoding.attr, NULL, }; ATTRIBUTE_GROUPS(ovl_sysfs); -- 2.55.0