1/* 2 * QEMU I/O channels block driver 3 * 4 * Copyright (c) 2022 Red Hat, Inc. 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, see <http://www.gnu.org/licenses/>. 18 * 19 */ 20 21#ifndef QIO_CHANNEL_BLOCK_H 22#define QIO_CHANNEL_BLOCK_H 23 24#include "io/channel.h" 25#include "qom/object.h" 26 27#define TYPE_QIO_CHANNEL_BLOCK "qio-channel-block" 28OBJECT_DECLARE_SIMPLE_TYPE(QIOChannelBlock, QIO_CHANNEL_BLOCK) 29 30 31/** 32 * QIOChannelBlock: 33 * 34 * The QIOChannelBlock object provides a channel implementation 35 * that is able to perform I/O on the BlockDriverState objects 36 * to the VMState region. 37 */ 38 39struct QIOChannelBlock { 40 QIOChannel parent; 41 BlockDriverState *bs; 42 off_t offset; 43}; 44 45 46/** 47 * qio_channel_block_new: 48 * @bs: the block driver state 49 * 50 * Create a new IO channel object that can perform 51 * I/O on a BlockDriverState object to the VMState 52 * region 53 * 54 * Returns: the new channel object 55 */ 56QIOChannelBlock * 57qio_channel_block_new(BlockDriverState *bs); 58 59#endif /* QIO_CHANNEL_BLOCK_H */ 60