blob: 0eceafab2af1084a293dd3f7540c4b955b9a0c02 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Jorgen Lundman4d3c95f2012-07-19 20:48:25 +00002/*
3 *
4 * based on code of fs/reiserfs/dev.c by
5 *
6 * (C) Copyright 2003 - 2004
7 * Sysgo AG, <www.elinos.com>, Pavel Bartusek <pba@sysgo.com>
Jorgen Lundman4d3c95f2012-07-19 20:48:25 +00008 */
9
Jorgen Lundman4d3c95f2012-07-19 20:48:25 +000010#include <config.h>
Marek BehĂșn5994e8b2017-09-03 17:00:24 +020011#include <fs_internal.h>
Jorgen Lundman4d3c95f2012-07-19 20:48:25 +000012#include <zfs_common.h>
13
Simon Glass4101f682016-02-29 15:25:34 -070014static struct blk_desc *zfs_blk_desc;
Simon Glass05289792020-05-10 11:39:57 -060015static struct disk_partition *part_info;
Jorgen Lundman4d3c95f2012-07-19 20:48:25 +000016
Simon Glass05289792020-05-10 11:39:57 -060017void zfs_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info)
Jorgen Lundman4d3c95f2012-07-19 20:48:25 +000018{
Simon Glass4101f682016-02-29 15:25:34 -070019 zfs_blk_desc = rbdd;
Rob Herring41204572012-08-23 11:31:49 +000020 part_info = info;
Jorgen Lundman4d3c95f2012-07-19 20:48:25 +000021}
22
23/* err */
24int zfs_devread(int sector, int byte_offset, int byte_len, char *buf)
25{
Marek BehĂșn5994e8b2017-09-03 17:00:24 +020026 return fs_devread(zfs_blk_desc, part_info, sector, byte_offset,
mwleeds@mailtundra.com1e85ddb2024-04-06 18:47:28 -070027 byte_len, buf) ? 0 : 1;
Jorgen Lundman4d3c95f2012-07-19 20:48:25 +000028}