qemu-e2k/scripts
Markus Armbruster 297a3646c2 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>
2014-05-15 14:00:46 -04:00
..
kvm
qemu-guest-agent
qmp qmp: Check for returned data from __json_read in get_events 2014-02-28 13:35:53 -05:00
tracetool trace: [tracetool] Minimize the amount of per-backend code 2014-05-07 19:07:18 +02:00
acpi_extract_preprocess.py i386: add ACPI table files from seabios 2013-10-14 17:48:51 +03:00
acpi_extract.py i386: add ACPI table files from seabios 2013-10-14 17:48:51 +03:00
analyse-9p-simpletrace.py
check-qerror.sh
checkpatch.pl checkpatch.pl: Check .cpp files 2013-09-09 14:17:56 -05:00
cleanup-trace-events.pl cleanup-trace-events.pl: New 2013-07-18 11:44:42 +08:00
coverity-model.c scripts: add sample model file for Coverity Scan 2014-04-18 10:33:36 +04:00
create_config module: implement module loading 2014-02-20 13:14:18 +01:00
disas-objdump.pl disas-objdump: Pass --adjust-vma to objdump 2013-08-24 07:26:45 +02:00
dump-guest-memory.py Python-lang gdb script to extract x86_64 guest vmcore from qemu coredump 2014-01-26 13:06:48 +02:00
extract-vsssdk-headers Add a script to extract VSS SDK headers on POSIX system 2013-09-09 14:17:56 -05:00
feature_to_c.sh
get_maintainer.pl Use qemu-project.org domain name 2013-10-11 09:34:56 -07:00
gtester-cat
hxtool
make_device_config.sh
make-release make-release: Record SeaBIOS version 2014-03-31 15:02:04 +01:00
ordereddict.py
qapi-commands.py qapi: Replace uncommon use of the error API by the common one 2014-05-15 14:00:46 -04:00
qapi-types.py qapi: Use an explicit input file 2014-05-08 14:19:58 -04:00
qapi-visit.py qapi: Replace uncommon use of the error API by the common one 2014-05-15 14:00:46 -04:00
qapi.py qapi: Add a primitive to include other files from a QAPI schema file 2014-05-08 14:19:58 -04:00
qemu-binfmt-conf.sh scripts/qemu-binfmt-conf.sh: Add AArch64 registration 2014-03-17 16:31:53 +00:00
qemu-gdb.py
qtest
refresh-pxe-roms.sh roms: rewrite scripts/refresh-pxe-roms.sh 2013-09-30 09:44:35 +02:00
signrom.py
simpletrace.py trace: [tracetool] Minimize the amount of per-backend code 2014-05-07 19:07:18 +02:00
switch-timer-api misc: Fix case Qemu -> QEMU 2014-02-15 16:10:25 +04:00
texi2pod.pl
tracetool.py build: do not use TARGET_ARCH 2013-06-14 15:33:10 +01:00
update-acpi.sh acpi: add rules to compile ASL source 2013-10-14 17:48:51 +03:00
update-linux-headers.sh