summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorJohannes Thumshirn2019-06-03 16:58:56 +0200
committerDavid Sterba2019-07-01 13:35:01 +0200
commit6d97c6e31b553bc9f58b83ac3c4c79c17affbda8 (patch)
tree1630ce58106d085e9a5d0f08fe25d57f967f4b6a /fs/btrfs/ctree.h
parentbtrfs: Simplify btrfs_check_super_csum() and get rid of size assumptions (diff)
downloadkernel-qcow2-linux-6d97c6e31b553bc9f58b83ac3c4c79c17affbda8.tar.gz
kernel-qcow2-linux-6d97c6e31b553bc9f58b83ac3c4c79c17affbda8.tar.xz
kernel-qcow2-linux-6d97c6e31b553bc9f58b83ac3c4c79c17affbda8.zip
btrfs: add boilerplate code for directly including the crypto framework
Add boilerplate code for directly including the crypto framework. This helps us flipping the switch for new algorithms. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index a66ed58058d9..2e908c557fb2 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -73,6 +73,7 @@ struct btrfs_ref;
/* four bytes for CRC32 */
static const int btrfs_csum_sizes[] = { 4 };
+static const char *btrfs_csum_names[] = { "crc32c" };
#define BTRFS_EMPTY_DIR_SIZE 0
@@ -1163,6 +1164,8 @@ struct btrfs_fs_info {
spinlock_t swapfile_pins_lock;
struct rb_root swapfile_pins;
+ struct crypto_shash *csum_shash;
+
#ifdef CONFIG_BTRFS_FS_REF_VERIFY
spinlock_t ref_verify_lock;
struct rb_root block_tree;
@@ -2454,6 +2457,11 @@ static inline int btrfs_super_csum_size(const struct btrfs_super_block *s)
return btrfs_csum_sizes[t];
}
+static inline const char *btrfs_super_csum_name(u16 csum_type)
+{
+ /* csum type is validated at mount time */
+ return btrfs_csum_names[csum_type];
+}
/*
* The leaf data grows from end-to-front in the node.