]> git.ipfire.org Git - thirdparty/u-boot.git/blob - fs/btrfs/dev.c
command: Introduce functions to obtain command arguments
[thirdparty/u-boot.git] / fs / btrfs / dev.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * BTRFS filesystem implementation for U-Boot
4 *
5 * 2017 Marek BehĂșn, CZ.NIC, kabel@kernel.org
6 */
7
8 #include <common.h>
9 #include <blk.h>
10 #include <compiler.h>
11 #include <fs_internal.h>
12
13 struct blk_desc *btrfs_blk_desc;
14 struct disk_partition *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 }