[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-commits] [qemu/qemu] 46cfbf: qobject: Use qobject_to() instead of
From: |
GitHub |
Subject: |
[Qemu-commits] [qemu/qemu] 46cfbf: qobject: Use qobject_to() instead of type cast |
Date: |
Fri, 04 May 2018 06:42:14 -0700 |
Branch: refs/heads/master
Home: https://github.com/qemu/qemu
Commit: 46cfbf13b06d551072ed17fbfca67c103edf814f
https://github.com/qemu/qemu/commit/46cfbf13b06d551072ed17fbfca67c103edf814f
Author: Markus Armbruster <address@hidden>
Date: 2018-05-04 (Fri, 04 May 2018)
Changed paths:
M tests/check-qdict.c
Log Message:
-----------
qobject: Use qobject_to() instead of type cast
The proper way to convert from (abstract) QObject to a (concrete)
subtype is qobject_to(). Look for offenders that type cast instead:
$ git-grep '(Q[A-Z][a-z]* \*)'
hmp.c: qmp_device_add((QDict *)qdict, NULL, &err);
include/qapi/qmp/qobject.h: return (QObject *)obj;
qobject/qobject.c:static void (*qdestroy[QTYPE__MAX])(QObject *) = {
tests/check-qdict.c: dst = (QDict *)qdict_crumple(src, &error_abort);
The first two cast away const, the third isn't a type cast. Fix the
fourth.
Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
Commit: 7ee9edfdb117da47c86c9764d90f0be11a648666
https://github.com/qemu/qemu/commit/7ee9edfdb117da47c86c9764d90f0be11a648666
Author: Marc-André Lureau <address@hidden>
Date: 2018-05-04 (Fri, 04 May 2018)
Changed paths:
M include/qapi/qmp/qobject.h
M qobject/qobject.c
Log Message:
-----------
qobject: Ensure base is at offset 0
All QObject types have the base QObject as their first field. This
allows the simplification of qobject_to().
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
[Commit message paragraph on type casts dropped, to avoid giving the
impression type casting would be okay]
Signed-off-by: Markus Armbruster <address@hidden>
Commit: 3d3eacaeccaab718ea0e2ddaa578bfae9e311c59
https://github.com/qemu/qemu/commit/3d3eacaeccaab718ea0e2ddaa578bfae9e311c59
Author: Marc-André Lureau <address@hidden>
Date: 2018-05-04 (Fri, 04 May 2018)
Changed paths:
M include/qapi/qmp/qbool.h
M include/qapi/qmp/qdict.h
M include/qapi/qmp/qlist.h
M include/qapi/qmp/qnull.h
M include/qapi/qmp/qnum.h
M include/qapi/qmp/qobject.h
M include/qapi/qmp/qstring.h
M qobject/qobject.c
M tests/check-qdict.c
Log Message:
-----------
qobject: use a QObjectBase_ struct
By moving the base fields to a QObjectBase_, QObject can be a type
which also has a 'base' field. This allows writing a generic QOBJECT()
macro that will work with any QObject type, including QObject
itself. The container_of() macro ensures that the object to cast has a
QObjectBase_ base field, giving some type safety guarantees. QObject
must have no members but QObjectBase_ base, or else QOBJECT() breaks.
QObjectBase_ is not a typedef and uses a trailing underscore to make
it obvious it is not for normal use and to avoid potential abuse.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Commit: cb3e7f08aeaab0ab13e629ce8496dca150a449ba
https://github.com/qemu/qemu/commit/cb3e7f08aeaab0ab13e629ce8496dca150a449ba
Author: Marc-André Lureau <address@hidden>
Date: 2018-05-04 (Fri, 04 May 2018)
Changed paths:
M block.c
M block/blkdebug.c
M block/blkverify.c
M block/crypto.c
M block/gluster.c
M block/iscsi.c
M block/nbd.c
M block/nfs.c
M block/null.c
M block/nvme.c
M block/parallels.c
M block/qapi.c
M block/qcow.c
M block/qcow2.c
M block/qed.c
M block/quorum.c
M block/rbd.c
M block/sheepdog.c
M block/snapshot.c
M block/ssh.c
M block/vdi.c
M block/vhdx.c
M block/vpc.c
M block/vvfat.c
M block/vxhs.c
M blockdev.c
M docs/devel/qapi-code-gen.txt
M hw/i386/acpi-build.c
M hw/ppc/spapr_drc.c
M hw/usb/xen-usb.c
M include/qapi/qmp/qnull.h
M include/qapi/qmp/qobject.h
M migration/migration.c
M migration/qjson.c
M monitor.c
M qapi/qapi-dealloc-visitor.c
M qapi/qmp-dispatch.c
M qapi/qobject-input-visitor.c
M qapi/qobject-output-visitor.c
M qemu-img.c
M qemu-io.c
M qga/main.c
M qmp.c
M qobject/json-parser.c
M qobject/qdict.c
M qobject/qjson.c
M qobject/qlist.c
M qom/object.c
M qom/object_interfaces.c
M scripts/coccinelle/qobject.cocci
M scripts/qapi/events.py
M target/ppc/translate_init.c
M target/s390x/cpu_models.c
M tests/ahci-test.c
M tests/check-qdict.c
M tests/check-qjson.c
M tests/check-qlist.c
M tests/check-qlit.c
M tests/check-qnull.c
M tests/check-qnum.c
M tests/check-qobject.c
M tests/check-qstring.c
M tests/cpu-plug-test.c
M tests/device-introspect-test.c
M tests/drive_del-test.c
M tests/libqos/libqos.c
M tests/libqos/pci-pc.c
M tests/libqtest.c
M tests/machine-none-test.c
M tests/migration-test.c
M tests/numa-test.c
M tests/pvpanic-test.c
M tests/q35-test.c
M tests/qmp-test.c
M tests/qom-test.c
M tests/tco-test.c
M tests/test-char.c
M tests/test-keyval.c
M tests/test-netfilter.c
M tests/test-qemu-opts.c
M tests/test-qga.c
M tests/test-qmp-cmds.c
M tests/test-qmp-event.c
M tests/test-qobject-input-visitor.c
M tests/test-qobject-output-visitor.c
M tests/test-visitor-serialization.c
M tests/test-x86-cpuid-compat.c
M tests/tmp105-test.c
M tests/vhost-user-test.c
M tests/virtio-net-test.c
M tests/vmgenid-test.c
M tests/wdt_ib700-test.c
M util/keyval.c
M util/qemu-config.c
Log Message:
-----------
qobject: Replace qobject_incref/QINCREF qobject_decref/QDECREF
Now that we can safely call QOBJECT() on QObject * as well as its
subtypes, we can have macros qobject_ref() / qobject_unref() that work
everywhere instead of having to use QINCREF() / QDECREF() for QObject
and qobject_incref() / qobject_decref() for its subtypes.
The replacement is mechanical, except I broke a long line, and added a
cast in monitor_qmp_cleanup_req_queue_locked(). Unlike
qobject_decref(), qobject_unref() doesn't accept void *.
Note that the new macros evaluate their argument exactly once, thus no
need to shout them.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
[Rebased, semantic conflict resolved, commit message improved]
Signed-off-by: Markus Armbruster <address@hidden>
Commit: f5a74a5a50387c6f980b2e2f94f062487a1826da
https://github.com/qemu/qemu/commit/f5a74a5a50387c6f980b2e2f94f062487a1826da
Author: Marc-André Lureau <address@hidden>
Date: 2018-05-04 (Fri, 04 May 2018)
Changed paths:
M block.c
M block/blkdebug.c
M block/blkverify.c
M block/null.c
M block/nvme.c
M block/quorum.c
M include/qapi/qmp/qnull.h
M include/qapi/qmp/qobject.h
M monitor.c
M qapi/qobject-input-visitor.c
M qapi/qobject-output-visitor.c
M qobject/qdict.c
Log Message:
-----------
qobject: Modify qobject_ref() to return obj
For convenience and clarity, make it possible to call qobject_ref() at
the time when the reference is associated with a variable, or
argument, by making qobject_ref() return the same pointer as given.
Use that to simplify the callers.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
[Useless change to qobject_ref_impl() dropped, commit message improved
slightly]
Signed-off-by: Markus Armbruster <address@hidden>
Commit: 96054f56396eaa0b9b5c681fc3e42a0004b17ade
https://github.com/qemu/qemu/commit/96054f56396eaa0b9b5c681fc3e42a0004b17ade
Author: Laszlo Ersek <address@hidden>
Date: 2018-05-04 (Fri, 04 May 2018)
Changed paths:
M cpus.c
M qapi/misc.json
Log Message:
-----------
qapi: fill in CpuInfoFast.arch in query-cpus-fast
* Commit ca230ff33f89 added the @arch field to @CpuInfoFast, but it failed
to set the new field in qmp_query_cpus_fast(), when TARGET_S390X was not
defined. The updated @query-cpus-fast example in "qapi-schema.json"
showed "arch":"x86" only because qmp_query_cpus_fast() calls g_malloc0()
to allocate @CpuInfoFast, and the CPU_INFO_ARCH_X86 enum constant is
generated with value 0.
All @arch values other than @s390 implied the @CpuInfoOther sub-struct
for @CpuInfoFast -- at the time of writing the patch --, thus no fields
other than @arch needed to be set when TARGET_S390X was not defined. Set
@arch now, by copying the corresponding assignments from
qmp_query_cpus().
* Commit 25fa194b7b11 added the @riscv enum constant to @CpuInfoArch (used
in both @CpuInfo and @CpuInfoFast -- the return types of the @query-cpus
and @query-cpus-fast commands, respectively), and assigned, in both
return structures, the @CpuInfoRISCV sub-structure to the new enum
value.
However, qmp_query_cpus_fast() would not populate either the @arch field
or the @CpuInfoRISCV sub-structure, when TARGET_RISCV was defined; only
qmp_query_cpus() would.
Assign @CpuInfoOther to the @riscv enum constant in @CpuInfoFast, and
populate only the @arch field in qmp_query_cpus_fast(). Getting CPU
state without interrupting KVM is an exceptional thing that only S390X
does currently. Quoting Cornelia Huck <address@hidden>, "s390x is
exceptional in that it has state in QEMU that is actually interesting
for upper layers and can be retrieved without performance penalty". See
also
<https://www.redhat.com/archives/libvir-list/2018-February/msg00121.html>.
Cc: Cornelia Huck <address@hidden>
Cc: Eric Blake <address@hidden>
Cc: Markus Armbruster <address@hidden>
Cc: Viktor VM Mihajlovski <address@hidden>
Cc: address@hidden
Fixes: ca230ff33f89bf7102cbfbc2328716da6750aaed
Fixes: 25fa194b7b11901561532e435beb83d046899f7a
Signed-off-by: Laszlo Ersek <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Cornelia Huck <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Commit: 9a801c7d6c8fd927df915f2ac3eacd306e8fc334
https://github.com/qemu/qemu/commit/9a801c7d6c8fd927df915f2ac3eacd306e8fc334
Author: Laszlo Ersek <address@hidden>
Date: 2018-05-04 (Fri, 04 May 2018)
Changed paths:
M qapi/common.json
M scripts/qapi/common.py
Log Message:
-----------
qapi: add SysEmuTarget to "common.json"
We'll soon need an enumeration type that lists all the softmmu targets
that QEMU (the project) supports. Introduce @SysEmuTarget to
"common.json".
The enum constant @x86_64 doesn't match the QAPI convention of preferring
hyphen ("-") over underscore ("_"). This is intentional; the @SysEmuTarget
constants are supposed to produce QEMU executable names when stringified
and appended to the "qemu-system-" prefix. Put differently, the
replacement text of the TARGET_NAME preprocessor macro must be possible to
look up in the list of (stringified) enum constants.
Like other enum types, @SysEmuTarget too can be used for discriminator
fields in unions. For the @i386 constant, a C-language union member called
"i386" would be generated. On mingw build hosts, "i386" is a macro
however. Add "i386" to "polluted_words" at once.
Cc: "Daniel P. Berrange" <address@hidden>
Cc: Eric Blake <address@hidden>
Cc: Markus Armbruster <address@hidden>
Signed-off-by: Laszlo Ersek <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Commit: b47aa7b3d44dcedf7bf541563f70704f82f500d0
https://github.com/qemu/qemu/commit/b47aa7b3d44dcedf7bf541563f70704f82f500d0
Author: Laszlo Ersek <address@hidden>
Date: 2018-05-04 (Fri, 04 May 2018)
Changed paths:
M arch_init.c
M qapi/misc.json
Log Message:
-----------
qapi: change the type of TargetInfo.arch from string to enum SysEmuTarget
Now that we have @SysEmuTarget, it makes sense to restrict
@address@hidden to valid sysemu targets at the schema level.
Cc: "Daniel P. Berrange" <address@hidden>
Cc: Eric Blake <address@hidden>
Cc: Markus Armbruster <address@hidden>
Signed-off-by: Laszlo Ersek <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Commit: daa9d2bc6d73618bc230787ddfa821a6a6560fc2
https://github.com/qemu/qemu/commit/daa9d2bc6d73618bc230787ddfa821a6a6560fc2
Author: Laszlo Ersek <address@hidden>
Date: 2018-05-04 (Fri, 04 May 2018)
Changed paths:
M cpus.c
M qapi/misc.json
Log Message:
-----------
qapi: discriminate CpuInfoFast on SysEmuTarget, not CpuInfoArch
Add a new field @target (of type @SysEmuTarget) to the output of the
@query-cpus-fast command, which provides more information about the
emulation target than the field @arch (of type @CpuInfoArch). Make @target
the new discriminator for the @CpuInfoFast return structure. Keep @arch
for compatibility.
Cc: "Daniel P. Berrange" <address@hidden>
Cc: Eric Blake <address@hidden>
Cc: Markus Armbruster <address@hidden>
Signed-off-by: Laszlo Ersek <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Commit: 6ffa3ab453b431ec047ff1fc87120059b5266014
https://github.com/qemu/qemu/commit/6ffa3ab453b431ec047ff1fc87120059b5266014
Author: Laszlo Ersek <address@hidden>
Date: 2018-05-04 (Fri, 04 May 2018)
Changed paths:
M qapi/misc.json
M qemu-doc.texi
Log Message:
-----------
qapi: deprecate CpuInfoFast.arch
The TARGET_BASE_ARCH values from "configure" don't all map to the
@CpuInfoArch enum constants; in particular "s390x" from the former does
not match @s390 in the latter. Clients are known to rely on the @s390
constant specifically, so we can't change it silently. Instead, deprecate
the @address@hidden member (in favor of @address@hidden) using the
regular deprecation process.
(No deprecation reminder is added to sysemu_target_to_cpuinfo_arch(): once
@address@hidden is removed, the assignment expression that calls
sysemu_target_to_cpuinfo_arch() from qmp_query_cpus_fast() will have to
disappear; in turn the static function left without callers will also
break the build, thus it'll have to go.)
Cc: "Daniel P. Berrange" <address@hidden>
Cc: Eric Blake <address@hidden>
Cc: Markus Armbruster <address@hidden>
Signed-off-by: Laszlo Ersek <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Commit: 7c867af89a43e4be56ea25dd9691196eb1818fe6
https://github.com/qemu/qemu/commit/7c867af89a43e4be56ea25dd9691196eb1818fe6
Author: Peter Maydell <address@hidden>
Date: 2018-05-04 (Fri, 04 May 2018)
Changed paths:
M arch_init.c
M block.c
M block/blkdebug.c
M block/blkverify.c
M block/crypto.c
M block/gluster.c
M block/iscsi.c
M block/nbd.c
M block/nfs.c
M block/null.c
M block/nvme.c
M block/parallels.c
M block/qapi.c
M block/qcow.c
M block/qcow2.c
M block/qed.c
M block/quorum.c
M block/rbd.c
M block/sheepdog.c
M block/snapshot.c
M block/ssh.c
M block/vdi.c
M block/vhdx.c
M block/vpc.c
M block/vvfat.c
M block/vxhs.c
M blockdev.c
M cpus.c
M docs/devel/qapi-code-gen.txt
M hw/i386/acpi-build.c
M hw/ppc/spapr_drc.c
M hw/usb/xen-usb.c
M include/qapi/qmp/qbool.h
M include/qapi/qmp/qdict.h
M include/qapi/qmp/qlist.h
M include/qapi/qmp/qnull.h
M include/qapi/qmp/qnum.h
M include/qapi/qmp/qobject.h
M include/qapi/qmp/qstring.h
M migration/migration.c
M migration/qjson.c
M monitor.c
M qapi/common.json
M qapi/misc.json
M qapi/qapi-dealloc-visitor.c
M qapi/qmp-dispatch.c
M qapi/qobject-input-visitor.c
M qapi/qobject-output-visitor.c
M qemu-doc.texi
M qemu-img.c
M qemu-io.c
M qga/main.c
M qmp.c
M qobject/json-parser.c
M qobject/qdict.c
M qobject/qjson.c
M qobject/qlist.c
M qobject/qobject.c
M qom/object.c
M qom/object_interfaces.c
M scripts/coccinelle/qobject.cocci
M scripts/qapi/common.py
M scripts/qapi/events.py
M target/ppc/translate_init.c
M target/s390x/cpu_models.c
M tests/ahci-test.c
M tests/check-qdict.c
M tests/check-qjson.c
M tests/check-qlist.c
M tests/check-qlit.c
M tests/check-qnull.c
M tests/check-qnum.c
M tests/check-qobject.c
M tests/check-qstring.c
M tests/cpu-plug-test.c
M tests/device-introspect-test.c
M tests/drive_del-test.c
M tests/libqos/libqos.c
M tests/libqos/pci-pc.c
M tests/libqtest.c
M tests/machine-none-test.c
M tests/migration-test.c
M tests/numa-test.c
M tests/pvpanic-test.c
M tests/q35-test.c
M tests/qmp-test.c
M tests/qom-test.c
M tests/tco-test.c
M tests/test-char.c
M tests/test-keyval.c
M tests/test-netfilter.c
M tests/test-qemu-opts.c
M tests/test-qga.c
M tests/test-qmp-cmds.c
M tests/test-qmp-event.c
M tests/test-qobject-input-visitor.c
M tests/test-qobject-output-visitor.c
M tests/test-visitor-serialization.c
M tests/test-x86-cpuid-compat.c
M tests/tmp105-test.c
M tests/vhost-user-test.c
M tests/virtio-net-test.c
M tests/vmgenid-test.c
M tests/wdt_ib700-test.c
M util/keyval.c
M util/qemu-config.c
Log Message:
-----------
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2018-05-04' into
staging
QAPI patches for 2018-05-04
# gpg: Signature made Fri 04 May 2018 08:59:16 BST
# gpg: using RSA key 3870B400EB918653
# gpg: Good signature from "Markus Armbruster <address@hidden>"
# gpg: aka "Markus Armbruster <address@hidden>"
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653
* remotes/armbru/tags/pull-qapi-2018-05-04:
qapi: deprecate CpuInfoFast.arch
qapi: discriminate CpuInfoFast on SysEmuTarget, not CpuInfoArch
qapi: change the type of TargetInfo.arch from string to enum SysEmuTarget
qapi: add SysEmuTarget to "common.json"
qapi: fill in CpuInfoFast.arch in query-cpus-fast
qobject: Modify qobject_ref() to return obj
qobject: Replace qobject_incref/QINCREF qobject_decref/QDECREF
qobject: use a QObjectBase_ struct
qobject: Ensure base is at offset 0
qobject: Use qobject_to() instead of type cast
Signed-off-by: Peter Maydell <address@hidden>
Compare: https://github.com/qemu/qemu/compare/46e04dacd3a6...7c867af89a43
**NOTE:** This service been marked for deprecation:
https://developer.github.com/changes/2018-04-25-github-services-deprecation/
Functionality will be removed from GitHub.com on January 31st, 2019.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-commits] [qemu/qemu] 46cfbf: qobject: Use qobject_to() instead of type cast,
GitHub <=