xen: add implementations of xen-block connect and disconnect functions...
[qemu.git] / include / hw / xen / xen-block.h
blobc4223f9be1ffa0aa57180ef20ab3714e779318cb
1 /*
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.
6 */
8 #ifndef HW_XEN_BLOCK_H
9 #define HW_XEN_BLOCK_H
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"
16 typedef enum XenBlockVdevType {
17 XEN_BLOCK_VDEV_TYPE_INVALID,
18 XEN_BLOCK_VDEV_TYPE_DP,
19 XEN_BLOCK_VDEV_TYPE_XVD,
20 XEN_BLOCK_VDEV_TYPE_HD,
21 XEN_BLOCK_VDEV_TYPE_SD,
22 XEN_BLOCK_VDEV_TYPE__MAX
23 } XenBlockVdevType;
25 typedef struct XenBlockVdev {
26 XenBlockVdevType type;
27 unsigned long disk;
28 unsigned long partition;
29 unsigned long number;
30 } XenBlockVdev;
32 typedef struct XenBlockProperties {
33 XenBlockVdev vdev;
34 BlockConf conf;
35 unsigned int max_ring_page_order;
36 IOThread *iothread;
37 } XenBlockProperties;
39 typedef struct XenBlockDevice {
40 XenDevice xendev;
41 XenBlockProperties props;
42 const char *device_type;
43 unsigned int info;
44 XenBlockDataPlane *dataplane;
45 } XenBlockDevice;
47 typedef void (*XenBlockDeviceRealize)(XenBlockDevice *blockdev, Error **errp);
48 typedef void (*XenBlockDeviceUnrealize)(XenBlockDevice *blockdev, Error **errp);
50 typedef struct XenBlockDeviceClass {
51 /*< private >*/
52 XenDeviceClass parent_class;
53 /*< public >*/
54 XenBlockDeviceRealize realize;
55 XenBlockDeviceUnrealize unrealize;
56 } XenBlockDeviceClass;
58 #define TYPE_XEN_BLOCK_DEVICE "xen-block"
59 #define XEN_BLOCK_DEVICE(obj) \
60 OBJECT_CHECK(XenBlockDevice, (obj), TYPE_XEN_BLOCK_DEVICE)
61 #define XEN_BLOCK_DEVICE_CLASS(class) \
62 OBJECT_CLASS_CHECK(XenBlockDeviceClass, (class), TYPE_XEN_BLOCK_DEVICE)
63 #define XEN_BLOCK_DEVICE_GET_CLASS(obj) \
64 OBJECT_GET_CLASS(XenBlockDeviceClass, (obj), TYPE_XEN_BLOCK_DEVICE)
66 typedef struct XenDiskDevice {
67 XenBlockDevice blockdev;
68 } XenDiskDevice;
70 #define TYPE_XEN_DISK_DEVICE "xen-disk"
71 #define XEN_DISK_DEVICE(obj) \
72 OBJECT_CHECK(XenDiskDevice, (obj), TYPE_XEN_DISK_DEVICE)
74 typedef struct XenCDRomDevice {
75 XenBlockDevice blockdev;
76 } XenCDRomDevice;
78 #define TYPE_XEN_CDROM_DEVICE "xen-cdrom"
79 #define XEN_CDROM_DEVICE(obj) \
80 OBJECT_CHECK(XenCDRomDevice, (obj), TYPE_XEN_CDROM_DEVICE)
82 #endif /* HW_XEN_BLOCK_H */