]> git.proxmox.com Git - mirror_qemu.git/blame - include/hw/xen/xen-block.h
Use OBJECT_DECLARE_SIMPLE_TYPE when possible
[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"
db1015e9 15#include "qom/object.h"
1a72d9ae
PD
16
17typedef 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
24} XenBlockVdevType;
25
26typedef struct XenBlockVdev {
27 XenBlockVdevType type;
28 unsigned long disk;
29 unsigned long partition;
30 unsigned long number;
31} XenBlockVdev;
32
db9ff46e 33
1a72d9ae
PD
34typedef struct XenBlockProperties {
35 XenBlockVdev vdev;
b6af8926
PD
36 BlockConf conf;
37 unsigned int max_ring_page_order;
38 IOThread *iothread;
1a72d9ae
PD
39} XenBlockProperties;
40
db9ff46e
PD
41typedef struct XenBlockDrive {
42 char *id;
43 char *node_name;
44} XenBlockDrive;
45
46typedef struct XenBlockIOThread {
47 char *id;
48} XenBlockIOThread;
49
db1015e9 50struct XenBlockDevice {
1a72d9ae
PD
51 XenDevice xendev;
52 XenBlockProperties props;
b6af8926
PD
53 const char *device_type;
54 unsigned int info;
55 XenBlockDataPlane *dataplane;
db9ff46e
PD
56 XenBlockDrive *drive;
57 XenBlockIOThread *iothread;
db1015e9
EH
58};
59typedef struct XenBlockDevice XenBlockDevice;
1a72d9ae
PD
60
61typedef void (*XenBlockDeviceRealize)(XenBlockDevice *blockdev, Error **errp);
b69c3c21 62typedef void (*XenBlockDeviceUnrealize)(XenBlockDevice *blockdev);
1a72d9ae 63
db1015e9 64struct XenBlockDeviceClass {
1a72d9ae
PD
65 /*< private >*/
66 XenDeviceClass parent_class;
67 /*< public >*/
68 XenBlockDeviceRealize realize;
69 XenBlockDeviceUnrealize unrealize;
db1015e9 70};
1a72d9ae
PD
71
72#define TYPE_XEN_BLOCK_DEVICE "xen-block"
a489d195 73OBJECT_DECLARE_TYPE(XenBlockDevice, XenBlockDeviceClass, XEN_BLOCK_DEVICE)
1a72d9ae 74
db1015e9 75struct XenDiskDevice {
1a72d9ae 76 XenBlockDevice blockdev;
db1015e9 77};
1a72d9ae
PD
78
79#define TYPE_XEN_DISK_DEVICE "xen-disk"
8063396b 80OBJECT_DECLARE_SIMPLE_TYPE(XenDiskDevice, XEN_DISK_DEVICE)
1a72d9ae 81
db1015e9 82struct XenCDRomDevice {
1a72d9ae 83 XenBlockDevice blockdev;
db1015e9 84};
1a72d9ae
PD
85
86#define TYPE_XEN_CDROM_DEVICE "xen-cdrom"
8063396b 87OBJECT_DECLARE_SIMPLE_TYPE(XenCDRomDevice, XEN_CDROM_DEVICE)
1a72d9ae
PD
88
89#endif /* HW_XEN_BLOCK_H */