Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Marek Behún | 21a14fa | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 2 | /* |
| 3 | * BTRFS filesystem implementation for U-Boot |
| 4 | * |
| 5 | * 2017 Marek Behun, CZ.NIC, marek.behun@nic.cz |
Marek Behún | 21a14fa | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
Simon Glass | e6f6f9e | 2020-05-10 11:39:58 -0600 | [diff] [blame] | 9 | #include <blk.h> |
Marek Behún | 21a14fa | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 10 | #include <compiler.h> |
| 11 | #include <fs_internal.h> |
| 12 | |
| 13 | struct blk_desc *btrfs_blk_desc; |
Simon Glass | 0528979 | 2020-05-10 11:39:57 -0600 | [diff] [blame] | 14 | struct disk_partition *btrfs_part_info; |
Marek Behún | 21a14fa | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 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 | } |