blob: fe4093cbd8318d061246e26753ab9e56b1b3b4a4 [file] [log] [blame]
Qu Wenruo565a4142020-06-24 18:02:48 +02001// SPDX-License-Identifier: GPL-2.0+
2#ifndef __BTRFS_DISK_IO_H__
3#define __BTRFS_DISK_IO_H__
4
Qu Wenruo4aebb992020-06-24 18:02:49 +02005#include <linux/sizes.h>
6#include <fs_internal.h>
Qu Wenruo565a4142020-06-24 18:02:48 +02007#include "crypto/hash.h"
8#include "ctree.h"
9#include "disk-io.h"
10
Qu Wenruo4aebb992020-06-24 18:02:49 +020011#define BTRFS_SUPER_INFO_OFFSET SZ_64K
12#define BTRFS_SUPER_INFO_SIZE SZ_4K
Qu Wenruo565a4142020-06-24 18:02:48 +020013static inline u64 btrfs_name_hash(const char *name, int len)
14{
15 u32 crc;
16
17 crc = crc32c((u32)~1, (unsigned char *)name, len);
18
19 return (u64)crc;
20}
21
22int btrfs_csum_data(u16 csum_type, const u8 *data, u8 *out, size_t len);
23
Qu Wenruo4aebb992020-06-24 18:02:49 +020024int btrfs_read_dev_super(struct blk_desc *desc, struct disk_partition *part,
25 struct btrfs_super_block *sb);
26int btrfs_read_superblock(void);
Qu Wenruo565a4142020-06-24 18:02:48 +020027#endif