2 * Copyright (c) 2018 Citrix Systems Inc.
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.
11 #include "hw/xen/xen-bus.h"
12 #include "hw/block/block.h"
13 #include "hw/block/dataplane/xen-block.h"
14 #include "sysemu/iothread.h"
15 #include "qom/object.h"
17 typedef enum XenBlockVdevType
{
18 XEN_BLOCK_VDEV_TYPE_INVALID
,
19 XEN_BLOCK_VDEV_TYPE_DP
,
20 XEN_BLOCK_VDEV_TYPE_XVD
,
21 XEN_BLOCK_VDEV_TYPE_HD
,
22 XEN_BLOCK_VDEV_TYPE_SD
,
23 XEN_BLOCK_VDEV_TYPE__MAX
26 typedef struct XenBlockVdev
{
27 XenBlockVdevType type
;
29 unsigned long partition
;
34 typedef struct XenBlockProperties
{
37 unsigned int max_ring_page_order
;
41 typedef struct XenBlockDrive
{
46 typedef struct XenBlockIOThread
{
50 struct XenBlockDevice
{
52 XenBlockProperties props
;
53 const char *device_type
;
55 XenBlockDataPlane
*dataplane
;
57 XenBlockIOThread
*iothread
;
59 typedef struct XenBlockDevice XenBlockDevice
;
61 typedef void (*XenBlockDeviceRealize
)(XenBlockDevice
*blockdev
, Error
**errp
);
62 typedef void (*XenBlockDeviceUnrealize
)(XenBlockDevice
*blockdev
);
64 struct XenBlockDeviceClass
{
66 XenDeviceClass parent_class
;
68 XenBlockDeviceRealize realize
;
69 XenBlockDeviceUnrealize unrealize
;
72 #define TYPE_XEN_BLOCK_DEVICE "xen-block"
73 OBJECT_DECLARE_TYPE(XenBlockDevice
, XenBlockDeviceClass
, XEN_BLOCK_DEVICE
)
75 struct XenDiskDevice
{
76 XenBlockDevice blockdev
;
79 #define TYPE_XEN_DISK_DEVICE "xen-disk"
80 OBJECT_DECLARE_SIMPLE_TYPE(XenDiskDevice
, XEN_DISK_DEVICE
)
82 struct XenCDRomDevice
{
83 XenBlockDevice blockdev
;
86 #define TYPE_XEN_CDROM_DEVICE "xen-cdrom"
87 OBJECT_DECLARE_SIMPLE_TYPE(XenCDRomDevice
, XEN_CDROM_DEVICE
)
89 #endif /* HW_XEN_BLOCK_H */