2
0

channel-block.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #ifndef QIO_CHANNEL_BLOCK_H
  21. #define QIO_CHANNEL_BLOCK_H
  22. #include "io/channel.h"
  23. #include "qom/object.h"
  24. #define TYPE_QIO_CHANNEL_BLOCK "qio-channel-block"
  25. OBJECT_DECLARE_SIMPLE_TYPE(QIOChannelBlock, QIO_CHANNEL_BLOCK)
  26. /**
  27. * QIOChannelBlock:
  28. *
  29. * The QIOChannelBlock object provides a channel implementation
  30. * that is able to perform I/O on the BlockDriverState objects
  31. * to the VMState region.
  32. */
  33. struct QIOChannelBlock {
  34. QIOChannel parent;
  35. BlockDriverState *bs;
  36. off_t offset;
  37. };
  38. /**
  39. * qio_channel_block_new:
  40. * @bs: the block driver state
  41. *
  42. * Create a new IO channel object that can perform
  43. * I/O on a BlockDriverState object to the VMState
  44. * region
  45. *
  46. * Returns: the new channel object
  47. */
  48. QIOChannelBlock *
  49. qio_channel_block_new(BlockDriverState *bs);
  50. #endif /* QIO_CHANNEL_BLOCK_H */