From patchwork Thu Nov 10 14:12:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niels de Vos X-Patchwork-Id: 13038834 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC4FDC4332F for ; Thu, 10 Nov 2022 14:13:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231218AbiKJONu (ORCPT ); Thu, 10 Nov 2022 09:13:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230260AbiKJONm (ORCPT ); Thu, 10 Nov 2022 09:13:42 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4C5CBC3D for ; Thu, 10 Nov 2022 06:12:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668089564; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2Ux0Kqna/qXUsHD5Gh3Ugbi8sSSVQd7KnYLI13e7kJA=; b=eaIE+S2f90xQm6lDWE5/uvIxF4dV4TO1U0vRTmk5RsDHX/bf+FXzJf7HNm6AUOqMyA2YCG nLgoL1svSmhk2FyfEy/yi7Z3nZXMtAh8DE8cymzMJqWcPsC778YoSiIx8lMDdh7MIDRxvZ ZaqaEHuOc/C5zJjWbxyZGpGBSunJWoM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-611-yVjsB3gpPOmMztob50aSCg-1; Thu, 10 Nov 2022 09:12:39 -0500 X-MC-Unique: yVjsB3gpPOmMztob50aSCg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2573687A380; Thu, 10 Nov 2022 14:12:39 +0000 (UTC) Received: from localhost (unknown [10.39.208.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D4DE120290AE; Thu, 10 Nov 2022 14:12:38 +0000 (UTC) From: Niels de Vos To: linux-fscrypt@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Xiubo Li , Marcel Lauhoff , Niels de Vos Subject: [RFC 1/4] fscrypt: introduce USE_FS_ENCRYPTION Date: Thu, 10 Nov 2022 15:12:22 +0100 Message-Id: <20221110141225.2308856-2-ndevos@redhat.com> In-Reply-To: <20221110141225.2308856-1-ndevos@redhat.com> References: <20221110141225.2308856-1-ndevos@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org 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 --- 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 #include #include 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 #endif +#ifdef CONFIG_FS_ENCRYPTION +#define USE_FS_ENCRYPTION +#endif #include + #include #include 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 #include +#ifdef CONFIG_FS_ENCRYPTION +#define USE_FS_ENCRYPTION +#endif #include + #include 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 #include +#ifdef CONFIG_FS_ENCRYPTION +#define USE_FS_ENCRYPTION +#endif #include #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