mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2016-03-18' into staging
QAPI patches for 2016-03-18 # gpg: Signature made Fri 18 Mar 2016 09:54:57 GMT using RSA key ID EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" * remotes/armbru/tags/pull-qapi-2016-03-18: qapi: Use anonymous bases in QMP flat unions qapi: Allow anonymous base for flat union qapi: Make BlockdevOptions doc example closer to reality qapi: Don't special-case simple union wrappers qapi: Drop unused c_null() qapi: Inline gen_visit_members() into lone caller qapi-commands: Inline single-use helpers of gen_marshal() qapi-commands: Utilize implicit struct visits qapi-event: Utilize implicit struct visits qapi-event: Drop qmp_output_get_qobject() null check qapi: Emit implicit structs in generated C qapi: Adjust names of implicit types qapi: Make c_type() more OO-like qapi: Fix command with named empty argument type qapi: Assert in places where variants are not handled Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
+1
-1
@@ -567,7 +567,7 @@ static CharDriverState *chr_baum_init(const char *id,
|
||||
ChardevReturn *ret,
|
||||
Error **errp)
|
||||
{
|
||||
ChardevCommon *common = backend->u.braille;
|
||||
ChardevCommon *common = backend->u.braille.data;
|
||||
BaumDriverState *baum;
|
||||
CharDriverState *chr;
|
||||
brlapi_handle_t *handle;
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ static CharDriverState *qemu_chr_open_msmouse(const char *id,
|
||||
ChardevReturn *ret,
|
||||
Error **errp)
|
||||
{
|
||||
ChardevCommon *common = backend->u.msmouse;
|
||||
ChardevCommon *common = backend->u.msmouse.data;
|
||||
CharDriverState *chr;
|
||||
|
||||
chr = qemu_chr_alloc(common, errp);
|
||||
|
||||
+3
-3
@@ -206,13 +206,13 @@ static SocketAddress *nbd_config(BDRVNBDState *s, QDict *options, char **export,
|
||||
if (qdict_haskey(options, "path")) {
|
||||
UnixSocketAddress *q_unix;
|
||||
saddr->type = SOCKET_ADDRESS_KIND_UNIX;
|
||||
q_unix = saddr->u.q_unix = g_new0(UnixSocketAddress, 1);
|
||||
q_unix = saddr->u.q_unix.data = g_new0(UnixSocketAddress, 1);
|
||||
q_unix->path = g_strdup(qdict_get_str(options, "path"));
|
||||
qdict_del(options, "path");
|
||||
} else {
|
||||
InetSocketAddress *inet;
|
||||
saddr->type = SOCKET_ADDRESS_KIND_INET;
|
||||
inet = saddr->u.inet = g_new0(InetSocketAddress, 1);
|
||||
inet = saddr->u.inet.data = g_new0(InetSocketAddress, 1);
|
||||
inet->host = g_strdup(qdict_get_str(options, "host"));
|
||||
if (!qdict_get_try_str(options, "port")) {
|
||||
inet->port = g_strdup_printf("%d", NBD_DEFAULT_PORT);
|
||||
@@ -321,7 +321,7 @@ static int nbd_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
error_setg(errp, "TLS only supported over IP sockets");
|
||||
goto error;
|
||||
}
|
||||
hostname = saddr->u.inet->host;
|
||||
hostname = saddr->u.inet.data->host;
|
||||
}
|
||||
|
||||
/* establish TCP connection, return error if it fails
|
||||
|
||||
+3
-3
@@ -2800,15 +2800,15 @@ static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs)
|
||||
|
||||
*spec_info = (ImageInfoSpecific){
|
||||
.type = IMAGE_INFO_SPECIFIC_KIND_QCOW2,
|
||||
.u.qcow2 = g_new(ImageInfoSpecificQCow2, 1),
|
||||
.u.qcow2.data = g_new(ImageInfoSpecificQCow2, 1),
|
||||
};
|
||||
if (s->qcow_version == 2) {
|
||||
*spec_info->u.qcow2 = (ImageInfoSpecificQCow2){
|
||||
*spec_info->u.qcow2.data = (ImageInfoSpecificQCow2){
|
||||
.compat = g_strdup("0.10"),
|
||||
.refcount_bits = s->refcount_bits,
|
||||
};
|
||||
} else if (s->qcow_version == 3) {
|
||||
*spec_info->u.qcow2 = (ImageInfoSpecificQCow2){
|
||||
*spec_info->u.qcow2.data = (ImageInfoSpecificQCow2){
|
||||
.compat = g_strdup("1.1"),
|
||||
.lazy_refcounts = s->compatible_features &
|
||||
QCOW2_COMPAT_LAZY_REFCOUNTS,
|
||||
|
||||
+4
-4
@@ -2203,18 +2203,18 @@ static ImageInfoSpecific *vmdk_get_specific_info(BlockDriverState *bs)
|
||||
|
||||
*spec_info = (ImageInfoSpecific){
|
||||
.type = IMAGE_INFO_SPECIFIC_KIND_VMDK,
|
||||
{
|
||||
.vmdk = g_new0(ImageInfoSpecificVmdk, 1),
|
||||
.u = {
|
||||
.vmdk.data = g_new0(ImageInfoSpecificVmdk, 1),
|
||||
},
|
||||
};
|
||||
|
||||
*spec_info->u.vmdk = (ImageInfoSpecificVmdk) {
|
||||
*spec_info->u.vmdk.data = (ImageInfoSpecificVmdk) {
|
||||
.create_type = g_strdup(s->create_type),
|
||||
.cid = s->cid,
|
||||
.parent_cid = s->parent_cid,
|
||||
};
|
||||
|
||||
next = &spec_info->u.vmdk->extents;
|
||||
next = &spec_info->u.vmdk.data->extents;
|
||||
for (i = 0; i < s->num_extents; i++) {
|
||||
*next = g_new0(ImageInfoList, 1);
|
||||
(*next)->value = vmdk_get_extent_info(&s->extents[i]);
|
||||
|
||||
+12
-12
@@ -1247,7 +1247,7 @@ void qmp_blockdev_snapshot_sync(bool has_device, const char *device,
|
||||
};
|
||||
TransactionAction action = {
|
||||
.type = TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC,
|
||||
.u.blockdev_snapshot_sync = &snapshot,
|
||||
.u.blockdev_snapshot_sync.data = &snapshot,
|
||||
};
|
||||
blockdev_do_action(&action, errp);
|
||||
}
|
||||
@@ -1261,7 +1261,7 @@ void qmp_blockdev_snapshot(const char *node, const char *overlay,
|
||||
};
|
||||
TransactionAction action = {
|
||||
.type = TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT,
|
||||
.u.blockdev_snapshot = &snapshot_data,
|
||||
.u.blockdev_snapshot.data = &snapshot_data,
|
||||
};
|
||||
blockdev_do_action(&action, errp);
|
||||
}
|
||||
@@ -1276,7 +1276,7 @@ void qmp_blockdev_snapshot_internal_sync(const char *device,
|
||||
};
|
||||
TransactionAction action = {
|
||||
.type = TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_INTERNAL_SYNC,
|
||||
.u.blockdev_snapshot_internal_sync = &snapshot,
|
||||
.u.blockdev_snapshot_internal_sync.data = &snapshot,
|
||||
};
|
||||
blockdev_do_action(&action, errp);
|
||||
}
|
||||
@@ -1515,7 +1515,7 @@ static void internal_snapshot_prepare(BlkActionState *common,
|
||||
|
||||
g_assert(common->action->type ==
|
||||
TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_INTERNAL_SYNC);
|
||||
internal = common->action->u.blockdev_snapshot_internal_sync;
|
||||
internal = common->action->u.blockdev_snapshot_internal_sync.data;
|
||||
state = DO_UPCAST(InternalSnapshotState, common, common);
|
||||
|
||||
/* 1. parse input */
|
||||
@@ -1665,7 +1665,7 @@ static void external_snapshot_prepare(BlkActionState *common,
|
||||
switch (action->type) {
|
||||
case TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT:
|
||||
{
|
||||
BlockdevSnapshot *s = action->u.blockdev_snapshot;
|
||||
BlockdevSnapshot *s = action->u.blockdev_snapshot.data;
|
||||
device = s->node;
|
||||
node_name = s->node;
|
||||
new_image_file = NULL;
|
||||
@@ -1674,7 +1674,7 @@ static void external_snapshot_prepare(BlkActionState *common,
|
||||
break;
|
||||
case TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC:
|
||||
{
|
||||
BlockdevSnapshotSync *s = action->u.blockdev_snapshot_sync;
|
||||
BlockdevSnapshotSync *s = action->u.blockdev_snapshot_sync.data;
|
||||
device = s->has_device ? s->device : NULL;
|
||||
node_name = s->has_node_name ? s->node_name : NULL;
|
||||
new_image_file = s->snapshot_file;
|
||||
@@ -1723,7 +1723,7 @@ static void external_snapshot_prepare(BlkActionState *common,
|
||||
}
|
||||
|
||||
if (action->type == TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC) {
|
||||
BlockdevSnapshotSync *s = action->u.blockdev_snapshot_sync;
|
||||
BlockdevSnapshotSync *s = action->u.blockdev_snapshot_sync.data;
|
||||
const char *format = s->has_format ? s->format : "qcow2";
|
||||
enum NewImageMode mode;
|
||||
const char *snapshot_node_name =
|
||||
@@ -1861,7 +1861,7 @@ static void drive_backup_prepare(BlkActionState *common, Error **errp)
|
||||
Error *local_err = NULL;
|
||||
|
||||
assert(common->action->type == TRANSACTION_ACTION_KIND_DRIVE_BACKUP);
|
||||
backup = common->action->u.drive_backup;
|
||||
backup = common->action->u.drive_backup.data;
|
||||
|
||||
blk = blk_by_name(backup->device);
|
||||
if (!blk) {
|
||||
@@ -1943,7 +1943,7 @@ static void blockdev_backup_prepare(BlkActionState *common, Error **errp)
|
||||
Error *local_err = NULL;
|
||||
|
||||
assert(common->action->type == TRANSACTION_ACTION_KIND_BLOCKDEV_BACKUP);
|
||||
backup = common->action->u.blockdev_backup;
|
||||
backup = common->action->u.blockdev_backup.data;
|
||||
|
||||
blk = blk_by_name(backup->device);
|
||||
if (!blk) {
|
||||
@@ -2029,7 +2029,7 @@ static void block_dirty_bitmap_add_prepare(BlkActionState *common,
|
||||
return;
|
||||
}
|
||||
|
||||
action = common->action->u.block_dirty_bitmap_add;
|
||||
action = common->action->u.block_dirty_bitmap_add.data;
|
||||
/* AIO context taken and released within qmp_block_dirty_bitmap_add */
|
||||
qmp_block_dirty_bitmap_add(action->node, action->name,
|
||||
action->has_granularity, action->granularity,
|
||||
@@ -2048,7 +2048,7 @@ static void block_dirty_bitmap_add_abort(BlkActionState *common)
|
||||
BlockDirtyBitmapState *state = DO_UPCAST(BlockDirtyBitmapState,
|
||||
common, common);
|
||||
|
||||
action = common->action->u.block_dirty_bitmap_add;
|
||||
action = common->action->u.block_dirty_bitmap_add.data;
|
||||
/* Should not be able to fail: IF the bitmap was added via .prepare(),
|
||||
* then the node reference and bitmap name must have been valid.
|
||||
*/
|
||||
@@ -2068,7 +2068,7 @@ static void block_dirty_bitmap_clear_prepare(BlkActionState *common,
|
||||
return;
|
||||
}
|
||||
|
||||
action = common->action->u.block_dirty_bitmap_clear;
|
||||
action = common->action->u.block_dirty_bitmap_clear.data;
|
||||
state->bitmap = block_dirty_bitmap_lookup(action->node,
|
||||
action->name,
|
||||
&state->bs,
|
||||
|
||||
+49
-49
@@ -284,7 +284,7 @@ better than open-coding the member to be type 'str'.
|
||||
=== Union types ===
|
||||
|
||||
Usage: { 'union': STRING, 'data': DICT }
|
||||
or: { 'union': STRING, 'data': DICT, 'base': STRUCT-NAME,
|
||||
or: { 'union': STRING, 'data': DICT, 'base': STRUCT-NAME-OR-DICT,
|
||||
'discriminator': ENUM-MEMBER-OF-BASE }
|
||||
|
||||
Union types are used to let the user choose between several different
|
||||
@@ -297,22 +297,22 @@ be empty.
|
||||
A simple union type defines a mapping from automatic discriminator
|
||||
values to data types like in this example:
|
||||
|
||||
{ 'struct': 'FileOptions', 'data': { 'filename': 'str' } }
|
||||
{ 'struct': 'Qcow2Options',
|
||||
'data': { 'backing-file': 'str', 'lazy-refcounts': 'bool' } }
|
||||
{ 'struct': 'BlockdevOptionsFile', 'data': { 'filename': 'str' } }
|
||||
{ 'struct': 'BlockdevOptionsQcow2',
|
||||
'data': { 'backing': 'str', '*lazy-refcounts': 'bool' } }
|
||||
|
||||
{ 'union': 'BlockdevOptions',
|
||||
'data': { 'file': 'FileOptions',
|
||||
'qcow2': 'Qcow2Options' } }
|
||||
{ 'union': 'BlockdevOptionsSimple',
|
||||
'data': { 'file': 'BlockdevOptionsFile',
|
||||
'qcow2': 'BlockdevOptionsQcow2' } }
|
||||
|
||||
In the Client JSON Protocol, a simple union is represented by a
|
||||
dictionary that contains the 'type' member as a discriminator, and a
|
||||
'data' member that is of the specified data type corresponding to the
|
||||
discriminator value, as in these examples:
|
||||
|
||||
{ "type": "file", "data" : { "filename": "/some/place/my-image" } }
|
||||
{ "type": "qcow2", "data" : { "backing-file": "/some/place/my-image",
|
||||
"lazy-refcounts": true } }
|
||||
{ "type": "file", "data": { "filename": "/some/place/my-image" } }
|
||||
{ "type": "qcow2", "data": { "backing": "/some/place/my-image",
|
||||
"lazy-refcounts": true } }
|
||||
|
||||
The generated C code uses a struct containing a union. Additionally,
|
||||
an implicit C enum 'NameKind' is created, corresponding to the union
|
||||
@@ -320,34 +320,35 @@ an implicit C enum 'NameKind' is created, corresponding to the union
|
||||
the union can be named 'max', as this would collide with the implicit
|
||||
enum. The value for each branch can be of any type.
|
||||
|
||||
A flat union definition specifies a struct as its base, and
|
||||
avoids nesting on the wire. All branches of the union must be
|
||||
complex types, and the top-level members of the union dictionary on
|
||||
the wire will be combination of members from both the base type and the
|
||||
appropriate branch type (when merging two dictionaries, there must be
|
||||
no keys in common). The 'discriminator' member must be the name of an
|
||||
enum-typed member of the base struct.
|
||||
A flat union definition avoids nesting on the wire, and specifies a
|
||||
set of common members that occur in all variants of the union. The
|
||||
'base' key must specifiy either a type name (the type must be a
|
||||
struct, not a union), or a dictionary representing an anonymous type.
|
||||
All branches of the union must be complex types, and the top-level
|
||||
members of the union dictionary on the wire will be combination of
|
||||
members from both the base type and the appropriate branch type (when
|
||||
merging two dictionaries, there must be no keys in common). The
|
||||
'discriminator' member must be the name of a non-optional enum-typed
|
||||
member of the base struct.
|
||||
|
||||
The following example enhances the above simple union example by
|
||||
adding a common member 'readonly', renaming the discriminator to
|
||||
something more applicable, and reducing the number of {} required on
|
||||
the wire:
|
||||
adding an optional common member 'read-only', renaming the
|
||||
discriminator to something more applicable than the simple union's
|
||||
default of 'type', and reducing the number of {} required on the wire:
|
||||
|
||||
{ 'enum': 'BlockdevDriver', 'data': [ 'file', 'qcow2' ] }
|
||||
{ 'struct': 'BlockdevCommonOptions',
|
||||
'data': { 'driver': 'BlockdevDriver', 'readonly': 'bool' } }
|
||||
{ 'union': 'BlockdevOptions',
|
||||
'base': 'BlockdevCommonOptions',
|
||||
'base': { 'driver': 'BlockdevDriver', '*read-only': 'bool' },
|
||||
'discriminator': 'driver',
|
||||
'data': { 'file': 'FileOptions',
|
||||
'qcow2': 'Qcow2Options' } }
|
||||
'data': { 'file': 'BlockdevOptionsFile',
|
||||
'qcow2': 'BlockdevOptionsQcow2' } }
|
||||
|
||||
Resulting in these JSON objects:
|
||||
|
||||
{ "driver": "file", "readonly": true,
|
||||
{ "driver": "file", "read-only": true,
|
||||
"filename": "/some/place/my-image" }
|
||||
{ "driver": "qcow2", "readonly": false,
|
||||
"backing-file": "/some/place/my-image", "lazy-refcounts": true }
|
||||
{ "driver": "qcow2", "read-only": false,
|
||||
"backing": "/some/place/my-image", "lazy-refcounts": true }
|
||||
|
||||
Notice that in a flat union, the discriminator name is controlled by
|
||||
the user, but because it must map to a base member with enum type, the
|
||||
@@ -366,10 +367,9 @@ union has a struct with a single member named 'data'. That is,
|
||||
is identical on the wire to:
|
||||
|
||||
{ 'enum': 'Enum', 'data': ['one', 'two'] }
|
||||
{ 'struct': 'Base', 'data': { 'type': 'Enum' } }
|
||||
{ 'struct': 'Branch1', 'data': { 'data': 'str' } }
|
||||
{ 'struct': 'Branch2', 'data': { 'data': 'int' } }
|
||||
{ 'union': 'Flat', 'base': 'Base', 'discriminator': 'type',
|
||||
{ 'union': 'Flat': 'base': { 'type': 'Enum' }, 'discriminator': 'type',
|
||||
'data': { 'one': 'Branch1', 'two': 'Branch2' } }
|
||||
|
||||
|
||||
@@ -382,7 +382,7 @@ data types (string, integer, number, or object, but currently not
|
||||
array) on the wire. The definition is similar to a simple union type,
|
||||
where each branch of the union names a QAPI type. For example:
|
||||
|
||||
{ 'alternate': 'BlockRef',
|
||||
{ 'alternate': 'BlockdevRef',
|
||||
'data': { 'definition': 'BlockdevOptions',
|
||||
'reference': 'str' } }
|
||||
|
||||
@@ -403,7 +403,7 @@ following example objects:
|
||||
|
||||
{ "file": "my_existing_block_device_id" }
|
||||
{ "file": { "driver": "file",
|
||||
"readonly": false,
|
||||
"read-only": false,
|
||||
"filename": "/tmp/mydisk.qcow2" } }
|
||||
|
||||
|
||||
@@ -575,9 +575,9 @@ names an object type without members.
|
||||
Example: the SchemaInfo for command query-qmp-schema
|
||||
|
||||
{ "name": "query-qmp-schema", "meta-type": "command",
|
||||
"arg-type": ":empty", "ret-type": "SchemaInfoList" }
|
||||
"arg-type": "q_empty", "ret-type": "SchemaInfoList" }
|
||||
|
||||
Type ":empty" is an object type without members, and type
|
||||
Type "q_empty" is an automatic object type without members, and type
|
||||
"SchemaInfoList" is the array of SchemaInfo type.
|
||||
|
||||
The SchemaInfo for an event has meta-type "event", and variant member
|
||||
@@ -594,9 +594,9 @@ QAPI schema implicitly defines an object type.
|
||||
Example: the SchemaInfo for EVENT_C from section Events
|
||||
|
||||
{ "name": "EVENT_C", "meta-type": "event",
|
||||
"arg-type": ":obj-EVENT_C-arg" }
|
||||
"arg-type": "q_obj-EVENT_C-arg" }
|
||||
|
||||
Type ":obj-EVENT_C-arg" is an implicitly defined object type with
|
||||
Type "q_obj-EVENT_C-arg" is an implicitly defined object type with
|
||||
the two members from the event's definition.
|
||||
|
||||
The SchemaInfo for struct and union types has meta-type "object".
|
||||
@@ -637,11 +637,11 @@ Union types
|
||||
{ "name": "BlockdevOptions", "meta-type": "object",
|
||||
"members": [
|
||||
{ "name": "driver", "type": "BlockdevDriver" },
|
||||
{ "name": "readonly", "type": "bool"} ],
|
||||
{ "name": "read-only", "type": "bool", "default": null } ],
|
||||
"tag": "driver",
|
||||
"variants": [
|
||||
{ "case": "file", "type": "FileOptions" },
|
||||
{ "case": "qcow2", "type": "Qcow2Options" } ] }
|
||||
{ "case": "file", "type": "BlockdevOptionsFile" },
|
||||
{ "case": "qcow2", "type": "BlockdevOptionsQcow2" } ] }
|
||||
|
||||
Note that base types are "flattened": its members are included in the
|
||||
"members" array.
|
||||
@@ -652,20 +652,20 @@ discriminator (called "type" on the wire, see section Union types).
|
||||
A simple union implicitly defines an object type for each of its
|
||||
variants.
|
||||
|
||||
Example: the SchemaInfo for simple union BlockdevOptions from section
|
||||
Example: the SchemaInfo for simple union BlockdevOptionsSimple from section
|
||||
Union types
|
||||
|
||||
{ "name": "BlockdevOptions", "meta-type": "object",
|
||||
{ "name": "BlockdevOptionsSimple", "meta-type": "object",
|
||||
"members": [
|
||||
{ "name": "type", "type": "BlockdevOptionsKind" } ],
|
||||
{ "name": "type", "type": "BlockdevOptionsSimpleKind" } ],
|
||||
"tag": "type",
|
||||
"variants": [
|
||||
{ "case": "file", "type": ":obj-FileOptions-wrapper" },
|
||||
{ "case": "qcow2", "type": ":obj-Qcow2Options-wrapper" } ] }
|
||||
{ "case": "file", "type": "q_obj-BlockdevOptionsFile-wrapper" },
|
||||
{ "case": "qcow2", "type": "q_obj-BlockdevOptionsQcow2-wrapper" } ] }
|
||||
|
||||
Enumeration type "BlockdevOptionsKind" and the object types
|
||||
":obj-FileOptions-wrapper", ":obj-Qcow2Options-wrapper" are
|
||||
implicitly defined.
|
||||
Enumeration type "BlockdevOptionsSimpleKind" and the object types
|
||||
"q_obj-BlockdevOptionsFile-wrapper", "q_obj-BlockdevOptionsQcow2-wrapper"
|
||||
are implicitly defined.
|
||||
|
||||
The SchemaInfo for an alternate type has meta-type "alternate", and
|
||||
variant member "members". "members" is a JSON array. Each element is
|
||||
@@ -673,9 +673,9 @@ a JSON object with member "type", which names a type. Values of the
|
||||
alternate type conform to exactly one of its member types. There is
|
||||
no guarantee on the order in which "members" will be listed.
|
||||
|
||||
Example: the SchemaInfo for BlockRef from section Alternate types
|
||||
Example: the SchemaInfo for BlockdevRef from section Alternate types
|
||||
|
||||
{ "name": "BlockRef", "meta-type": "alternate",
|
||||
{ "name": "BlockdevRef", "meta-type": "alternate",
|
||||
"members": [
|
||||
{ "type": "BlockdevOptions" },
|
||||
{ "type": "str" } ] }
|
||||
|
||||
@@ -857,7 +857,7 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict)
|
||||
|
||||
switch (ti->options->type) {
|
||||
case TPM_TYPE_OPTIONS_KIND_PASSTHROUGH:
|
||||
tpo = ti->options->u.passthrough;
|
||||
tpo = ti->options->u.passthrough.data;
|
||||
monitor_printf(mon, "%s%s%s%s",
|
||||
tpo->has_path ? ",path=" : "",
|
||||
tpo->has_path ? tpo->path : "",
|
||||
@@ -1753,14 +1753,14 @@ void hmp_sendkey(Monitor *mon, const QDict *qdict)
|
||||
goto err_out;
|
||||
}
|
||||
keylist->value->type = KEY_VALUE_KIND_NUMBER;
|
||||
keylist->value->u.number = value;
|
||||
keylist->value->u.number.data = value;
|
||||
} else {
|
||||
int idx = index_from_key(keys, keyname_len);
|
||||
if (idx == Q_KEY_CODE__MAX) {
|
||||
goto err_out;
|
||||
}
|
||||
keylist->value->type = KEY_VALUE_KIND_QCODE;
|
||||
keylist->value->u.qcode = idx;
|
||||
keylist->value->u.qcode.data = idx;
|
||||
}
|
||||
|
||||
if (!separator) {
|
||||
@@ -1977,7 +1977,7 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
|
||||
if (value) {
|
||||
switch (value->type) {
|
||||
case MEMORY_DEVICE_INFO_KIND_DIMM:
|
||||
di = value->u.dimm;
|
||||
di = value->u.dimm.data;
|
||||
|
||||
monitor_printf(mon, "Memory device [%s]: \"%s\"\n",
|
||||
MemoryDeviceInfoKind_lookup[value->type],
|
||||
|
||||
+1
-1
@@ -845,7 +845,7 @@ static void sunkbd_handle_event(DeviceState *dev, QemuConsole *src,
|
||||
InputKeyEvent *key;
|
||||
|
||||
assert(evt->type == INPUT_EVENT_KIND_KEY);
|
||||
key = evt->u.key;
|
||||
key = evt->u.key.data;
|
||||
qcode = qemu_input_key_value_to_qcode(key->key);
|
||||
trace_escc_sunkbd_event_in(qcode, QKeyCode_lookup[qcode],
|
||||
key->down);
|
||||
|
||||
+4
-4
@@ -124,7 +124,7 @@ static void hid_pointer_event(DeviceState *dev, QemuConsole *src,
|
||||
|
||||
switch (evt->type) {
|
||||
case INPUT_EVENT_KIND_REL:
|
||||
move = evt->u.rel;
|
||||
move = evt->u.rel.data;
|
||||
if (move->axis == INPUT_AXIS_X) {
|
||||
e->xdx += move->value;
|
||||
} else if (move->axis == INPUT_AXIS_Y) {
|
||||
@@ -133,7 +133,7 @@ static void hid_pointer_event(DeviceState *dev, QemuConsole *src,
|
||||
break;
|
||||
|
||||
case INPUT_EVENT_KIND_ABS:
|
||||
move = evt->u.abs;
|
||||
move = evt->u.abs.data;
|
||||
if (move->axis == INPUT_AXIS_X) {
|
||||
e->xdx = move->value;
|
||||
} else if (move->axis == INPUT_AXIS_Y) {
|
||||
@@ -142,7 +142,7 @@ static void hid_pointer_event(DeviceState *dev, QemuConsole *src,
|
||||
break;
|
||||
|
||||
case INPUT_EVENT_KIND_BTN:
|
||||
btn = evt->u.btn;
|
||||
btn = evt->u.btn.data;
|
||||
if (btn->down) {
|
||||
e->buttons_state |= bmap[btn->button];
|
||||
if (btn->button == INPUT_BUTTON_WHEEL_UP) {
|
||||
@@ -228,7 +228,7 @@ static void hid_keyboard_event(DeviceState *dev, QemuConsole *src,
|
||||
HIDState *hs = (HIDState *)dev;
|
||||
int scancodes[3], i, count;
|
||||
int slot;
|
||||
InputKeyEvent *key = evt->u.key;
|
||||
InputKeyEvent *key = evt->u.key.data;
|
||||
|
||||
count = qemu_input_key_value_to_scancode(key->key,
|
||||
key->down,
|
||||
|
||||
+3
-3
@@ -182,7 +182,7 @@ static void ps2_keyboard_event(DeviceState *dev, QemuConsole *src,
|
||||
{
|
||||
PS2KbdState *s = (PS2KbdState *)dev;
|
||||
int scancodes[3], i, count;
|
||||
InputKeyEvent *key = evt->u.key;
|
||||
InputKeyEvent *key = evt->u.key.data;
|
||||
|
||||
qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
|
||||
count = qemu_input_key_value_to_scancode(key->key,
|
||||
@@ -399,7 +399,7 @@ static void ps2_mouse_event(DeviceState *dev, QemuConsole *src,
|
||||
|
||||
switch (evt->type) {
|
||||
case INPUT_EVENT_KIND_REL:
|
||||
move = evt->u.rel;
|
||||
move = evt->u.rel.data;
|
||||
if (move->axis == INPUT_AXIS_X) {
|
||||
s->mouse_dx += move->value;
|
||||
} else if (move->axis == INPUT_AXIS_Y) {
|
||||
@@ -408,7 +408,7 @@ static void ps2_mouse_event(DeviceState *dev, QemuConsole *src,
|
||||
break;
|
||||
|
||||
case INPUT_EVENT_KIND_BTN:
|
||||
btn = evt->u.btn;
|
||||
btn = evt->u.btn.data;
|
||||
if (btn->down) {
|
||||
s->mouse_buttons |= bmap[btn->button];
|
||||
if (btn->button == INPUT_BUTTON_WHEEL_UP) {
|
||||
|
||||
@@ -197,7 +197,7 @@ static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src,
|
||||
|
||||
switch (evt->type) {
|
||||
case INPUT_EVENT_KIND_KEY:
|
||||
key = evt->u.key;
|
||||
key = evt->u.key.data;
|
||||
qcode = qemu_input_key_value_to_qcode(key->key);
|
||||
if (qcode && keymap_qcode[qcode]) {
|
||||
event.type = cpu_to_le16(EV_KEY);
|
||||
@@ -212,7 +212,7 @@ static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src,
|
||||
}
|
||||
break;
|
||||
case INPUT_EVENT_KIND_BTN:
|
||||
btn = evt->u.btn;
|
||||
btn = evt->u.btn.data;
|
||||
if (keymap_button[btn->button]) {
|
||||
event.type = cpu_to_le16(EV_KEY);
|
||||
event.code = cpu_to_le16(keymap_button[btn->button]);
|
||||
@@ -227,14 +227,14 @@ static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src,
|
||||
}
|
||||
break;
|
||||
case INPUT_EVENT_KIND_REL:
|
||||
move = evt->u.rel;
|
||||
move = evt->u.rel.data;
|
||||
event.type = cpu_to_le16(EV_REL);
|
||||
event.code = cpu_to_le16(axismap_rel[move->axis]);
|
||||
event.value = cpu_to_le32(move->value);
|
||||
virtio_input_send(vinput, &event);
|
||||
break;
|
||||
case INPUT_EVENT_KIND_ABS:
|
||||
move = evt->u.abs;
|
||||
move = evt->u.abs.data;
|
||||
event.type = cpu_to_le16(EV_ABS);
|
||||
event.code = cpu_to_le16(axismap_abs[move->axis]);
|
||||
event.value = cpu_to_le32(move->value);
|
||||
|
||||
+1
-1
@@ -180,7 +180,7 @@ int qmp_pc_dimm_device_list(Object *obj, void *opaque)
|
||||
NULL);
|
||||
di->memdev = object_get_canonical_path(OBJECT(dimm->hostmem));
|
||||
|
||||
info->u.dimm = di;
|
||||
info->u.dimm.data = di;
|
||||
elem->value = info;
|
||||
elem->next = NULL;
|
||||
**prev = elem;
|
||||
|
||||
+1
-1
@@ -189,7 +189,7 @@ int net_init_dump(const NetClientOptions *opts, const char *name,
|
||||
DumpNetClient *dnc;
|
||||
|
||||
assert(opts->type == NET_CLIENT_OPTIONS_KIND_DUMP);
|
||||
dump = opts->u.dump;
|
||||
dump = opts->u.dump.data;
|
||||
|
||||
assert(peer);
|
||||
|
||||
|
||||
@@ -288,7 +288,7 @@ int net_init_hubport(const NetClientOptions *opts, const char *name,
|
||||
|
||||
assert(opts->type == NET_CLIENT_OPTIONS_KIND_HUBPORT);
|
||||
assert(!peer);
|
||||
hubport = opts->u.hubport;
|
||||
hubport = opts->u.hubport.data;
|
||||
|
||||
net_hub_add_port(hubport->hubid, name);
|
||||
return 0;
|
||||
|
||||
+1
-1
@@ -546,7 +546,7 @@ int net_init_l2tpv3(const NetClientOptions *opts,
|
||||
s->header_mismatch = false;
|
||||
|
||||
assert(opts->type == NET_CLIENT_OPTIONS_KIND_L2TPV3);
|
||||
l2tpv3 = opts->u.l2tpv3;
|
||||
l2tpv3 = opts->u.l2tpv3.data;
|
||||
|
||||
if (l2tpv3->has_ipv6 && l2tpv3->ipv6) {
|
||||
s->ipv6 = l2tpv3->ipv6;
|
||||
|
||||
@@ -893,7 +893,7 @@ static int net_init_nic(const NetClientOptions *opts, const char *name,
|
||||
const NetLegacyNicOptions *nic;
|
||||
|
||||
assert(opts->type == NET_CLIENT_OPTIONS_KIND_NIC);
|
||||
nic = opts->u.nic;
|
||||
nic = opts->u.nic.data;
|
||||
|
||||
idx = nic_get_free_idx();
|
||||
if (idx == -1 || nb_nics >= MAX_NICS) {
|
||||
@@ -1025,7 +1025,7 @@ static int net_client_init1(const void *object, int is_netdev, Error **errp)
|
||||
|
||||
/* Do not add to a vlan if it's a nic with a netdev= parameter. */
|
||||
if (opts->type != NET_CLIENT_OPTIONS_KIND_NIC ||
|
||||
!opts->u.nic->has_netdev) {
|
||||
!opts->u.nic.data->has_netdev) {
|
||||
peer = net_hub_add_port(net->has_vlan ? net->vlan : 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -420,7 +420,7 @@ static NetClientInfo net_netmap_info = {
|
||||
int net_init_netmap(const NetClientOptions *opts,
|
||||
const char *name, NetClientState *peer, Error **errp)
|
||||
{
|
||||
const NetdevNetmapOptions *netmap_opts = opts->u.netmap;
|
||||
const NetdevNetmapOptions *netmap_opts = opts->u.netmap.data;
|
||||
struct nm_desc *nmd;
|
||||
NetClientState *nc;
|
||||
Error *err = NULL;
|
||||
|
||||
+1
-1
@@ -814,7 +814,7 @@ int net_init_slirp(const NetClientOptions *opts, const char *name,
|
||||
const char **dnssearch;
|
||||
|
||||
assert(opts->type == NET_CLIENT_OPTIONS_KIND_USER);
|
||||
user = opts->u.user;
|
||||
user = opts->u.user.data;
|
||||
|
||||
vnet = user->has_net ? g_strdup(user->net) :
|
||||
user->has_ip ? g_strdup_printf("%s/24", user->ip) :
|
||||
|
||||
+1
-1
@@ -704,7 +704,7 @@ int net_init_socket(const NetClientOptions *opts, const char *name,
|
||||
const NetdevSocketOptions *sock;
|
||||
|
||||
assert(opts->type == NET_CLIENT_OPTIONS_KIND_SOCKET);
|
||||
sock = opts->u.socket;
|
||||
sock = opts->u.socket.data;
|
||||
|
||||
if (sock->has_fd + sock->has_listen + sock->has_connect + sock->has_mcast +
|
||||
sock->has_udp != 1) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user