1
2
3
4
5
6
7
8
9
10#ifndef BLOCKDEV_H
11#define BLOCKDEV_H
12
13#include "block/block.h"
14#include "qemu/queue.h"
15
16typedef enum {
17 IF_DEFAULT = -1,
18
19
20
21
22 IF_NONE = 0,
23 IF_IDE, IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD, IF_VIRTIO, IF_XEN,
24 IF_COUNT
25} BlockInterfaceType;
26
27struct DriveInfo {
28 BlockInterfaceType type;
29 int bus;
30 int unit;
31 int auto_del;
32 bool is_default;
33 int media_cd;
34 QemuOpts *opts;
35 QTAILQ_ENTRY(DriveInfo) next;
36};
37
38
39
40
41
42
43
44
45void blockdev_mark_auto_del(BlockBackend *blk);
46void blockdev_auto_del(BlockBackend *blk);
47
48DriveInfo *blk_legacy_dinfo(BlockBackend *blk);
49DriveInfo *blk_set_legacy_dinfo(BlockBackend *blk, DriveInfo *dinfo);
50BlockBackend *blk_by_legacy_dinfo(DriveInfo *dinfo);
51
52void override_max_devs(BlockInterfaceType type, int max_devs);
53
54DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit);
55void drive_check_orphaned(void);
56DriveInfo *drive_get_by_index(BlockInterfaceType type, int index);
57int drive_get_max_bus(BlockInterfaceType type);
58
59QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file,
60 const char *optstr);
61DriveInfo *drive_new(QemuOpts *arg, BlockInterfaceType block_default_type,
62 Error **errp);
63
64#endif
65