ctree.c (f7cea56c0fff95bd5a6cd21b9fa299f66193b604) ctree.c (b4e967be431cf37f56cd1993592943007d7ab03b)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2007,2008 Oracle. All rights reserved.
4 */
5
6#include <linux/sched.h>
7#include <linux/slab.h>
8#include <linux/rbtree.h>

--- 18 unchanged lines hidden (view full) ---

27 struct extent_buffer *dst_buf,
28 struct extent_buffer *src_buf);
29static void del_ptr(struct btrfs_root *root, struct btrfs_path *path,
30 int level, int slot);
31
32static const struct btrfs_csums {
33 u16 size;
34 const char *name;
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2007,2008 Oracle. All rights reserved.
4 */
5
6#include <linux/sched.h>
7#include <linux/slab.h>
8#include <linux/rbtree.h>

--- 18 unchanged lines hidden (view full) ---

27 struct extent_buffer *dst_buf,
28 struct extent_buffer *src_buf);
29static void del_ptr(struct btrfs_root *root, struct btrfs_path *path,
30 int level, int slot);
31
32static const struct btrfs_csums {
33 u16 size;
34 const char *name;
35 const char *driver;
35} btrfs_csums[] = {
36 [BTRFS_CSUM_TYPE_CRC32] = { .size = 4, .name = "crc32c" },
37 [BTRFS_CSUM_TYPE_XXHASH] = { .size = 8, .name = "xxhash64" },
38 [BTRFS_CSUM_TYPE_SHA256] = { .size = 32, .name = "sha256" },
39};
40
41int btrfs_super_csum_size(const struct btrfs_super_block *s)
42{

--- 5 unchanged lines hidden (view full) ---

48}
49
50const char *btrfs_super_csum_name(u16 csum_type)
51{
52 /* csum type is validated at mount time */
53 return btrfs_csums[csum_type].name;
54}
55
36} btrfs_csums[] = {
37 [BTRFS_CSUM_TYPE_CRC32] = { .size = 4, .name = "crc32c" },
38 [BTRFS_CSUM_TYPE_XXHASH] = { .size = 8, .name = "xxhash64" },
39 [BTRFS_CSUM_TYPE_SHA256] = { .size = 32, .name = "sha256" },
40};
41
42int btrfs_super_csum_size(const struct btrfs_super_block *s)
43{

--- 5 unchanged lines hidden (view full) ---

49}
50
51const char *btrfs_super_csum_name(u16 csum_type)
52{
53 /* csum type is validated at mount time */
54 return btrfs_csums[csum_type].name;
55}
56
57/*
58 * Return driver name if defined, otherwise the name that's also a valid driver
59 * name
60 */
61const char *btrfs_super_csum_driver(u16 csum_type)
62{
63 /* csum type is validated at mount time */
64 return btrfs_csums[csum_type].driver ?:
65 btrfs_csums[csum_type].name;
66}
67
56size_t __const btrfs_get_num_csums(void)
57{
58 return ARRAY_SIZE(btrfs_csums);
59}
60
61struct btrfs_path *btrfs_alloc_path(void)
62{
63 return kmem_cache_zalloc(btrfs_path_cachep, GFP_NOFS);

--- 5488 unchanged lines hidden ---
68size_t __const btrfs_get_num_csums(void)
69{
70 return ARRAY_SIZE(btrfs_csums);
71}
72
73struct btrfs_path *btrfs_alloc_path(void)
74{
75 return kmem_cache_zalloc(btrfs_path_cachep, GFP_NOFS);

--- 5488 unchanged lines hidden ---