xref: /openbmc/u-boot/fs/btrfs/dev.c (revision 342b4b09)
1 /*
2  * BTRFS filesystem implementation for U-Boot
3  *
4  * 2017 Marek Behun, CZ.NIC, marek.behun@nic.cz
5  *
6  * SPDX-License-Identifier:	GPL-2.0+
7  */
8 
9 #include <common.h>
10 #include <compiler.h>
11 #include <fs_internal.h>
12 
13 struct blk_desc *btrfs_blk_desc;
14 disk_partition_t *btrfs_part_info;
15 
16 int btrfs_devread(u64 address, int byte_len, void *buf)
17 {
18 	lbaint_t sector;
19 	int byte_offset;
20 
21 	sector = address >> btrfs_blk_desc->log2blksz;
22 	byte_offset = address % btrfs_blk_desc->blksz;
23 
24 	return fs_devread(btrfs_blk_desc, btrfs_part_info, sector, byte_offset,
25 			  byte_len, buf);
26 }
27