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 | |
| 8 | #include <common.h> |
Simon Glass | 655306c | 2020-05-10 11:39:58 -0600 | [diff] [blame] | 9 | #include <blk.h> |
Marek Behún | 2938754 | 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 | c1c4a8f | 2020-05-10 11:39:57 -0600 | [diff] [blame] | 14 | struct disk_partition *btrfs_part_info; |
Marek Behún | 2938754 | 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 | } |