5db15096 | 05-Jun-2014 |
Benoît Canet <benoit.canet@irqsave.net> |
qapi: create two block related json modules
qapi/block-core.json contains block definitions unrelated to emulation.
qapi/block.json is a superset of the previous and contains definitions related to
qapi: create two block related json modules
qapi/block-core.json contains block definitions unrelated to emulation.
qapi/block.json is a superset of the previous and contains definitions related to emulation.
The purpose of these extractions is to be able to hook qapi/block-core.json generated code on qemu-nbd.
Signed-off-by: Benoit Canet <benoit@irqsave.net> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
297a3646 | 07-May-2014 |
Markus Armbruster <armbru@redhat.com> |
qapi: Replace uncommon use of the error API by the common one
We commonly use the error API like this:
err = NULL; foo(..., &err); if (err) { goto out; } bar(..., &err);
qapi: Replace uncommon use of the error API by the common one
We commonly use the error API like this:
err = NULL; foo(..., &err); if (err) { goto out; } bar(..., &err);
Every error source is checked separately. The second function is only called when the first one succeeds. Both functions are free to pass their argument to error_set(). Because error_set() asserts no error has been set, this effectively means they must not be called with an error set.
The qapi-generated code uses the error API differently:
// *errp was initialized to NULL somewhere up the call chain frob(..., errp); gnat(..., errp);
Errors accumulate in *errp: first error wins, subsequent errors get dropped. To make this work, the second function does nothing when called with an error set. Requires non-null errp, or else the second function can't see the first one fail.
This usage has also bled into visitor tests, and two device model object property getters rtc_get_date() and balloon_stats_get_all().
With the "accumulate" technique, you need fewer error checks in callers, and buy that with an error check in every callee. Can be nice.
However, mixing the two techniques is confusing. You can't use the "accumulate" technique with functions designed for the "check separately" technique. You can use the "check separately" technique with functions designed for the "accumulate" technique, but then error_set() can't catch you setting an error more than once.
Standardize on the "check separately" technique for now, because it's overwhelmingly prevalent.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
e2cd0f4f | 07-May-2014 |
Markus Armbruster <armbru@redhat.com> |
qapi: Replace start_optional()/end_optional() by optional()
Semantics of end_optional() differ subtly from the other end_FOO() callbacks: when start_FOO() succeeds, the matching end_FOO() gets calle
qapi: Replace start_optional()/end_optional() by optional()
Semantics of end_optional() differ subtly from the other end_FOO() callbacks: when start_FOO() succeeds, the matching end_FOO() gets called regardless of what happens in between. end_optional() gets called only when everything in between succeeds as well. Entirely undocumented, like all of the visitor API.
The only user of Visitor Callback end_optional() never did anything, and was removed in commit 9f9ab46.
I'm about to clean up error handling in the generated visitor code, and end_optional() is in my way. No users mean no test cases, and making non-trivial cleanup transformations without test cases doesn't strike me as a good idea.
Drop end_optional(), and rename start_optional() to optional(). We can always go back to a pair of callbacks when we have an actual need.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
b690d679 | 08-May-2014 |
Peter Lieven <pl@kamp.de> |
Revert "qapi: Clean up superfluous null check in qapi_dealloc_type_str()"
This reverts commit 25a7017555f1b4aeb543b5d323ff4afb8f9c5437.
Turns out the argument *can* be null: QEMU now segfaults if i
Revert "qapi: Clean up superfluous null check in qapi_dealloc_type_str()"
This reverts commit 25a7017555f1b4aeb543b5d323ff4afb8f9c5437.
Turns out the argument *can* be null: QEMU now segfaults if it receives an invalid parameter via a qmp command instead of throwing an error.
For example: { "execute": "blockdev-add", "arguments": { "options" : { "driver": "invalid-driver" } } }
CC: qemu-stable@nongnu.org Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
ee16ce93 | 02-May-2014 |
Markus Armbruster <armbru@redhat.com> |
qapi: Clean up fragile use of error_is_set()
Using error_is_set(ERRP) to find out whether a function failed is either wrong, fragile, or unnecessarily opaque. It's wrong when ERRP may be null, beca
qapi: Clean up fragile use of error_is_set()
Using error_is_set(ERRP) to find out whether a function failed is either wrong, fragile, or unnecessarily opaque. It's wrong when ERRP may be null, because errors go undetected when it is. It's fragile when proving ERRP non-null involves a non-local argument. Else, it's unnecessarily opaque (see commit 84d18f0).
The error_is_set(errp) in do_qmp_dispatch() is merely fragile, because the caller never passes a null errp argument.
Make the code more robust and more obviously correct: receive the error in a local variable, then propagate it through the parameter.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
4af8be1f | 02-May-2014 |
Markus Armbruster <armbru@redhat.com> |
qapi: Drop redundant, unclean error_is_set()
do_qmp_dispatch()'s test for qmp_dispatch_check_obj() failure examines both the return value and the error object. The latter part is unclean; it works
qapi: Drop redundant, unclean error_is_set()
do_qmp_dispatch()'s test for qmp_dispatch_check_obj() failure examines both the return value and the error object. The latter part is unclean; it works only when do_qmp_dispatch()'s caller passes a non-null errp argument. That's the case, but it's not locally obvious. Unclean.
Cleanup would be easy enough, but since the unclean code is also redundant, let's just drop it.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
b7745397 | 01-Mar-2014 |
Markus Armbruster <armbru@redhat.com> |
qapi: Add missing null check to opts_start_struct()
Argument is null when visiting an unboxed struct. I can't see such a visit in the current code. Fix it anyway.
Signed-off-by: Markus Armbruster
qapi: Add missing null check to opts_start_struct()
Argument is null when visiting an unboxed struct. I can't see such a visit in the current code. Fix it anyway.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
0106dc4f | 08-Oct-2013 |
Mark Wu <wudxw@linux.vnet.ibm.com> |
qemu-ga: Extend 'guest-info' command to expose flag 'success-response'
Now we have several qemu-ga commands not returning response on success. It has been documented in qga/qapi-schema.json already.
qemu-ga: Extend 'guest-info' command to expose flag 'success-response'
Now we have several qemu-ga commands not returning response on success. It has been documented in qga/qapi-schema.json already. This patch exposes the 'success-response' flag by extending 'guest-info' command. With this change, the clients can handle the command response more flexibly.
Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> *fixed up commit subject Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
show more ...
|