xen-block.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * Copyright (c) 2018 Citrix Systems Inc.
  3. *
  4. * This work is licensed under the terms of the GNU GPL, version 2 or later.
  5. * See the COPYING file in the top-level directory.
  6. */
  7. #ifndef HW_XEN_BLOCK_H
  8. #define HW_XEN_BLOCK_H
  9. #include "hw/xen/xen-bus.h"
  10. #include "hw/block/block.h"
  11. #include "hw/block/dataplane/xen-block.h"
  12. #include "sysemu/iothread.h"
  13. #include "qom/object.h"
  14. typedef enum XenBlockVdevType {
  15. XEN_BLOCK_VDEV_TYPE_INVALID,
  16. XEN_BLOCK_VDEV_TYPE_DP,
  17. XEN_BLOCK_VDEV_TYPE_XVD,
  18. XEN_BLOCK_VDEV_TYPE_HD,
  19. XEN_BLOCK_VDEV_TYPE_SD,
  20. XEN_BLOCK_VDEV_TYPE__MAX
  21. } XenBlockVdevType;
  22. typedef struct XenBlockVdev {
  23. XenBlockVdevType type;
  24. unsigned long disk;
  25. unsigned long partition;
  26. unsigned long number;
  27. } XenBlockVdev;
  28. typedef struct XenBlockProperties {
  29. XenBlockVdev vdev;
  30. BlockConf conf;
  31. unsigned int max_ring_page_order;
  32. IOThread *iothread;
  33. } XenBlockProperties;
  34. typedef struct XenBlockDrive {
  35. char *id;
  36. char *node_name;
  37. } XenBlockDrive;
  38. typedef struct XenBlockIOThread {
  39. char *id;
  40. } XenBlockIOThread;
  41. struct XenBlockDevice {
  42. XenDevice xendev;
  43. XenBlockProperties props;
  44. const char *device_type;
  45. unsigned int info;
  46. XenBlockDataPlane *dataplane;
  47. XenBlockDrive *drive;
  48. XenBlockIOThread *iothread;
  49. };
  50. typedef struct XenBlockDevice XenBlockDevice;
  51. typedef void (*XenBlockDeviceRealize)(XenBlockDevice *blockdev, Error **errp);
  52. typedef void (*XenBlockDeviceUnrealize)(XenBlockDevice *blockdev);
  53. struct XenBlockDeviceClass {
  54. /*< private >*/
  55. XenDeviceClass parent_class;
  56. /*< public >*/
  57. XenBlockDeviceRealize realize;
  58. XenBlockDeviceUnrealize unrealize;
  59. };
  60. #define TYPE_XEN_BLOCK_DEVICE "xen-block"
  61. OBJECT_DECLARE_TYPE(XenBlockDevice, XenBlockDeviceClass, XEN_BLOCK_DEVICE)
  62. struct XenDiskDevice {
  63. XenBlockDevice blockdev;
  64. };
  65. typedef struct XenDiskDevice XenDiskDevice;
  66. #define TYPE_XEN_DISK_DEVICE "xen-disk"
  67. DECLARE_INSTANCE_CHECKER(XenDiskDevice, XEN_DISK_DEVICE,
  68. TYPE_XEN_DISK_DEVICE)
  69. struct XenCDRomDevice {
  70. XenBlockDevice blockdev;
  71. };
  72. typedef struct XenCDRomDevice XenCDRomDevice;
  73. #define TYPE_XEN_CDROM_DEVICE "xen-cdrom"
  74. DECLARE_INSTANCE_CHECKER(XenCDRomDevice, XEN_CDROM_DEVICE,
  75. TYPE_XEN_CDROM_DEVICE)
  76. #endif /* HW_XEN_BLOCK_H */