Linux EXT4 FS development
 help / color / mirror / Atom feed
From: Daniel Vacek <neelx@suse.com>
To: fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org,
	linux-xfs@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net, zlang@redhat.com,
	hch@infradead.org, djwong@kernel.org,
	David Sterba <dsterba@suse.com>, Daniel Vacek <neelx@suse.com>,
	linux-fscrypt@vger.kernel.org,
	Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Subject: [PATCH 03/12] common/encrypt: add btrfs to get_ciphertext_filename
Date: Fri, 24 Jul 2026 15:33:19 +0200	[thread overview]
Message-ID: <20260724133328.1837318-4-neelx@suse.com> (raw)
In-Reply-To: <20260724133328.1837318-1-neelx@suse.com>

From: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>

Add the relevant call to get an encrypted filename from btrfs.

v1:
 * fix reading of the encrypted name
   - use simple sed substitutions and consume escapes using printf

Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Signed-off-by: Daniel Vacek <neelx@suse.com>
---
 common/encrypt | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/common/encrypt b/common/encrypt
index 29293ea4..8a0aaf1a 100644
--- a/common/encrypt
+++ b/common/encrypt
@@ -713,6 +713,20 @@ _get_ciphertext_filename()
 				print STDERR "Invalid base64-encoded string!\n";
 			}'
 		;;
+	btrfs)
+		# Extract the filename from the inode_ref object, similar to:
+		#
+		#	item 20 key (258 INODE_REF 257) itemoff 15121 itemsize 26
+		#		index 2 namelen 16 name: v\354\301\231\214\341+\335A\002\216\3405eFz
+		#
+		$BTRFS_UTIL_PROG inspect-internal dump-tree $device | \
+			sed -n "/ key ($inode INODE_REF $dir_inode) / { n
+				s/.*name: //
+				s/%/%%/g
+				s/\\\\ / /g
+				p; q }" | tr -d \\n | \
+			xargs -0 printf
+		;;
 	*)
 		_fail "_get_ciphertext_filename() isn't implemented on $FSTYP"
 		;;
@@ -767,6 +781,9 @@ _require_get_ciphertext_filename_support()
 			_notrun "dump.f2fs (f2fs-tools) is too old; doesn't support showing unambiguous on-disk filenames"
 		fi
 		;;
+	btrfs)
+		_require_command "$BTRFS_UTIL_PROG" btrfs
+		;;
 	*)
 		_notrun "_get_ciphertext_filename() isn't implemented on $FSTYP"
 		;;
-- 
2.53.0


  parent reply	other threads:[~2026-07-24 13:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24 13:33 [PATCH 00/12] fstests: introduce fscrypt support for btrfs Daniel Vacek
2026-07-24 13:33 ` [PATCH 01/12] common/encrypt: separate data and inode nonces Daniel Vacek
2026-07-24 13:33 ` [PATCH 02/12] common/encrypt: add btrfs to get_encryption_*nonce Daniel Vacek
2026-07-24 13:33 ` Daniel Vacek [this message]
2026-07-24 13:33 ` [PATCH 04/12] common/encrypt: enable making a encrypted btrfs filesystem Daniel Vacek
2026-07-24 13:33 ` [PATCH 05/12] common/verity: explicitly don't allow btrfs encryption Daniel Vacek
2026-07-24 13:33 ` [PATCH 06/12] btrfs: add simple test of reflink of encrypted data Daniel Vacek
2026-07-24 13:33 ` [PATCH 07/12] btrfs: test snapshotting encrypted subvol Daniel Vacek
2026-07-24 13:33 ` [PATCH 08/12] fstests: properly test for v1 encryption policies in encrypt tests Daniel Vacek
2026-07-24 13:33 ` [PATCH 09/12] fstests: split generic/580 into two tests Daniel Vacek
2026-07-24 13:33 ` [PATCH 10/12] fstests: split generic/581 " Daniel Vacek
2026-07-24 13:33 ` [PATCH 11/12] fstests: split generic/613 " Daniel Vacek
2026-07-24 13:33 ` [PATCH 12/12] fscrypt-crypt-util: add support for per extent KDF Daniel Vacek
2026-07-28  3:19 ` [PATCH 00/12] fstests: introduce fscrypt support for btrfs Christoph Hellwig
2026-07-28  5:44   ` Daniel Vacek
2026-07-28  5:48     ` Eric Biggers
2026-07-28  6:04       ` Christoph Hellwig
2026-07-28  6:07         ` Eric Biggers

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=20260724133328.1837318-4-neelx@suse.com \
    --to=neelx@suse.com \
    --cc=djwong@kernel.org \
    --cc=dsterba@suse.com \
    --cc=fstests@vger.kernel.org \
    --cc=hch@infradead.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sweettea-kernel@dorminy.me \
    --cc=zlang@redhat.com \
    /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