Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Marek Behún | 2938754 | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 2 | /* |
| 3 | * BTRFS filesystem implementation for U-Boot |
| 4 | * |
Marek Behún | d63726e | 2022-06-01 17:17:06 +0200 | [diff] [blame] | 5 | * 2017 Marek Behún, CZ.NIC, kabel@kernel.org |
Marek Behún | 2938754 | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 6 | */ |
| 7 | |
Simon Glass | 655306c | 2020-05-10 11:39:58 -0600 | [diff] [blame] | 8 | #include <blk.h> |
Marek Behún | 2938754 | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 9 | #include <compiler.h> |
| 10 | #include <fs_internal.h> |
| 11 | |
| 12 | struct blk_desc *btrfs_blk_desc; |
Simon Glass | c1c4a8f | 2020-05-10 11:39:57 -0600 | [diff] [blame] | 13 | struct disk_partition *btrfs_part_info; |
Marek Behún | 2938754 | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 14 | |
| 15 | int btrfs_devread(u64 address, int byte_len, void *buf) |
| 16 | { |
| 17 | lbaint_t sector; |
| 18 | int byte_offset; |
| 19 | |
| 20 | sector = address >> btrfs_blk_desc->log2blksz; |
| 21 | byte_offset = address % btrfs_blk_desc->blksz; |
| 22 | |
| 23 | return fs_devread(btrfs_blk_desc, btrfs_part_info, sector, byte_offset, |
| 24 | byte_len, buf); |
| 25 | } |