blob: 722c6a86176c3618e0e310bda6f5a3f5adb47228 [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
10
Jorgen Lundman9b4a1f92012-07-19 20:48:25 +000011#include <config.h>
Marek BehĂșn45ebb952017-09-03 17:00:24 +020012#include <fs_internal.h>
Jorgen Lundman9b4a1f92012-07-19 20:48:25 +000013#include <zfs_common.h>
14
Simon Glasse3394752016-02-29 15:25:34 -070015static struct blk_desc *zfs_blk_desc;
Simon Glassc1c4a8f2020-05-10 11:39:57 -060016static struct disk_partition *part_info;
Jorgen Lundman9b4a1f92012-07-19 20:48:25 +000017
Simon Glassc1c4a8f2020-05-10 11:39:57 -060018void zfs_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info)
Jorgen Lundman9b4a1f92012-07-19 20:48:25 +000019{
Simon Glasse3394752016-02-29 15:25:34 -070020 zfs_blk_desc = rbdd;
Rob Herring153817e2012-08-23 11:31:49 +000021 part_info = info;
Jorgen Lundman9b4a1f92012-07-19 20:48:25 +000022}
23
24/* err */
25int zfs_devread(int sector, int byte_offset, int byte_len, char *buf)
26{
Marek BehĂșn45ebb952017-09-03 17:00:24 +020027 return fs_devread(zfs_blk_desc, part_info, sector, byte_offset,
mwleeds@mailtundra.com185b1aa2024-04-06 18:47:28 -070028 byte_len, buf) ? 0 : 1;
Jorgen Lundman9b4a1f92012-07-19 20:48:25 +000029}