From patchwork Thu Jun 29 19:58:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sweet Tea Dorminy X-Patchwork-Id: 13297269 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 3BAD7C001DD for ; Thu, 29 Jun 2023 19:58:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229920AbjF2T6k (ORCPT ); Thu, 29 Jun 2023 15:58:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232281AbjF2T6c (ORCPT ); Thu, 29 Jun 2023 15:58:32 -0400 Received: from box.fidei.email (box.fidei.email [71.19.144.250]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC0922D7F for ; Thu, 29 Jun 2023 12:58:29 -0700 (PDT) Received: from authenticated-user (box.fidei.email [71.19.144.250]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by box.fidei.email (Postfix) with ESMTPSA id 3A8B580AF9; Thu, 29 Jun 2023 15:58:29 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=dorminy.me; s=mail; t=1688068709; bh=ObQpQrL4KHM33ejHPvAR0tH4XlYuTKxVOfpA7M2aQxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=clFhhDXlXLmQE/NZZp1OQGUjMTK5mo5TOYgZmPjIENNsXV3gbImFveyFSkBQEfrjg NfsPwCgM6MhqlxRRg1kDIhyaHZ7fb32TJh9BBcfg99vudvgDV2TiLOuAAKbLWHXOkA +GJs3+6m0xImcnpQumc9bDE5yVjHtwAATPEMUe4AEJ7y2Rg39B4pYoayCFNOOnR/3A Z+Krl7wq0OyuDy0Vzhq+1XYpBsH4+u6IDkDt2aNUl6dOl0AzROvDSj/OERs0xxHKex SPN4r5D0iLJeV5saAJFttPUSebJJg3bvaR8/dV2SK6RYnmd3Me4EB+wJ4bjORgvKij SbZpRPERr8U2g== From: Sweet Tea Dorminy To: linux-btrfs@vger.kernel.org, kernel-team@meta.com Cc: Omar Sandoval , Sweet Tea Dorminy Subject: [PATCH 3/8] progs: add inode encryption contexts Date: Thu, 29 Jun 2023 15:58:04 -0400 Message-Id: <5f7ac56467a214aa5d754614b5cf419fe6889fdb.1688068150.git.sweettea-kernel@dorminy.me> In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Omar Sandoval Recapitulates relevant parts of kernel change 'btrfs: add inode encryption contexts'. Signed-off-by: Sweet Tea Dorminy --- kernel-shared/uapi/btrfs_tree.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kernel-shared/uapi/btrfs_tree.h b/kernel-shared/uapi/btrfs_tree.h index ad555e70..2df7cfec 100644 --- a/kernel-shared/uapi/btrfs_tree.h +++ b/kernel-shared/uapi/btrfs_tree.h @@ -162,6 +162,8 @@ #define BTRFS_VERITY_DESC_ITEM_KEY 36 #define BTRFS_VERITY_MERKLE_ITEM_KEY 37 +#define BTRFS_FSCRYPT_CTXT_ITEM_KEY 41 + #define BTRFS_ORPHAN_ITEM_KEY 48 /* reserve 2-15 close to the inode for later flexibility */ @@ -400,6 +402,7 @@ static inline __u8 btrfs_dir_flags_to_ftype(__u8 flags) #define BTRFS_INODE_NOATIME (1U << 9) #define BTRFS_INODE_DIRSYNC (1U << 10) #define BTRFS_INODE_COMPRESS (1U << 11) +#define BTRFS_INODE_ENCRYPT (1U << 12) #define BTRFS_INODE_ROOT_ITEM_INIT (1U << 31) @@ -416,6 +419,7 @@ static inline __u8 btrfs_dir_flags_to_ftype(__u8 flags) BTRFS_INODE_NOATIME | \ BTRFS_INODE_DIRSYNC | \ BTRFS_INODE_COMPRESS | \ + BTRFS_INODE_ENCRYPT | \ BTRFS_INODE_ROOT_ITEM_INIT) #define BTRFS_INODE_RO_VERITY (1U << 0) @@ -1016,6 +1020,12 @@ enum { BTRFS_NR_FILE_EXTENT_TYPES = 3, }; +enum { + BTRFS_ENCRYPTION_NONE, + BTRFS_ENCRYPTION_FSCRYPT, + BTRFS_NR_ENCRYPTION_TYPES, +}; + struct btrfs_file_extent_item { /* * transaction id that created this extent