Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gabriel Krisman Bertazi <krisman@suse.de>
To: linux-fsdevel@vger.kernel.org
Cc: Gabriel Krisman Bertazi <krisman@suse.de>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	"Theodore Ts'o" <tytso@mit.edu>, Hugh Dickins <hughd@google.com>,
	Daniel Tang <danielzgtg.opensource@gmail.com>,
	linux-ext4@vger.kernel.org, Miklos Szeredi <miklos@szeredi.hu>,
	Amir Goldstein <amir73il@gmail.com>,
	linux-unionfs@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH 4/4] ovl: Expose the filesystem encoding through sysfs
Date: Mon, 28 Sep 2026 17:31:55 -0400	[thread overview]
Message-ID: <20260928213155.2612039-5-krisman@suse.de> (raw)
In-Reply-To: <20260928213155.2612039-1-krisman@suse.de>

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 <krisman@suse.de>
---
 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.
 		<volume> is set to the device major:minor.
+
+What:		/sys/fs/overlay/<volume>/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



  parent reply	other threads:[~2026-09-28 21:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 21:31 [PATCH 0/4] Expose encoding information of volumes Gabriel Krisman Bertazi
2026-09-28 21:31 ` [PATCH 1/4] shmem: Report casefold setting in mount options Gabriel Krisman Bertazi
2026-09-29 14:00   ` Mohammed EL Kadiri
2026-09-29 15:17     ` Gabriel Krisman Bertazi
2026-09-28 21:31 ` [PATCH 2/4] ext4: Expose the filesystem encoding through sysfs Gabriel Krisman Bertazi
2026-09-28 21:31 ` [PATCH 3/4] ovl: Add /sys/fs/overlay plumbing Gabriel Krisman Bertazi
2026-09-28 21:31 ` Gabriel Krisman Bertazi [this message]
2026-09-29 14:15   ` [PATCH 4/4] ovl: Expose the filesystem encoding through sysfs Amir Goldstein
2026-09-29 14:40     ` Pali Rohár
2026-09-29 15:35       ` Gabriel Krisman Bertazi
2026-09-29 15:35     ` Gabriel Krisman Bertazi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260928213155.2612039-5-krisman@suse.de \
    --to=krisman@suse.de \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=danielzgtg.opensource@gmail.com \
    --cc=hughd@google.com \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox