diff mbox series

btrfs-progs: add print support for verity items.

Message ID 20220323194504.1777182-1-sweettea-kernel@dorminy.me (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: add print support for verity items. | expand

Commit Message

Sweet Tea Dorminy March 23, 2022, 7:45 p.m. UTC
'btrfs inspect-internals dump-tree' doesn't currently know about the two
types of verity items and prints them as 'UNKNOWN.36' or 'UNKNOWN.37'.
So add them to the known item types.

Suggested-by: Boris Burkov <boris@bur.io>
Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>

---

Inspired by Boris' recent patchset noting that these items were not yet
properly printed:
https://lore.kernel.org/linux-btrfs/5579a70597cd660ffb265db9e97840a1faca8812.1647382272.git.boris@bur.io/T/#u

---

 kernel-shared/ctree.h      | 4 ++++
 kernel-shared/print-tree.c | 2 ++
 2 files changed, 6 insertions(+)

Comments

Josef Bacik March 23, 2022, 8:11 p.m. UTC | #1
On Wed, Mar 23, 2022 at 03:45:05PM -0400, Sweet Tea Dorminy wrote:
> 'btrfs inspect-internals dump-tree' doesn't currently know about the two
> types of verity items and prints them as 'UNKNOWN.36' or 'UNKNOWN.37'.
> So add them to the known item types.
> 
> Suggested-by: Boris Burkov <boris@bur.io>
> Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
> 

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef
David Sterba March 23, 2022, 9:14 p.m. UTC | #2
On Wed, Mar 23, 2022 at 03:45:05PM -0400, Sweet Tea Dorminy wrote:
> 'btrfs inspect-internals dump-tree' doesn't currently know about the two
> types of verity items and prints them as 'UNKNOWN.36' or 'UNKNOWN.37'.
> So add them to the known item types.
> 
> Suggested-by: Boris Burkov <boris@bur.io>
> Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>

Added to devel, thanks.
David Sterba March 23, 2022, 11:38 p.m. UTC | #3
On Wed, Mar 23, 2022 at 03:45:05PM -0400, Sweet Tea Dorminy wrote:
> 'btrfs inspect-internals dump-tree' doesn't currently know about the two
> types of verity items and prints them as 'UNKNOWN.36' or 'UNKNOWN.37'.
> So add them to the known item types.
> 
> Suggested-by: Boris Burkov <boris@bur.io>
> Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
> 
> ---
> 
> Inspired by Boris' recent patchset noting that these items were not yet
> properly printed:
> https://lore.kernel.org/linux-btrfs/5579a70597cd660ffb265db9e97840a1faca8812.1647382272.git.boris@bur.io/T/#u
> 
> ---
> 
>  kernel-shared/ctree.h      | 4 ++++
>  kernel-shared/print-tree.c | 2 ++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/kernel-shared/ctree.h b/kernel-shared/ctree.h
> index bf71fc85..b8d7e5a8 100644
> --- a/kernel-shared/ctree.h
> +++ b/kernel-shared/ctree.h
> @@ -1350,6 +1350,10 @@ static inline u32 BTRFS_MAX_XATTR_SIZE(const struct btrfs_fs_info *info)
>  #define BTRFS_INODE_REF_KEY		12
>  #define BTRFS_INODE_EXTREF_KEY		13
>  #define BTRFS_XATTR_ITEM_KEY		24
> +
> +#define BTRFS_VERITY_DESC_ITEM_KEY	36
> +#define BTRFS_VERITY_MERKLE_ITEM_KEY	37
> +
>  #define BTRFS_ORPHAN_ITEM_KEY		48
>  
>  #define BTRFS_DIR_LOG_ITEM_KEY  60
> diff --git a/kernel-shared/print-tree.c b/kernel-shared/print-tree.c
> index 73f969c3..ee7f679c 100644
> --- a/kernel-shared/print-tree.c
> +++ b/kernel-shared/print-tree.c
> @@ -647,6 +647,8 @@ void print_key_type(FILE *stream, u64 objectid, u8 type)
>  		[BTRFS_DIR_LOG_ITEM_KEY]	= "DIR_LOG_ITEM",
>  		[BTRFS_DIR_LOG_INDEX_KEY]	= "DIR_LOG_INDEX",
>  		[BTRFS_XATTR_ITEM_KEY]		= "XATTR_ITEM",
> +		[BTRFS_VERITY_DESC_ITEM_KEY]	= "VERITY_DESC_ITEM",
> +		[BTRFS_VERITY_MERKLE_ITEM_KEY	= "VERITY_MERKLE_ITEM",

    [CC]     kernel-shared/print-tree.o
kernel-shared/print-tree.c: In function ‘print_key_type’:
kernel-shared/print-tree.c:650:49: error: lvalue required as left operand of assignment
  650 |                 [BTRFS_VERITY_MERKLE_ITEM_KEY   = "VERITY_MERKLE_ITEM",
      |                                                 ^
kernel-shared/print-tree.c:650:71: error: expected ‘]’ before ‘,’ token
  650 |                 [BTRFS_VERITY_MERKLE_ITEM_KEY   = "VERITY_MERKLE_ITEM",
      |                                                                       ^
      |                                                                       ]
kernel-shared/print-tree.c:682:9: error: expected expression before ‘}’ token
  682 |         };
      |         ^
make: *** [Makefile:414: kernel-shared/print-tree.o] Error 1
diff mbox series

Patch

diff --git a/kernel-shared/ctree.h b/kernel-shared/ctree.h
index bf71fc85..b8d7e5a8 100644
--- a/kernel-shared/ctree.h
+++ b/kernel-shared/ctree.h
@@ -1350,6 +1350,10 @@  static inline u32 BTRFS_MAX_XATTR_SIZE(const struct btrfs_fs_info *info)
 #define BTRFS_INODE_REF_KEY		12
 #define BTRFS_INODE_EXTREF_KEY		13
 #define BTRFS_XATTR_ITEM_KEY		24
+
+#define BTRFS_VERITY_DESC_ITEM_KEY	36
+#define BTRFS_VERITY_MERKLE_ITEM_KEY	37
+
 #define BTRFS_ORPHAN_ITEM_KEY		48
 
 #define BTRFS_DIR_LOG_ITEM_KEY  60
diff --git a/kernel-shared/print-tree.c b/kernel-shared/print-tree.c
index 73f969c3..ee7f679c 100644
--- a/kernel-shared/print-tree.c
+++ b/kernel-shared/print-tree.c
@@ -647,6 +647,8 @@  void print_key_type(FILE *stream, u64 objectid, u8 type)
 		[BTRFS_DIR_LOG_ITEM_KEY]	= "DIR_LOG_ITEM",
 		[BTRFS_DIR_LOG_INDEX_KEY]	= "DIR_LOG_INDEX",
 		[BTRFS_XATTR_ITEM_KEY]		= "XATTR_ITEM",
+		[BTRFS_VERITY_DESC_ITEM_KEY]	= "VERITY_DESC_ITEM",
+		[BTRFS_VERITY_MERKLE_ITEM_KEY	= "VERITY_MERKLE_ITEM",
 		[BTRFS_ORPHAN_ITEM_KEY]		= "ORPHAN_ITEM",
 		[BTRFS_ROOT_ITEM_KEY]		= "ROOT_ITEM",
 		[BTRFS_ROOT_REF_KEY]		= "ROOT_REF",