]> git.proxmox.com Git - mirror_qemu.git/blame - include/hw/xen/xen-block.h
Merge remote-tracking branch 'remotes/stsquad/tags/pull-misc-gitdm-next-140119-1...
[mirror_qemu.git] / include / hw / xen / xen-block.h
CommitLineData
1a72d9ae
PD
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
8#ifndef HW_XEN_BLOCK_H
9#define HW_XEN_BLOCK_H
10
11#include "hw/xen/xen-bus.h"
b6af8926
PD
12#include "hw/block/block.h"
13#include "hw/block/dataplane/xen-block.h"
14#include "sysemu/iothread.h"
1a72d9ae
PD
15
16typedef 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;
24
25typedef struct XenBlockVdev {
26 XenBlockVdevType type;
27 unsigned long disk;
28 unsigned long partition;
29 unsigned long number;
30} XenBlockVdev;
31
db9ff46e 32
1a72d9ae
PD
33typedef struct XenBlockProperties {
34 XenBlockVdev vdev;
b6af8926
PD
35 BlockConf conf;
36 unsigned int max_ring_page_order;
37 IOThread *iothread;
1a72d9ae
PD
38} XenBlockProperties;
39
db9ff46e
PD
40typedef struct XenBlockDrive {
41 char *id;
42 char *node_name;
43} XenBlockDrive;
44
45typedef struct XenBlockIOThread {
46 char *id;
47} XenBlockIOThread;
48
1a72d9ae
PD
49typedef struct XenBlockDevice {
50 XenDevice xendev;
51 XenBlockProperties props;
b6af8926
PD
52 const char *device_type;
53 unsigned int info;
54 XenBlockDataPlane *dataplane;
db9ff46e
PD
55 XenBlockDrive *drive;
56 XenBlockIOThread *iothread;
1a72d9ae
PD
57} XenBlockDevice;
58
59typedef void (*XenBlockDeviceRealize)(XenBlockDevice *blockdev, Error **errp);
60typedef void (*XenBlockDeviceUnrealize)(XenBlockDevice *blockdev, Error **errp);
61
62typedef struct XenBlockDeviceClass {
63 /*< private >*/
64 XenDeviceClass parent_class;
65 /*< public >*/
66 XenBlockDeviceRealize realize;
67 XenBlockDeviceUnrealize unrealize;
68} XenBlockDeviceClass;
69
70#define TYPE_XEN_BLOCK_DEVICE "xen-block"
71#define XEN_BLOCK_DEVICE(obj) \
72 OBJECT_CHECK(XenBlockDevice, (obj), TYPE_XEN_BLOCK_DEVICE)
73#define XEN_BLOCK_DEVICE_CLASS(class) \
74 OBJECT_CLASS_CHECK(XenBlockDeviceClass, (class), TYPE_XEN_BLOCK_DEVICE)
75#define XEN_BLOCK_DEVICE_GET_CLASS(obj) \
76 OBJECT_GET_CLASS(XenBlockDeviceClass, (obj), TYPE_XEN_BLOCK_DEVICE)
77
78typedef struct XenDiskDevice {
79 XenBlockDevice blockdev;
80} XenDiskDevice;
81
82#define TYPE_XEN_DISK_DEVICE "xen-disk"
83#define XEN_DISK_DEVICE(obj) \
84 OBJECT_CHECK(XenDiskDevice, (obj), TYPE_XEN_DISK_DEVICE)
85
86typedef struct XenCDRomDevice {
87 XenBlockDevice blockdev;
88} XenCDRomDevice;
89
90#define TYPE_XEN_CDROM_DEVICE "xen-cdrom"
91#define XEN_CDROM_DEVICE(obj) \
92 OBJECT_CHECK(XenCDRomDevice, (obj), TYPE_XEN_CDROM_DEVICE)
93
94#endif /* HW_XEN_BLOCK_H */