#
e0c7de8d |
| 04-Oct-2023 |
Philippe Mathieu-Daudé <philmd@linaro.org> |
qom/object_interfaces: Clean up global variable shadowing
Fix:
qom/object_interfaces.c:262:53: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] ObjectOptions *user_c
qom/object_interfaces: Clean up global variable shadowing
Fix:
qom/object_interfaces.c:262:53: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] ObjectOptions *user_creatable_parse_str(const char *optarg, Error **errp) ^ qom/object_interfaces.c:298:46: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] bool user_creatable_add_from_str(const char *optarg, Error **errp) ^ qom/object_interfaces.c:313:49: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] void user_creatable_process_cmdline(const char *optarg) ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/getopt.h:77:14: note: previous declaration is here extern char *optarg; /* getopt(3) external variables */ ^
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20231004120019.93101-9-philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
e0c7de8d |
| 04-Oct-2023 |
Philippe Mathieu-Daudé <philmd@linaro.org> |
qom/object_interfaces: Clean up global variable shadowing
Fix:
qom/object_interfaces.c:262:53: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] ObjectOptions *user_c
qom/object_interfaces: Clean up global variable shadowing
Fix:
qom/object_interfaces.c:262:53: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] ObjectOptions *user_creatable_parse_str(const char *optarg, Error **errp) ^ qom/object_interfaces.c:298:46: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] bool user_creatable_add_from_str(const char *optarg, Error **errp) ^ qom/object_interfaces.c:313:49: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] void user_creatable_process_cmdline(const char *optarg) ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/getopt.h:77:14: note: previous declaration is here extern char *optarg; /* getopt(3) external variables */ ^
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20231004120019.93101-9-philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
#
e0c7de8d |
| 04-Oct-2023 |
Philippe Mathieu-Daudé <philmd@linaro.org> |
qom/object_interfaces: Clean up global variable shadowing
Fix:
qom/object_interfaces.c:262:53: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] ObjectOptions *user_c
qom/object_interfaces: Clean up global variable shadowing
Fix:
qom/object_interfaces.c:262:53: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] ObjectOptions *user_creatable_parse_str(const char *optarg, Error **errp) ^ qom/object_interfaces.c:298:46: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] bool user_creatable_add_from_str(const char *optarg, Error **errp) ^ qom/object_interfaces.c:313:49: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] void user_creatable_process_cmdline(const char *optarg) ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/getopt.h:77:14: note: previous declaration is here extern char *optarg; /* getopt(3) external variables */ ^
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20231004120019.93101-9-philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
Revision tags: v8.1.1, v7.2.6, v8.0.5, v8.1.0, v8.1.0-rc4, v8.1.0-rc3, v7.2.5, v8.0.4, v8.1.0-rc2, v8.1.0-rc1, v8.1.0-rc0, v8.0.3, v7.2.4, v8.0.2, v8.0.1, v7.2.3, v7.2.2, v8.0.0, v8.0.0-rc4, v8.0.0-rc3, v7.2.1, v8.0.0-rc2, v8.0.0-rc1, v8.0.0-rc0 |
|
#
919a0423 |
| 19-Dec-2022 |
Philippe Mathieu-Daudé <philmd@linaro.org> |
qom/object_interfaces: Fix QAPI headers included
Since commit a0e61807a3 ("qapi: Remove QMP events and commands from user-mode builds") we don't generate the "qapi-commands-qom.h" header in a user-e
qom/object_interfaces: Fix QAPI headers included
Since commit a0e61807a3 ("qapi: Remove QMP events and commands from user-mode builds") we don't generate the "qapi-commands-qom.h" header in a user-emulation-only build.
Commit f375026606 ("qom: Factor out user_creatable_process_cmdline") incorrectly added a dependency on this "qapi/qapi-commands-qom.h" header (the QMP handlers are still defined in qom/qom-qmp-cmds.c). Remove it, and add "qapi/qmp/qobject.h" which declares qobject_unref.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20221220115709.18508-1-philmd@linaro.org>
show more ...
|
Revision tags: v7.2.0, v7.2.0-rc4, v7.2.0-rc3, v7.2.0-rc2, v7.2.0-rc1, v7.2.0-rc0, v7.1.0, v7.1.0-rc4, v7.1.0-rc3, v7.1.0-rc2, v7.1.0-rc1, v7.1.0-rc0 |
|
#
9ca9c893 |
| 20-Apr-2022 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
include: add qemu/keyval.h
Do not require the whole option machinery to handle keyval, as it is used by QAPI alone, without the option API. And match the associated unit name.
Signed-off-by: Marc-A
include: add qemu/keyval.h
Do not require the whole option machinery to handle keyval, as it is used by QAPI alone, without the option API. And match the associated unit name.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20220420132624.2439741-24-marcandre.lureau@redhat.com>
show more ...
|
Revision tags: v7.0.0, v7.0.0-rc4, v7.0.0-rc3, v7.0.0-rc2, v7.0.0-rc1, v7.0.0-rc0, v6.1.1, v6.2.0, v6.2.0-rc4, v6.2.0-rc3, v6.2.0-rc2, v6.2.0-rc1, v6.2.0-rc0, v6.0.1 |
|
#
dbc8221f |
| 08-Oct-2021 |
Kevin Wolf <kwolf@redhat.com> |
qom: Reduce use of error_propagate()
ERRP_GUARD() makes debugging easier by making sure that &error_abort still fails at the real origin of the error instead of error_propagate().
Signed-off-by: Ke
qom: Reduce use of error_propagate()
ERRP_GUARD() makes debugging easier by making sure that &error_abort still fails at the real origin of the error instead of error_propagate().
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20211008133442.141332-5-kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: Peter Krempa <pkrempa@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
Revision tags: v6.1.0, v6.1.0-rc4, v6.1.0-rc3, v6.1.0-rc2, v6.1.0-rc1, v6.1.0-rc0, v6.0.0, v6.0.0-rc5, v6.0.0-rc4, v6.0.0-rc3, v6.0.0-rc2, v6.0.0-rc1, v6.0.0-rc0, v5.2.0, v5.2.0-rc4, v5.2.0-rc3, v5.2.0-rc2, v5.2.0-rc1, v5.2.0-rc0 |
|
#
3bb69445 |
| 02-Nov-2020 |
Paolo Bonzini <pbonzini@redhat.com> |
qom: export more functions for use with non-UserCreatable objects
Machines and accelerators are not user-creatable but they are going to share similar command-line parsing machinery. Export functio
qom: export more functions for use with non-UserCreatable objects
Machines and accelerators are not user-creatable but they are going to share similar command-line parsing machinery. Export functions that will be used with -machine and -accel in softmmu/vl.c.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
bd74ecd1 |
| 24-Mar-2021 |
Markus Armbruster <armbru@redhat.com> |
qom: Fix default values in help
Output of default values in device help is broken:
$ ./qemu-system-x86_64 -S -display none -monitor stdio QEMU 5.2.50 monitor - type 'help' for more informat
qom: Fix default values in help
Output of default values in device help is broken:
$ ./qemu-system-x86_64 -S -display none -monitor stdio QEMU 5.2.50 monitor - type 'help' for more information (qemu) device_add pvpanic,help pvpanic options: events=<uint8> - (default: (null)) ioport=<uint16> - (default: (null)) pvpanic[0]=<child<qemu:memory-region>>
The "(null)" is glibc printing a null pointer. Other systems crash instead. Having a help request crash a running VM can really spoil your day.
Root cause is a botched replacement of qstring_free() by g_string_free(): to get the string back, we need to pass true to the former, but false to the latter. Fix the argument.
Fixes: eab3a4678b07267c39e7290a6e9e7690b1d2a521 Reported-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20210324084130.3986072-1-armbru@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
show more ...
|
#
cb4d9e38 |
| 28-Mar-2021 |
Thomas Huth <thuth@redhat.com> |
Revert "qom: use qemu_printf to print help for user-creatable objects"
This reverts commit 6d9abb6de9cc53a508823db0283061824f2f98a2.
The real code change had already been added by Kevin's commit da
Revert "qom: use qemu_printf to print help for user-creatable objects"
This reverts commit 6d9abb6de9cc53a508823db0283061824f2f98a2.
The real code change had already been added by Kevin's commit da0a932bbf ("hmp: QAPIfy object_add") and commit 6d9abb6d just added a duplicated include statement as a left-over of a rebase.
Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <20210328054758.2351461-1-thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
6d9abb6d |
| 11-Nov-2020 |
Paolo Bonzini <pbonzini@redhat.com> |
qom: use qemu_printf to print help for user-creatable objects
Since we have added help support for object_add, the help is printed on stdout. Switch to qemu_printf so that it goes to the monitor.
qom: use qemu_printf to print help for user-creatable objects
Since we have added help support for object_add, the help is printed on stdout. Switch to qemu_printf so that it goes to the monitor.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
bc2f4fcb |
| 12-Mar-2021 |
Paolo Bonzini <pbonzini@redhat.com> |
qom: move user_creatable_add_opts logic to vl.c and QAPIfy it
Emulators are currently using OptsVisitor (via user_creatable_add_opts) to parse the -object command line option. This has one extra fe
qom: move user_creatable_add_opts logic to vl.c and QAPIfy it
Emulators are currently using OptsVisitor (via user_creatable_add_opts) to parse the -object command line option. This has one extra feature, compared to keyval, which is automatic conversion of integers to lists as well as support for lists as repeated options:
-object memory-backend-ram,id=pc.ram,size=1048576000,host-nodes=0,policy=bind
So we cannot replace OptsVisitor with keyval right now. Still, this patch moves the user_creatable_add_opts logic to vl.c since it is not needed anywhere else, and makes it go through user_creatable_add_qapi.
In order to minimize code changes, the predicate still takes a string. This can be changed later to use the ObjectType QAPI enum directly.
Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20210312173547.1283477-3-pbonzini@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
#
155b5f8b |
| 12-Mar-2021 |
Kevin Wolf <kwolf@redhat.com> |
qom: Support JSON in HMP object_add and tools --object
Support JSON for --object in all tools and in HMP object_add in the same way as it is supported in qobject_input_visitor_new_str().
Signed-off
qom: Support JSON in HMP object_add and tools --object
Support JSON for --object in all tools and in HMP object_add in the same way as it is supported in qobject_input_visitor_new_str().
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20210312131921.421023-1-kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
#
ddf6dae7 |
| 19-Feb-2021 |
Kevin Wolf <kwolf@redhat.com> |
qom: Add user_creatable_parse_str()
The system emulator has a more complicated way of handling command line options in that it reorders options before it processes them. This means that parsing obje
qom: Add user_creatable_parse_str()
The system emulator has a more complicated way of handling command line options in that it reorders options before it processes them. This means that parsing object options and creating the object happen at two different points. Split the parsing part into a separate function that can be reused by the system emulator command line.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
show more ...
|
#
da0a932b |
| 17-Feb-2021 |
Kevin Wolf <kwolf@redhat.com> |
hmp: QAPIfy object_add
This switches the HMP command object_add from a QemuOpts-based parser to user_creatable_add_from_str() which uses a keyval parser and enforces the QAPI schema.
Apart from bei
hmp: QAPIfy object_add
This switches the HMP command object_add from a QemuOpts-based parser to user_creatable_add_from_str() which uses a keyval parser and enforces the QAPI schema.
Apart from being a cleanup, this makes non-scalar properties and help accessible. In order for help to be printed to the monitor instead of stdout, the printf() calls in the help functions are changed to qemu_printf().
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
show more ...
|
#
ffd58ef8 |
| 17-Feb-2021 |
Kevin Wolf <kwolf@redhat.com> |
qom: Add user_creatable_add_from_str()
This is a version of user_creatable_process_cmdline() with an Error parameter that never calls exit() and is therefore usable in HMP.
Signed-off-by: Kevin Wol
qom: Add user_creatable_add_from_str()
This is a version of user_creatable_process_cmdline() with an Error parameter that never calls exit() and is therefore usable in HMP.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
show more ...
|
#
f3750266 |
| 17-Feb-2021 |
Kevin Wolf <kwolf@redhat.com> |
qom: Factor out user_creatable_process_cmdline()
The implementation for --object can be shared between qemu-storage-daemon and other binaries, so move it into a function in qom/object_interfaces.c t
qom: Factor out user_creatable_process_cmdline()
The implementation for --object can be shared between qemu-storage-daemon and other binaries, so move it into a function in qom/object_interfaces.c that is accessible from everywhere.
This also requires moving the implementation of qmp_object_add() into a new user_creatable_add_qapi(), because qom/qom-qmp-cmds.c is not linked for tools.
user_creatable_print_help_from_qdict() can become static now.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
show more ...
|
#
c9231123 |
| 17-Nov-2020 |
Kevin Wolf <kwolf@redhat.com> |
qom: Remove user_creatable_add_dict()
This function is now unused and can be removed.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Peter Krem
qom: Remove user_creatable_add_dict()
This function is now unused and can be removed.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
show more ...
|
#
98c43b7b |
| 22-Feb-2021 |
Kevin Wolf <kwolf@redhat.com> |
qom: Make "object" QemuOptsList optional
This code is going away anyway, but for a few more commits, we'll be in a state where some binaries still use QemuOpts and others don't. If the "object" Qemu
qom: Make "object" QemuOptsList optional
This code is going away anyway, but for a few more commits, we'll be in a state where some binaries still use QemuOpts and others don't. If the "object" QemuOptsList doesn't even exist, we don't have to remove (or fail to remove, and therefore abort) a user creatable object from it.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
show more ...
|
#
0bd5a2eb |
| 02-Mar-2021 |
Kevin Wolf <kwolf@redhat.com> |
qom: Check for wellformed id in user_creatable_add_type()
Most code paths for creating a user creatable object go through QemuOpts, which ensures that the provided 'id' option is actually a valid id
qom: Check for wellformed id in user_creatable_add_type()
Most code paths for creating a user creatable object go through QemuOpts, which ensures that the provided 'id' option is actually a valid identifier.
However, there are some code paths that don't go through QemuOpts: qemu-storage-daemon --object (since commit 8db1efd3) and QMP object-add (since it was first introduced in commit cff8b2c6). We need to have the same validity check for those, too.
This adds the check and makes it print the same error message as QemuOpts on failure.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20210302171623.49709-1-kwolf@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
eab3a467 |
| 11-Dec-2020 |
Markus Armbruster <armbru@redhat.com> |
qobject: Change qobject_to_json()'s value to GString
qobject_to_json() and qobject_to_json_pretty() build a GString, then covert it to QString. Just one of the callers actually needs a QString: qem
qobject: Change qobject_to_json()'s value to GString
qobject_to_json() and qobject_to_json_pretty() build a GString, then covert it to QString. Just one of the callers actually needs a QString: qemu_rbd_parse_filename(). A few others need a string they can modify: qmp_send_response(), qga's send_response(), to_json_str(), and qmp_fd_vsend_fds(). The remainder just need a string.
Change qobject_to_json() and qobject_to_json_pretty() to return the GString.
qemu_rbd_parse_filename() now has to convert to QString. All others save a QString temporary. to_json_str() actually becomes a bit simpler, because GString provides more convenient modification functions.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201211171152.146877-6-armbru@redhat.com>
show more ...
|
#
c9ac1458 |
| 07-Oct-2020 |
Kevin Wolf <kwolf@redhat.com> |
qom: Add user_creatable_print_help_from_qdict()
This adds a function that, given a QDict of non-help options, prints help for user creatable objects.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Re
qom: Add user_creatable_print_help_from_qdict()
This adds a function that, given a QDict of non-help options, prints help for user creatable objects.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201007164903.282198-4-kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
#
0e301d44 |
| 07-Oct-2020 |
Kevin Wolf <kwolf@redhat.com> |
qom: Factor out helpers from user_creatable_print_help()
This creates separate helper functions for printing a list of user creatable object types and for printing a list of properties of a given ty
qom: Factor out helpers from user_creatable_print_help()
This creates separate helper functions for printing a list of user creatable object types and for printing a list of properties of a given type. This will allow using these parts without having a QemuOpts.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201007164903.282198-3-kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
Revision tags: v5.0.1, v5.1.0, v5.1.0-rc3, v5.1.0-rc2, v5.1.0-rc1, v5.1.0-rc0 |
|
#
db57fef1 |
| 29-Jun-2020 |
Eric Auger <eric.auger@redhat.com> |
qom: Introduce object_property_try_add_child()
object_property_add() does not allow object_property_try_add() to gracefully fail as &error_abort is passed as an error handle.
However such failure c
qom: Introduce object_property_try_add_child()
object_property_add() does not allow object_property_try_add() to gracefully fail as &error_abort is passed as an error handle.
However such failure can easily be triggered from the QMP shell when, for instance, one attempts to create an object with an id that already exists. This is achieved from the following call path:
qmp_object_add -> user_creatable_add_dict -> user_creatable_add_type -> object_property_add_child -> object_property_add
For instance, from the qmp-shell, call twice: object-add qom-type=memory-backend-ram id=mem1 props.size=1073741824 and QEMU aborts.
This behavior is undesired as a user/management application mistake in reusing a property ID shouldn't result in loss of the VM and live data within.
This patch introduces a new function, object_property_try_add_child() which takes an error handle and turn object_property_try_add() into a non-static one.
Now the call path becomes:
user_creatable_add_type -> object_property_try_add_child -> object_property_try_add
and the error is returned gracefully to the QMP client.
(QEMU) object-add qom-type=memory-backend-ram id=mem2 props.size=4294967296 {"return": {}} (QEMU) object-add qom-type=memory-backend-ram id=mem2 props.size=4294967296 {"error": {"class": "GenericError", "desc": "attempt to add duplicate property 'mem2' to object (type 'container')"}}
Signed-off-by: Eric Auger <eric.auger@redhat.com> Fixes: d2623129a7de ("qom: Drop parameter @errp of object_property_add() & friends") Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Greg Kurz <groug@kaod.org> Tested-by: Greg Kurz <groug@kaod.org> Message-Id: <20200629193424.30280-2-eric.auger@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
778a2dc5 |
| 07-Jul-2020 |
Markus Armbruster <armbru@redhat.com> |
qom: Use returned bool to check for failure, Coccinelle part
The previous commit enables conversion of
foo(..., &err); if (err) { ... }
to
if (!foo(..., errp)) { .
qom: Use returned bool to check for failure, Coccinelle part
The previous commit enables conversion of
foo(..., &err); if (err) { ... }
to
if (!foo(..., errp)) { ... }
for QOM functions that now return true / false on success / error. Coccinelle script:
@@ identifier fun = { object_apply_global_props, object_initialize_child_with_props, object_initialize_child_with_propsv, object_property_get, object_property_get_bool, object_property_parse, object_property_set, object_property_set_bool, object_property_set_int, object_property_set_link, object_property_set_qobject, object_property_set_str, object_property_set_uint, object_set_props, object_set_propv, user_creatable_add_dict, user_creatable_complete, user_creatable_del }; expression list args, args2; typedef Error; Error *err; @@ - fun(args, &err, args2); - if (err) + if (!fun(args, &err, args2)) { ... }
Fails to convert hw/arm/armsse.c, because Coccinelle gets confused by ARMSSE being used both as typedef and function-like macro there. Convert manually.
Line breaks tidied up manually.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20200707160613.848843-29-armbru@redhat.com>
show more ...
|
#
6fd5bef1 |
| 07-Jul-2020 |
Markus Armbruster <armbru@redhat.com> |
qom: Make functions taking Error ** return bool, not void
See recent commit "error: Document Error API usage rules" for rationale.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by:
qom: Make functions taking Error ** return bool, not void
See recent commit "error: Document Error API usage rules" for rationale.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20200707160613.848843-28-armbru@redhat.com>
show more ...
|