qapi: Reject multiple and empty feature descriptions
[qemu/kevin.git] / include / sysemu / blockdev.h
blob3211b16513ae0d6d5e96cab7d3cc917fe439a8d9
1 /*
2 * QEMU host block devices
4 * Copyright (c) 2003-2008 Fabrice Bellard
6 * This work is licensed under the terms of the GNU GPL, version 2 or
7 * later. See the COPYING file in the top-level directory.
8 */
10 #ifndef BLOCKDEV_H
11 #define BLOCKDEV_H
13 #include "block/block.h"
14 #include "qemu/queue.h"
16 typedef enum {
17 IF_DEFAULT = -1, /* for use with drive_add() only */
19 * IF_NONE must be zero, because we want MachineClass member
20 * block_default_type to default-initialize to IF_NONE
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;
27 struct DriveInfo {
28 BlockInterfaceType type;
29 int bus;
30 int unit;
31 int auto_del; /* see blockdev_mark_auto_del() */
32 bool is_default; /* Added by default_drive() ? */
33 int media_cd;
34 QemuOpts *opts;
35 QTAILQ_ENTRY(DriveInfo) next;
39 * Global state (GS) API. These functions run under the BQL.
41 * See include/block/block-global-state.h for more information about
42 * the GS API.
45 void blockdev_mark_auto_del(BlockBackend *blk);
46 void blockdev_auto_del(BlockBackend *blk);
48 DriveInfo *blk_legacy_dinfo(BlockBackend *blk);
49 DriveInfo *blk_set_legacy_dinfo(BlockBackend *blk, DriveInfo *dinfo);
50 BlockBackend *blk_by_legacy_dinfo(DriveInfo *dinfo);
52 void override_max_devs(BlockInterfaceType type, int max_devs);
54 DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit);
55 void drive_check_orphaned(void);
56 DriveInfo *drive_get_by_index(BlockInterfaceType type, int index);
57 int drive_get_max_bus(BlockInterfaceType type);
59 QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file,
60 const char *optstr);
61 DriveInfo *drive_new(QemuOpts *arg, BlockInterfaceType block_default_type,
62 Error **errp);
64 #endif