[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221110141225.2308856-2-ndevos@redhat.com>
Date: Thu, 10 Nov 2022 15:12:22 +0100
From: Niels de Vos <ndevos@...hat.com>
To: linux-fscrypt@...r.kernel.org, linux-fsdevel@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Xiubo Li <xiubli@...hat.com>,
Marcel Lauhoff <marcel.lauhoff@...e.com>,
Niels de Vos <ndevos@...hat.com>
Subject: [RFC 1/4] fscrypt: introduce USE_FS_ENCRYPTION
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@...hat.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
Powered by blists - more mailing lists