aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/dev.c
blob: 1e5b83235ad5f8674857fc2ec8e76149355b1620 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: GPL-2.0+
/*
 * BTRFS filesystem implementation for U-Boot
 *
 * 2017 Marek Behun, CZ.NIC, marek.behun@nic.cz
 */

#include <common.h>
#include <blk.h>
#include <compiler.h>
#include <fs_internal.h>

struct blk_desc *btrfs_blk_desc;
struct disk_partition *btrfs_part_info;

int btrfs_devread(u64 address, int byte_len, void *buf)
{
	lbaint_t sector;
	int byte_offset;

	sector = address >> btrfs_blk_desc->log2blksz;
	byte_offset = address % btrfs_blk_desc->blksz;

	return fs_devread(btrfs_blk_desc, btrfs_part_info, sector, byte_offset,
			  byte_len, buf);
}