2
0

xen-block.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 "system/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. #define TYPE_XEN_DISK_DEVICE "xen-disk"
  66. OBJECT_DECLARE_SIMPLE_TYPE(XenDiskDevice, XEN_DISK_DEVICE)
  67. struct XenCDRomDevice {
  68. XenBlockDevice blockdev;
  69. };
  70. #define TYPE_XEN_CDROM_DEVICE "xen-cdrom"
  71. OBJECT_DECLARE_SIMPLE_TYPE(XenCDRomDevice, XEN_CDROM_DEVICE)
  72. #endif /* HW_XEN_BLOCK_H */