2012-10-24 01:41:52 +02:00
|
|
|
#ifndef QEMU_TYPEDEFS_H
|
|
|
|
#define QEMU_TYPEDEFS_H
|
|
|
|
|
|
|
|
/* A load of opaque types so that device init declarations don't have to
|
|
|
|
pull in all the real definitions. */
|
|
|
|
|
2014-12-11 12:46:36 +01:00
|
|
|
/* Please keep this list in alphabetical order */
|
|
|
|
typedef struct AdapterInfo AdapterInfo;
|
2013-04-09 11:10:27 +02:00
|
|
|
typedef struct AddressSpace AddressSpace;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct AioContext AioContext;
|
2015-11-06 20:09:01 +01:00
|
|
|
typedef struct AllwinnerAHCIState AllwinnerAHCIState;
|
2012-10-24 01:41:52 +02:00
|
|
|
typedef struct AudioState AudioState;
|
block: New BlockBackend
A block device consists of a frontend device model and a backend.
A block backend has a tree of block drivers doing the actual work.
The tree is managed by the block layer.
We currently use a single abstraction BlockDriverState both for tree
nodes and the backend as a whole. Drawbacks:
* Its API includes both stuff that makes sense only at the block
backend level (root of the tree) and stuff that's only for use
within the block layer. This makes the API bigger and more complex
than necessary. Moreover, it's not obvious which interfaces are
meant for device models, and which really aren't.
* Since device models keep a reference to their backend, the backend
object can't just be destroyed. But for media change, we need to
replace the tree. Our solution is to make the BlockDriverState
generic, with actual driver state in a separate object, pointed to
by member opaque. That lets us replace the tree by deinitializing
and reinitializing its root. This special need of the root makes
the data structure awkward everywhere in the tree.
The general plan is to separate the APIs into "block backend", for use
by device models, monitor and whatever other code dealing with block
backends, and "block driver", for use by the block layer and whatever
other code (if any) dealing with trees and tree nodes.
Code dealing with block backends, device models in particular, should
become completely oblivious of BlockDriverState. This should let us
clean up both APIs, and the tree data structures.
This commit is a first step. It creates a minimal "block backend"
API: type BlockBackend and functions to create, destroy and find them.
BlockBackend objects are created and destroyed exactly when root
BlockDriverState objects are created and destroyed. "Root" in the
sense of "in bdrv_states". They're not yet used for anything; that'll
come shortly.
A root BlockDriverState is created with bdrv_new_root(), so where to
create a BlockBackend is obvious. Where these roots get destroyed
isn't always as obvious.
It is obvious in qemu-img.c, qemu-io.c and qemu-nbd.c, and in error
paths of blockdev_init(), blk_connect(). That leaves destruction of
objects successfully created by blockdev_init() and blk_connect().
blockdev_init() is used only by drive_new() and qmp_blockdev_add().
Objects created by the latter are currently indestructible (see commit
48f364d "blockdev: Refuse to drive_del something added with
blockdev-add" and commit 2d246f0 "blockdev: Introduce
DriveInfo.enable_auto_del"). Objects created by the former get
destroyed by drive_del().
Objects created by blk_connect() get destroyed by blk_disconnect().
BlockBackend is reference-counted. Its reference count never exceeds
one so far, but that's going to change.
In drive_del(), the BB's reference count is surely one now. The BDS's
reference count is greater than one when something else is holding a
reference, such as a block job. In this case, the BB is destroyed
right away, but the BDS lives on until all extra references get
dropped.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-10-07 13:59:04 +02:00
|
|
|
typedef struct BlockBackend BlockBackend;
|
2015-10-19 17:53:24 +02:00
|
|
|
typedef struct BlockBackendRootState BlockBackendRootState;
|
2012-10-24 01:41:52 +02:00
|
|
|
typedef struct BlockDriverState BlockDriverState;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct BusClass BusClass;
|
|
|
|
typedef struct BusState BusState;
|
|
|
|
typedef struct CharDriverState CharDriverState;
|
|
|
|
typedef struct CompatProperty CompatProperty;
|
2015-10-01 16:29:50 +02:00
|
|
|
typedef struct CPUAddressSpace CPUAddressSpace;
|
2015-01-20 12:05:07 +01:00
|
|
|
typedef struct DeviceListener DeviceListener;
|
2015-11-19 13:29:28 +01:00
|
|
|
typedef struct DeviceState DeviceState;
|
2012-10-24 01:41:52 +02:00
|
|
|
typedef struct DisplayChangeListener DisplayChangeListener;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct DisplayState DisplayState;
|
2012-10-24 01:41:52 +02:00
|
|
|
typedef struct DisplaySurface DisplaySurface;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct DriveInfo DriveInfo;
|
|
|
|
typedef struct EventNotifier EventNotifier;
|
2014-12-22 13:11:35 +01:00
|
|
|
typedef struct FWCfgIoState FWCfgIoState;
|
|
|
|
typedef struct FWCfgMemState FWCfgMemState;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct FWCfgState FWCfgState;
|
|
|
|
typedef struct HCIInfo HCIInfo;
|
2013-08-03 00:18:51 +02:00
|
|
|
typedef struct I2CBus I2CBus;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct I2SCodec I2SCodec;
|
2012-10-24 01:41:52 +02:00
|
|
|
typedef struct ISABus ISABus;
|
|
|
|
typedef struct ISADevice ISADevice;
|
2015-05-21 14:24:16 +02:00
|
|
|
typedef struct LoadStateEntry LoadStateEntry;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct MACAddr MACAddr;
|
|
|
|
typedef struct MachineClass MachineClass;
|
|
|
|
typedef struct MachineState MachineState;
|
|
|
|
typedef struct MemoryListener MemoryListener;
|
|
|
|
typedef struct MemoryMappingList MemoryMappingList;
|
|
|
|
typedef struct MemoryRegion MemoryRegion;
|
|
|
|
typedef struct MemoryRegionSection MemoryRegionSection;
|
2015-05-21 14:24:14 +02:00
|
|
|
typedef struct MigrationIncomingState MigrationIncomingState;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct MigrationParams MigrationParams;
|
2015-11-05 19:10:40 +01:00
|
|
|
typedef struct MigrationState MigrationState;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct Monitor Monitor;
|
2015-11-19 13:29:28 +01:00
|
|
|
typedef struct MonitorDef MonitorDef;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct MouseTransformInfo MouseTransformInfo;
|
|
|
|
typedef struct MSIMessage MSIMessage;
|
|
|
|
typedef struct NetClientState NetClientState;
|
2015-10-07 05:52:14 +02:00
|
|
|
typedef struct NetFilterState NetFilterState;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct NICInfo NICInfo;
|
|
|
|
typedef struct PcGuestInfo PcGuestInfo;
|
|
|
|
typedef struct PCIBridge PCIBridge;
|
2012-10-24 01:41:52 +02:00
|
|
|
typedef struct PCIBus PCIBus;
|
|
|
|
typedef struct PCIDevice PCIDevice;
|
|
|
|
typedef struct PCIEAERErr PCIEAERErr;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct PCIEAERLog PCIEAERLog;
|
|
|
|
typedef struct PCIEAERMsg PCIEAERMsg;
|
2012-10-24 01:41:52 +02:00
|
|
|
typedef struct PCIEPort PCIEPort;
|
|
|
|
typedef struct PCIESlot PCIESlot;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct PCIExpressDevice PCIExpressDevice;
|
|
|
|
typedef struct PCIExpressHost PCIExpressHost;
|
|
|
|
typedef struct PCIHostState PCIHostState;
|
2015-08-07 21:55:46 +02:00
|
|
|
typedef struct PCMachineClass PCMachineClass;
|
2015-11-19 13:29:28 +01:00
|
|
|
typedef struct PCMachineState PCMachineState;
|
2012-10-24 01:41:52 +02:00
|
|
|
typedef struct PCMCIACardState PCMCIACardState;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct PixelFormat PixelFormat;
|
2015-11-05 19:11:02 +01:00
|
|
|
typedef struct PostcopyDiscardState PostcopyDiscardState;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct Property Property;
|
2015-11-19 13:29:28 +01:00
|
|
|
typedef struct PropertyInfo PropertyInfo;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct QEMUBH QEMUBH;
|
|
|
|
typedef struct QemuConsole QemuConsole;
|
|
|
|
typedef struct QEMUFile QEMUFile;
|
2015-09-17 18:25:01 +02:00
|
|
|
typedef struct QemuOpt QemuOpt;
|
|
|
|
typedef struct QemuOpts QemuOpts;
|
|
|
|
typedef struct QemuOptsList QemuOptsList;
|
2012-10-24 01:41:52 +02:00
|
|
|
typedef struct QEMUSGList QEMUSGList;
|
2014-10-10 13:39:04 +02:00
|
|
|
typedef struct QEMUSizedBuffer QEMUSizedBuffer;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct QEMUTimer QEMUTimer;
|
2015-11-19 13:29:28 +01:00
|
|
|
typedef struct QEMUTimerListGroup QEMUTimerListGroup;
|
qapi: Convert QType into QAPI built-in enum type
What's more meta than using qapi to define qapi? :)
Convert QType into a full-fledged[*] builtin qapi enum type, so
that a subsequent patch can then use it as the discriminator
type of qapi alternate types. Fortunately, the judicious use of
'prefix' in the qapi definition avoids churn to the spelling of
the enum constants.
To avoid circular definitions, we have to flip the order of
inclusion between "qobject.h" vs. "qapi-types.h". Back in commit
28770e0, we had the latter include the former, so that we could
use 'QObject *' for our implementation of 'any'. But that usage
also works with only a forward declaration, whereas the
definition of QObject requires QType to be a complete type.
[*] The type has to be builtin, rather than declared in
qapi/common.json, because we want to use it for alternates even
when common.json is not included. But since it is the first
builtin enum type, we have to add special cases to qapi-types
and qapi-visit to only emit definitions once, even when two
qapi files are being compiled into the same binary (the way we
already handled builtin list types like 'intList'). We may
need to revisit how multiple qapi files share common types,
but that's a project for another day.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1449033659-25497-4-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-12-02 06:20:47 +01:00
|
|
|
typedef struct QObject QObject;
|
2015-11-05 19:10:32 +01:00
|
|
|
typedef struct RAMBlock RAMBlock;
|
2015-11-19 13:29:28 +01:00
|
|
|
typedef struct Range Range;
|
2014-12-11 12:46:36 +01:00
|
|
|
typedef struct SerialState SerialState;
|
|
|
|
typedef struct SHPCDevice SHPCDevice;
|
|
|
|
typedef struct SMBusDevice SMBusDevice;
|
|
|
|
typedef struct SSIBus SSIBus;
|
|
|
|
typedef struct uWireSlave uWireSlave;
|
|
|
|
typedef struct VirtIODevice VirtIODevice;
|
|
|
|
typedef struct Visitor Visitor;
|
2012-10-24 01:41:52 +02:00
|
|
|
|
|
|
|
#endif /* QEMU_TYPEDEFS_H */
|