blob: 0eceafab2af1084a293dd3f7540c4b955b9a0c02 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Jorgen Lundman9b4a1f92012-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 Lundman9b4a1f92012-07-19 20:48:25 +00008 */
9
Jorgen Lundman9b4a1f92012-07-19 20:48:25 +000010#include <config.h>
Marek BehĂșn45ebb952017-09-03 17:00:24 +020011#include <fs_internal.h>
Jorgen Lundman9b4a1f92012-07-19 20:48:25 +000012#include <zfs_common.h>
13
Simon Glasse3394752016-02-29 15:25:34 -070014static struct blk_desc *zfs_blk_desc;
Simon Glassc1c4a8f2020-05-10 11:39:57 -060015static struct disk_partition *part_info;
Jorgen Lundman9b4a1f92012-07-19 20:48:25 +000016
Simon Glassc1c4a8f2020-05-10 11:39:57 -060017void zfs_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info)
Jorgen Lundman9b4a1f92012-07-19 20:48:25 +000018{
Simon Glasse3394752016-02-29 15:25:34 -070019 zfs_blk_desc = rbdd;
Rob Herring153817e2012-08-23 11:31:49 +000020 part_info = info;
Jorgen Lundman9b4a1f92012-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Ășn45ebb952017-09-03 17:00:24 +020026 return fs_devread(zfs_blk_desc, part_info, sector, byte_offset,
mwleeds@mailtundra.com185b1aa2024-04-06 18:47:28 -070027 byte_len, buf) ? 0 : 1;
Jorgen Lundman9b4a1f92012-07-19 20:48:25 +000028}