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.
13 #include "block/block.h"
14 #include "qemu/queue.h"
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
23 IF_IDE
, IF_SCSI
, IF_FLOPPY
, IF_PFLASH
, IF_MTD
, IF_SD
, IF_VIRTIO
, IF_XEN
,
28 BlockInterfaceType type
;
31 int auto_del
; /* see blockdev_mark_auto_del() */
32 bool is_default
; /* Added by default_drive() ? */
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
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
,
61 DriveInfo
*drive_new(QemuOpts
*arg
, BlockInterfaceType block_default_type
,