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> |
| 9 | #include <compiler.h> |
| 10 | #include <fs_internal.h> |
| 11 | |
| 12 | struct blk_desc *btrfs_blk_desc; |
| 13 | disk_partition_t *btrfs_part_info; |
| 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 | } |