public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Niels de Vos <ndevos@redhat.com>
To: linux-fscrypt@vger.kernel.org, linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Xiubo Li <xiubli@redhat.com>,
	Marcel Lauhoff <marcel.lauhoff@suse.com>,
	Niels de Vos <ndevos@redhat.com>
Subject: [RFC 1/4] fscrypt: introduce USE_FS_ENCRYPTION
Date: Thu, 10 Nov 2022 15:12:22 +0100	[thread overview]
Message-ID: <20221110141225.2308856-2-ndevos@redhat.com> (raw)
In-Reply-To: <20221110141225.2308856-1-ndevos@redhat.com>

The new USE_FS_ENCRYPTION define is added so that filesystems can
opt-out of supporting fscrypt, while other filesystems have fscrypt
enabled.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
---
 fs/crypto/fscrypt_private.h | 2 ++
 fs/ext4/ext4.h              | 4 ++++
 fs/f2fs/f2fs.h              | 4 ++++
 fs/ubifs/ubifs.h            | 3 +++
 include/linux/fscrypt.h     | 6 +++---
 5 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/fs/crypto/fscrypt_private.h b/fs/crypto/fscrypt_private.h
index d5f68a0c5d15..f8dc3aab80b3 100644
--- a/fs/crypto/fscrypt_private.h
+++ b/fs/crypto/fscrypt_private.h
@@ -11,6 +11,8 @@
 #ifndef _FSCRYPT_PRIVATE_H
 #define _FSCRYPT_PRIVATE_H
 
+#define USE_FS_ENCRYPTION
+
 #include <linux/fscrypt.h>
 #include <linux/siphash.h>
 #include <crypto/hash.h>
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 8d5453852f98..23c2ceaa074d 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -41,7 +41,11 @@
 #include <linux/compat.h>
 #endif
 
+#ifdef CONFIG_FS_ENCRYPTION
+#define USE_FS_ENCRYPTION
+#endif
 #include <linux/fscrypt.h>
+
 #include <linux/fsverity.h>
 
 #include <linux/compiler.h>
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index e6355a5683b7..194844029633 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -26,7 +26,11 @@
 #include <linux/part_stat.h>
 #include <crypto/hash.h>
 
+#ifdef CONFIG_FS_ENCRYPTION
+#define USE_FS_ENCRYPTION
+#endif
 #include <linux/fscrypt.h>
+
 #include <linux/fsverity.h>
 
 struct pagevec;
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 478bbbb5382f..3ef0e9ef5015 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -33,6 +33,9 @@
 #include <crypto/hash.h>
 #include <crypto/algapi.h>
 
+#ifdef CONFIG_FS_ENCRYPTION
+#define USE_FS_ENCRYPTION
+#endif
 #include <linux/fscrypt.h>
 
 #include "ubifs-media.h"
diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h
index 4f5f8a651213..403a686619f8 100644
--- a/include/linux/fscrypt.h
+++ b/include/linux/fscrypt.h
@@ -57,7 +57,7 @@ struct fscrypt_name {
 /* Maximum value for the third parameter of fscrypt_operations.set_context(). */
 #define FSCRYPT_SET_CONTEXT_MAX_SIZE	40
 
-#ifdef CONFIG_FS_ENCRYPTION
+#if defined(CONFIG_FS_ENCRYPTION) && defined(USE_FS_ENCRYPTION)
 
 /*
  * If set, the fscrypt bounce page pool won't be allocated (unless another
@@ -379,7 +379,7 @@ static inline void fscrypt_set_ops(struct super_block *sb,
 {
 	sb->s_cop = s_cop;
 }
-#else  /* !CONFIG_FS_ENCRYPTION */
+#else  /* !CONFIG_FS_ENCRYPTION || !USE_FS_ENCRYPTION */
 
 static inline struct fscrypt_info *fscrypt_get_info(const struct inode *inode)
 {
@@ -743,7 +743,7 @@ static inline void fscrypt_set_ops(struct super_block *sb,
 {
 }
 
-#endif	/* !CONFIG_FS_ENCRYPTION */
+#endif	/* !CONFIG_FS_ENCRYPTION || !USE_FS_ENCRYPTION */
 
 /* inline_crypt.c */
 #ifdef CONFIG_FS_ENCRYPTION_INLINE_CRYPT
-- 
2.37.3


  reply	other threads:[~2022-11-10 14:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10 14:12 [RFC 0/4] fs: provide per-filesystem options to disable fscrypt Niels de Vos
2022-11-10 14:12 ` Niels de Vos [this message]
2022-11-10 14:12 ` [RFC 2/4] fs: make fscrypt support an ext4 config option Niels de Vos
2022-11-10 14:12 ` [RFC 3/4] fs: make fscrypt support a f2fs " Niels de Vos
2022-11-10 14:12 ` [RFC 4/4] fs: make fscrypt support a UBIFS " Niels de Vos
2022-11-10 15:38 ` [RFC 0/4] fs: provide per-filesystem options to disable fscrypt Theodore Ts'o
2022-11-10 16:47   ` Niels de Vos
2022-11-10 18:15     ` Theodore Ts'o
2022-11-10 18:43       ` Theodore Ts'o
2022-11-18 13:05       ` Niels de Vos
2022-11-14  6:02     ` Christoph Hellwig
2022-11-18 13:13       ` Niels de Vos
2022-11-16  2:10 ` Eric Biggers
2022-11-18 13:25   ` Niels de Vos

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=20221110141225.2308856-2-ndevos@redhat.com \
    --to=ndevos@redhat.com \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel.lauhoff@suse.com \
    --cc=xiubli@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