@@ -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>
@@ -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>
@@ -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;
@@ -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"
@@ -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
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(-)