diff mbox series

[17/17] btrfs: move the btrfs_verity_descriptor_item defs up in ctree.h

Message ID f86d4f92429b1efe41664e67405ce6266d7d2ea7.1663167824.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs: initial ctree.h cleanups, simple stuff | expand

Commit Message

Josef Bacik Sept. 14, 2022, 3:06 p.m. UTC
These are wrapped in CONFIG_FS_VERITY, but we can have the definitions
without verity enabled.  Move these definitions up with the other
accessor helpers.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/ctree.h | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

Comments

Qu Wenruo Sept. 15, 2022, 9:30 a.m. UTC | #1
On 2022/9/14 23:06, Josef Bacik wrote:
> These are wrapped in CONFIG_FS_VERITY, but we can have the definitions
> without verity enabled.  Move these definitions up with the other
> accessor helpers.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>


Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
>   fs/btrfs/ctree.h | 23 ++++++++++-------------
>   1 file changed, 10 insertions(+), 13 deletions(-)
> 
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> index 42dec21b3517..cb1ae35c1095 100644
> --- a/fs/btrfs/ctree.h
> +++ b/fs/btrfs/ctree.h
> @@ -2499,6 +2499,16 @@ BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_cursor_left,
>   BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_cursor_right,
>   			 struct btrfs_dev_replace_item, cursor_right, 64);
>   
> +/* btrfs_verity_descriptor_item */
> +BTRFS_SETGET_FUNCS(verity_descriptor_encryption, struct btrfs_verity_descriptor_item,
> +		   encryption, 8);
> +BTRFS_SETGET_FUNCS(verity_descriptor_size, struct btrfs_verity_descriptor_item,
> +		   size, 64);
> +BTRFS_SETGET_STACK_FUNCS(stack_verity_descriptor_encryption,
> +			 struct btrfs_verity_descriptor_item, encryption, 8);
> +BTRFS_SETGET_STACK_FUNCS(stack_verity_descriptor_size,
> +			 struct btrfs_verity_descriptor_item, size, 64);
> +
>   /* helper function to cast into the data area of the leaf. */
>   #define btrfs_item_ptr(leaf, slot, type) \
>   	((type *)(BTRFS_LEAF_DATA_OFFSET + \
> @@ -3742,22 +3752,10 @@ static inline int btrfs_defrag_cancelled(struct btrfs_fs_info *fs_info)
>   
>   /* verity.c */
>   #ifdef CONFIG_FS_VERITY
> -
>   extern const struct fsverity_operations btrfs_verityops;
>   int btrfs_drop_verity_items(struct btrfs_inode *inode);
>   int btrfs_get_verity_descriptor(struct inode *inode, void *buf, size_t buf_size);
> -
> -BTRFS_SETGET_FUNCS(verity_descriptor_encryption, struct btrfs_verity_descriptor_item,
> -		   encryption, 8);
> -BTRFS_SETGET_FUNCS(verity_descriptor_size, struct btrfs_verity_descriptor_item,
> -		   size, 64);
> -BTRFS_SETGET_STACK_FUNCS(stack_verity_descriptor_encryption,
> -			 struct btrfs_verity_descriptor_item, encryption, 8);
> -BTRFS_SETGET_STACK_FUNCS(stack_verity_descriptor_size,
> -			 struct btrfs_verity_descriptor_item, size, 64);
> -
>   #else
> -
>   static inline int btrfs_drop_verity_items(struct btrfs_inode *inode)
>   {
>   	return 0;
> @@ -3768,7 +3766,6 @@ static inline int btrfs_get_verity_descriptor(struct inode *inode, void *buf,
>   {
>   	return -EPERM;
>   }
> -
>   #endif
>   
>   /* Sanity test specific functions */
Johannes Thumshirn Sept. 15, 2022, 2:30 p.m. UTC | #2
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff mbox series

Patch

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 42dec21b3517..cb1ae35c1095 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2499,6 +2499,16 @@  BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_cursor_left,
 BTRFS_SETGET_STACK_FUNCS(stack_dev_replace_cursor_right,
 			 struct btrfs_dev_replace_item, cursor_right, 64);
 
+/* btrfs_verity_descriptor_item */
+BTRFS_SETGET_FUNCS(verity_descriptor_encryption, struct btrfs_verity_descriptor_item,
+		   encryption, 8);
+BTRFS_SETGET_FUNCS(verity_descriptor_size, struct btrfs_verity_descriptor_item,
+		   size, 64);
+BTRFS_SETGET_STACK_FUNCS(stack_verity_descriptor_encryption,
+			 struct btrfs_verity_descriptor_item, encryption, 8);
+BTRFS_SETGET_STACK_FUNCS(stack_verity_descriptor_size,
+			 struct btrfs_verity_descriptor_item, size, 64);
+
 /* helper function to cast into the data area of the leaf. */
 #define btrfs_item_ptr(leaf, slot, type) \
 	((type *)(BTRFS_LEAF_DATA_OFFSET + \
@@ -3742,22 +3752,10 @@  static inline int btrfs_defrag_cancelled(struct btrfs_fs_info *fs_info)
 
 /* verity.c */
 #ifdef CONFIG_FS_VERITY
-
 extern const struct fsverity_operations btrfs_verityops;
 int btrfs_drop_verity_items(struct btrfs_inode *inode);
 int btrfs_get_verity_descriptor(struct inode *inode, void *buf, size_t buf_size);
-
-BTRFS_SETGET_FUNCS(verity_descriptor_encryption, struct btrfs_verity_descriptor_item,
-		   encryption, 8);
-BTRFS_SETGET_FUNCS(verity_descriptor_size, struct btrfs_verity_descriptor_item,
-		   size, 64);
-BTRFS_SETGET_STACK_FUNCS(stack_verity_descriptor_encryption,
-			 struct btrfs_verity_descriptor_item, encryption, 8);
-BTRFS_SETGET_STACK_FUNCS(stack_verity_descriptor_size,
-			 struct btrfs_verity_descriptor_item, size, 64);
-
 #else
-
 static inline int btrfs_drop_verity_items(struct btrfs_inode *inode)
 {
 	return 0;
@@ -3768,7 +3766,6 @@  static inline int btrfs_get_verity_descriptor(struct inode *inode, void *buf,
 {
 	return -EPERM;
 }
-
 #endif
 
 /* Sanity test specific functions */