Sprint to the finish: purge QError
Subsystems (4)
cover Sprint to the finish: purge QError
After a bit over a year and many patches, QError is finally ripe. All that's left of qerror.h after this series is a bunch of QERR_ macros. Killing them is left for another day.
The diffstat looks a bit scary, but that's almost entirely due to mechanical changes like PATCH 05.
This series applies on top of my "[PATCH v2 0/7] qdev: Mostly wean off QError".
Markus Armbruster (11):
QemuOpts: Wean off qerror_report_err()
vl: Avoid qerror_report() outside QMP command handlers
vl: Use error_report() for --display errors
qerror: Eliminate QERR_DEVICE_NOT_FOUND
qerror: Clean up QERR_ macros to expand into a single string
tpm: Avoid qerror_report() outside QMP command handlers
qmp: Wean off qerror_report()
qerror: Finally unused, clean up
qerror: Move #include out of qerror.h
Include qapi/qmp/qerror.h exactly where needed Include monitor/monitor.h exactly where needed
audio/spiceaudio.c | 1 + audio/wavcapture.c | 1 + backends/hostmem.c | 1 - backends/rng-egd.c | 11 +-- backends/rng-random.c | 6 +- backends/rng.c | 2 +- backends/tpm.c | 2 +- balloon.c | 5 +- block.c | 4 +- block/backup.c | 5 +- block/commit.c | 3 +- block/curl.c | 1 + block/dmg.c | 1 + block/io.c | 1 + block/iscsi.c | 1 + block/mirror.c | 9 +-- block/qapi.c | 6 -- block/qcow.c | 5 +- block/qcow2-snapshot.c | 1 + block/qcow2.c | 4 +- block/qed.c | 4 +- block/quorum.c | 5 +- block/raw-posix.c | 2 + block/snapshot.c | 5 +- block/ssh.c | 2 + block/stream.c | 5 +- block/vhdx-log.c | 1 + block/vmdk.c | 14 ++-- block/vvfat.c | 1 + blockdev-nbd.c | 6 +- blockdev.c | 80 ++++++++++++--------- blockjob.c | 9 +-- cpus.c | 9 +-- dump.c | 13 ++-- hmp.c | 24 ++++--- hw/9pfs/virtio-9p.c | 1 + hw/char/serial-pci.c | 1 - hw/char/virtio-serial-bus.c | 1 + hw/core/nmi.c | 2 +- hw/core/platform-bus.c | 1 - hw/core/qdev-properties-system.c | 3 +- hw/core/qdev-properties.c | 12 ++-- hw/core/qdev.c | 9 +-- hw/display/g364fb.c | 1 + hw/display/qxl.c | 1 - hw/display/tcx.c | 1 + hw/dma/xilinx_axidma.c | 1 - hw/i386/pc.c | 2 +- hw/ide/ahci.c | 2 +- hw/intc/openpic.c | 6 +- hw/misc/ivshmem.c | 2 +- hw/net/xilinx_axienet.c | 1 - hw/pci/pci-stub.c | 3 +- hw/pci/pci.c | 1 + hw/pci/pcie.c | 1 - hw/pci/shpc.c | 1 - hw/ppc/spapr_pci.c | 8 +-- hw/ppc/spapr_vio.c | 1 - hw/ppc/virtex_ml507.c | 2 +- hw/s390x/event-facility.c | 1 - hw/s390x/s390-virtio-bus.c | 1 - hw/s390x/s390-virtio.c | 4 +- hw/s390x/virtio-ccw.c | 2 +- hw/scsi/vhost-scsi.c | 1 + hw/timer/hpet.c | 1 + hw/tpm/tpm_passthrough.c | 1 + hw/usb/bus.c | 1 + hw/usb/ccid-card-emulated.c | 1 - hw/usb/ccid-card-passthru.c | 2 +- hw/usb/dev-network.c | 2 +- hw/usb/dev-serial.c | 2 +- hw/usb/dev-smartcard-reader.c | 1 - hw/usb/dev-storage.c | 1 + hw/usb/hcd-ehci.h | 1 - hw/usb/host-libusb.c | 1 + hw/usb/redirect.c | 9 +-- hw/virtio/virtio-rng.c | 1 - include/block/block_int.h | 2 - include/monitor/monitor.h | 9 +-- include/monitor/qdev.h | 5 +- include/net/net.h | 2 +- include/qapi/qmp/qerror.h | 85 +++++++++------------- include/qapi/qmp/qobject.h | 1 - include/qemu/option.h | 5 +- include/qemu/sockets.h | 1 - include/sysemu/balloon.h | 1 - include/ui/console.h | 4 +- include/ui/qemu-spice.h | 2 - migration/migration.c | 38 +++++----- migration/qemu-file-buf.c | 1 + migration/qemu-file.c | 1 + migration/rdma.c | 1 + migration/savevm.c | 4 +- monitor.c | 104 +++++++++++---------------- net/l2tpv3.c | 1 - net/net.c | 41 +++++------ net/slirp.c | 1 + numa.c | 1 - qapi/opts-visitor.c | 24 +++---- qapi/qapi-visit-core.c | 28 ++++---- qapi/qmp-dispatch.c | 12 ++-- qapi/qmp-input-visitor.c | 28 ++++---- qapi/qmp-output-visitor.c | 1 - qapi/string-input-visitor.c | 24 +++---- qapi/string-output-visitor.c | 1 - qdev-monitor.c | 37 +++++----- qemu-char.c | 1 + qemu-img.c | 6 +- qemu-io-cmds.c | 1 + qemu-io.c | 4 +- qemu-nbd.c | 4 +- qga/commands-posix.c | 40 +++++------ qga/commands-win32.c | 66 ++++++++--------- qga/main.c | 4 +- qmp-commands.hx | 4 +- qmp.c | 97 ++++++++++--------------- qobject/Makefile.objs | 1 - qobject/json-parser.c | 1 - qobject/qerror.c | 148 --------------------------------------- qobject/qjson.c | 3 - qom/object.c | 18 ++--- scripts/qapi-commands.py | 42 ++--------- slirp/misc.c | 1 + stubs/Makefile.objs | 1 - stubs/arch-query-cpu-def.c | 2 +- stubs/dump.c | 1 - stubs/mon-is-qmp.c | 2 + stubs/mon-set-error.c | 8 --- target-arm/cpu.c | 1 - target-i386/cpu.c | 20 +++--- target-i386/kvm.c | 1 - target-s390x/kvm.c | 1 - tests/test-opts-visitor.c | 3 +- tests/test-qemu-opts.c | 2 +- tpm.c | 12 ++-- ui/input-legacy.c | 1 - ui/input.c | 4 +- ui/spice-core.c | 1 + ui/spice-display.c | 1 - ui/vnc.c | 10 +-- util/osdep.c | 1 + util/qemu-config.c | 1 - util/qemu-error.c | 5 +- util/qemu-option.c | 47 ++++++++----- vl.c | 143 +++++++++++++++++++++---------------- 145 files changed, 676 insertions(+), 845 deletions(-) delete mode 100644 qobject/qerror.c delete mode 100644 stubs/mon-set-error.c
Signature · 1 line
1.9.3
PATCH 1/11 QemuOpts: Wean off qerror_report_err()
qerror_report_err() is a transitional interface to help with converting existing monitor commands to QMP. It should not be used elsewhere.
The only remaining user in qemu-option.c is qemu_opts_parse(). Is it used in QMP context? If not, we can simply replace qerror_report_err() by error_report_err().
The uses in qemu-img.c, qemu-io.c, qemu-nbd.c and under tests/ are clearly not in QMP context.
The uses in vl.c aren't either, because the only QMP command handlers there are qmp_query_status() and qmp_query_machines(), and they don't call it.
Remaining uses:
* drive_def(): Command line -drive and such, HMP drive_add and pci_add
* hmp_chardev_add(): HMP chardev-add
* monitor_parse_command(): HMP core
* tmp_config_parse(): Command line -tpmdev
* net_host_device_add(): HMP host_net_add
* net_client_parse(): Command line -net and -netdev
* qemu_global_option(): Command line -global
* vnc_parse_func(): Command line -display, -vnc, default display, HMP change, QMP change. Bummer.
* qemu_pci_hot_add_nic(): HMP pci_add
* usb_net_init(): Command line -usbdevice, HMP usb_add
Propoagate errors through qemu_opts_parse(). Create a convenience function qemu_opts_parse_noisily() that passes errors to error_report_err(). Switch all non-QMP users outside tests to it.
That leaves vnc_parse_func(). Propagate errors through it. Since I'm touching it anyway, rename it to vnc_parse().
--- blockdev.c | 2 +- hmp.c | 2 +- hw/usb/dev-network.c | 2 +- include/qemu/option.h | 5 ++- include/ui/console.h | 2 +- monitor.c | 2 +- net/net.c | 5 ++- qdev-monitor.c | 2 +- qemu-img.c | 3 +- qemu-io.c | 2 +- qemu-nbd.c | 3 +- qmp.c | 2 +- tests/test-opts-visitor.c | 3 +- tests/test-qemu-opts.c | 2 +- tpm.c | 2 +- ui/vnc.c | 4 +- util/qemu-option.c | 25 ++++++++--- vl.c | 103 +++++++++++++++++++++++++++++----------------- 18 files changed, 109 insertions(+), 62 deletions(-)
blockdev.c +1 -1
@@ -173,7 +173,7 @@ static int drive_index_to_unit_id(BlockInterfaceType type, int index)QemuOpts *drive_def (const char *optstr) { -return qemu_opts_parse (qemu_find_opts ("drive" ), optstr,0 ); +return qemu_opts_parse_noisily (qemu_find_opts ("drive" ), optstr, false); } QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file,
hmp.c +1 -1
@@ -1835,7 +1835,7 @@ void hmp_chardev_add(Monitor *mon, const QDict *qdict)Error *err =NULL ;QemuOpts *opts; - opts =qemu_opts_parse (qemu_find_opts ("chardev" ), args,1 ); + opts =qemu_opts_parse_noisily (qemu_find_opts ("chardev" ), args, true);if (opts ==NULL ) {error_setg (&err,"Parsing chardev args failed" ); }else {
hw/usb/dev-network.c +1 -1
@@ -1397,7 +1397,7 @@ static USBDevice *usb_net_init(USBBus *bus, const char *cmdline)QemuOpts *opts;int idx; - opts =qemu_opts_parse (qemu_find_opts ("net" ), cmdline,0 ); + opts =qemu_opts_parse_noisily (qemu_find_opts ("net" ), cmdline, false);if (!opts) {return NULL ; }
include/qemu/option.h +4 -1
@@ -119,7 +119,10 @@ void qemu_opts_del(QemuOpts *opts);void qemu_opts_validate (QemuOpts *opts,const QemuOptDesc *desc,Error **errp);void qemu_opts_do_parse (QemuOpts *opts,const char *params,const char *firstname,Error **errp); -QemuOpts *qemu_opts_parse (QemuOptsList *list,const char *params,int permit_abbrev); +QemuOpts *qemu_opts_parse_noisily (QemuOptsList *list,const char *params, +bool permit_abbrev); +QemuOpts *qemu_opts_parse (QemuOptsList *list,const char *params, +bool permit_abbrev,Error **errp);void qemu_opts_set_defaults (QemuOptsList *list,const char *params,int permit_abbrev); QemuOpts *qemu_opts_from_qdict(QemuOptsList *list, const QDict *qdict,
include/ui/console.h +1 -1
@@ -369,7 +369,7 @@ char *vnc_display_local_addr(const char *id);#ifdef CONFIG_VNC int vnc_display_password (const char *id,const char *password);int vnc_display_pw_expire (const char *id,time_t expires); -QemuOpts *vnc_parse_func (const char *str); +QemuOpts *vnc_parse (const char *str,Error **errp);int vnc_init_func (void *opaque,QemuOpts *opts,Error **errp);#else static inline int vnc_display_password (const char *id,const char *password)
monitor.c +1 -1
@@ -3753,7 +3753,7 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon,if (get_str (buf,sizeof (buf), &p) <0 ) { goto fail; } - opts =qemu_opts_parse (opts_list, buf,1 ); + opts =qemu_opts_parse_noisily (opts_list, buf, true);if (!opts) { goto fail; }
net/net.c +3 -2
@@ -1031,7 +1031,8 @@ void hmp_host_net_add(Monitor *mon, const QDict *qdict)return ; } - opts =qemu_opts_parse (qemu_find_opts ("net" ), opts_str ? opts_str :"" ,0 ); + opts =qemu_opts_parse_noisily (qemu_find_opts ("net" ), + opts_str ? opts_str :"" , false);if (!opts) {return ; }
@@ -1394,7 +1395,7 @@ int net_client_parse(QemuOptsList *opts_list, const char *optarg) }#endif -if (!qemu_opts_parse (opts_list, optarg,1 )) { +if (!qemu_opts_parse_noisily (opts_list, optarg, true)) {return -1 ; }
qdev-monitor.c +1 -1
@@ -853,7 +853,7 @@ int qemu_global_option(const char *str)return 0 ; } - opts =qemu_opts_parse (&qemu_global_opts, str, false); + opts =qemu_opts_parse_noisily (&qemu_global_opts, str, false);if (!opts) {return -1 ; }
qemu-img.c +2 -1
@@ -1590,7 +1590,8 @@ static int img_convert(int argc, char **argv)break ;case 'l' :if (strstart (optarg,SNAPSHOT_OPT_BASE ,NULL )) { - sn_opts =qemu_opts_parse (&internal_snapshot_opts, optarg,0 ); + sn_opts =qemu_opts_parse_noisily (&internal_snapshot_opts, + optarg, false);if (!sn_opts) {error_report ("Failed in parsing snapshot param '%s'" , optarg);
qemu-io.c +1 -1
@@ -153,7 +153,7 @@ static int open_f(BlockBackend *blk, int argc, char **argv) readonly =1 ;break ;case 'o' : -if (!qemu_opts_parse (&empty_opts, optarg,0 )) { +if (!qemu_opts_parse_noisily (&empty_opts, optarg, false)) {printf ("could not parse option list -- %s\n" , optarg);qemu_opts_reset (&empty_opts);return 0 ;
qemu-nbd.c +2 -1
@@ -549,7 +549,8 @@ int main(int argc, char **argv)break ;case 'l' :if (strstart (optarg,SNAPSHOT_OPT_BASE ,NULL )) { - sn_opts =qemu_opts_parse (&internal_snapshot_opts, optarg,0 ); + sn_opts =qemu_opts_parse_noisily (&internal_snapshot_opts, + optarg, false);if (!sn_opts) {errx (EXIT_FAILURE ,"Failed in parsing snapshot param `%s'" , optarg);
qmp.c +1 -1
@@ -387,7 +387,7 @@ static void qmp_change_vnc_listen(const char *target, Error **errp)if (opts) {qemu_opts_del (opts); } - opts =vnc_parse_func (target); + opts =vnc_parse (target, errp);if (!opts) {return ; }
tests/test-opts-visitor.c +2 -1
@@ -39,7 +39,8 @@ setup_fixture(OptsVisitorFixture *f, gconstpointer test_data)QemuOpts *opts;OptsVisitor *ov; - opts =qemu_opts_parse (qemu_find_opts ("userdef" ), opts_string,0 ); + opts =qemu_opts_parse (qemu_find_opts ("userdef" ), opts_string, false, +NULL );g_assert (opts !=NULL ); ov =opts_visitor_new (opts);
tests/test-qemu-opts.c +1 -1
@@ -323,7 +323,7 @@ static void test_qemu_opt_unset(void)int ret;/* dynamically initialized (parsed) opts */ - opts =qemu_opts_parse (&opts_list_03,"key=value" ,0 ); + opts =qemu_opts_parse (&opts_list_03,"key=value" , false,NULL );g_assert (opts !=NULL );/* check default/parsed value */
tpm.c +1 -1
@@ -228,7 +228,7 @@ int tpm_config_parse(QemuOptsList *opts_list, const char *optarg)tpm_display_backend_drivers ();return -1 ; } - opts =qemu_opts_parse (opts_list, optarg,1 ); + opts =qemu_opts_parse_noisily (opts_list, optarg, true);if (!opts) {return -1 ; }
ui/vnc.c +2 -2
@@ -3749,10 +3749,10 @@ static void vnc_auto_assign_id(QemuOptsList *olist, QemuOpts *opts)qemu_opts_set_id (opts, id); } -QemuOpts *vnc_parse_func (const char *str) +QemuOpts *vnc_parse (const char *str,Error **errp) {QemuOptsList *olist =qemu_find_opts ("vnc" ); -QemuOpts *opts =qemu_opts_parse (olist, str,1 ); +QemuOpts *opts =qemu_opts_parse (olist, str, true, errp);const char *id;if (!opts) {
util/qemu-option.c +19 -6
@@ -820,7 +820,7 @@ void qemu_opts_do_parse(QemuOpts *opts, const char *params, }static QemuOpts *opts_parse (QemuOptsList *list,const char *params, -int permit_abbrev,bool defaults,Error **errp) +bool permit_abbrev,bool defaults,Error **errp) {const char *firstname;char value[1024 ], *id =NULL ;
@@ -867,19 +867,32 @@ static QemuOpts *opts_parse(QemuOptsList *list, const char *params,* Create a QemuOpts in @list and with options parsed from @params. * If @permit_abbrev, the first key=value in @params may omit key=, * and is treated as if key was @list->implied_opt_name. -* Report errors with qerror_report_err(). +* On error, store an error object through @errp if non-null. * Return the new QemuOpts on success, null pointer on error. */ QemuOpts *qemu_opts_parse (QemuOptsList *list,const char *params, -int permit_abbrev) +bool permit_abbrev,Error **errp) +{ +return opts_parse (list, params, permit_abbrev, false, errp); +} + +/** +* Create a QemuOpts in @list and with options parsed from @params. +* If @permit_abbrev, the first key=value in @params may omit key=, +* and is treated as if key was @list->implied_opt_name. +* Report errors with error_report_err(). This is inappropriate in +* QMP context. Do not use this function there! +* Return the new QemuOpts on success, null pointer on error. +*/ +QemuOpts *qemu_opts_parse_noisily (QemuOptsList *list,const char *params, +bool permit_abbrev) {Error *err =NULL ;QemuOpts *opts; opts =opts_parse (list, params, permit_abbrev, false, &err); -if (!opts) { -qerror_report_err (err); -error_free (err); +if (err) { +error_report_err (err); }return opts; }
vl.c +65 -38
313 lines not on this page · raw message
Signature · 1 line
1.9.3
Re: [Qemu-devel] [PATCH 01/11] QemuOpts: Wean off qerror_report_err()
Quoted 11 lines · Markus Armbruster
qerror_report_err()is a transitional interface to help with converting existing monitor commands to QMP. It should not be used elsewhere.The only remaining user in
qemu-option.cisqemu_opts_parse(). Is it used in QMP context? If not, we can simply replaceqerror_report_err()byerror_report_err().Propoagate errors through
qemu_opts_parse(). Create a convenience
s/Propoagate/Propagate/
Quoted 8 lines
function
qemu_opts_parse_noisily()that passes errors toerror_report_err(). Switch all non-QMP users outside tests to it.That leaves
vnc_parse_func(). Propagate errors through it. Since I'm touching it anyway, rename it tovnc_parse().Signed-off-by Markus Armbruster <[email protected]>---
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH 01/11] QemuOpts: Wean off qerror_report_err()
Quoted 11 lines · Eric Blake
Quoted 10 lines · Markus Armbruster
qerror_report_err()is a transitional interface to help with converting existing monitor commands to QMP. It should not be used elsewhere.The only remaining user in
qemu-option.cisqemu_opts_parse(). Is it used in QMP context? If not, we can simply replaceqerror_report_err()byerror_report_err().
Quoted 3 lines
Quoted 1 line
Propoagate errors through
qemu_opts_parse(). Create a conveniences/Propoagate/Propagate/
Fixing...
Quoted 10 lines
Quoted 8 lines
function
qemu_opts_parse_noisily()that passes errors toerror_report_err(). Switch all non-QMP users outside tests to it.That leaves
vnc_parse_func(). Propagate errors through it. Since I'm touching it anyway, rename it tovnc_parse().Signed-off-by Markus Armbruster <[email protected]>---
Reviewed-by Eric Blake <[email protected]>
Thanks!
Re: [Qemu-devel] [PATCH 01/11] QemuOpts: Wean off qerror_report_err()
In reply to Markus ArmbrusterQuoted 58 lines · Markus Armbruster
qerror_report_err()is a transitional interface to help with converting existing monitor commands to QMP. It should not be used elsewhere.The only remaining user in
qemu-option.cisqemu_opts_parse(). Is it used in QMP context? If not, we can simply replaceqerror_report_err()byerror_report_err().The uses in
qemu-img.c,qemu-io.c,qemu-nbd.cand under tests/ are clearly not in QMP context.The uses in
vl.caren't either, because the only QMP command handlers there areqmp_query_status()andqmp_query_machines(), and they don't call it.Remaining uses:
*
drive_def(): Command line -drive and such, HMPdrive_addandpci_add*
hmp_chardev_add(): HMP chardev-add*
monitor_parse_command(): HMP core*
tmp_config_parse(): Command line -tpmdev*
net_host_device_add(): HMPhost_net_add*
net_client_parse(): Command line -net and -netdev*
qemu_global_option(): Command line -global*
vnc_parse_func(): Command line -display, -vnc, default display, HMP change, QMP change. Bummer.*
qemu_pci_hot_add_nic(): HMPpci_add*
usb_net_init(): Command line -usbdevice, HMPusb_addPropoagate errors through
qemu_opts_parse(). Create a convenience functionqemu_opts_parse_noisily()that passes errors toerror_report_err(). Switch all non-QMP users outside tests to it.That leaves
vnc_parse_func(). Propagate errors through it. Since I'm touching it anyway, rename it tovnc_parse().Signed-off-by Markus Armbruster <[email protected]>--- blockdev.c | 2 +- hmp.c | 2 +- hw/usb/dev-network.c | 2 +- include/qemu/option.h | 5 ++- include/ui/console.h | 2 +- monitor.c | 2 +- net/net.c | 5 ++- qdev-monitor.c | 2 +- qemu-img.c | 3 +- qemu-io.c | 2 +- qemu-nbd.c | 3 +-
Quoted 8 lines
qmp.c | 2 +- tests/test-opts-visitor.c | 3 +- tests/test-qemu-opts.c | 2 +- tpm.c | 2 +- ui/vnc.c | 4 +- util/qemu-option.c | 25 ++++++++--- vl.c | 103 +++++++++++++++++++++++++++++----------------- 18 files changed, 109 insertions(+), 62 deletions(-)
PATCH 2/11 vl: Avoid qerror_report() outside QMP command handlers
In reply to Markus Armbrusterqerror_report() is a transitional interface to help with converting existing monitor commands to QMP. It should not be used elsewhere. Replace by error_report() in initial startup helpers parse_sandbox() and parse_add_fd().
--- vl.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)
vl.c +9 -14
@@ -986,13 +986,13 @@ static int parse_sandbox(void *opaque, QemuOpts *opts, Error **errp)if (qemu_opt_get_bool (opts,"enable" , false)) {#ifdef CONFIG_SECCOMP if (seccomp_start () <0 ) { -qerror_report (ERROR_CLASS_GENERIC_ERROR , -"failed to install seccomp syscall filter in the kernel" ); +error_report ("failed to install seccomp syscall filter " +"in the kernel" );return -1 ; }#else -qerror_report (ERROR_CLASS_GENERIC_ERROR , -"sandboxing request but seccomp is not compiled into this build" ); +error_report ("sandboxing request but seccomp is not compiled " +"into this build" );return -1 ;#endif }
@@ -1040,14 +1040,12 @@ static int parse_add_fd(void *opaque, QemuOpts *opts, Error **errp) fd_opaque =qemu_opt_get (opts,"opaque" );if (fd <0 ) { -qerror_report (ERROR_CLASS_GENERIC_ERROR , -"fd option is required and must be non-negative" ); +error_report ("fd option is required and must be non-negative" );return -1 ; }if (fd <=STDERR_FILENO ) { -qerror_report (ERROR_CLASS_GENERIC_ERROR , -"fd cannot be a standard I/O stream" ); +error_report ("fd cannot be a standard I/O stream" );return -1 ; }
@@ -1057,14 +1055,12 @@ static int parse_add_fd(void *opaque, QemuOpts *opts, Error **errp)*/ flags =fcntl (fd,F_GETFD );if (flags ==-1 || (flags &FD_CLOEXEC )) { -qerror_report (ERROR_CLASS_GENERIC_ERROR , -"fd is not valid or already in use" ); +error_report ("fd is not valid or already in use" );return -1 ; }if (fdset_id <0 ) { -qerror_report (ERROR_CLASS_GENERIC_ERROR , -"set option is required and must be non-negative" ); +error_report ("set option is required and must be non-negative" );return -1 ; }
@@ -1077,8 +1073,7 @@ static int parse_add_fd(void *opaque, QemuOpts *opts, Error **errp) }#endif if (dupfd ==-1 ) { -qerror_report (ERROR_CLASS_GENERIC_ERROR , -"Error duplicating fd: %s" ,strerror (errno)); +error_report ("Error duplicating fd: %s" ,strerror (errno));return -1 ; }
Signature · 1 line
1.9.3
Re: [Qemu-devel] [PATCH 02/11] vl: Avoid qerror_report() outside QMP command handlers
Quoted 12 lines · Markus Armbruster
qerror_report()is a transitional interface to help with converting existing monitor commands to QMP. It should not be used elsewhere. Replace byerror_report()in initial startup helpersparse_sandbox()andparse_add_fd().Signed-off-by Markus Armbruster <[email protected]>--- vl.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)#else
vl.c static int parse_sandbox(void *opaque, QemuOpts *opts, Error **errp) · line 995
Quoted 4 lines
vl.c +2
-2-qerror_report (ERROR_CLASS_GENERIC_ERROR , -"sandboxing request but seccomp is not compiled into this build" ); +error_report ("sandboxing request but seccomp is not compiled " +"into this build" );
Pre-existing, but s/request/requested/ would sound better while touching this.
Either way,
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH 02/11] vl: Avoid qerror_report() outside QMP command handlers
Quoted 12 lines · Eric Blake
Quoted 10 lines · Markus Armbruster
qerror_report()is a transitional interface to help with converting existing monitor commands to QMP. It should not be used elsewhere. Replace byerror_report()in initial startup helpersparse_sandbox()andparse_add_fd().Signed-off-by Markus Armbruster <[email protected]>--- vl.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)
Quoted 8 lines
vl.c static int parse_sandbox(void *opaque, QemuOpts *opts, Error **errp) · line 995
Quoted 5 lines
#else
vl.c +2
-2-qerror_report (ERROR_CLASS_GENERIC_ERROR , -"sandboxing request but seccomp is not compiled into this build" ); +error_report ("sandboxing request but seccomp is not compiled " +"into this build" );Pre-existing, but s/request/requested/ would sound better while touching this.
The full error message is
qemu-kvm-x86_64: -sandbox on: sandboxing request but seccomp is not compiled into this build
I think
qemu-kvm-x86_64: -sandbox on: seccomp is not compiled into this build
would do just fine.
I guess I'd happily squash that into a shorter patch, but this one is big enough for me to prefer a separate patch.
Quoted 2 lines
Either way,
Reviewed-by Eric Blake <[email protected]>
Thanks!
PATCH 3/11 vl: Use error_report() for --display errors
In reply to Markus ArmbrusterResults in nicer error messages. Before this patch:
Invalid GTK option string: gtk,lirum-larum
After:
qemu-system-x86_64: -display gtk,lirum-larum: Invalid GTK option string
Of course, the thing ought to use QemuOpts instead of parsing by hand.
--- vl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
vl.c +8 -8
@@ -2007,13 +2007,13 @@ static DisplayType select_display(const char *p) } }else { invalid_sdl_args: -fprintf (stderr,"Invalid SDL option string: %s\n" , p); +error_report ("Invalid SDL option string" );exit (1 ); } opts = nextopt; }#else -fprintf (stderr,"SDL support is disabled\n" ); +error_report ("SDL support is disabled" );exit (1 );#endif }else if (strstart (p,"vnc" , &opts)) {
@@ -2024,18 +2024,18 @@ static DisplayType select_display(const char *p) exit(1); } }else { -fprintf (stderr,"VNC requires a display argument vnc=<display>\n" ); +error_report ("VNC requires a display argument vnc=<display>" );exit (1 ); }#else -fprintf (stderr,"VNC support is disabled\n" ); +error_report ("VNC support is disabled" );exit (1 );#endif }else if (strstart (p,"curses" , &opts)) {#ifdef CONFIG_CURSES display =DT_CURSES ;#else -fprintf (stderr,"Curses support is disabled\n" ); +error_report ("Curses support is disabled" );exit (1 );#endif }else if (strstart (p,"gtk" , &opts)) {
@@ -2064,19 +2064,19 @@ static DisplayType select_display(const char *p) } }else { invalid_gtk_args: -fprintf (stderr,"Invalid GTK option string: %s\n" , p); +error_report ("Invalid GTK option string" );exit (1 ); } opts = nextopt; }#else -fprintf (stderr,"GTK support is disabled\n" ); +error_report ("GTK support is disabled" );exit (1 );#endif }else if (strstart (p,"none" , &opts)) { display =DT_NONE ; }else { -fprintf (stderr,"Unknown display type: %s\n" , p); +error_report ("Unknown display type" );exit (1 ); }
Signature · 1 line
1.9.3
Re: [Qemu-devel] [PATCH 03/11] vl: Use error_report() for --display errors
Quoted 6 lines · Markus Armbruster
Results in nicer error messages. Before this patch:
Invalid GTK option string: gtk,lirum-larum
After:
Quoted 9 lines
qemu-system-x86_64: -display gtk,lirum-larum: Invalid GTK option string
Of course, the thing ought to use QemuOpts instead of parsing by hand.
Signed-off-by Markus Armbruster <[email protected]>--- vl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
PATCH 4/11 qerror: Eliminate QERR_DEVICE_NOT_FOUND
In reply to Markus ArmbrusterError classes other than ERROR_CLASS_GENERIC_ERROR should not be used in new code. Hiding them in QERR_ macros makes new uses hard to spot. Fortunately, there's just one such macro left. Eliminate it with this coccinelle semantic patch:
@@
expression EP, E;
@@
-error_set(EP, QERR_DEVICE_NOT_FOUND, E)
+error_set(EP, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", E)--- backends/rng-egd.c | 3 ++- blockdev-nbd.c | 3 ++- blockdev.c | 33 ++++++++++++++++++++++----------- hmp.c | 6 ++++-- include/qapi/qmp/qerror.h | 3 --- net/net.c | 6 ++++-- qdev-monitor.c | 6 ++++-- qmp.c | 12 ++++++++---- qom/object.c | 6 ++++-- ui/input.c | 3 ++- 10 files changed, 52 insertions(+), 29 deletions(-)
backends/rng-egd.c +2 -1
@@ -147,7 +147,8 @@ static void rng_egd_opened(RngBackend *b, Error **errp) s->chr =qemu_chr_find (s->chr_name);if (s->chr ==NULL ) { -error_set (errp,QERR_DEVICE_NOT_FOUND , s->chr_name); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , s->chr_name);return ; }
blockdev-nbd.c +2 -1
@@ -91,7 +91,8 @@ void qmp_nbd_server_add(const char *device, bool has_writable, bool writable, blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return ; }if (!blk_is_inserted (blk)) {
blockdev.c +22 -11
@@ -1102,7 +1102,8 @@ SnapshotInfo *qmp_blockdev_snapshot_delete_internal_sync(const char *device, blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return NULL ; } bs =blk_bs (blk);
@@ -1291,7 +1292,8 @@ static void internal_snapshot_prepare(BlkTransactionState *common,/* 2. check for validation */ blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return ; } bs =blk_bs (blk);
@@ -1571,7 +1573,8 @@ static void drive_backup_prepare(BlkTransactionState *common, Error **errp) blk =blk_by_name (backup->device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , backup->device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , backup->device);return ; } bs =blk_bs (blk);
@@ -1841,7 +1844,8 @@ void qmp_eject(const char *device, bool has_force, bool force, Error **errp) blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return ; }
@@ -1901,7 +1905,8 @@ void qmp_change_blockdev(const char *device, const char *filename, blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return ; } bs =blk_bs (blk);
@@ -1960,7 +1965,8 @@ void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd, blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return ; } bs =blk_bs (blk);
@@ -2275,7 +2281,8 @@ void qmp_block_stream(const char *device, blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return ; } bs =blk_bs (blk);
@@ -2349,7 +2356,8 @@ void qmp_block_commit(const char *device,* scenario in which all optional arguments are omitted. */ blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return ; } bs =blk_bs (blk);
@@ -2461,7 +2469,8 @@ void qmp_drive_backup(const char *device, const char *target, blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return ; } bs =blk_bs (blk);
@@ -2675,7 +2684,8 @@ void qmp_drive_mirror(const char *device, const char *target, blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return ; } bs =blk_bs (blk);
@@ -2941,7 +2951,8 @@ void qmp_change_backing_file(const char *device, blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return ; } bs =blk_bs (blk);
hmp.c +4 -2
@@ -1863,7 +1863,8 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict)if (blk) {qemuio_command (blk, command); }else { -error_set (&err,QERR_DEVICE_NOT_FOUND , device); +error_set (&err,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device); }hmp_handle_error (mon, &err);
@@ -1991,7 +1992,8 @@ void hmp_qom_set(Monitor *mon, const QDict *qdict) obj =object_resolve_path (path, &ambiguous);if (obj ==NULL ) { -error_set (&err,QERR_DEVICE_NOT_FOUND , path); +error_set (&err,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , path); }else {if (ambiguous) {monitor_printf (mon,"Warning: Path '%s' is ambiguous\n" , path);
include/qapi/qmp/qerror.h +0 -3
@@ -55,9 +55,6 @@ void qerror_report_err(Error *err);#define QERR_DEVICE_NO_HOTPLUG \ ERROR_CLASS_GENERIC_ERROR, "Device '%s' does not support hotplugging" -#define QERR_DEVICE_NOT_FOUND \ - ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found" -#define QERR_FD_NOT_FOUND \ ERROR_CLASS_GENERIC_ERROR, "File descriptor named '%s' not found"
net/net.c +4 -2
@@ -1109,7 +1109,8 @@ void qmp_netdev_del(const char *id, Error **errp) nc =qemu_find_netdev (id);if (!nc) { -error_set (errp,QERR_DEVICE_NOT_FOUND , id); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , id);return ; }
@@ -1220,7 +1221,8 @@ void qmp_set_link(const char *name, bool up, Error **errp) MAX_QUEUE_NUM);if (queues ==0 ) { -error_set (errp,QERR_DEVICE_NOT_FOUND , name); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , name);return ; } nc = ncs[0 ];
qdev-monitor.c +4 -2
@@ -457,7 +457,8 @@ static BusState *qbus_find(const char *path, Error **errp) pos += len; dev =qbus_find_dev (bus, elem);if (!dev) { -error_set (errp,QERR_DEVICE_NOT_FOUND , elem); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , elem);#if 0 /* conversion from qerror_report() to error_set() broke this: */ if (!monitor_cur_is_qmp ()) {qbus_list_dev (bus);
@@ -793,7 +794,8 @@ void qmp_device_del(const char *id, Error **errp)g_free (path);if (!obj) { -error_set (errp,QERR_DEVICE_NOT_FOUND , id); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , id);return ; }
qmp.c +8 -4
@@ -206,7 +206,8 @@ ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)if (ambiguous) {error_setg (errp,"Path '%s' is ambiguous" , path); }else { -error_set (errp,QERR_DEVICE_NOT_FOUND , path); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , path); }return NULL ; }
@@ -236,7 +237,8 @@ int qmp_qom_set(Monitor *mon, const QDict *qdict, QObject **ret) obj =object_resolve_path (path,NULL );if (!obj) { -error_set (&local_err,QERR_DEVICE_NOT_FOUND , path); +error_set (&local_err,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , path); goto out; }
@@ -261,7 +263,8 @@ int qmp_qom_get(Monitor *mon, const QDict *qdict, QObject **ret) obj =object_resolve_path (path,NULL );if (!obj) { -error_set (&local_err,QERR_DEVICE_NOT_FOUND , path); +error_set (&local_err,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , path); goto out; }
@@ -518,7 +521,8 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename, klass =object_class_by_name (typename);if (klass ==NULL ) { -error_set (errp,QERR_DEVICE_NOT_FOUND , typename); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , typename);return NULL ; }
qom/object.c +4 -2
@@ -890,7 +890,8 @@ Object *object_property_get_link(Object *obj, const char *name,if (str && *str) { target =object_resolve_path (str,NULL );if (!target) { -error_set (errp,QERR_DEVICE_NOT_FOUND , str); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , str); } }
@@ -1170,7 +1171,8 @@ static Object *object_resolve_link(Object *obj, const char *name,if (target || ambiguous) {error_set (errp,QERR_INVALID_PARAMETER_TYPE , name, target_type); }else { -error_set (errp,QERR_DEVICE_NOT_FOUND , path); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , path); } target =NULL ; }
ui/input.c +2 -1
@@ -84,7 +84,8 @@ void qemu_input_handler_bind(QemuInputHandlerState *s, dev =qdev_find_recursive (sysbus_get_default (), device_id);if (dev ==NULL ) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device_id); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device_id);return ; }
Signature · 1 line
1.9.3
Re: [Qemu-devel] [PATCH 04/11] qerror: Eliminate QERR_DEVICE_NOT_FOUND
Quoted 12 lines · Markus Armbruster
Error classes other than
ERROR_CLASS_GENERIC_ERRORshould not be used in new code. Hiding them inQERR_macros makes new uses hard to spot. Fortunately, there's just one such macro left. Eliminate it with this coccinelle semantic patch:@@ expression EP, E; @@ -error_set(EP, QERR_DEVICE_NOT_FOUND, E) +error_set(EP, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", E)Signed-off-by Markus Armbruster <[email protected]>
Quoted 12 lines
--- backends/rng-egd.c | 3 ++- blockdev-nbd.c | 3 ++- blockdev.c | 33 ++++++++++++++++++++++----------- hmp.c | 6 ++++-- include/qapi/qmp/qerror.h | 3 --- net/net.c | 6 ++++-- qdev-monitor.c | 6 ++++-- qmp.c | 12 ++++++++---- qom/object.c | 6 ++++-- ui/input.c | 3 ++- 10 files changed, 52 insertions(+), 29 deletions(-)
Plain transformation would be closer to a 1:1 insertion/deletion count.
The larger insertion count is due to reflowing long lines after the
transformation. Does coccinelle do that for you, or do you have to touch things up manually? But I'm okay with the result.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH 04/11] qerror: Eliminate QERR_DEVICE_NOT_FOUND
Quoted 26 lines · Eric Blake
Quoted 12 lines · Markus Armbruster
Error classes other than
ERROR_CLASS_GENERIC_ERRORshould not be used in new code. Hiding them inQERR_macros makes new uses hard to spot. Fortunately, there's just one such macro left. Eliminate it with this coccinelle semantic patch:@@ expression EP, E; @@ -error_set(EP, QERR_DEVICE_NOT_FOUND, E) +error_set(EP, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", E)Signed-off-by Markus Armbruster <[email protected]>Quoted 12 lines
--- backends/rng-egd.c | 3 ++- blockdev-nbd.c | 3 ++- blockdev.c | 33 ++++++++++++++++++++++----------- hmp.c | 6 ++++-- include/qapi/qmp/qerror.h | 3 --- net/net.c | 6 ++++-- qdev-monitor.c | 6 ++++-- qmp.c | 12 ++++++++---- qom/object.c | 6 ++++-- ui/input.c | 3 ++- 10 files changed, 52 insertions(+), 29 deletions(-)
Quoted 4 lines
Plain transformation would be closer to a 1:1 insertion/deletion count.
The larger insertion count is due to reflowing long lines after the
transformation. Does coccinelle do that for you, or do you have to touch things up manually?
It does, and most of the time it's a relief.
Quoted 3 lines
But I'm okay with the result.
Reviewed-by Eric Blake <[email protected]>
Thanks!
Re: [Qemu-devel] [PATCH 04/11] qerror: Eliminate QERR_DEVICE_NOT_FOUND
In reply to Markus ArmbrusterQuoted 12 lines · Markus Armbruster
Error classes other than
ERROR_CLASS_GENERIC_ERRORshould not be used in new code. Hiding them inQERR_macros makes new uses hard to spot. Fortunately, there's just one such macro left. Eliminate it with this coccinelle semantic patch:@@ expression EP, E; @@ -error_set(EP, QERR_DEVICE_NOT_FOUND, E) +error_set(EP, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", E)Signed-off-by Markus Armbruster <[email protected]>
Quoted 12 lines
--- backends/rng-egd.c | 3 ++- blockdev-nbd.c | 3 ++- blockdev.c | 33 ++++++++++++++++++++++----------- hmp.c | 6 ++++-- include/qapi/qmp/qerror.h | 3 --- net/net.c | 6 ++++-- qdev-monitor.c | 6 ++++-- qmp.c | 12 ++++++++---- qom/object.c | 6 ++++-- ui/input.c | 3 ++- 10 files changed, 52 insertions(+), 29 deletions(-)
Re: [Qemu-devel] [PATCH 04/11] qerror: Eliminate QERR_DEVICE_NOT_FOUND
In reply to Markus ArmbrusterQuoted 10 lines · On Sat, 13 Jun 2015 16:20:51 +0200 Markus Armbruster <[email protected]> wrote:
Error classes other than
ERROR_CLASS_GENERIC_ERRORshould not be used in new code. Hiding them inQERR_macros makes new uses hard to spot. Fortunately, there's just one such macro left. Eliminate it with this coccinelle semantic patch:@@ expression EP, E; @@ -error_set(EP, QERR_DEVICE_NOT_FOUND, E) +error_set(EP, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", E)
This is a bit minor, but I think I'd have created a new function instead, say error_set_enodev(). This avoids all the duplication. But I'm not asking you to change, as the patch is good and this can be done in the future if we so want.
Quoted 325 lines
Signed-off-by Markus Armbruster <[email protected]>--- backends/rng-egd.c | 3 ++- blockdev-nbd.c | 3 ++- blockdev.c | 33 ++++++++++++++++++++++----------- hmp.c | 6 ++++-- include/qapi/qmp/qerror.h | 3 --- net/net.c | 6 ++++-- qdev-monitor.c | 6 ++++-- qmp.c | 12 ++++++++---- qom/object.c | 6 ++++-- ui/input.c | 3 ++- 10 files changed, 52 insertions(+), 29 deletions(-)backends/rng-egd.c +2
-1@@ -147,7 +147,8 @@ static void rng_egd_opened(RngBackend *b, Error **errp) s->chr =qemu_chr_find (s->chr_name);if (s->chr ==NULL ) { -error_set (errp,QERR_DEVICE_NOT_FOUND , s->chr_name); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , s->chr_name);return ; }blockdev-nbd.c +2
-1@@ -91,7 +91,8 @@ void qmp_nbd_server_add(const char *device, bool has_writable, bool writable, blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return ; }if (!blk_is_inserted (blk)) {blockdev.c +22
-11@@ -1102,7 +1102,8 @@ SnapshotInfo *qmp_blockdev_snapshot_delete_internal_sync(const char *device, blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return NULL ; } bs =blk_bs (blk);@@ -1291,7 +1292,8 @@ static void internal_snapshot_prepare(BlkTransactionState *common,/* 2. check for validation */ blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return ; } bs =blk_bs (blk);@@ -1571,7 +1573,8 @@ static void drive_backup_prepare(BlkTransactionState *common, Error **errp) blk =blk_by_name (backup->device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , backup->device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , backup->device);return ; } bs =blk_bs (blk);@@ -1841,7 +1844,8 @@ void qmp_eject(const char *device, bool has_force, bool force, Error **errp) blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return ; }@@ -1901,7 +1905,8 @@ void qmp_change_blockdev(const char *device, const char *filename, blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return ; } bs =blk_bs (blk);@@ -1960,7 +1965,8 @@ void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd, blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return ; } bs =blk_bs (blk);@@ -2275,7 +2281,8 @@ void qmp_block_stream(const char *device, blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return ; } bs =blk_bs (blk);@@ -2349,7 +2356,8 @@ void qmp_block_commit(const char *device,* scenario in which all optional arguments are omitted. */ blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return ; } bs =blk_bs (blk);@@ -2461,7 +2469,8 @@ void qmp_drive_backup(const char *device, const char *target, blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return ; } bs =blk_bs (blk);@@ -2675,7 +2684,8 @@ void qmp_drive_mirror(const char *device, const char *target, blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return ; } bs =blk_bs (blk);@@ -2941,7 +2951,8 @@ void qmp_change_backing_file(const char *device, blk =blk_by_name (device);if (!blk) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device);return ; } bs =blk_bs (blk);hmp.c +4
-2@@ -1863,7 +1863,8 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict)if (blk) {qemuio_command (blk, command); }else { -error_set (&err,QERR_DEVICE_NOT_FOUND , device); +error_set (&err,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device); }hmp_handle_error (mon, &err);@@ -1991,7 +1992,8 @@ void hmp_qom_set(Monitor *mon, const QDict *qdict) obj =object_resolve_path (path, &ambiguous);if (obj ==NULL ) { -error_set (&err,QERR_DEVICE_NOT_FOUND , path); +error_set (&err,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , path); }else {if (ambiguous) {monitor_printf (mon,"Warning: Path '%s' is ambiguous\n" , path);include/qapi/qmp/qerror.h +0
-3@@ -55,9 +55,6 @@ void qerror_report_err(Error *err);#define QERR_DEVICE_NO_HOTPLUG \ ERROR_CLASS_GENERIC_ERROR, "Device '%s' does not support hotplugging" -#define QERR_DEVICE_NOT_FOUND \ - ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found" -#define QERR_FD_NOT_FOUND \ ERROR_CLASS_GENERIC_ERROR, "File descriptor named '%s' not found"net/net.c +4
-2@@ -1109,7 +1109,8 @@ void qmp_netdev_del(const char *id, Error **errp) nc =qemu_find_netdev (id);if (!nc) { -error_set (errp,QERR_DEVICE_NOT_FOUND , id); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , id);return ; }@@ -1220,7 +1221,8 @@ void qmp_set_link(const char *name, bool up, Error **errp) MAX_QUEUE_NUM);if (queues ==0 ) { -error_set (errp,QERR_DEVICE_NOT_FOUND , name); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , name);return ; } nc = ncs[0 ];qdev-monitor.c +4
-2@@ -457,7 +457,8 @@ static BusState *qbus_find(const char *path, Error **errp) pos += len; dev =qbus_find_dev (bus, elem);if (!dev) { -error_set (errp,QERR_DEVICE_NOT_FOUND , elem); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , elem);#if 0 /* conversion from qerror_report() to error_set() broke this: */ if (!monitor_cur_is_qmp ()) {qbus_list_dev (bus);@@ -793,7 +794,8 @@ void qmp_device_del(const char *id, Error **errp)g_free (path);if (!obj) { -error_set (errp,QERR_DEVICE_NOT_FOUND , id); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , id);return ; }qmp.c +8
-4@@ -206,7 +206,8 @@ ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)if (ambiguous) {error_setg (errp,"Path '%s' is ambiguous" , path); }else { -error_set (errp,QERR_DEVICE_NOT_FOUND , path); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , path); }return NULL ; }@@ -236,7 +237,8 @@ int qmp_qom_set(Monitor *mon, const QDict *qdict, QObject **ret) obj =object_resolve_path (path,NULL );if (!obj) { -error_set (&local_err,QERR_DEVICE_NOT_FOUND , path); +error_set (&local_err,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , path); goto out; }@@ -261,7 +263,8 @@ int qmp_qom_get(Monitor *mon, const QDict *qdict, QObject **ret) obj =object_resolve_path (path,NULL );if (!obj) { -error_set (&local_err,QERR_DEVICE_NOT_FOUND , path); +error_set (&local_err,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , path); goto out; }@@ -518,7 +521,8 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename, klass =object_class_by_name (typename);if (klass ==NULL ) { -error_set (errp,QERR_DEVICE_NOT_FOUND , typename); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , typename);return NULL ; }qom/object.c +4
-2@@ -890,7 +890,8 @@ Object *object_property_get_link(Object *obj, const char *name,if (str && *str) { target =object_resolve_path (str,NULL );if (!target) { -error_set (errp,QERR_DEVICE_NOT_FOUND , str); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , str); } }@@ -1170,7 +1171,8 @@ static Object *object_resolve_link(Object *obj, const char *name,if (target || ambiguous) {error_set (errp,QERR_INVALID_PARAMETER_TYPE , name, target_type); }else { -error_set (errp,QERR_DEVICE_NOT_FOUND , path); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , path); } target =NULL ; }ui/input.c +2
-1@@ -84,7 +84,8 @@ void qemu_input_handler_bind(QemuInputHandlerState *s, dev =qdev_find_recursive (sysbus_get_default (), device_id);if (dev ==NULL ) { -error_set (errp,QERR_DEVICE_NOT_FOUND , device_id); +error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND , +"Device '%s' not found" , device_id);return ; }
Re: [Qemu-devel] [PATCH 04/11] qerror: Eliminate QERR_DEVICE_NOT_FOUND
Quoted 14 lines · Luiz Capitulino
Quoted 10 lines · On Sat, 13 Jun 2015 16:20:51 +0200 Markus Armbruster <[email protected]> wrote:
Error classes other than
ERROR_CLASS_GENERIC_ERRORshould not be used in new code. Hiding them inQERR_macros makes new uses hard to spot. Fortunately, there's just one such macro left. Eliminate it with this coccinelle semantic patch:@@ expression EP, E; @@ -error_set(EP, QERR_DEVICE_NOT_FOUND, E) +error_set(EP, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", E)
Quoted 4 lines
This is a bit minor, but I think I'd have created a new function instead, say
error_set_enodev(). This avoids all the duplication. But I'm not asking you to change, as the patch is good and this can be done in the future if we so want.
In fact, in both patch 4 and 5, I thought a similar thing - the remaining QERR_ macros that contain a % embedded in them are a bit unusual (when reading error_setg(), you have to go look up the QERR_ macro to see how many arguments you should really be passing). If I understand correctly, one of the reasons we went with QERR_ macros embedding % was to ensure consistent error messages among multiple call sites, in part if we want to enable error message translations (but that's a bigger project anyways, which you have argued that we may not even want).
Having helper functions for the more common error messages can both reduce confusion (no hidden %) and duplication (callers don't need to repeat the same string). But I likewise agree with Luiz that it can be deferred to the future if desired.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH 04/11] qerror: Eliminate QERR_DEVICE_NOT_FOUND
Quoted 30 lines · Eric Blake
Quoted 14 lines · Luiz Capitulino
Quoted 10 lines · On Sat, 13 Jun 2015 16:20:51 +0200 Markus Armbruster <[email protected]> wrote:
Error classes other than
ERROR_CLASS_GENERIC_ERRORshould not be used in new code. Hiding them inQERR_macros makes new uses hard to spot. Fortunately, there's just one such macro left. Eliminate it with this coccinelle semantic patch:@@ expression EP, E; @@ -error_set(EP, QERR_DEVICE_NOT_FOUND, E) +error_set(EP, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", E)Quoted 4 lines
This is a bit minor, but I think I'd have created a new function instead, say
error_set_enodev(). This avoids all the duplication. But I'm not asking you to change, as the patch is good and this can be done in the future if we so want.In fact, in both patch 4 and 5, I thought a similar thing - the remaining
QERR_macros that contain a % embedded in them are a bit unusual (when readingerror_setg(), you have to go look up theQERR_macro to see how many arguments you should really be passing). If I understand correctly, one of the reasons we went withQERR_macros embedding % was to ensure consistent error messages among multiple call sites, in part if we want to enable error message translations (but that's a bigger project anyways, which you have argued that we may not even want).
Quoted 4 lines
Having helper functions for the more common error messages can both reduce confusion (no hidden %) and duplication (callers don't need to repeat the same string). But I likewise agree with Luiz that it can be deferred to the future if desired.
My preferred solution is to have a helper function for the *action* rather than just its error. Not always practical.
Re: [Qemu-devel] [PATCH 04/11] qerror: Eliminate QERR_DEVICE_NOT_FOUND
In reply to Luiz CapitulinoQuoted 14 lines · Luiz Capitulino
Quoted 10 lines · On Sat, 13 Jun 2015 16:20:51 +0200 Markus Armbruster <[email protected]> wrote:
Error classes other than
ERROR_CLASS_GENERIC_ERRORshould not be used in new code. Hiding them inQERR_macros makes new uses hard to spot. Fortunately, there's just one such macro left. Eliminate it with this coccinelle semantic patch:@@ expression EP, E; @@ -error_set(EP, QERR_DEVICE_NOT_FOUND, E) +error_set(EP, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", E)
Quoted 4 lines
This is a bit minor, but I think I'd have created a new function instead, say
error_set_enodev(). This avoids all the duplication. But I'm not asking you to change, as the patch is good and this can be done in the future if we so want.
The thing about that kind of generic set-an-error function is that it encourages people to use it rather than providing an error message that's more specific and helpful for the particular situation. That might not be a problem in this patch (I haven't read it), but I mention it because I have a patch onlist elsewhere which undoes a bit of "generic error based on an errno" in favour of being more specific about why something didn't work.
thanks
-- PMM
Re: [Qemu-devel] [PATCH 04/11] qerror: Eliminate QERR_DEVICE_NOT_FOUND
Quoted 20 lines · Peter Maydell
Quoted 14 lines · Luiz Capitulino
Quoted 10 lines · On Sat, 13 Jun 2015 16:20:51 +0200 Markus Armbruster <[email protected]> wrote:
Error classes other than
ERROR_CLASS_GENERIC_ERRORshould not be used in new code. Hiding them inQERR_macros makes new uses hard to spot. Fortunately, there's just one such macro left. Eliminate it with this coccinelle semantic patch:@@ expression EP, E; @@ -error_set(EP, QERR_DEVICE_NOT_FOUND, E) +error_set(EP, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", E)Quoted 4 lines
This is a bit minor, but I think I'd have created a new function instead, say
error_set_enodev(). This avoids all the duplication. But I'm not asking you to change, as the patch is good and this can be done in the future if we so want.
Quoted 7 lines
The thing about that kind of generic set-an-error function is that it encourages people to use it rather than providing an error message that's more specific and helpful for the particular situation. That might not be a problem in this patch (I haven't read it), but I mention it because I have a patch onlist elsewhere which undoes a bit of "generic error based on an errno" in favour of being more specific about why something didn't work.
Observation seconded.
When creating bad error messages is easier or looks cleaner than creating good ones, you'll invariably end up with tons of bad ones.
Back when we still pursued the "rich" error objects mistake, we had "easier" on steroids: for a new error, you had to create a macro, maybe add an error class, edit a table, and then use the macro. Hard to blame anyone for "sod it, I'll just reuse an existing one."
Using a common error helper when it doesn't quite fit is a case of "looks cleaner". It's only (marginally) cleaner when it fits. But having one for the cases where it fits creates temptation for cases where it doesn't quite fit.
PATCH 5/11 qerror: Clean up QERR_ macros to expand into a single string
In reply to Markus ArmbrusterThese macros expand into error class enumeration constant, comma, string. Unclean. Has been that way since commit 13f59ae.
The error class is always ERROR_CLASS_GENERIC_ERROR since the previous commit.
Clean up as follows:
* Prepend every use of a QERR_ macro by ERROR_CLASS_GENERIC_ERROR, and delete it from the QERR_ macro. No change after preprocessing.
* Rewrite error_set(ERROR_CLASS_GENERIC_ERROR, ...) into error_setg(...). Again, no change after preprocessing.
--- backends/rng-egd.c | 8 ++--- backends/rng-random.c | 6 ++-- backends/rng.c | 2 +- backends/tpm.c | 2 +- balloon.c | 2 +- block.c | 2 +- block/backup.c | 4 +-- block/commit.c | 2 +- block/mirror.c | 8 ++--- block/qcow.c | 4 +-- block/qcow2.c | 4 +-- block/qed.c | 4 +-- block/quorum.c | 4 +-- block/snapshot.c | 4 +-- block/stream.c | 4 +-- block/vmdk.c | 12 ++++---- blockdev-nbd.c | 2 +- blockdev.c | 43 +++++++++++++------------- blockjob.c | 8 ++--- cpus.c | 8 ++--- dump.c | 12 ++++---- hmp.c | 10 +++--- hw/core/nmi.c | 2 +- hw/core/qdev-properties-system.c | 3 +- hw/core/qdev-properties.c | 12 ++++---- hw/core/qdev.c | 8 ++--- hw/intc/openpic.c | 6 ++-- hw/pci/pci-stub.c | 2 +- hw/ppc/spapr_pci.c | 8 ++--- hw/s390x/s390-virtio.c | 2 +- hw/usb/redirect.c | 6 ++-- include/qapi/qmp/qerror.h | 60 ++++++++++++++++++------------------ migration/migration.c | 35 ++++++++++----------- migration/savevm.c | 2 +- monitor.c | 66 ++++++++++++++++++++-------------------- net/net.c | 12 ++++---- qapi/opts-visitor.c | 24 +++++++-------- qapi/qapi-visit-core.c | 28 ++++++++--------- qapi/qmp-dispatch.c | 12 ++++---- qapi/qmp-input-visitor.c | 28 ++++++++--------- qapi/string-input-visitor.c | 24 +++++++-------- qdev-monitor.c | 12 ++++---- qemu-img.c | 2 +- qga/commands-posix.c | 40 ++++++++++++------------ qga/commands-win32.c | 66 ++++++++++++++++++++-------------------- qga/main.c | 4 +-- qmp.c | 34 ++++++++++----------- qom/object.c | 12 ++++---- stubs/arch-query-cpu-def.c | 2 +- target-i386/cpu.c | 19 ++++++------ tpm.c | 8 +++-- ui/vnc.c | 4 +-- util/qemu-option.c | 22 ++++++++------ 53 files changed, 362 insertions(+), 358 deletions(-)
backends/rng-egd.c +4 -4
@@ -140,8 +140,8 @@ static void rng_egd_opened(RngBackend *b, Error **errp)RngEgd *s =RNG_EGD (b);if (s->chr_name ==NULL ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , -"chardev" ,"a valid character device" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"chardev" , +"a valid character device" );return ; }
@@ -153,7 +153,7 @@ static void rng_egd_opened(RngBackend *b, Error **errp) }if (qemu_chr_fe_claim (s->chr) !=0 ) { -error_set (errp,QERR_DEVICE_IN_USE , s->chr_name); +error_setg (errp,QERR_DEVICE_IN_USE , s->chr_name);return ; }
@@ -168,7 +168,7 @@ static void rng_egd_set_chardev(Object *obj, const char *value, Error **errp)RngEgd *s =RNG_EGD (b);if (b->opened) { -error_set (errp,QERR_PERMISSION_DENIED ); +error_setg (errp,QERR_PERMISSION_DENIED ); }else {g_free (s->chr_name); s->chr_name =g_strdup (value);
backends/rng-random.c +3 -3
@@ -74,8 +74,8 @@ static void rng_random_opened(RngBackend *b, Error **errp)RndRandom *s =RNG_RANDOM (b);if (s->filename ==NULL ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , -"filename" ,"a valid filename" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"filename" , +"a valid filename" ); }else { s->fd =qemu_open (s->filename,O_RDONLY |O_NONBLOCK );if (s->fd ==-1 ) {
@@ -98,7 +98,7 @@ static void rng_random_set_filename(Object *obj, const char *filename,RndRandom *s =RNG_RANDOM (obj);if (b->opened) { -error_set (errp,QERR_PERMISSION_DENIED ); +error_setg (errp,QERR_PERMISSION_DENIED );return ; }
backends/rng.c +1 -1
@@ -57,7 +57,7 @@ static void rng_backend_prop_set_opened(Object *obj, bool value, Error **errp) }if (!value && s->opened) { -error_set (errp,QERR_PERMISSION_DENIED ); +error_setg (errp,QERR_PERMISSION_DENIED );return ; }
backends/tpm.c +1 -1
@@ -133,7 +133,7 @@ static void tpm_backend_prop_set_opened(Object *obj, bool value, Error **errp) }if (!value && s->opened) { -error_set (errp,QERR_PERMISSION_DENIED ); +error_setg (errp,QERR_PERMISSION_DENIED );return ; }
balloon.c +1 -1
@@ -96,7 +96,7 @@ void qmp_balloon(int64_t target, Error **errp) }if (target <=0 ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE ,"target" ,"a size" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"target" ,"a size" );return ; }
block.c +1 -1
@@ -2518,7 +2518,7 @@ void bdrv_add_key(BlockDriverState *bs, const char *key, Error **errp)error_setg (errp,"Node '%s' is not encrypted" ,bdrv_get_device_or_node_name (bs)); }else if (bdrv_set_key (bs, key) <0 ) { -error_set (errp,QERR_INVALID_PASSWORD ); +error_setg (errp,QERR_INVALID_PASSWORD ); } }else {if (bdrv_key_required (bs)) {
block/backup.c +2 -2
@@ -197,7 +197,7 @@ static void backup_set_speed(BlockJob *job, int64_t speed, Error **errp)BackupBlockJob *s =container_of (job, BackupBlockJob, common);if (speed <0 ) { -error_set (errp,QERR_INVALID_PARAMETER ,"speed" ); +error_setg (errp,QERR_INVALID_PARAMETER ,"speed" );return ; }ratelimit_set_speed (&s->limit, speed /BDRV_SECTOR_SIZE ,SLICE_TIME );
@@ -472,7 +472,7 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target,if ((on_source_error ==BLOCKDEV_ON_ERROR_STOP || on_source_error ==BLOCKDEV_ON_ERROR_ENOSPC ) && !bdrv_iostatus_is_enabled (bs)) { -error_set (errp,QERR_INVALID_PARAMETER ,"on-source-error" ); +error_setg (errp,QERR_INVALID_PARAMETER ,"on-source-error" );return ; }
block/commit.c +1 -1
@@ -186,7 +186,7 @@ static void commit_set_speed(BlockJob *job, int64_t speed, Error **errp)CommitBlockJob *s =container_of (job, CommitBlockJob, common);if (speed <0 ) { -error_set (errp,QERR_INVALID_PARAMETER ,"speed" ); +error_setg (errp,QERR_INVALID_PARAMETER ,"speed" );return ; }ratelimit_set_speed (&s->limit, speed /BDRV_SECTOR_SIZE ,SLICE_TIME );
block/mirror.c +4 -4
@@ -573,7 +573,7 @@ static void mirror_set_speed(BlockJob *job, int64_t speed, Error **errp)MirrorBlockJob *s =container_of (job, MirrorBlockJob, common);if (speed <0 ) { -error_set (errp,QERR_INVALID_PARAMETER ,"speed" ); +error_setg (errp,QERR_INVALID_PARAMETER ,"speed" );return ; }ratelimit_set_speed (&s->limit, speed /BDRV_SECTOR_SIZE ,SLICE_TIME );
@@ -598,8 +598,8 @@ static void mirror_complete(BlockJob *job, Error **errp)return ; }if (!s->synced) { -error_set (errp,QERR_BLOCK_JOB_NOT_READY , -bdrv_get_device_name (job->bs)); +error_setg (errp,QERR_BLOCK_JOB_NOT_READY , +bdrv_get_device_name (job->bs));return ; }
@@ -667,7 +667,7 @@ static void mirror_start_job(BlockDriverState *bs, BlockDriverState *target,if ((on_source_error ==BLOCKDEV_ON_ERROR_STOP || on_source_error ==BLOCKDEV_ON_ERROR_ENOSPC ) && !bdrv_iostatus_is_enabled (bs)) { -error_set (errp,QERR_INVALID_PARAMETER ,"on-source-error" ); +error_setg (errp,QERR_INVALID_PARAMETER ,"on-source-error" );return ; }
block/qcow.c +2 -2
@@ -123,8 +123,8 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,char version[64 ];snprintf (version,sizeof (version),"QCOW version %" PRIu32, header.version); -error_set (errp,QERR_UNKNOWN_BLOCK_FORMAT_FEATURE , -bdrv_get_device_or_node_name (bs),"qcow" , version); +error_setg (errp,QERR_UNKNOWN_BLOCK_FORMAT_FEATURE , +bdrv_get_device_or_node_name (bs),"qcow" , version); ret = -ENOTSUP ; goto fail; }
block/qcow2.c +2 -2
@@ -207,8 +207,8 @@ static void GCC_FMT_ATTR(3, 4) report_unsupported(BlockDriverState *bs,vsnprintf (msg,sizeof (msg), fmt, ap);va_end (ap); -error_set (errp,QERR_UNKNOWN_BLOCK_FORMAT_FEATURE , -bdrv_get_device_or_node_name (bs),"qcow2" , msg); +error_setg (errp,QERR_UNKNOWN_BLOCK_FORMAT_FEATURE , +bdrv_get_device_or_node_name (bs),"qcow2" , msg); } static void report_unsupported_feature(BlockDriverState *bs,
block/qed.c +2 -2
@@ -407,8 +407,8 @@ static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags,char buf[64 ];snprintf (buf,sizeof (buf),"%" PRIx64, s->header.features & ~QED_FEATURE_MASK ); -error_set (errp,QERR_UNKNOWN_BLOCK_FORMAT_FEATURE , -bdrv_get_device_or_node_name (bs),"QED" , buf); +error_setg (errp,QERR_UNKNOWN_BLOCK_FORMAT_FEATURE , +bdrv_get_device_or_node_name (bs),"QED" , buf);return -ENOTSUP ; }if (!qed_is_cluster_size_valid (s->header.cluster_size)) {
block/quorum.c +2 -2
@@ -800,8 +800,8 @@ static int quorum_valid_threshold(int threshold, int num_children, Error **errp) {if (threshold <1 ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , -"vote-threshold" ,"value >= 1" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"vote-threshold" , +"value >= 1" );return -ERANGE ; }
block/snapshot.c +2 -2
@@ -229,7 +229,7 @@ int bdrv_snapshot_delete(BlockDriverState *bs, {BlockDriver *drv = bs->drv;if (!drv) { -error_set (errp,QERR_DEVICE_HAS_NO_MEDIUM ,bdrv_get_device_name (bs)); +error_setg (errp,QERR_DEVICE_HAS_NO_MEDIUM ,bdrv_get_device_name (bs));return -ENOMEDIUM ; }if (!snapshot_id && !name) {
@@ -315,7 +315,7 @@ int bdrv_snapshot_load_tmp(BlockDriverState *bs,BlockDriver *drv = bs->drv;if (!drv) { -error_set (errp,QERR_DEVICE_HAS_NO_MEDIUM ,bdrv_get_device_name (bs)); +error_setg (errp,QERR_DEVICE_HAS_NO_MEDIUM ,bdrv_get_device_name (bs));return -ENOMEDIUM ; }if (!snapshot_id && !name) {
block/stream.c +2 -2
@@ -227,7 +227,7 @@ static void stream_set_speed(BlockJob *job, int64_t speed, Error **errp)StreamBlockJob *s =container_of (job, StreamBlockJob, common);if (speed <0 ) { -error_set (errp,QERR_INVALID_PARAMETER ,"speed" ); +error_setg (errp,QERR_INVALID_PARAMETER ,"speed" );return ; }ratelimit_set_speed (&s->limit, speed /BDRV_SECTOR_SIZE ,SLICE_TIME );
@@ -250,7 +250,7 @@ void stream_start(BlockDriverState *bs, BlockDriverState *base,if ((on_error ==BLOCKDEV_ON_ERROR_STOP || on_error ==BLOCKDEV_ON_ERROR_ENOSPC ) && !bdrv_iostatus_is_enabled (bs)) { -error_set (errp,QERR_INVALID_PARAMETER ,"on-error" ); +error_setg (errp,QERR_INVALID_PARAMETER ,"on-error" );return ; }
block/vmdk.c +6 -6
@@ -669,8 +669,8 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,char buf[64 ];snprintf (buf,sizeof (buf),"VMDK version %" PRId32,le32_to_cpu (header.version)); -error_set (errp,QERR_UNKNOWN_BLOCK_FORMAT_FEATURE , -bdrv_get_device_or_node_name (bs),"vmdk" , buf); +error_setg (errp,QERR_UNKNOWN_BLOCK_FORMAT_FEATURE , +bdrv_get_device_or_node_name (bs),"vmdk" , buf);return -ENOTSUP ; }else if (le32_to_cpu (header.version) ==3 && (flags &BDRV_O_RDWR )) {/* VMware KB 2064959 explains that version 3 added support for
@@ -1700,12 +1700,12 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,/* write all the data */ ret =bdrv_pwrite (bs,0 , &magic,sizeof (magic));if (ret <0 ) { -error_set (errp,QERR_IO_ERROR ); +error_setg (errp,QERR_IO_ERROR ); goto exit; } ret =bdrv_pwrite (bs,sizeof (magic), &header,sizeof (header));if (ret <0 ) { -error_set (errp,QERR_IO_ERROR ); +error_setg (errp,QERR_IO_ERROR ); goto exit; }
@@ -1725,7 +1725,7 @@ static int vmdk_create_extent(const char *filename, int64_t filesize, ret =bdrv_pwrite (bs,le64_to_cpu (header.rgd_offset) *BDRV_SECTOR_SIZE , gd_buf, gd_buf_size);if (ret <0 ) { -error_set (errp,QERR_IO_ERROR ); +error_setg (errp,QERR_IO_ERROR ); goto exit; }
@@ -1737,7 +1737,7 @@ static int vmdk_create_extent(const char *filename, int64_t filesize, ret =bdrv_pwrite (bs,le64_to_cpu (header.gd_offset) *BDRV_SECTOR_SIZE , gd_buf, gd_buf_size);if (ret <0 ) { -error_set (errp,QERR_IO_ERROR ); +error_setg (errp,QERR_IO_ERROR ); goto exit; }
blockdev-nbd.c +1 -1
@@ -96,7 +96,7 @@ void qmp_nbd_server_add(const char *device, bool has_writable, bool writable,return ; }if (!blk_is_inserted (blk)) { -error_set (errp,QERR_DEVICE_HAS_NO_MEDIUM , device); +error_setg (errp,QERR_DEVICE_HAS_NO_MEDIUM , device);return ; }
blockdev.c +22 -21
150 lines not on this page · raw message
blockjob.c +4 -4
@@ -42,7 +42,7 @@ void *block_job_create(const BlockJobDriver *driver, BlockDriverState *bs,BlockJob *job;if (bs->job) { -error_set (errp,QERR_DEVICE_IN_USE ,bdrv_get_device_name (bs)); +error_setg (errp,QERR_DEVICE_IN_USE ,bdrv_get_device_name (bs));return NULL ; }bdrv_ref (bs);
@@ -93,7 +93,7 @@ void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp)Error *local_err =NULL ;if (!job->driver->set_speed) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED );return ; } job->driver->set_speed (job, speed, &local_err);
@@ -108,8 +108,8 @@ void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp)void block_job_complete (BlockJob *job,Error **errp) {if (job->pause_count || job->cancelled || !job->driver->complete) { -error_set (errp,QERR_BLOCK_JOB_NOT_READY , -bdrv_get_device_name (job->bs)); +error_setg (errp,QERR_BLOCK_JOB_NOT_READY , +bdrv_get_device_name (job->bs));return ; }
cpus.c +4 -4
@@ -1512,8 +1512,8 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename, cpu =qemu_get_cpu (cpu_index);if (cpu ==NULL ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE ,"cpu-index" , -"a CPU number" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"cpu-index" , +"a CPU number" );return ; }
@@ -1533,7 +1533,7 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename, goto exit; }if (fwrite (buf,1 , l, f) != l) { -error_set (errp,QERR_IO_ERROR ); +error_setg (errp,QERR_IO_ERROR ); goto exit; } addr += l;
@@ -1563,7 +1563,7 @@ void qmp_pmemsave(int64_t addr, int64_t size, const char *filename, l = size;cpu_physical_memory_read (addr, buf, l);if (fwrite (buf,1 , l, f) != l) { -error_set (errp,QERR_IO_ERROR ); +error_setg (errp,QERR_IO_ERROR ); goto exit; } addr += l;
dump.c +6 -6
@@ -1474,7 +1474,7 @@ static void dump_init(DumpState *s, int fd, bool has_format, s->start =get_start_block (s);if (s->start ==-1 ) { -error_set (errp,QERR_INVALID_PARAMETER ,"begin" ); +error_setg (errp,QERR_INVALID_PARAMETER ,"begin" ); goto cleanup; }
@@ -1484,14 +1484,14 @@ static void dump_init(DumpState *s, int fd, bool has_format,*/ ret =cpu_get_dump_info (&s->dump_info, &s->guest_phys_blocks);if (ret <0 ) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED ); goto cleanup; } s->note_size =cpu_get_note_size (s->dump_info.d_class, s->dump_info.d_machine, nr_cpus);if (s->note_size <0 ) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED ); goto cleanup; }
@@ -1615,11 +1615,11 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,return ; }if (has_begin && !has_length) { -error_set (errp,QERR_MISSING_PARAMETER ,"length" ); +error_setg (errp,QERR_MISSING_PARAMETER ,"length" );return ; }if (!has_begin && has_length) { -error_set (errp,QERR_MISSING_PARAMETER ,"begin" ); +error_setg (errp,QERR_MISSING_PARAMETER ,"begin" );return ; }
@@ -1656,7 +1656,7 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin, }if (fd ==-1 ) { -error_set (errp,QERR_INVALID_PARAMETER ,"protocol" ); +error_setg (errp,QERR_INVALID_PARAMETER ,"protocol" );return ; }
hmp.c +5 -5
@@ -1043,7 +1043,7 @@ void hmp_drive_mirror(Monitor *mon, const QDict *qdict)Error *err =NULL ;if (!filename) { -error_set (&err,QERR_MISSING_PARAMETER ,"target" ); +error_setg (&err,QERR_MISSING_PARAMETER ,"target" );hmp_handle_error (mon, &err);return ; }
@@ -1073,7 +1073,7 @@ void hmp_drive_backup(Monitor *mon, const QDict *qdict)Error *err =NULL ;if (!filename) { -error_set (&err,QERR_MISSING_PARAMETER ,"target" ); +error_setg (&err,QERR_MISSING_PARAMETER ,"target" );hmp_handle_error (mon, &err);return ; }
@@ -1103,7 +1103,7 @@ void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict)if (!filename) {/* In the future, if 'snapshot-file' is not specified, the snapshot will be taken internally. Today it's actually required. */ -error_set (&err,QERR_MISSING_PARAMETER ,"snapshot-file" ); +error_setg (&err,QERR_MISSING_PARAMETER ,"snapshot-file" );hmp_handle_error (mon, &err);return ; }
@@ -1198,7 +1198,7 @@ void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict) }if (i ==MIGRATION_CAPABILITY_MAX ) { -error_set (&err,QERR_INVALID_PARAMETER , cap); +error_setg (&err,QERR_INVALID_PARAMETER , cap); }qapi_free_MigrationCapabilityStatusList (caps);
@@ -1242,7 +1242,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict) }if (i ==MIGRATION_PARAMETER_MAX ) { -error_set (&err,QERR_INVALID_PARAMETER , param); +error_setg (&err,QERR_INVALID_PARAMETER , param); }if (err) {
hw/core/nmi.c +1 -1
@@ -66,7 +66,7 @@ void nmi_monitor_handle(int cpu_index, Error **errp)if (ns.handled) {error_propagate (errp, ns.errp); }else { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED ); } }
hw/core/qdev-properties-system.c +1 -2
@@ -326,8 +326,7 @@ static void set_vlan(Object *obj, Visitor *v, void *opaque, hubport =net_hub_port_find (id);if (!hubport) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , - name, prop->info->name); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE , name, prop->info->name);return ; } *ptr = hubport;
hw/core/qdev-properties.c +6 -6
@@ -570,8 +570,8 @@ static void set_pci_devfn(Object *obj, Visitor *v, void *opaque,if (local_err) {error_propagate (errp, local_err); }else if (value <-1 || value >255 ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , name ? name :"null" , -"pci_devfn" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE , + name ? name :"null" ,"pci_devfn" ); }else { *ptr = value; }
@@ -640,8 +640,8 @@ static void set_blocksize(Object *obj, Visitor *v, void *opaque, }/* value of 0 means "unset" */ if (value && (value < min || value > max)) { -error_set (errp,QERR_PROPERTY_VALUE_OUT_OF_RANGE , - dev->id?:"" , name, (int64_t )value, min, max); +error_setg (errp,QERR_PROPERTY_VALUE_OUT_OF_RANGE , dev->id ? :"" , + name, (int64_t )value, min, max);return ; }
@@ -923,8 +923,8 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev,break ;default :case -EINVAL : -error_set (errp,QERR_PROPERTY_VALUE_BAD , -object_get_typename (OBJECT (dev)), prop->name, value); +error_setg (errp,QERR_PROPERTY_VALUE_BAD , +object_get_typename (OBJECT (dev)), prop->name, value);break ;case -ENOENT : error_setg(errp, "Property '%s.%s' can't find value '%s'",
hw/core/qdev.c +4 -4
@@ -276,13 +276,13 @@ void qdev_unplug(DeviceState *dev, Error **errp)HotplugHandlerClass *hdc;if (dev->parent_bus && !qbus_is_hotpluggable (dev->parent_bus)) { -error_set (errp,QERR_BUS_NO_HOTPLUG , dev->parent_bus->name); +error_setg (errp,QERR_BUS_NO_HOTPLUG , dev->parent_bus->name);return ; }if (!dc->hotpluggable) { -error_set (errp,QERR_DEVICE_NO_HOTPLUG , -object_get_typename (OBJECT (dev))); +error_setg (errp,QERR_DEVICE_NO_HOTPLUG , +object_get_typename (OBJECT (dev)));return ; }
@@ -1024,7 +1024,7 @@ static void device_set_realized(Object *obj, bool value, Error **errp)Error *local_err =NULL ;if (dev->hotplugged && !dc->hotpluggable) { -error_set (errp,QERR_DEVICE_NO_HOTPLUG ,object_get_typename (obj)); +error_setg (errp,QERR_DEVICE_NO_HOTPLUG ,object_get_typename (obj));return ; }
hw/intc/openpic.c +3 -3
@@ -1556,9 +1556,9 @@ static void openpic_realize(DeviceState *dev, Error **errp) };if (opp->nb_cpus >MAX_CPU ) { -error_set (errp,QERR_PROPERTY_VALUE_OUT_OF_RANGE , -TYPE_OPENPIC ,"nb_cpus" , (uint64_t )opp->nb_cpus, - (uint64_t )0 , (uint64_t )MAX_CPU ); +error_setg (errp,QERR_PROPERTY_VALUE_OUT_OF_RANGE ,TYPE_OPENPIC , +"nb_cpus" , (uint64_t )opp->nb_cpus, (uint64_t )0 , + (uint64_t )MAX_CPU );return ; }
hw/pci/pci-stub.c +1 -1
@@ -25,7 +25,7 @@PciInfoList *qmp_query_pci (Error **errp) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED );return NULL ; }
hw/ppc/spapr_pci.c +4 -4
@@ -1062,8 +1062,8 @@ static void spapr_phb_hot_plug_child(HotplugHandler *plug_handler,* we need to let them know it's not enabled */ if (plugged_dev->hotplugged) { -error_set (errp,QERR_BUS_NO_HOTPLUG , -object_get_typename (OBJECT (phb))); +error_setg (errp,QERR_BUS_NO_HOTPLUG , +object_get_typename (OBJECT (phb))); }return ; }
@@ -1090,8 +1090,8 @@ static void spapr_phb_hot_unplug_child(HotplugHandler *plug_handler,Error *local_err =NULL ;if (!phb->dr_enabled) { -error_set (errp,QERR_BUS_NO_HOTPLUG , -object_get_typename (OBJECT (phb))); +error_setg (errp,QERR_BUS_NO_HOTPLUG , +object_get_typename (OBJECT (phb)));return ; }
hw/s390x/s390-virtio.c +1 -1
@@ -324,7 +324,7 @@ void s390_nmi(NMIState *n, int cpu_index, Error **errp)CPUState *cs =qemu_get_cpu (cpu_index);if (s390_cpu_restart (S390_CPU (cs))) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED ); } }
hw/usb/redirect.c +3 -3
@@ -1369,7 +1369,7 @@ static void usbredir_realize(USBDevice *udev, Error **errp)int i;if (dev->cs ==NULL ) { -error_set (errp,QERR_MISSING_PARAMETER ,"chardev" ); +error_setg (errp,QERR_MISSING_PARAMETER ,"chardev" );return ; }
@@ -1378,8 +1378,8 @@ static void usbredir_realize(USBDevice *udev, Error **errp) &dev->filter_rules, &dev->filter_rules_count);if (i) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE ,"filter" , -"a usb device filter string" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"filter" , +"a usb device filter string" );return ; } }
include/qapi/qmp/qerror.h +30 -30
123 lines not on this page · raw message
migration/migration.c +18 -17
@@ -337,7 +337,7 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,if (s->state ==MIGRATION_STATUS_ACTIVE || s->state ==MIGRATION_STATUS_SETUP ) { -error_set (errp,QERR_MIGRATION_ACTIVE ); +error_setg (errp,QERR_MIGRATION_ACTIVE );return ; }
@@ -356,22 +356,22 @@ void qmp_migrate_set_parameters(bool has_compress_level,MigrationState *s =migrate_get_current ();if (has_compress_level && (compress_level <0 || compress_level >9 )) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE ,"compress_level" , -"is invalid, it should be in the range of 0 to 9" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"compress_level" , +"is invalid, it should be in the range of 0 to 9" );return ; }if (has_compress_threads && (compress_threads <1 || compress_threads >255 )) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , -"compress_threads" , -"is invalid, it should be in the range of 1 to 255" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE , +"compress_threads" , +"is invalid, it should be in the range of 1 to 255" );return ; }if (has_decompress_threads && (decompress_threads <1 || decompress_threads >255 )) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , -"decompress_threads" , -"is invalid, it should be in the range of 1 to 255" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE , +"decompress_threads" , +"is invalid, it should be in the range of 1 to 255" );return ; }
@@ -573,7 +573,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,if (s->state ==MIGRATION_STATUS_ACTIVE || s->state ==MIGRATION_STATUS_SETUP || s->state ==MIGRATION_STATUS_CANCELLING ) { -error_set (errp,QERR_MIGRATION_ACTIVE ); +error_setg (errp,QERR_MIGRATION_ACTIVE );return ; }
@@ -608,7 +608,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,fd_start_outgoing_migration (s, p, &local_err);#endif }else { -error_set (errp,QERR_INVALID_PARAMETER_VALUE ,"uri" ,"a valid migration protocol" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"uri" , +"a valid migration protocol" ); s->state =MIGRATION_STATUS_FAILED ;return ; }
@@ -632,22 +633,22 @@ void qmp_migrate_set_cache_size(int64_t value, Error **errp)/* Check for truncation */ if (value != (size_t )value) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE ,"cache size" , -"exceeding address space" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"cache size" , +"exceeding address space" );return ; }/* Cache should not be larger than guest ram size */ if (value >ram_bytes_total ()) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE ,"cache size" , -"exceeds guest ram size " ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"cache size" , +"exceeds guest ram size " );return ; } new_size =xbzrle_cache_resize (value);if (new_size <0 ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE ,"cache size" , -"is smaller than page size" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"cache size" , +"is smaller than page size" );return ; }
migration/savevm.c +1 -1
@@ -1307,7 +1307,7 @@ void qmp_xen_save_devices_state(const char *filename, Error **errp) ret =qemu_save_device_state (f);qemu_fclose (f);if (ret <0 ) { -error_set (errp,QERR_IO_ERROR ); +error_setg (errp,QERR_IO_ERROR ); } the_end:
monitor.c +33 -33
204 lines not on this page · raw message
net/net.c +6 -6
@@ -927,16 +927,16 @@ static int net_client_init1(const void *object, int is_netdev, Error **errp)break ;default : -error_set (errp,QERR_INVALID_PARAMETER_VALUE ,"type" , -"a netdev backend type" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"type" , +"a netdev backend type" );return -1 ; } }else { u.net = object; opts = u.net->opts;if (opts->kind ==NET_CLIENT_OPTIONS_KIND_HUBPORT ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE ,"type" , -"a net type" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"type" , +"a net type" );return -1 ; }/* missing optional values have been initialized to "all bits zero" */
@@ -957,8 +957,8 @@ static int net_client_init1(const void *object, int is_netdev, Error **errp)if (net_client_init_fun[opts->kind](opts, name, peer, errp) <0 ) {/* FIXME drop when all init functions store an Error */ if (errp && !*errp) { -error_set (errp,QERR_DEVICE_INIT_FAILED , - NetClientOptionsKind_lookup[opts->kind]); +error_setg (errp,QERR_DEVICE_INIT_FAILED , + NetClientOptionsKind_lookup[opts->kind]); }return -1 ; }
qapi/opts-visitor.c +12 -12
@@ -173,7 +173,7 @@ opts_end_struct(Visitor *v, Error **errp)const QemuOpt *first; first =g_queue_peek_head (any); -error_set (errp,QERR_INVALID_PARAMETER , first->name); +error_setg (errp,QERR_INVALID_PARAMETER , first->name); }g_hash_table_destroy (ov->unprocessed_opts); ov->unprocessed_opts =NULL ;
@@ -193,7 +193,7 @@ lookup_distinct(const OptsVisitor *ov, const char *name, Error **errp) list =g_hash_table_lookup (ov->unprocessed_opts, name);if (!list) { -error_set (errp,QERR_MISSING_PARAMETER , name); +error_setg (errp,QERR_MISSING_PARAMETER , name); }return list; }
@@ -341,8 +341,8 @@ opts_type_bool(Visitor *v, bool *obj, const char *name, Error **errp) strcmp(opt->str, "n") == 0) { *obj = false; }else { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , opt->name, -"on|yes|y|off|no|n" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE , opt->name, +"on|yes|y|off|no|n" );return ; } } else {
@@ -403,9 +403,9 @@ opts_type_int(Visitor *v, int64_t *obj, const char *name, Error **errp) } } } -error_set (errp,QERR_INVALID_PARAMETER_VALUE , opt->name, - (ov->list_mode ==LM_NONE ) ?"an int64 value" : -"an int64 value or range" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE , opt->name, + (ov->list_mode ==LM_NONE ) ?"an int64 value" : +"an int64 value or range" ); }
@@ -455,9 +455,9 @@ opts_type_uint64(Visitor *v, uint64_t *obj, const char *name, Error **errp) } } } -error_set (errp,QERR_INVALID_PARAMETER_VALUE , opt->name, - (ov->list_mode ==LM_NONE ) ?"a uint64 value" : -"a uint64 value or range" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE , opt->name, + (ov->list_mode ==LM_NONE ) ?"a uint64 value" : +"a uint64 value or range" ); }
@@ -477,8 +477,8 @@ opts_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp) val =strtosz_suffix (opt->str ? opt->str :"" , &endptr,STRTOSZ_DEFSUFFIX_B );if (val <0 || *endptr) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , opt->name, -"a size value representible as a non-negative int64" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE , opt->name, +"a size value representible as a non-negative int64" );return ; }
qapi/qapi-visit-core.c +14 -14
@@ -110,8 +110,8 @@ void visit_type_uint8(Visitor *v, uint8_t *obj, const char *name, Error **errp) value = *obj; v->type_int (v, &value, name, errp);if (value <0 || value >UINT8_MAX ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , name ? name :"null" , -"uint8_t" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE , + name ? name :"null" ,"uint8_t" );return ; } *obj = value;
@@ -128,8 +128,8 @@ void visit_type_uint16(Visitor *v, uint16_t *obj, const char *name, Error **errp value = *obj; v->type_int (v, &value, name, errp);if (value <0 || value >UINT16_MAX ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , name ? name :"null" , -"uint16_t" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE , + name ? name :"null" ,"uint16_t" );return ; } *obj = value;
@@ -146,8 +146,8 @@ void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name, Error **errp value = *obj; v->type_int (v, &value, name, errp);if (value <0 || value >UINT32_MAX ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , name ? name :"null" , -"uint32_t" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE , + name ? name :"null" ,"uint32_t" );return ; } *obj = value;
@@ -177,8 +177,8 @@ void visit_type_int8(Visitor *v, int8_t *obj, const char *name, Error **errp) value = *obj; v->type_int (v, &value, name, errp);if (value <INT8_MIN || value >INT8_MAX ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , name ? name :"null" , -"int8_t" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE , + name ? name :"null" ,"int8_t" );return ; } *obj = value;
@@ -195,8 +195,8 @@ void visit_type_int16(Visitor *v, int16_t *obj, const char *name, Error **errp) value = *obj; v->type_int (v, &value, name, errp);if (value <INT16_MIN || value >INT16_MAX ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , name ? name :"null" , -"int16_t" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE , + name ? name :"null" ,"int16_t" );return ; } *obj = value;
@@ -213,8 +213,8 @@ void visit_type_int32(Visitor *v, int32_t *obj, const char *name, Error **errp) value = *obj; v->type_int (v, &value, name, errp);if (value <INT32_MIN || value >INT32_MAX ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , name ? name :"null" , -"int32_t" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE , + name ? name :"null" ,"int32_t" );return ; } *obj = value;
@@ -271,7 +271,7 @@ void output_type_enum(Visitor *v, int *obj, const char *strings[],assert (strings);while (strings[i++] !=NULL );if (value <0 || value >= i -1 ) { -error_set (errp,QERR_INVALID_PARAMETER , name ? name :"null" ); +error_setg (errp,QERR_INVALID_PARAMETER , name ? name :"null" );return ; }
@@ -303,7 +303,7 @@ void input_type_enum(Visitor *v, int *obj, const char *strings[], }if (strings[value] ==NULL ) { -error_set (errp,QERR_INVALID_PARAMETER , enum_str); +error_setg (errp,QERR_INVALID_PARAMETER , enum_str);g_free (enum_str);return ; }
qapi/qmp-dispatch.c +6 -6
@@ -27,8 +27,8 @@ static QDict *qmp_dispatch_check_obj(const QObject *request, Error **errp)QDict *dict =NULL ;if (qobject_type (request) !=QTYPE_QDICT ) { -error_set (errp,QERR_QMP_BAD_INPUT_OBJECT , -"request is not a dictionary" ); +error_setg (errp,QERR_QMP_BAD_INPUT_OBJECT , +"request is not a dictionary" );return NULL ; }
@@ -41,19 +41,19 @@ static QDict *qmp_dispatch_check_obj(const QObject *request, Error **errp)if (!strcmp (arg_name,"execute" )) {if (qobject_type (arg_obj) !=QTYPE_QSTRING ) { -error_set (errp,QERR_QMP_BAD_INPUT_OBJECT_MEMBER ,"execute" , -"string" ); +error_setg (errp,QERR_QMP_BAD_INPUT_OBJECT_MEMBER ,"execute" , +"string" );return NULL ; } has_exec_key = true; }else if (strcmp (arg_name,"arguments" )) { -error_set (errp,QERR_QMP_EXTRA_MEMBER , arg_name); +error_setg (errp,QERR_QMP_EXTRA_MEMBER , arg_name);return NULL ; } }if (!has_exec_key) { -error_set (errp,QERR_QMP_BAD_INPUT_OBJECT ,"execute" ); +error_setg (errp,QERR_QMP_BAD_INPUT_OBJECT ,"execute" );return NULL ; }
qapi/qmp-input-visitor.c +14 -14
@@ -105,7 +105,7 @@ static void qmp_input_pop(QmpInputVisitor *qiv, Error **errp)if (g_hash_table_size (top_ht)) {const char *key;g_hash_table_find (top_ht, always_true, &key); -error_set (errp,QERR_QMP_EXTRA_MEMBER , key); +error_setg (errp,QERR_QMP_EXTRA_MEMBER , key); }g_hash_table_unref (top_ht); }
@@ -122,8 +122,8 @@ static void qmp_input_start_struct(Visitor *v, void **obj, const char *kind,Error *err =NULL ;if (!qobj ||qobject_type (qobj) !=QTYPE_QDICT ) { -error_set (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , -"QDict" ); +error_setg (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , +"QDict" );return ; }
@@ -163,8 +163,8 @@ static void qmp_input_start_list(Visitor *v, const char *name, Error **errp)QObject *qobj =qmp_input_get_object (qiv, name, true);if (!qobj ||qobject_type (qobj) !=QTYPE_QLIST ) { -error_set (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , -"list" ); +error_setg (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , +"list" );return ; }
@@ -215,7 +215,7 @@ static void qmp_input_get_next_type(Visitor *v, int *kind, const int *qobjects,QObject *qobj =qmp_input_get_object (qiv, name, false);if (!qobj) { -error_set (errp,QERR_MISSING_PARAMETER , name ? name :"null" ); +error_setg (errp,QERR_MISSING_PARAMETER , name ? name :"null" );return ; } *kind = qobjects[qobject_type (qobj)];
@@ -228,8 +228,8 @@ static void qmp_input_type_int(Visitor *v, int64_t *obj, const char *name,QObject *qobj =qmp_input_get_object (qiv, name, true);if (!qobj ||qobject_type (qobj) !=QTYPE_QINT ) { -error_set (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , -"integer" ); +error_setg (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , +"integer" );return ; }
@@ -243,8 +243,8 @@ static void qmp_input_type_bool(Visitor *v, bool *obj, const char *name,QObject *qobj =qmp_input_get_object (qiv, name, true);if (!qobj ||qobject_type (qobj) !=QTYPE_QBOOL ) { -error_set (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , -"boolean" ); +error_setg (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , +"boolean" );return ; }
@@ -258,8 +258,8 @@ static void qmp_input_type_str(Visitor *v, char **obj, const char *name,QObject *qobj =qmp_input_get_object (qiv, name, true);if (!qobj ||qobject_type (qobj) !=QTYPE_QSTRING ) { -error_set (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , -"string" ); +error_setg (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , +"string" );return ; }
@@ -274,8 +274,8 @@ static void qmp_input_type_number(Visitor *v, double *obj, const char *name,if (!qobj || (qobject_type (qobj) !=QTYPE_QFLOAT &&qobject_type (qobj) !=QTYPE_QINT )) { -error_set (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , -"number" ); +error_setg (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , +"number" );return ; }
qapi/string-input-visitor.c +12 -12
@@ -185,8 +185,8 @@ static void parse_type_int(Visitor *v, int64_t *obj, const char *name,StringInputVisitor *siv =DO_UPCAST (StringInputVisitor, visitor, v);if (!siv->string) { -error_set (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , -"integer" ); +error_setg (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , +"integer" );return ; }
@@ -217,8 +217,8 @@ static void parse_type_int(Visitor *v, int64_t *obj, const char *name,return ; error: -error_set (errp,QERR_INVALID_PARAMETER_VALUE , name, -"an int64 value or range" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE , name, +"an int64 value or range" ); } static void parse_type_size(Visitor *v, uint64_t *obj, const char *name,
@@ -231,8 +231,8 @@ static void parse_type_size(Visitor *v, uint64_t *obj, const char *name,if (siv->string) {parse_option_size (name, siv->string, &val, &err); }else { -error_set (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , -"size" ); +error_setg (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , +"size" );return ; }if (err) {
@@ -263,8 +263,8 @@ static void parse_type_bool(Visitor *v, bool *obj, const char *name, } } -error_set (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , -"boolean" ); +error_setg (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , +"boolean" ); } static void parse_type_str(Visitor *v, char **obj, const char *name,
@@ -274,8 +274,8 @@ static void parse_type_str(Visitor *v, char **obj, const char *name,if (siv->string) { *obj =g_strdup (siv->string); }else { -error_set (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , -"string" ); +error_setg (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , +"string" ); } }
@@ -291,8 +291,8 @@ static void parse_type_number(Visitor *v, double *obj, const char *name, val =strtod (siv->string, &endp); }if (!siv->string || errno || endp == siv->string || *endp) { -error_set (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , -"number" ); +error_setg (errp,QERR_INVALID_PARAMETER_TYPE , name ? name :"null" , +"number" );return ; }
qdev-monitor.c +6 -6
@@ -201,16 +201,16 @@ static DeviceClass *qdev_get_device_class(const char **driver, Error **errp) }if (object_class_is_abstract (oc)) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE ,"driver" , -"non-abstract device type" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"driver" , +"non-abstract device type" );return NULL ; } dc =DEVICE_CLASS (oc);if (dc->cannot_instantiate_with_device_add_yet || (qdev_hotplug && !dc->hotpluggable)) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE ,"driver" , -"pluggable device type" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"driver" , +"pluggable device type" );return NULL ; }
@@ -527,7 +527,7 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp) driver =qemu_opt_get (opts,"driver" );if (!driver) { -error_set (errp,QERR_MISSING_PARAMETER ,"driver" ); +error_setg (errp,QERR_MISSING_PARAMETER ,"driver" );return NULL ; }
@@ -558,7 +558,7 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp) } }if (qdev_hotplug && bus && !qbus_is_hotpluggable (bus)) { -error_set (errp,QERR_BUS_NO_HOTPLUG , bus->name); +error_setg (errp,QERR_BUS_NO_HOTPLUG , bus->name);return NULL ; }
qemu-img.c +1 -1
@@ -739,7 +739,7 @@ static int img_commit(int argc, char **argv)if (base) { base_bs =bdrv_find_backing_image (bs, base);if (!base_bs) { -error_set (&local_err,QERR_BASE_NOT_FOUND , base); +error_setg (&local_err,QERR_BASE_NOT_FOUND , base); goto done; } }else {
qga/commands-posix.c +20 -20
@@ -382,15 +382,15 @@ static int guest_file_toggle_flags(int fd, int flags, bool set, Error **err) old_flags =fcntl (fd,F_GETFL );if (old_flags ==-1 ) { -error_set_errno (err, errno,QERR_QGA_COMMAND_FAILED , -"failed to fetch filehandle flags" ); +error_setg_errno (err, errno,QERR_QGA_COMMAND_FAILED , +"failed to fetch filehandle flags" );return -1 ; } ret =fcntl (fd,F_SETFL , set ? (old_flags | flags) : (old_flags & ~flags));if (ret ==-1 ) { -error_set_errno (err, errno,QERR_QGA_COMMAND_FAILED , -"failed to set filehandle flags" ); +error_setg_errno (err, errno,QERR_QGA_COMMAND_FAILED , +"failed to set filehandle flags" );return -1 ; }
@@ -2302,34 +2302,34 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)void qmp_guest_suspend_disk (Error **errp) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED ); }void qmp_guest_suspend_ram (Error **errp) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED ); }void qmp_guest_suspend_hybrid (Error **errp) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED ); }GuestNetworkInterfaceList *qmp_guest_network_get_interfaces (Error **errp) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED );return NULL ; }GuestLogicalProcessorList *qmp_guest_get_vcpus (Error **errp) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED );return NULL ; }int64_t qmp_guest_set_vcpus (GuestLogicalProcessorList *vcpus,Error **errp) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED );return -1 ; }
@@ -2338,25 +2338,25 @@ void qmp_guest_set_user_password(const char *username,bool crypted, Error **errp) { -error_set (errp ,QERR_UNSUPPORTED ); +error_setg (errp ,QERR_UNSUPPORTED ); }GuestMemoryBlockList *qmp_guest_get_memory_blocks (Error **errp) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED );return NULL ; }GuestMemoryBlockResponseList *qmp_guest_set_memory_blocks (GuestMemoryBlockList *mem_blks,Error **errp) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED );return NULL ; }GuestMemoryBlockInfo *qmp_guest_get_memory_block_info (Error **errp) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED );return NULL ; }
@@ -2366,20 +2366,20 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)GuestFilesystemInfoList *qmp_guest_get_fsinfo (Error **errp) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED );return NULL ; }GuestFsfreezeStatus qmp_guest_fsfreeze_status (Error **errp) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED );return 0 ; }int64_t qmp_guest_fsfreeze_freeze (Error **errp) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED );return 0 ; }
@@ -2388,14 +2388,14 @@ int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints, strList *mountpoints, Error **errp) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED );return 0 ; }int64_t qmp_guest_fsfreeze_thaw (Error **errp) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED );return 0 ; }
@@ -2404,7 +2404,7 @@ int64_t qmp_guest_fsfreeze_thaw(Error **errp)#if !defined(CONFIG_FSTRIM )void qmp_guest_fstrim (bool has_minimum,int64_t minimum,Error **errp) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED ); }#endif
qga/commands-win32.c +33 -33
197 lines not on this page · raw message
qga/main.c +2 -2
@@ -578,7 +578,7 @@ static void process_event(JSONMessageParser *parser, QList *tokens) qdict =qdict_new ();if (!err) {g_warning ("failed to parse event: unknown error" ); -error_set (&err,QERR_JSON_PARSING ); +error_setg (&err,QERR_JSON_PARSING ); }else {g_warning ("failed to parse event: %s" ,error_get_pretty (err)); }
@@ -598,7 +598,7 @@ static void process_event(JSONMessageParser *parser, QList *tokens)QDECREF (qdict); qdict =qdict_new ();g_warning ("unrecognized payload format" ); -error_set (&err,QERR_UNSUPPORTED ); +error_setg (&err,QERR_UNSUPPORTED );qdict_put_obj (qdict,"error" ,qmp_build_error_object (err));error_free (err); }
qmp.c +17 -17
@@ -132,13 +132,13 @@ void qmp_cpu_add(int64_t id, Error **errp)defined in the VNC subsystem */ VncInfo *qmp_query_vnc (Error **errp) { -error_set (errp,QERR_FEATURE_DISABLED ,"vnc" ); +error_setg (errp,QERR_FEATURE_DISABLED ,"vnc" );return NULL ; };VncInfo2List *qmp_query_vnc_servers (Error **errp) { -error_set (errp,QERR_FEATURE_DISABLED ,"vnc" ); +error_setg (errp,QERR_FEATURE_DISABLED ,"vnc" );return NULL ; };#endif
@@ -295,7 +295,7 @@ void qmp_set_password(const char *protocol, const char *password, }else if (strcmp (connected,"keep" ) ==0 ) {/* nothing */ }else { -error_set (errp,QERR_INVALID_PARAMETER ,"connected" ); +error_setg (errp,QERR_INVALID_PARAMETER ,"connected" );return ; } }
@@ -307,7 +307,7 @@ void qmp_set_password(const char *protocol, const char *password, rc =qemu_spice_set_passwd (password, fail_if_connected, disconnect_if_connected);if (rc !=0 ) { -error_set (errp,QERR_SET_PASSWD_FAILED ); +error_setg (errp,QERR_SET_PASSWD_FAILED ); }return ; }
@@ -315,19 +315,19 @@ void qmp_set_password(const char *protocol, const char *password,if (strcmp (protocol,"vnc" ) ==0 ) {if (fail_if_connected || disconnect_if_connected) {/* vnc supports "connected=keep" only */ -error_set (errp,QERR_INVALID_PARAMETER ,"connected" ); +error_setg (errp,QERR_INVALID_PARAMETER ,"connected" );return ; }/* Note that setting an empty password will not disable login through * this interface. */ rc =vnc_display_password (NULL , password);if (rc <0 ) { -error_set (errp,QERR_SET_PASSWD_FAILED ); +error_setg (errp,QERR_SET_PASSWD_FAILED ); }return ; } -error_set (errp,QERR_INVALID_PARAMETER ,"protocol" ); +error_setg (errp,QERR_INVALID_PARAMETER ,"protocol" ); } void qmp_expire_password(const char *protocol, const char *whenstr,
@@ -352,7 +352,7 @@ void qmp_expire_password(const char *protocol, const char *whenstr, } rc =qemu_spice_set_pw_expire (when);if (rc !=0 ) { -error_set (errp,QERR_SET_PASSWD_FAILED ); +error_setg (errp,QERR_SET_PASSWD_FAILED ); }return ; }
@@ -360,19 +360,19 @@ void qmp_expire_password(const char *protocol, const char *whenstr,if (strcmp (protocol,"vnc" ) ==0 ) { rc =vnc_display_pw_expire (NULL , when);if (rc !=0 ) { -error_set (errp,QERR_SET_PASSWD_FAILED ); +error_setg (errp,QERR_SET_PASSWD_FAILED ); }return ; } -error_set (errp,QERR_INVALID_PARAMETER ,"protocol" ); +error_setg (errp,QERR_INVALID_PARAMETER ,"protocol" ); }#ifdef CONFIG_VNC void qmp_change_vnc_password (const char *password,Error **errp) {if (vnc_display_password (NULL , password) <0 ) { -error_set (errp,QERR_SET_PASSWD_FAILED ); +error_setg (errp,QERR_SET_PASSWD_FAILED ); } }
@@ -403,7 +403,7 @@ static void qmp_change_vnc(const char *target, bool has_arg, const char *arg, {if (strcmp (target,"passwd" ) ==0 ||strcmp (target,"password" ) ==0 ) {if (!has_arg) { -error_set (errp,QERR_MISSING_PARAMETER ,"password" ); +error_setg (errp,QERR_MISSING_PARAMETER ,"password" ); }else {qmp_change_vnc_password (arg, errp); }
@@ -414,12 +414,12 @@ static void qmp_change_vnc(const char *target, bool has_arg, const char *arg,#else void qmp_change_vnc_password (const char *password,Error **errp) { -error_set (errp,QERR_FEATURE_DISABLED ,"vnc" ); +error_setg (errp,QERR_FEATURE_DISABLED ,"vnc" ); }static void qmp_change_vnc (const char *target,bool has_arg,const char *arg,Error **errp) { -error_set (errp,QERR_FEATURE_DISABLED ,"vnc" ); +error_setg (errp,QERR_FEATURE_DISABLED ,"vnc" ); }#endif /* !CONFIG_VNC */
@@ -528,8 +528,7 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename, klass =object_class_dynamic_cast (klass,TYPE_DEVICE );if (klass ==NULL ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , -"name" ,TYPE_DEVICE ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"name" ,TYPE_DEVICE );return NULL ; }
@@ -686,7 +685,8 @@ int qmp_object_add(Monitor *mon, const QDict *qdict, QObject **ret)if (props) { pdict =qobject_to_qdict (props);if (!pdict) { -error_set (&local_err,QERR_INVALID_PARAMETER_TYPE ,"props" ,"dict" ); +error_setg (&local_err,QERR_INVALID_PARAMETER_TYPE ,"props" , +"dict" ); goto out; } }
qom/object.c +6 -6
@@ -817,7 +817,7 @@ void object_property_get(Object *obj, Visitor *v, const char *name, }if (!prop->get) { -error_set (errp,QERR_PERMISSION_DENIED ); +error_setg (errp,QERR_PERMISSION_DENIED ); }else { prop->get (obj, v, prop->opaque, name, errp); }
@@ -832,7 +832,7 @@ void object_property_set(Object *obj, Visitor *v, const char *name, }if (!prop->set) { -error_set (errp,QERR_PERMISSION_DENIED ); +error_setg (errp,QERR_PERMISSION_DENIED ); }else { prop->set (obj, v, prop->opaque, name, errp); }
@@ -859,7 +859,7 @@ char *object_property_get_str(Object *obj, const char *name, } qstring =qobject_to_qstring (ret);if (!qstring) { -error_set (errp,QERR_INVALID_PARAMETER_TYPE , name,"string" ); +error_setg (errp,QERR_INVALID_PARAMETER_TYPE , name,"string" ); retval =NULL ; }else { retval =g_strdup (qstring_get_str (qstring));
@@ -920,7 +920,7 @@ bool object_property_get_bool(Object *obj, const char *name, } qbool =qobject_to_qbool (ret);if (!qbool) { -error_set (errp,QERR_INVALID_PARAMETER_TYPE , name,"boolean" ); +error_setg (errp,QERR_INVALID_PARAMETER_TYPE , name,"boolean" ); retval = false; }else { retval =qbool_get_int (qbool);
@@ -951,7 +951,7 @@ int64_t object_property_get_int(Object *obj, const char *name, } qint =qobject_to_qint (ret);if (!qint) { -error_set (errp,QERR_INVALID_PARAMETER_TYPE , name,"int" ); +error_setg (errp,QERR_INVALID_PARAMETER_TYPE , name,"int" ); retval =-1 ; }else { retval =qint_get_int (qint);
@@ -1169,7 +1169,7 @@ static Object *object_resolve_link(Object *obj, const char *name, }else if (!target) { target =object_resolve_path (path, &ambiguous);if (target || ambiguous) { -error_set (errp,QERR_INVALID_PARAMETER_TYPE , name, target_type); +error_setg (errp,QERR_INVALID_PARAMETER_TYPE , name, target_type); }else {error_set (errp,ERROR_CLASS_DEVICE_NOT_FOUND ,"Device '%s' not found" , path);
stubs/arch-query-cpu-def.c +1 -1
@@ -4,6 +4,6 @@CpuDefinitionInfoList *arch_query_cpu_definitions (Error **errp) { -error_set (errp,QERR_UNSUPPORTED ); +error_setg (errp,QERR_UNSUPPORTED );return NULL ; }
target-i386/cpu.c +9 -10
@@ -1524,8 +1524,8 @@ static void x86_cpuid_version_set_family(Object *obj, Visitor *v, void *opaque,return ; }if (value < min || value > max) { -error_set (errp,QERR_PROPERTY_VALUE_OUT_OF_RANGE ,"" , - name ? name :"null" , value, min, max); +error_setg (errp,QERR_PROPERTY_VALUE_OUT_OF_RANGE ,"" , + name ? name :"null" , value, min, max);return ; }
@@ -1565,8 +1565,8 @@ static void x86_cpuid_version_set_model(Object *obj, Visitor *v, void *opaque,return ; }if (value < min || value > max) { -error_set (errp,QERR_PROPERTY_VALUE_OUT_OF_RANGE ,"" , - name ? name :"null" , value, min, max); +error_setg (errp,QERR_PROPERTY_VALUE_OUT_OF_RANGE ,"" , + name ? name :"null" , value, min, max);return ; }
@@ -1603,8 +1603,8 @@ static void x86_cpuid_version_set_stepping(Object *obj, Visitor *v,return ; }if (value < min || value > max) { -error_set (errp,QERR_PROPERTY_VALUE_OUT_OF_RANGE ,"" , - name ? name :"null" , value, min, max); +error_setg (errp,QERR_PROPERTY_VALUE_OUT_OF_RANGE ,"" , + name ? name :"null" , value, min, max);return ; }
@@ -1632,8 +1632,7 @@ static void x86_cpuid_set_vendor(Object *obj, const char *value,int i;if (strlen (value) !=CPUID_VENDOR_SZ ) { -error_set (errp,QERR_PROPERTY_VALUE_BAD ,"" , -"vendor" , value); +error_setg (errp,QERR_PROPERTY_VALUE_BAD ,"" ,"vendor" , value);return ; }
@@ -1709,8 +1708,8 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque,return ; }if (value < min || value > max) { -error_set (errp,QERR_PROPERTY_VALUE_OUT_OF_RANGE ,"" , - name ? name :"null" , value, min, max); +error_setg (errp,QERR_PROPERTY_VALUE_OUT_OF_RANGE ,"" , + name ? name :"null" , value, min, max);return ; }
tpm.c +5 -3
@@ -140,20 +140,22 @@ static int configure_tpm(QemuOpts *opts) id =qemu_opts_id (opts);if (id ==NULL ) { -qerror_report (QERR_MISSING_PARAMETER ,"id" ); +qerror_report (ERROR_CLASS_GENERIC_ERROR ,QERR_MISSING_PARAMETER ,"id" );return 1 ; } value =qemu_opt_get (opts,"type" );if (!value) { -qerror_report (QERR_MISSING_PARAMETER ,"type" ); +qerror_report (ERROR_CLASS_GENERIC_ERROR ,QERR_MISSING_PARAMETER , +"type" );tpm_display_backend_drivers ();return 1 ; } be =tpm_get_backend_driver (value);if (be ==NULL ) { -qerror_report (QERR_INVALID_PARAMETER_VALUE ,"type" , +qerror_report (ERROR_CLASS_GENERIC_ERROR , +QERR_INVALID_PARAMETER_VALUE ,"type" ,"a TPM backend type" );tpm_display_backend_drivers ();return 1 ;
ui/vnc.c +2 -2
@@ -427,7 +427,7 @@ VncInfo *qmp_query_vnc(Error **errp)if (getsockname (vd->lsock, (struct sockaddr *)&sa, &salen) ==-1 ) { -error_set (errp,QERR_UNDEFINED_ERROR ); +error_setg (errp,QERR_UNDEFINED_ERROR ); goto out_error; }
@@ -435,7 +435,7 @@ VncInfo *qmp_query_vnc(Error **errp) host, sizeof(host), serv, sizeof(serv), NI_NUMERICHOST | NI_NUMERICSERV) < 0) { -error_set (errp,QERR_UNDEFINED_ERROR ); +error_setg (errp,QERR_UNDEFINED_ERROR ); goto out_error; }
util/qemu-option.c +12 -10
@@ -132,7 +132,8 @@ static void parse_option_bool(const char *name, const char *value, bool *ret, }else if (!strcmp (value,"off" )) { *ret =0 ; }else { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , name,"'on' or 'off'" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE , name, +"'on' or 'off'" ); } }else { *ret =1 ;
@@ -148,12 +149,12 @@ static void parse_option_number(const char *name, const char *value,if (value !=NULL ) { number =strtoull (value, &postfix,0 );if (*postfix !='\0' ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , name,"a number" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE , name,"a number" );return ; } *ret = number; }else { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , name,"a number" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE , name,"a number" ); } }
@@ -198,7 +199,7 @@ void parse_option_size(const char *name, const char *value, *ret = (uint64_t ) sizef;break ;default : -error_set (errp,QERR_INVALID_PARAMETER_VALUE , name,"a size" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE , name,"a size" );#if 0 /* conversion from qerror_report() to error_set() broke this: */ error_printf_unless_qmp ("You may use k, M, G or T suffixes for " "kilobytes, megabytes, gigabytes and terabytes.\n" );
@@ -206,7 +207,7 @@ void parse_option_size(const char *name, const char *value,return ; } }else { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , name,"a size" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE , name,"a size" ); } }
@@ -527,7 +528,7 @@ static void opt_set(QemuOpts *opts, const char *name, const char *value, desc =find_desc_by_name (opts->list->desc, name);if (!desc && !opts_accepts_any (opts)) { -error_set (errp,QERR_INVALID_PARAMETER , name); +error_setg (errp,QERR_INVALID_PARAMETER , name);return ; }
@@ -563,7 +564,7 @@ void qemu_opt_set_bool(QemuOpts *opts, const char *name, bool val, opt =g_malloc0 (sizeof (*opt)); opt->desc =find_desc_by_name (desc, name);if (!opt->desc && !opts_accepts_any (opts)) { -error_set (errp,QERR_INVALID_PARAMETER , name); +error_setg (errp,QERR_INVALID_PARAMETER , name);g_free (opt);return ; }
@@ -584,7 +585,7 @@ void qemu_opt_set_number(QemuOpts *opts, const char *name, int64_t val, opt =g_malloc0 (sizeof (*opt)); opt->desc =find_desc_by_name (desc, name);if (!opt->desc && !opts_accepts_any (opts)) { -error_set (errp,QERR_INVALID_PARAMETER , name); +error_setg (errp,QERR_INVALID_PARAMETER , name);g_free (opt);return ; }
@@ -640,7 +641,8 @@ QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id,if (id) {if (!id_wellformed (id)) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE ,"id" ,"an identifier" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"id" , +"an identifier" );#if 0 /* conversion from qerror_report() to error_set() broke this: */ error_printf_unless_qmp ("Identifiers consist of letters, digits, '-', '.', '_', starting with a letter.\n" );#endif
@@ -1055,7 +1057,7 @@ void qemu_opts_validate(QemuOpts *opts, const QemuOptDesc *desc, Error **errp) QTAILQ_FOREACH(opt, &opts->head, next) { opt->desc =find_desc_by_name (desc, opt->name);if (!opt->desc) { -error_set (errp,QERR_INVALID_PARAMETER , opt->name); +error_setg (errp,QERR_INVALID_PARAMETER , opt->name);return ; }
Signature · 1 line
1.9.3
Re: [Qemu-devel] [PATCH 05/11] qerror: Clean up QERR_ macros to expand into a single string
Quoted 62 lines · Markus Armbruster
These macros expand into error class enumeration constant, comma, string. Unclean. Has been that way since commit 13f59ae.
The error class is always
ERROR_CLASS_GENERIC_ERRORsince the previous commit.Clean up as follows:
* Prepend every use of a
QERR_macro byERROR_CLASS_GENERIC_ERROR, and delete it from theQERR_macro. No change after preprocessing.* Rewrite
error_set(ERROR_CLASS_GENERIC_ERROR, ...)intoerror_setg(...). Again, no change after preprocessing.Signed-off-by Markus Armbruster <[email protected]>--- backends/rng-egd.c | 8 ++--- backends/rng-random.c | 6 ++-- backends/rng.c | 2 +- backends/tpm.c | 2 +- balloon.c | 2 +- block.c | 2 +- block/backup.c | 4 +-- block/commit.c | 2 +- block/mirror.c | 8 ++--- block/qcow.c | 4 +-- block/qcow2.c | 4 +-- block/qed.c | 4 +-- block/quorum.c | 4 +-- block/snapshot.c | 4 +-- block/stream.c | 4 +-- block/vmdk.c | 12 ++++---- blockdev-nbd.c | 2 +- blockdev.c | 43 +++++++++++++------------- blockjob.c | 8 ++--- cpus.c | 8 ++--- dump.c | 12 ++++---- hmp.c | 10 +++--- hw/core/nmi.c | 2 +- hw/core/qdev-properties-system.c | 3 +- hw/core/qdev-properties.c | 12 ++++---- hw/core/qdev.c | 8 ++--- hw/intc/openpic.c | 6 ++-- hw/pci/pci-stub.c | 2 +- hw/ppc/spapr_pci.c | 8 ++--- hw/s390x/s390-virtio.c | 2 +- hw/usb/redirect.c | 6 ++-- include/qapi/qmp/qerror.h | 60 ++++++++++++++++++------------------ migration/migration.c | 35 ++++++++++----------- migration/savevm.c | 2 +- monitor.c | 66 ++++++++++++++++++++-------------------- net/net.c | 12 ++++---- qapi/opts-visitor.c | 24 +++++++-------- qapi/qapi-visit-core.c | 28 ++++++++--------- qapi/qmp-dispatch.c | 12 ++++---- qapi/qmp-input-visitor.c | 28 ++++++++--------- qapi/string-input-visitor.c | 24 +++++++-------- qdev-monitor.c | 12 ++++---- qemu-img.c | 2 +- qga/commands-posix.c | 40 ++++++++++++------------ qga/commands-win32.c | 66 ++++++++++++++++++++-------------------- qga/main.c | 4 +--
Quoted 8 lines
qmp.c | 34 ++++++++++----------- qom/object.c | 12 ++++---- stubs/arch-query-cpu-def.c | 2 +- target-i386/cpu.c | 19 ++++++------ tpm.c | 8 +++-- ui/vnc.c | 4 +-- util/qemu-option.c | 22 ++++++++------ 53 files changed, 362 insertions(+), 358 deletions(-)
Nice simplification.
Re: [Qemu-devel] [PATCH 05/11] qerror: Clean up QERR_ macros to expand into a single string
In reply to Markus ArmbrusterQuoted 6 lines · Markus Armbruster
These macros expand into error class enumeration constant, comma, string. Unclean. Has been that way since commit 13f59ae.
The error class is always
ERROR_CLASS_GENERIC_ERRORsince the previous commit.
Quoted 7 lines
Clean up as follows:
* Prepend every use of a
QERR_macro byERROR_CLASS_GENERIC_ERROR, and delete it from theQERR_macro. No change after preprocessing.* Rewrite
error_set(ERROR_CLASS_GENERIC_ERROR, ...)intoerror_setg(...). Again, no change after preprocessing.
Were these conversions done via coccinelle? If so, it would be nice to mention the script used in the commit message. But that doesn't affect the correctness of the patch itself.
Quoted 6 lines
Signed-off-by Markus Armbruster <[email protected]>---
util/qemu-option.c | 22 ++++++++------ 53 files changed, 362 insertions(+), 358 deletions(-)
Close to 1:1 lineup; difference is due to altered line wraps in a few spots.
backends/rng-egd.c static void rng_egd_opened(RngBackend *b, Error **errp) · line 144
Quoted 13 lines
backends/rng-egd.c +2
-2@@ -140,8 +140,8 @@ static void rng_egd_opened(RngBackend *b, Error **errp)RngEgd *s =RNG_EGD (b);if (s->chr_name ==NULL ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , -"chardev" ,"a valid character device" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"chardev" , +"a valid character device" );
Interesting line rewrap.
backends/rng-egd.c static void rng_random_opened(RngBackend *b, Error **errp) · line 78
Quoted 9 lines
backends/rng-egd.c +3
-2+++ b/backends/rng-random.c@@ -74,8 +74,8 @@ static void rng_random_opened(RngBackend *b, Error **errp)RndRandom *s =RNG_RANDOM (b);if (s->filename ==NULL ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , -"filename" ,"a valid filename" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"filename" , +"a valid filename" );
and again
backends/rng-egd.c static int quorum_valid_threshold(int threshold, int num_children, Error **errp) · line 804
Quoted 9 lines
backends/rng-egd.c +3
-2+++ b/block/quorum.c@@ -800,8 +800,8 @@ static int quorum_valid_threshold(int threshold, int num_children, Error **errp) {if (threshold <1 ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , -"vote-threshold" ,"value >= 1" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"vote-threshold" , +"value >= 1" );
looks like there are several of them. They don't hurt, so I'll quit pointing them out.
backends/rng-egd.c static int quorum_valid_threshold(int threshold, int num_children, Error **errp) · line 806
Quoted 4 lines
backends/rng-egd.c +1
-1#define QERR_PROPERTY_VALUE_OUT_OF_RANGE \ - ERROR_CLASS_GENERIC_ERROR, "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")" + "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")"
Still a long line; worth wrapping with another \ mid-string?
backends/rng-egd.c static int configure_tpm(QemuOpts *opts) · line 144
Quoted 8 lines
backends/rng-egd.c +2
-1+++ b/tpm.c@@ -140,20 +140,22 @@ static int configure_tpm(QemuOpts *opts) id =qemu_opts_id (opts);if (id ==NULL ) { -qerror_report (QERR_MISSING_PARAMETER ,"id" ); +qerror_report (ERROR_CLASS_GENERIC_ERROR ,QERR_MISSING_PARAMETER ,"id" );return 1 ;
Not quite the same s/error_set/error_setg/ change as everywhere else, but still correct.
There may be additional merge conflicts depending on timing of getting this in, but it is mechanical resolution, and the sooner we get this in, the better.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH 05/11] qerror: Clean up QERR_ macros to expand into a single string
Quoted 12 lines · Eric Blake
Quoted 11 lines · Markus Armbruster
These macros expand into error class enumeration constant, comma, string. Unclean. Has been that way since commit 13f59ae.
The error class is always
ERROR_CLASS_GENERIC_ERRORsince the previous commit.Clean up as follows:
* Prepend every use of a
QERR_macro byERROR_CLASS_GENERIC_ERROR, and delete it from theQERR_macro. No change after preprocessing.
Quoted 6 lines
Quoted 2 lines
* Rewrite
error_set(ERROR_CLASS_GENERIC_ERROR, ...)intoerror_setg(...). Again, no change after preprocessing.Were these conversions done via coccinelle? If so, it would be nice to mention the script used in the commit message. But that doesn't affect the correctness of the patch itself.
The semantic patch I used is almost 200 repetitive lines, because I derived it from qerror.h with regexp-magic. I doubt including it is useful.
Quoted 16 lines
Quoted 5 lines
Signed-off-by Markus Armbruster <[email protected]>---
util/qemu-option.c | 22 ++++++++------ 53 files changed, 362 insertions(+), 358 deletions(-)Close to 1:1 lineup; difference is due to altered line wraps in a few spots.
Quoted 8 lines
backends/rng-egd.c +0
-0@@ -140,8 +140,8 @@ static void rng_egd_opened(RngBackend *b, Error **errp)RngEgd *s =RNG_EGD (b);
Quoted 7 lines
backends/rng-egd.c static void rng_egd_opened(RngBackend *b, Error **errp) · line 144
Quoted 5 lines
backends/rng-egd.c +2
-2if (s->chr_name ==NULL ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , -"chardev" ,"a valid character device" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"chardev" , +"a valid character device" );Interesting line rewrap.
Coccinelle.
Quoted 17 lines
backends/rng-egd.c static void rng_random_opened(RngBackend *b, Error **errp) · line 78
Quoted 9 lines
backends/rng-egd.c +3
-2+++ b/backends/rng-random.c@@ -74,8 +74,8 @@ static void rng_random_opened(RngBackend *b, Error **errp)RndRandom *s =RNG_RANDOM (b);if (s->filename ==NULL ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , -"filename" ,"a valid filename" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"filename" , +"a valid filename" );and again
Quoted 4 lines
backends/rng-egd.c +1
-0+++ b/block/quorum.c@@ -800,8 +800,8 @@ static int quorum_valid_threshold(int threshold, int num_children, Error **errp) {
Quoted 8 lines
backends/rng-egd.c static int quorum_valid_threshold(int threshold, int num_children, Error **errp) · line 804
Quoted 5 lines
backends/rng-egd.c +2
-2if (threshold <1 ) { -error_set (errp,QERR_INVALID_PARAMETER_VALUE , -"vote-threshold" ,"value >= 1" ); +error_setg (errp,QERR_INVALID_PARAMETER_VALUE ,"vote-threshold" , +"value >= 1" );looks like there are several of them. They don't hurt, so I'll quit pointing them out.
I'll try to avoid uncalled-for rewraps in v2.
Quoted 7 lines
Quoted 5 lines
backends/rng-egd.c +0
-1#define QERR_PROPERTY_VALUE_OUT_OF_RANGE \ - ERROR_CLASS_GENERIC_ERROR, "Property %s.%s doesn't take value %"PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")"
+ "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")"Still a long line; worth wrapping with another \ mid-string?
Normally yes, but these macros should die, hopefully soon.
Quoted 12 lines
backends/rng-egd.c static int configure_tpm(QemuOpts *opts) · line 144
Quoted 8 lines
+++
b/tpm.cbackends/rng-egd.c +1
-1@@ -140,20 +140,22 @@ static int configure_tpm(QemuOpts *opts) id =qemu_opts_id (opts);if (id ==NULL ) { -qerror_report (QERR_MISSING_PARAMETER ,"id" ); +qerror_report (ERROR_CLASS_GENERIC_ERROR ,QERR_MISSING_PARAMETER ,"id" );return 1 ;Not quite the same s/error_set/error_setg/ change as everywhere else, but still correct.
Quoted 3 lines
There may be additional merge conflicts depending on timing of getting this in, but it is mechanical resolution, and the sooner we get this in, the better.
Yup.
Quoted 1 line
Reviewed-by Eric Blake <[email protected]>
Thanks!
PATCH 6/11 tpm: Avoid qerror_report() outside QMP command handlers
In reply to Markus Armbrusterqerror_report() is a transitional interface to help with converting existing monitor commands to QMP. It should not be used elsewhere. Replace by error_report().
--- tpm.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
tpm.c +4 -6
@@ -140,23 +140,21 @@ static int configure_tpm(QemuOpts *opts) id =qemu_opts_id (opts);if (id ==NULL ) { -qerror_report (ERROR_CLASS_GENERIC_ERROR ,QERR_MISSING_PARAMETER ,"id" ); +error_report (QERR_MISSING_PARAMETER ,"id" );return 1 ; } value =qemu_opt_get (opts,"type" );if (!value) { -qerror_report (ERROR_CLASS_GENERIC_ERROR ,QERR_MISSING_PARAMETER , -"type" ); +error_report (QERR_MISSING_PARAMETER ,"type" );tpm_display_backend_drivers ();return 1 ; } be =tpm_get_backend_driver (value);if (be ==NULL ) { -qerror_report (ERROR_CLASS_GENERIC_ERROR , -QERR_INVALID_PARAMETER_VALUE ,"type" , -"a TPM backend type" ); +error_report (QERR_INVALID_PARAMETER_VALUE ,"type" , +"a TPM backend type" );tpm_display_backend_drivers ();return 1 ; }
Signature · 1 line
1.9.3
Re: [Qemu-devel] [PATCH 06/11] tpm: Avoid qerror_report() outside QMP command handlers
Quoted 14 lines · Markus Armbruster
qerror_report()is a transitional interface to help with converting existing monitor commands to QMP. It should not be used elsewhere. Replace byerror_report().Signed-off-by Markus Armbruster <[email protected]>--- tpm.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)tpm.c +0
-0
tpm.c static int configure_tpm(QemuOpts *opts) · line 143
Quoted 5 lines
tpm.c +1
-1@@ -140,23 +140,21 @@ static int configure_tpm(QemuOpts *opts) id =qemu_opts_id (opts);if (id ==NULL ) { -qerror_report (ERROR_CLASS_GENERIC_ERROR ,QERR_MISSING_PARAMETER ,"id" ); +error_report (QERR_MISSING_PARAMETER ,"id" );
Ah, this fixes a hunk difference I pointed out in 5/11. If you need to rebase, I'd consider rearranging to put this patch first, so that the mechanical 5/11 is even more mechanical (limited to just error_setg conversion). But that's not enough reason in itself for a respin, so:
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH 06/11] tpm: Avoid qerror_report() outside QMP command handlers
Quoted 16 lines · Eric Blake
Quoted 15 lines · Markus Armbruster
qerror_report()is a transitional interface to help with converting existing monitor commands to QMP. It should not be used elsewhere. Replace byerror_report().Signed-off-by Markus Armbruster <[email protected]>--- tpm.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)tpm.c +0
-0@@ -140,23 +140,21 @@ static int configure_tpm(QemuOpts *opts)
Quoted 9 lines
tpm.c static int configure_tpm(QemuOpts *opts) · line 143
Quoted 4 lines
tpm.c +1
-1id =qemu_opts_id (opts);if (id ==NULL ) { -qerror_report (ERROR_CLASS_GENERIC_ERROR ,QERR_MISSING_PARAMETER ,"id" ); +error_report (QERR_MISSING_PARAMETER ,"id" );Ah, this fixes a hunk difference I pointed out in 5/11. If you need to rebase, I'd consider rearranging to put this patch first, so that the mechanical 5/11 is even more mechanical (limited to just
error_setgconversion).
While that would make PATCH 05 a bit more mechanical, this one would become quite a bit uglier, because I can't directly pass QERR_MISSING_PARAMETER to any of the error_report() functions.
I'd either have to create an Error to pass to error_report_err(), or drop the unwanted error class by wrapping parenthesis around QERR_MISSING_PARAMETER to turn its comma into a comma operator. Ugh.
Quoted 3 lines
But that's not enough reason in itself for a respin, so:
Reviewed-by Eric Blake <[email protected]>
Thanks!
PATCH 7/11 qmp: Wean off qerror_report()
In reply to Markus ArmbrusterThe traditional QMP command handler interface
int qmp_FOO(Monitor *mon, const QDict *params, QObject **ret_data);
doesn't provide for returning an Error object. Instead, the handler is expected to stash it in the monitor with qerror_report().
When we rebased QMP on top of QAPI, we didn't change this interface. Instead, commit 776574d introduced "middle mode" as a temporary aid for converting existing QMP commands to QAPI one by one. More than three years later, we're still using it.
Middle mode has two effects:
* Instead of the native input marshallers
static void qmp_marshal_input_FOO(QDict *, QObject **, Error **)
it generates input marshallers conforming to the traditional QMP command handler interface.
* It suppresses generation of code to register them with qmp_register_command()
This permits giving them internal linkage.
As long as we need qmp-commands.hx, we can't use the registry behind qmp_register_command(), so the latter has to stay for now.
The former has to go to get rid of qerror_report(). Changing all QMP commands to fit the QAPI mold in one go was impractical back when we started, but by now there are just a few stragglers left:do_qmp_capabilities(), qmp_qom_set(), qmp_qom_get(), qmp_object_add(), qmp_netdev_add(), do_device_add().
Switch middle mode to generate native input marshallers, and adapt the stragglers. Simplifies both the monitor code and the stragglers.
Rename do_qmp_capabilities() to qmp_capabilities(), and do_device_add() to qmp_device_add, because that's how QMP command handlers are named today.
--- hmp.c | 5 ++++- include/monitor/monitor.h | 7 +++--- include/monitor/qdev.h | 3 ++- include/net/net.h | 2 +- monitor.c | 24 ++++++--------------- net/net.c | 16 ++++++-------- qdev-monitor.c | 15 ++++++------- qmp-commands.hx | 4 ++-- qmp.c | 55 +++++++++++------------------------------------ scripts/qapi-commands.py | 41 ++++++----------------------------- util/qemu-error.c | 4 ++-- 11 files changed, 50 insertions(+), 126 deletions(-)
hmp.c +4 -1
@@ -1503,7 +1503,10 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)void hmp_device_add (Monitor *mon,const QDict *qdict) { -do_device_add (mon, qdict,NULL ); +Error *err =NULL ; + +qmp_device_add ((QDict *)qdict,NULL , &err); +hmp_handle_error (mon, &err); }void hmp_device_del (Monitor *mon,const QDict *qdict)
include/monitor/monitor.h +3 -4
@@ -45,10 +45,9 @@ void monitor_read_command(Monitor *mon, int show_prompt);int monitor_read_password (Monitor *mon,ReadLineFunc *readline_func,void *opaque); -int qmp_qom_set (Monitor *mon,const QDict *qdict,QObject **ret); - -int qmp_qom_get (Monitor *mon,const QDict *qdict,QObject **ret); -int qmp_object_add (Monitor *mon,const QDict *qdict,QObject **ret); +void qmp_qom_set (QDict *qdict,QObject **ret,Error **errp); +void qmp_qom_get (QDict *qdict,QObject **ret,Error **errp); +void qmp_object_add (QDict *qdict,QObject **ret,Error **errp);void object_add (const char *type,const char *id,const QDict *qdict,Visitor *v,Error **errp);
include/monitor/qdev.h +2 -1
@@ -9,7 +9,8 @@void hmp_info_qtree (Monitor *mon,const QDict *qdict);void hmp_info_qdm (Monitor *mon,const QDict *qdict);void hmp_info_qom_tree (Monitor *mon,const QDict *dict); -int do_device_add (Monitor *mon,const QDict *qdict,QObject **ret_data); +void qmp_device_add (QDict *qdict,QObject **ret_data,Error **errp); +int qdev_device_help (QemuOpts *opts);DeviceState *qdev_device_add (QemuOpts *opts,Error **errp);
include/net/net.h +1 -1
@@ -191,7 +191,7 @@ void net_cleanup(void);void hmp_host_net_add (Monitor *mon,const QDict *qdict);void hmp_host_net_remove (Monitor *mon,const QDict *qdict);void netdev_add (QemuOpts *opts,Error **errp); -int qmp_netdev_add (Monitor *mon,const QDict *qdict,QObject **ret); +void qmp_netdev_add (QDict *qdict,QObject **ret,Error **errp);int net_hub_id_for_client (NetClientState *nc,int *id);NetClientState *net_hub_port_find (int hub_id);
monitor.c +6 -18
@@ -125,7 +125,7 @@ typedef struct mon_cmd_t {const char *help;union {void (*cmd)(Monitor *mon,const QDict *qdict); -int (*cmd_new)(Monitor *mon,const QDict *params,QObject **ret_data); +void (*cmd_new)(QDict *params,QObject **ret_data,Error **errp); } mhandler;/* @sub_table is a list of 2nd level of commands. If it do not exist, * mhandler should be used. If it exist, sub_table[?].mhandler should be
@@ -567,11 +567,9 @@ static void monitor_qapi_event_init(void)qmp_event_set_func_emit (monitor_qapi_event_queue); } -static int do_qmp_capabilities (Monitor *mon,const QDict *params, -QObject **ret_data) +static void qmp_capabilities (QDict *params,QObject **ret_data,Error **errp) { - mon->qmp.in_command_mode = true; -return 0 ; + cur_mon->qmp.in_command_mode = true; }static void handle_hmp_command (Monitor *mon,const char *cmdline);
@@ -4733,7 +4731,7 @@ static int monitor_can_read(void *opaque)static bool invalid_qmp_mode (const Monitor *mon,const mon_cmd_t *cmd,Error **errp) { -bool is_cap = cmd->mhandler.cmd_new == do_qmp_capabilities; +bool is_cap = cmd->mhandler.cmd_new == qmp_capabilities;if (is_cap && mon->qmp.in_command_mode) { error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND,
@@ -5052,17 +5050,7 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens) goto err_out; } -if (cmd->mhandler.cmd_new (mon, args, &data)) { -/* Command failed... */ -if (!mon->error) { -/* ... without setting an error, so make one up */ -error_setg (&local_err,QERR_UNDEFINED_ERROR ); - } - } -if (mon->error) { -error_set (&local_err, mon->error->err_class,"%s" , - mon->error->err_msg); - } + cmd->mhandler.cmd_new (args, &data, &local_err); err_out:monitor_protocol_emitter (mon, data, local_err);
@@ -5134,7 +5122,7 @@ static QObject *get_qmp_greeting(void) {QObject *ver =NULL ; -qmp_marshal_input_query_version (NULL ,NULL , &ver); +qmp_marshal_input_query_version (NULL , &ver,NULL );return qobject_from_jsonf ("{'QMP':{'version': %p,'capabilities': []}}" ,ver); }
net/net.c +6 -10
@@ -1072,7 +1072,7 @@ void netdev_add(QemuOpts *opts, Error **errp)net_client_init (opts,1 , errp); } -int qmp_netdev_add (Monitor *mon,const QDict *qdict,QObject **ret) +void qmp_netdev_add (QDict *qdict,QObject **ret,Error **errp) {Error *local_err =NULL ;QemuOptsList *opts_list;
@@ -1080,26 +1080,22 @@ int qmp_netdev_add(Monitor *mon, const QDict *qdict, QObject **ret) opts_list =qemu_find_opts_err ("netdev" , &local_err);if (local_err) { - goto exit_err; + goto out; } opts =qemu_opts_from_qdict (opts_list, qdict, &local_err);if (local_err) { - goto exit_err; + goto out; }netdev_add (opts, &local_err);if (local_err) {qemu_opts_del (opts); - goto exit_err; + goto out; } -return 0 ; - -exit_err: -qerror_report_err (local_err); -error_free (local_err); -return -1 ; +out: +error_propagate (errp, local_err); }void qmp_netdev_del (const char *id,Error **errp)
qdev-monitor.c +6 -9
@@ -756,7 +756,7 @@ void hmp_info_qom_tree(Monitor *mon, const QDict *dict)print_qom_composition (mon, obj,0 ); } -int do_device_add (Monitor *mon,const QDict *qdict,QObject **ret_data) +void qmp_device_add (QDict *qdict,QObject **ret_data,Error **errp) {Error *local_err =NULL ;QemuOpts *opts;
@@ -764,23 +764,20 @@ int do_device_add(Monitor *mon, const QDict *qdict, QObject **ret_data) opts =qemu_opts_from_qdict (qemu_find_opts ("device" ), qdict, &local_err);if (local_err) { -qerror_report_err (local_err); -error_free (local_err); -return -1 ; +error_propagate (errp, local_err); +return ; }if (!monitor_cur_is_qmp () &&qdev_device_help (opts)) {qemu_opts_del (opts); -return 0 ; +return ; } dev =qdev_device_add (opts, &local_err);if (!dev) { -qerror_report_err (local_err); -error_free (local_err); +error_propagate (errp, local_err);qemu_opts_del (opts); -return -1 ; +return ; }object_unref (OBJECT (dev)); -return 0 ; }void qmp_device_del (const char *id,Error **errp)
qmp-commands.hx +2 -2
@@ -276,7 +276,7 @@ EQMP .args_type = "device:O", .params = "driver[,prop=value][,...]", .help = "add device, like -device on the command line", - .mhandler.cmd_new = do_device_add, + .mhandler.cmd_new = qmp_device_add, }, SQMP
@@ -1982,7 +1982,7 @@ EQMP .args_type = "", .params = "", .help = "enable QMP capabilities", - .mhandler.cmd_new = do_qmp_capabilities, + .mhandler.cmd_new = qmp_capabilities, }, SQMP
qmp.c +12 -43
105 lines not on this page · raw message
scripts/qapi-commands.py +6 -35
64 lines not on this page · raw message
util/qemu-error.c +2 -2
@@ -202,7 +202,7 @@ bool enable_timestamp_msg;* Format arguments like vsprintf(). The result should not contain * newlines. * Prepend the current location and append a newline. -* It's wrong to call this in a QMP monitor. Use qerror_report() there. +* It's wrong to call this in a QMP monitor. Use error_setg() there. */ void error_vreport (const char *fmt,va_list ap) {
@@ -226,7 +226,7 @@ void error_vreport(const char *fmt, va_list ap)* Format arguments like sprintf(). The result should not contain * newlines. * Prepend the current location and append a newline. -* It's wrong to call this in a QMP monitor. Use qerror_report() there. +* It's wrong to call this in a QMP monitor. Use error_setg() there. */ void error_report (const char *fmt, ...) {
Signature · 1 line
1.9.3
Re: [Qemu-devel] [PATCH 07/11] qmp: Wean off qerror_report()
Quoted 43 lines · Markus Armbruster
The traditional QMP command handler interface
int qmp_FOO(Monitor *mon, const QDict *params, QObject **ret_data);doesn't provide for returning an Error object. Instead, the handler is expected to stash it in the monitor with
qerror_report().When we rebased QMP on top of QAPI, we didn't change this interface. Instead, commit 776574d introduced "middle mode" as a temporary aid for converting existing QMP commands to QAPI one by one. More than three years later, we're still using it.
Middle mode has two effects:
* Instead of the native input marshallers
static void
qmp_marshal_input_FOO(QDict *, QObject **, Error **)it generates input marshallers conforming to the traditional QMP command handler interface.
* It suppresses generation of code to register them with
qmp_register_command()This permits giving them internal linkage.
As long as we need qmp-commands.hx, we can't use the registry behind
qmp_register_command(), so the latter has to stay for now.The former has to go to get rid of
qerror_report(). Changing all QMP commands to fit the QAPI mold in one go was impractical back when we started, but by now there are just a few stragglers left:do_qmp_capabilities(),qmp_qom_set(),qmp_qom_get(),qmp_object_add(),qmp_netdev_add(),do_device_add().Switch middle mode to generate native input marshallers, and adapt the stragglers. Simplifies both the monitor code and the stragglers.
Rename
do_qmp_capabilities()toqmp_capabilities(), anddo_device_add()toqmp_device_add, because that's how QMP command handlers are named today.Signed-off-by Markus Armbruster <[email protected]>
Quoted 13 lines
--- hmp.c | 5 ++++- include/monitor/monitor.h | 7 +++--- include/monitor/qdev.h | 3 ++- include/net/net.h | 2 +- monitor.c | 24 ++++++--------------- net/net.c | 16 ++++++-------- qdev-monitor.c | 15 ++++++------- qmp-commands.hx | 4 ++-- qmp.c | 55 +++++++++++------------------------------------ scripts/qapi-commands.py | 41 ++++++----------------------------- util/qemu-error.c | 4 ++-- 11 files changed, 50 insertions(+), 126 deletions(-)
Net portions look good.
Re: [Qemu-devel] [PATCH 07/11] qmp: Wean off qerror_report()
In reply to Markus ArmbrusterQuoted 7 lines · Markus Armbruster
The traditional QMP command handler interface
int qmp_FOO(Monitor *mon, const QDict *params, QObject **ret_data);doesn't provide for returning an Error object. Instead, the handler is expected to stash it in the monitor with
qerror_report().
Quoted 6 lines
When we rebased QMP on top of QAPI, we didn't change this interface. Instead, commit 776574d introduced "middle mode" as a temporary aid for converting existing QMP commands to QAPI one by one. More than three years later, we're still using it.
Middle mode has two effects:
Are these effects documented anywhere, as in docs/qapi-code-gen.txt? Should they be, or are we better off trying to get rid of middle mode?
Quoted 8 lines
* Instead of the native input marshallers
static void
qmp_marshal_input_FOO(QDict *, QObject **, Error **)it generates input marshallers conforming to the traditional QMP command handler interface.
Quoted 7 lines
* It suppresses generation of code to register them with
qmp_register_command()This permits giving them internal linkage.
As long as we need qmp-commands.hx, we can't use the registry behind
qmp_register_command(), so the latter has to stay for now.
Is there a qapi marking we can add for this effect, similar to 'gen':false? For that matter...
Quoted 6 lines
The former has to go to get rid of
qerror_report(). Changing all QMP commands to fit the QAPI mold in one go was impractical back when we started, but by now there are just a few stragglers left:do_qmp_capabilities(),qmp_qom_set(),qmp_qom_get(),qmp_object_add(),qmp_netdev_add(),do_device_add().
...many of these are already using 'gen':false!
Quoted 9 lines
Switch middle mode to generate native input marshallers, and adapt the stragglers. Simplifies both the monitor code and the stragglers.
Rename
do_qmp_capabilities()toqmp_capabilities(), anddo_device_add()toqmp_device_add, because that's how QMP command handlers are named today.Signed-off-by Markus Armbruster <[email protected]>
Quoted 13 lines
--- hmp.c | 5 ++++- include/monitor/monitor.h | 7 +++--- include/monitor/qdev.h | 3 ++- include/net/net.h | 2 +- monitor.c | 24 ++++++--------------- net/net.c | 16 ++++++-------- qdev-monitor.c | 15 ++++++------- qmp-commands.hx | 4 ++-- qmp.c | 55 +++++++++++------------------------------------ scripts/qapi-commands.py | 41 ++++++----------------------------- util/qemu-error.c | 4 ++-- 11 files changed, 50 insertions(+), 126 deletions(-)
Relatively nice diffstat.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH 07/11] qmp: Wean off qerror_report()
Quoted 13 lines · Eric Blake
Quoted 12 lines · Markus Armbruster
The traditional QMP command handler interface
int qmp_FOO(Monitor *mon, const QDict *params, QObject **ret_data);doesn't provide for returning an Error object. Instead, the handler is expected to stash it in the monitor with
qerror_report().When we rebased QMP on top of QAPI, we didn't change this interface. Instead, commit 776574d introduced "middle mode" as a temporary aid for converting existing QMP commands to QAPI one by one. More than three years later, we're still using it.
Quoted 4 lines
Quoted 1 line
Middle mode has two effects:
Are these effects documented anywhere, as in
docs/qapi-code-gen.txt? Should they be, or are we better off trying to get rid of middle mode?
The latter.
Quoted 19 lines
Quoted 7 lines
* Instead of the native input marshallers
static void
qmp_marshal_input_FOO(QDict *, QObject **, Error **)it generates input marshallers conforming to the traditional QMP command handler interface.
Quoted 7 lines
* It suppresses generation of code to register them with
qmp_register_command()This permits giving them internal linkage.
As long as we need qmp-commands.hx, we can't use the registry behind
qmp_register_command(), so the latter has to stay for now.Is there a qapi marking we can add for this effect, similar to 'gen':false? For that matter...
Quoted 1 line
Quoted 7 lines
Quoted 5 lines
The former has to go to get rid of
qerror_report(). Changing all QMP commands to fit the QAPI mold in one go was impractical back when we started, but by now there are just a few stragglers left:do_qmp_capabilities(),qmp_qom_set(),qmp_qom_get(),qmp_object_add(),qmp_netdev_add(),do_device_add()....many of these are already using 'gen':false!
Using qmp_register_command() for some commands and qmp-commands.hx for others doesn't sound appealing.
The best way forward is getting rid of qmp-commands.hx. Not in this development cycle, though.
Quoted 22 lines
Quoted 8 lines
Switch middle mode to generate native input marshallers, and adapt the stragglers. Simplifies both the monitor code and the stragglers.
Rename
do_qmp_capabilities()toqmp_capabilities(), anddo_device_add()toqmp_device_add, because that's how QMP command handlers are named today.Signed-off-by Markus Armbruster <[email protected]>Quoted 13 lines
--- hmp.c | 5 ++++- include/monitor/monitor.h | 7 +++--- include/monitor/qdev.h | 3 ++- include/net/net.h | 2 +- monitor.c | 24 ++++++--------------- net/net.c | 16 ++++++-------- qdev-monitor.c | 15 ++++++------- qmp-commands.hx | 4 ++-- qmp.c | 55 +++++++++++------------------------------------ scripts/qapi-commands.py | 41 ++++++----------------------------- util/qemu-error.c | 4 ++-- 11 files changed, 50 insertions(+), 126 deletions(-)
Quoted 3 lines
Relatively nice diffstat.
Reviewed-by Eric Blake <[email protected]>
Thanks!
PATCH 8/11 qerror: Finally unused, clean up
In reply to Markus ArmbrusterRemove it except for two things in qerror.h:
* Two #include to be cleaned up separately to avoid cluttering this patch.
* The QERR_ macros. Mark as obsolete.
--- block/qapi.c | 6 -- include/monitor/monitor.h | 1 - include/qapi/qmp/qerror.h | 19 +----- include/qapi/qmp/qobject.h | 1 - monitor.c | 13 ---- qobject/Makefile.objs | 1 - qobject/qerror.c | 148 --------------------------------------------- qobject/qjson.c | 3 - stubs/Makefile.objs | 1 - stubs/mon-is-qmp.c | 2 + stubs/mon-set-error.c | 8 --- 11 files changed, 4 insertions(+), 199 deletions(-) delete mode 100644 qobject/qerror.c delete mode 100644 stubs/mon-set-error.c
block/qapi.c +0 -6
@@ -517,12 +517,6 @@ static void dump_qobject(fprintf_function func_fprintf, void *f,func_fprintf (f,"%s" ,qbool_get_int (value) ?"true" :"false" );break ; } -case QTYPE_QERROR : { -QString *value =qerror_human ((QError *)obj); -func_fprintf (f,"%s" ,qstring_get_str (value)); -QDECREF (value); -break ; - }default :abort (); }
include/monitor/monitor.h +0 -1
@@ -40,7 +40,6 @@ void monitor_flush(Monitor *mon);int monitor_set_cpu (int cpu_index);int monitor_get_cpu_index (void ); -void monitor_set_error (Monitor *mon,QError *qerror);void monitor_read_command (Monitor *mon,int show_prompt);int monitor_read_password (Monitor *mon,ReadLineFunc *readline_func,void *opaque);
include/qapi/qmp/qerror.h +2 -17
@@ -14,25 +14,10 @@#include "qapi/qmp/qstring.h" #include "qemu/error-report.h" -#include "qapi/error.h" -#include "qapi-types.h" -#include <stdarg.h> - -typedef struct QError { -QObject_HEAD ; -Location loc; -char *err_msg; -ErrorClass err_class; -}QError ; - -QString *qerror_human (const QError *qerror); -void qerror_report(ErrorClass err_class, const char *fmt, ...) GCC_FMT_ATTR(2, 3); -void qerror_report_err (Error *err);/* -* QError class list -* Please keep the definitions in alphabetical order. -* Use scripts/check-qerror.sh to check. +* These macros will go away, please don't use in new code, and do not +* add new ones! */ #define QERR_BASE_NOT_FOUND \ "Base '%s' not found"
include/qapi/qmp/qobject.h +0 -1
@@ -44,7 +44,6 @@ typedef enum {QTYPE_QLIST ,QTYPE_QFLOAT ,QTYPE_QBOOL , -QTYPE_QERROR ,QTYPE_MAX , } qtype_code;
monitor.c +0 -13
@@ -205,7 +205,6 @@ struct Monitor {BlockCompletionFunc *password_completion_cb;void *password_opaque;mon_cmd_t *cmd_table; -QError *error; QLIST_HEAD(,mon_fd_t) fds;QLIST_ENTRY (Monitor) entry; };
@@ -4041,16 +4040,6 @@ fail:return NULL ; } -void monitor_set_error (Monitor *mon,QError *qerror) -{ -/* report only the first error */ -if (!mon->error) { - mon->error = qerror; - }else { -QDECREF (qerror); - } -} -static void handle_hmp_command (Monitor *mon,const char *cmdline) {QDict *qdict;
@@ -5055,8 +5044,6 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens) err_out:monitor_protocol_emitter (mon, data, local_err);qobject_decref (data); -QDECREF (mon->error); - mon->error =NULL ;QDECREF (input);QDECREF (args); }
qobject/Makefile.objs +0 -1
@@ -1,3 +1,2 @@ util-obj-y = qnull.o qint.o qstring.o qdict.o qlist.o qfloat.o qbool.o util-obj-y += qjson.o json-lexer.o json-streamer.o json-parser.o -util-obj-y += qerror.o
qobject/qerror.c deleted +0 -148
148 lines not on this page · raw message
qobject/qjson.c +0 -3
@@ -261,9 +261,6 @@ static void to_json(const QObject *obj, QString *str, int pretty, int indent) }break ; } -case QTYPE_QERROR : -/* XXX: should QError be emitted? */ -break ;default :abort (); }
stubs/Makefile.objs +0 -1
@@ -21,7 +21,6 @@ stub-obj-y += machine-init-done.o stub-obj-y += migr-blocker.o stub-obj-y += mon-is-qmp.o stub-obj-y += mon-printf.o -stub-obj-y += mon-set-error.o stub-obj-y += monitor-init.o stub-obj-y += notify-event.o stub-obj-$(CONFIG_SPICE) += qemu-chr-open-spice.o
stubs/mon-is-qmp.c +2 -0
@@ -1,6 +1,8 @@#include "qemu-common.h" #include "monitor/monitor.h" +Monitor *cur_mon; +bool monitor_cur_is_qmp (void ) {return false;
stubs/mon-set-error.c deleted +0 -8
@@ -1,8 +0,0 @@ -#include "qemu-common.h" -#include "monitor/monitor.h" - -Monitor *cur_mon; - -void monitor_set_error (Monitor *mon,QError *qerror) -{ -}
Signature · 1 line
1.9.3
Re: [Qemu-devel] [PATCH 08/11] qerror: Finally unused, clean up
Quoted 8 lines · Markus Armbruster
Remove it except for two things in
qerror.h:* Two #include to be cleaned up separately to avoid cluttering this patch.
* The
QERR_macros. Mark as obsolete.Signed-off-by Markus Armbruster <[email protected]>
Quoted 16 lines
--- block/qapi.c | 6 -- include/monitor/monitor.h | 1 - include/qapi/qmp/qerror.h | 19 +----- include/qapi/qmp/qobject.h | 1 - monitor.c | 13 ---- qobject/Makefile.objs | 1 - qobject/qerror.c | 148 --------------------------------------------- qobject/qjson.c | 3 - stubs/Makefile.objs | 1 - stubs/mon-is-qmp.c | 2 + stubs/mon-set-error.c | 8 --- 11 files changed, 4 insertions(+), 199 deletions(-) delete mode 100644 qobject/qerror.c delete mode 100644 stubs/mon-set-error.c
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
PATCH 9/11 qerror: Move #include out of qerror.h
In reply to Markus Armbruster--- audio/spiceaudio.c | 1 + audio/wavcapture.c | 1 + block.c | 1 + block/curl.c | 1 + block/dmg.c | 1 + block/io.c | 1 + block/iscsi.c | 1 + block/qcow2-snapshot.c | 1 + block/raw-posix.c | 2 ++ block/ssh.c | 2 ++ block/vhdx-log.c | 1 + block/vmdk.c | 1 + block/vvfat.c | 1 + blockdev.c | 1 + cpus.c | 1 + hw/9pfs/virtio-9p.c | 1 + hw/char/virtio-serial-bus.c | 1 + hw/core/qdev.c | 1 + hw/display/g364fb.c | 1 + hw/display/tcx.c | 1 + hw/i386/pc.c | 1 + hw/ide/ahci.c | 1 + hw/misc/ivshmem.c | 1 + hw/pci/pci.c | 1 + hw/ppc/virtex_ml507.c | 1 + hw/s390x/virtio-ccw.c | 1 + hw/scsi/vhost-scsi.c | 1 + hw/timer/hpet.c | 1 + hw/tpm/tpm_passthrough.c | 1 + hw/usb/bus.c | 1 + hw/usb/ccid-card-passthru.c | 1 + hw/usb/dev-serial.c | 1 + hw/usb/dev-storage.c | 1 + hw/usb/host-libusb.c | 1 + hw/usb/redirect.c | 1 + include/qapi/qmp/qerror.h | 3 --- migration/migration.c | 1 + migration/qemu-file-buf.c | 1 + migration/qemu-file.c | 1 + migration/rdma.c | 1 + migration/savevm.c | 1 + net/net.c | 1 + net/slirp.c | 1 + qdev-monitor.c | 1 + qemu-char.c | 1 + qemu-io-cmds.c | 1 + qemu-io.c | 2 ++ qemu-nbd.c | 1 + slirp/misc.c | 1 + target-i386/cpu.c | 1 + tpm.c | 1 + ui/input.c | 1 + ui/spice-core.c | 1 + ui/vnc.c | 1 + util/osdep.c | 1 + util/qemu-error.c | 1 + vl.c | 1 + 57 files changed, 59 insertions(+), 3 deletions(-)
audio/spiceaudio.c +1 -0
@@ -18,6 +18,7 @@*/ #include "hw/hw.h" +#include "qemu/error-report.h" #include "qemu/timer.h" #include "ui/qemu-spice.h"
audio/wavcapture.c +1 -0
@@ -1,5 +1,6 @@#include "hw/hw.h" #include "monitor/monitor.h" +#include "qemu/error-report.h" #include "audio.h" typedef struct {
block.c +1 -0
@@ -26,6 +26,7 @@#include "trace.h" #include "block/block_int.h" #include "block/blockjob.h" +#include "qemu/error-report.h" #include "qemu/module.h" #include "qapi/qmp/qjson.h" #include "sysemu/block-backend.h"
block/curl.c +1 -0
@@ -24,6 +24,7 @@#include "qemu-common.h" #include "block/block_int.h" #include "qapi/qmp/qbool.h" +#include "qapi/qmp/qstring.h" #include <curl/curl.h> // #define DEBUG_CURL
block/dmg.c +1 -0
@@ -24,6 +24,7 @@#include "qemu-common.h" #include "block/block_int.h" #include "qemu/bswap.h" +#include "qemu/error-report.h" #include "qemu/module.h" #include <zlib.h> #ifdef CONFIG_BZIP2
block/io.c +1 -0
@@ -26,6 +26,7 @@#include "sysemu/qtest.h" #include "block/blockjob.h" #include "block/block_int.h" +#include "qemu/error-report.h" #define NOT_DONE 0x7fffffff/* used while emulated sync operation in progress */
block/iscsi.c +1 -0
@@ -38,6 +38,7 @@#include "qemu/iov.h" #include "sysemu/sysemu.h" #include "qmp-commands.h" +#include "qapi/qmp/qstring.h" #include <iscsi/iscsi.h> #include <iscsi/scsi-lowlevel.h>
block/qcow2-snapshot.c +1 -0
@@ -25,6 +25,7 @@#include "qemu-common.h" #include "block/block_int.h" #include "block/qcow2.h" +#include "qemu/error-report.h" void qcow2_free_snapshots (BlockDriverState *bs) {
block/raw-posix.c +2 -0
@@ -22,6 +22,7 @@* THE SOFTWARE. */ #include "qemu-common.h" +#include "qemu/error-report.h" #include "qemu/timer.h" #include "qemu/log.h" #include "block/block_int.h"
@@ -31,6 +32,7 @@#include "qemu/iov.h" #include "raw-aio.h" #include "qapi/util.h" +#include "qapi/qmp/qstring.h" #if defined(__APPLE__) && (__MACH__)#include <paths.h>
block/ssh.c +2 -0
@@ -30,9 +30,11 @@#include <libssh2_sftp.h> #include "block/block_int.h" +#include "qemu/error-report.h" #include "qemu/sockets.h" #include "qemu/uri.h" #include "qapi/qmp/qint.h" +#include "qapi/qmp/qstring.h" /* DEBUG_SSH=1 enables the DPRINTF (debugging printf) statements in * this block driver code.
block/vhdx-log.c +1 -0
@@ -19,6 +19,7 @@*/ #include "qemu-common.h" #include "block/block_int.h" +#include "qemu/error-report.h" #include "qemu/module.h" #include "block/vhdx.h"
block/vmdk.c +1 -0
@@ -25,6 +25,7 @@#include "qemu-common.h" #include "block/block_int.h" +#include "qemu/error-report.h" #include "qemu/module.h" #include "migration/migration.h" #include <zlib.h>
block/vvfat.c +1 -0
@@ -30,6 +30,7 @@#include "migration/migration.h" #include "qapi/qmp/qint.h" #include "qapi/qmp/qbool.h" +#include "qapi/qmp/qstring.h" #ifndef S_IWGRP #define S_IWGRP 0
blockdev.c +1 -0
@@ -35,6 +35,7 @@#include "hw/block/block.h" #include "block/blockjob.h" #include "monitor/monitor.h" +#include "qemu/error-report.h" #include "qemu/option.h" #include "qemu/config-file.h" #include "qapi/qmp/types.h"
cpus.c +1 -0
@@ -27,6 +27,7 @@#include "monitor/monitor.h" #include "qapi/qmp/qerror.h" +#include "qemu/error-report.h" #include "sysemu/sysemu.h" #include "exec/gdbstub.h" #include "sysemu/dma.h"
hw/9pfs/virtio-9p.c +1 -0
@@ -13,6 +13,7 @@#include "hw/virtio/virtio.h" #include "hw/i386/pc.h" +#include "qemu/error-report.h" #include "qemu/sockets.h" #include "virtio-9p.h" #include "fsdev/qemu-fsdev.h"
hw/char/virtio-serial-bus.c +1 -0
@@ -20,6 +20,7 @@#include "qemu/iov.h" #include "monitor/monitor.h" +#include "qemu/error-report.h" #include "qemu/queue.h" #include "hw/sysbus.h" #include "trace.h"
hw/core/qdev.c +1 -0
@@ -32,6 +32,7 @@#include "qapi/qmp/qerror.h" #include "qapi/visitor.h" #include "qapi/qmp/qjson.h" +#include "qemu/error-report.h" #include "hw/hotplug.h" #include "hw/boards.h" #include "qapi-event.h"
hw/display/g364fb.c +1 -0
@@ -18,6 +18,7 @@*/ #include "hw/hw.h" +#include "qemu/error-report.h" #include "ui/console.h" #include "ui/pixel_ops.h" #include "trace.h"
hw/display/tcx.c +1 -0
@@ -27,6 +27,7 @@#include "ui/pixel_ops.h" #include "hw/loader.h" #include "hw/sysbus.h" +#include "qemu/error-report.h" #define TCX_ROM_FILE "QEMU,tcx.bin"#define FCODE_MAX_ROM_SIZE 0x10000
hw/i386/pc.c +1 -0
@@ -57,6 +57,7 @@#include "sysemu/arch_init.h" #include "qemu/bitmap.h" #include "qemu/config-file.h" +#include "qemu/error-report.h" #include "hw/acpi/acpi.h" #include "hw/acpi/cpu_hotplug.h" #include "hw/cpu/icc_bus.h"
hw/ide/ahci.c +1 -0
@@ -27,6 +27,7 @@#include <hw/pci/pci.h> #include <hw/sysbus.h> +#include "qemu/error-report.h" #include "monitor/monitor.h" #include "sysemu/block-backend.h" #include "sysemu/dma.h"
hw/misc/ivshmem.c +1 -0
@@ -23,6 +23,7 @@#include "sysemu/kvm.h" #include "migration/migration.h" #include "qapi/qmp/qerror.h" +#include "qemu/error-report.h" #include "qemu/event_notifier.h" #include "qemu/fifo8.h" #include "sysemu/char.h"
hw/pci/pci.c +1 -0
@@ -30,6 +30,7 @@#include "net/net.h" #include "sysemu/sysemu.h" #include "hw/loader.h" +#include "qemu/error-report.h" #include "qemu/range.h" #include "qmp-commands.h" #include "trace.h"
hw/ppc/virtex_ml507.c +1 -0
@@ -32,6 +32,7 @@#include "sysemu/device_tree.h" #include "hw/loader.h" #include "elf.h" +#include "qemu/error-report.h" #include "qemu/log.h" #include "exec/address-spaces.h"
hw/s390x/virtio-ccw.c +1 -0
@@ -21,6 +21,7 @@#include "hw/virtio/virtio-net.h" #include "hw/sysbus.h" #include "qemu/bitops.h" +#include "qemu/error-report.h" #include "hw/virtio/virtio-bus.h" #include "hw/s390x/adapter.h" #include "hw/s390x/s390_flic.h"
hw/scsi/vhost-scsi.c +1 -0
@@ -16,6 +16,7 @@#include <sys/ioctl.h> #include "config.h" +#include "qemu/error-report.h" #include "qemu/queue.h" #include "monitor/monitor.h" #include "migration/migration.h"
hw/timer/hpet.c +1 -0
@@ -27,6 +27,7 @@#include "hw/hw.h" #include "hw/i386/pc.h" #include "ui/console.h" +#include "qemu/error-report.h" #include "qemu/timer.h" #include "hw/timer/hpet.h" #include "hw/sysbus.h"
hw/tpm/tpm_passthrough.c +1 -0
@@ -26,6 +26,7 @@#include "qemu-common.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "qemu/sockets.h" #include "sysemu/tpm_backend.h" #include "tpm_int.h"
hw/usb/bus.c +1 -0
@@ -1,6 +1,7 @@#include "hw/hw.h" #include "hw/usb.h" #include "hw/qdev.h" +#include "qemu/error-report.h" #include "sysemu/sysemu.h" #include "monitor/monitor.h" #include "trace.h"
hw/usb/ccid-card-passthru.c +1 -0
@@ -9,6 +9,7 @@*/ #include "sysemu/char.h" +#include "qemu/error-report.h" #include "qemu/sockets.h" #include "monitor/monitor.h" #include "ccid.h"
hw/usb/dev-serial.c +1 -0
@@ -9,6 +9,7 @@*/ #include "qemu-common.h" +#include "qemu/error-report.h" #include "monitor/monitor.h" #include "hw/usb.h" #include "hw/usb/desc.h"
hw/usb/dev-storage.c +1 -0
@@ -8,6 +8,7 @@*/ #include "qemu-common.h" +#include "qemu/error-report.h" #include "qemu/option.h" #include "qemu/config-file.h" #include "hw/usb.h"
hw/usb/host-libusb.c +1 -0
@@ -38,6 +38,7 @@#include "qemu-common.h" #include "monitor/monitor.h" +#include "qemu/error-report.h" #include "sysemu/sysemu.h" #include "trace.h"
hw/usb/redirect.c +1 -0
@@ -29,6 +29,7 @@#include "qemu/timer.h" #include "monitor/monitor.h" #include "sysemu/sysemu.h" +#include "qemu/error-report.h" #include "qemu/iov.h" #include "sysemu/char.h"
include/qapi/qmp/qerror.h +0 -3
@@ -12,9 +12,6 @@#ifndef QERROR_H #define QERROR_H -#include "qapi/qmp/qstring.h" -#include "qemu/error-report.h" -/* * These macros will go away, please don't use in new code, and do not * add new ones!
migration/migration.c +1 -0
@@ -14,6 +14,7 @@*/ #include "qemu-common.h" +#include "qemu/error-report.h" #include "qemu/main-loop.h" #include "migration/migration.h" #include "monitor/monitor.h"
migration/qemu-file-buf.c +1 -0
@@ -26,6 +26,7 @@* THE SOFTWARE. */ #include "qemu-common.h" +#include "qemu/error-report.h" #include "qemu/iov.h" #include "qemu/sockets.h" #include "block/coroutine.h"
migration/qemu-file.c +1 -0
@@ -23,6 +23,7 @@*/ #include <zlib.h> #include "qemu-common.h" +#include "qemu/error-report.h" #include "qemu/iov.h" #include "qemu/sockets.h" #include "block/coroutine.h"
migration/rdma.c +1 -0
@@ -15,6 +15,7 @@#include "migration/migration.h" #include "migration/qemu-file.h" #include "exec/cpu-common.h" +#include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/sockets.h" #include "qemu/bitmap.h"
migration/savevm.c +1 -0
@@ -37,6 +37,7 @@#include "qemu/timer.h" #include "audio/audio.h" #include "migration/migration.h" +#include "qemu/error-report.h" #include "qemu/sockets.h" #include "qemu/queue.h" #include "sysemu/cpus.h"
net/net.c +1 -0
@@ -32,6 +32,7 @@#include "monitor/monitor.h" #include "qemu-common.h" +#include "qemu/error-report.h" #include "qemu/sockets.h" #include "qemu/config-file.h" #include "qmp-commands.h"
net/slirp.c +1 -0
@@ -33,6 +33,7 @@#include "clients.h" #include "hub.h" #include "monitor/monitor.h" +#include "qemu/error-report.h" #include "qemu/sockets.h" #include "slirp/libslirp.h" #include "sysemu/char.h"
qdev-monitor.c +1 -0
@@ -24,6 +24,7 @@#include "qmp-commands.h" #include "sysemu/arch_init.h" #include "qemu/config-file.h" +#include "qemu/error-report.h" /* * Aliases were a bad idea from the start. Let's keep them
qemu-char.c +1 -0
@@ -24,6 +24,7 @@#include "qemu-common.h" #include "monitor/monitor.h" #include "sysemu/sysemu.h" +#include "qemu/error-report.h" #include "qemu/timer.h" #include "sysemu/char.h" #include "hw/usb.h"
qemu-io-cmds.c +1 -0
@@ -13,6 +13,7 @@#include "block/block.h" #include "block/block_int.h" /* for info_f() */ #include "block/qapi.h" +#include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/timer.h" #include "sysemu/block-backend.h"
qemu-io.c +2 -0
@@ -15,10 +15,12 @@#include <libgen.h> #include "qemu-io.h" +#include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/option.h" #include "qemu/config-file.h" #include "qemu/readline.h" +#include "qapi/qmp/qstring.h" #include "sysemu/block-backend.h" #include "block/block_int.h" #include "trace/control.h"
qemu-nbd.c +1 -0
@@ -25,6 +25,7 @@#include "qemu/error-report.h" #include "block/snapshot.h" #include "qapi/util.h" +#include "qapi/qmp/qstring.h" #include <stdarg.h> #include <stdio.h>
slirp/misc.c +1 -0
@@ -9,6 +9,7 @@#include <libslirp.h> #include "monitor/monitor.h" +#include "qemu/error-report.h" #include "qemu/main-loop.h" #ifdef DEBUG
target-i386/cpu.c +1 -0
@@ -26,6 +26,7 @@#include "sysemu/cpus.h" #include "kvm_i386.h" +#include "qemu/error-report.h" #include "qemu/option.h" #include "qemu/config-file.h" #include "qapi/qmp/qerror.h"
tpm.c +1 -0
@@ -18,6 +18,7 @@#include "sysemu/tpm_backend.h" #include "sysemu/tpm.h" #include "qemu/config-file.h" +#include "qemu/error-report.h" #include "qmp-commands.h" static QLIST_HEAD(, TPMBackend) tpm_backends =
ui/input.c +1 -0
@@ -1,6 +1,7 @@#include "hw/qdev.h" #include "sysemu/sysemu.h" #include "qapi-types.h" +#include "qemu/error-report.h" #include "qmp-commands.h" #include "trace.h" #include "ui/input.h"
ui/spice-core.c +1 -0
@@ -22,6 +22,7 @@#include "qemu-common.h" #include "ui/qemu-spice.h" +#include "qemu/error-report.h" #include "qemu/thread.h" #include "qemu/timer.h" #include "qemu/queue.h"
ui/vnc.c +1 -0
@@ -29,6 +29,7 @@#include "trace.h" #include "hw/qdev.h" #include "sysemu/sysemu.h" +#include "qemu/error-report.h" #include "qemu/sockets.h" #include "qemu/timer.h" #include "qemu/acl.h"
util/osdep.c +1 -0
@@ -47,6 +47,7 @@ extern int madvise(caddr_t, size_t, int);#include "qemu-common.h" #include "qemu/sockets.h" +#include "qemu/error-report.h" #include "monitor/monitor.h" static bool fips_enabled = false;
util/qemu-error.c +1 -0
@@ -12,6 +12,7 @@#include <stdio.h> #include "monitor/monitor.h" +#include "qemu/error-report.h" /* * Print to current monitor if we have one, else to stderr.
vl.c +1 -0
@@ -58,6 +58,7 @@ int main(int argc, char **argv)#include <glib.h> +#include "qemu/error-report.h" #include "qemu/sockets.h" #include "hw/hw.h" #include "hw/boards.h"
Signature · 1 line
1.9.3
Re: [Qemu-devel] [PATCH 09/11] qerror: Move #include out of qerror.h
Quoted 52 lines · Markus Armbruster
Signed-off-by Markus Armbruster <[email protected]>--- audio/spiceaudio.c | 1 + audio/wavcapture.c | 1 + block.c | 1 + block/curl.c | 1 + block/dmg.c | 1 + block/io.c | 1 + block/iscsi.c | 1 + block/qcow2-snapshot.c | 1 + block/raw-posix.c | 2 ++ block/ssh.c | 2 ++ block/vhdx-log.c | 1 + block/vmdk.c | 1 + block/vvfat.c | 1 + blockdev.c | 1 + cpus.c | 1 + hw/9pfs/virtio-9p.c | 1 + hw/char/virtio-serial-bus.c | 1 + hw/core/qdev.c | 1 + hw/display/g364fb.c | 1 + hw/display/tcx.c | 1 + hw/i386/pc.c | 1 + hw/ide/ahci.c | 1 + hw/misc/ivshmem.c | 1 + hw/pci/pci.c | 1 + hw/ppc/virtex_ml507.c | 1 + hw/s390x/virtio-ccw.c | 1 + hw/scsi/vhost-scsi.c | 1 + hw/timer/hpet.c | 1 + hw/tpm/tpm_passthrough.c | 1 + hw/usb/bus.c | 1 + hw/usb/ccid-card-passthru.c | 1 + hw/usb/dev-serial.c | 1 + hw/usb/dev-storage.c | 1 + hw/usb/host-libusb.c | 1 + hw/usb/redirect.c | 1 + include/qapi/qmp/qerror.h | 3 --- migration/migration.c | 1 + migration/qemu-file-buf.c | 1 + migration/qemu-file.c | 1 + migration/rdma.c | 1 + migration/savevm.c | 1 + net/net.c | 1 + net/slirp.c | 1 + qdev-monitor.c | 1 + qemu-char.c | 1 + qemu-io-cmds.c | 1 + qemu-io.c | 2 ++ qemu-nbd.c | 1 + slirp/misc.c | 1 + target-i386/cpu.c | 1 +
Quoted 8 lines
tpm.c | 1 + ui/input.c | 1 + ui/spice-core.c | 1 + ui/vnc.c | 1 + util/osdep.c | 1 + util/qemu-error.c | 1 + vl.c | 1 + 57 files changed, 59 insertions(+), 3 deletions(-)
Re: [Qemu-devel] [PATCH 09/11] qerror: Move #include out of qerror.h
In reply to Markus ArmbrusterQuoted 11 lines · Markus Armbruster
Signed-off-by Markus Armbruster <[email protected]>---
57 files changed, 59 insertions(+), 3 deletions(-)include/qapi/qmp/qerror.h +0
-0
include/qapi/qmp/qerror.h line 17
Quoted 6 lines
include/qapi/qmp/qerror.h +0
-3@@ -12,9 +12,6 @@#ifndef QERROR_H #define QERROR_H -#include "qapi/qmp/qstring.h" -#include "qemu/error-report.h" -
The real meat of the change; the rest is adding these lines into .c files where compilation broke otherwise :)
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
PATCH 10/11 Include qapi/qmp/qerror.h exactly where needed
In reply to Markus ArmbrusterIn particular, don't include it into headers.
--- backends/hostmem.c | 1 - balloon.c | 1 + block.c | 1 + block/backup.c | 1 + block/commit.c | 1 + block/mirror.c | 1 + block/qcow.c | 1 + block/quorum.c | 1 + block/snapshot.c | 1 + block/stream.c | 1 + block/vmdk.c | 1 + blockdev.c | 1 + blockjob.c | 1 + dump.c | 1 + hmp.c | 1 + hw/char/serial-pci.c | 1 - hw/dma/xilinx_axidma.c | 1 - hw/misc/ivshmem.c | 1 - hw/net/xilinx_axienet.c | 1 - hw/pci/pci-stub.c | 1 + hw/pci/pcie.c | 1 - hw/pci/shpc.c | 1 - hw/ppc/virtex_ml507.c | 1 - hw/s390x/s390-virtio.c | 1 + hw/usb/redirect.c | 1 + hw/virtio/virtio-rng.c | 1 - include/block/block_int.h | 1 - include/monitor/monitor.h | 1 - include/qemu/sockets.h | 1 - migration/migration.c | 1 + migration/savevm.c | 1 + monitor.c | 1 + net/net.c | 1 + numa.c | 1 - qapi/qmp-output-visitor.c | 1 - qapi/string-output-visitor.c | 1 - qdev-monitor.c | 1 + qemu-img.c | 1 + qmp.c | 1 + qobject/json-parser.c | 1 - scripts/qapi-commands.py | 1 - stubs/dump.c | 1 - target-arm/cpu.c | 1 - target-i386/kvm.c | 1 - ui/vnc.c | 1 + util/qemu-config.c | 1 - 46 files changed, 25 insertions(+), 21 deletions(-)
backends/hostmem.c +0 -1
@@ -13,7 +13,6 @@#include "qapi/visitor.h" #include "qapi-types.h" #include "qapi-visit.h" -#include "qapi/qmp/qerror.h" #include "qemu/config-file.h" #include "qom/object_interfaces.h"
balloon.c +1 -0
@@ -30,6 +30,7 @@#include "sysemu/balloon.h" #include "trace.h" #include "qmp-commands.h" +#include "qapi/qmp/qerror.h" #include "qapi/qmp/qjson.h" static QEMUBalloonEvent *balloon_event_fn;
block.c +1 -0
@@ -28,6 +28,7 @@#include "block/blockjob.h" #include "qemu/error-report.h" #include "qemu/module.h" +#include "qapi/qmp/qerror.h" #include "qapi/qmp/qjson.h" #include "sysemu/block-backend.h" #include "sysemu/sysemu.h"
block/backup.c +1 -0
@@ -19,6 +19,7 @@#include "block/block.h" #include "block/block_int.h" #include "block/blockjob.h" +#include "qapi/qmp/qerror.h" #include "qemu/ratelimit.h" #define BACKUP_CLUSTER_BITS 16
block/commit.c +1 -0
@@ -15,6 +15,7 @@#include "trace.h" #include "block/block_int.h" #include "block/blockjob.h" +#include "qapi/qmp/qerror.h" #include "qemu/ratelimit.h" enum {
block/mirror.c +1 -0
@@ -14,6 +14,7 @@#include "trace.h" #include "block/blockjob.h" #include "block/block_int.h" +#include "qapi/qmp/qerror.h" #include "qemu/ratelimit.h" #include "qemu/bitmap.h"
block/qcow.c +1 -0
@@ -25,6 +25,7 @@#include "block/block_int.h" #include "qemu/module.h" #include <zlib.h> +#include "qapi/qmp/qerror.h" #include "qemu/aes.h" #include "migration/migration.h"
block/quorum.c +1 -0
@@ -18,6 +18,7 @@#include "block/block_int.h" #include "qapi/qmp/qbool.h" #include "qapi/qmp/qdict.h" +#include "qapi/qmp/qerror.h" #include "qapi/qmp/qint.h" #include "qapi/qmp/qjson.h" #include "qapi/qmp/qlist.h"
block/snapshot.c +1 -0
@@ -24,6 +24,7 @@#include "block/snapshot.h" #include "block/block_int.h" +#include "qapi/qmp/qerror.h" QemuOptsList internal_snapshot_opts = { .name ="snapshot" ,
block/stream.c +1 -0
@@ -14,6 +14,7 @@#include "trace.h" #include "block/block_int.h" #include "block/blockjob.h" +#include "qapi/qmp/qerror.h" #include "qemu/ratelimit.h" enum {
block/vmdk.c +1 -0
@@ -25,6 +25,7 @@#include "qemu-common.h" #include "block/block_int.h" +#include "qapi/qmp/qerror.h" #include "qemu/error-report.h" #include "qemu/module.h" #include "migration/migration.h"
blockdev.c +1 -0
@@ -40,6 +40,7 @@#include "qemu/config-file.h" #include "qapi/qmp/types.h" #include "qapi-visit.h" +#include "qapi/qmp/qerror.h" #include "qapi/qmp-output-visitor.h" #include "qapi/util.h" #include "sysemu/sysemu.h"
blockjob.c +1 -0
@@ -29,6 +29,7 @@#include "block/block.h" #include "block/blockjob.h" #include "block/block_int.h" +#include "qapi/qmp/qerror.h" #include "qapi/qmp/qjson.h" #include "block/coroutine.h" #include "qmp-commands.h"
dump.c +1 -0
@@ -23,6 +23,7 @@#include "sysemu/memory_mapping.h" #include "sysemu/cpus.h" #include "qapi/error.h" +#include "qapi/qmp/qerror.h" #include "qmp-commands.h" #include <zlib.h>
hmp.c +1 -0
@@ -25,6 +25,7 @@#include "monitor/monitor.h" #include "monitor/qdev.h" #include "qapi/opts-visitor.h" +#include "qapi/qmp/qerror.h" #include "qapi/string-output-visitor.h" #include "qapi-visit.h" #include "ui/console.h"
hw/char/serial-pci.c +0 -1
@@ -27,7 +27,6 @@#include "hw/char/serial.h" #include "hw/pci/pci.h" -#include "qapi/qmp/qerror.h" #define PCI_SERIAL_MAX_PORTS 4
hw/dma/xilinx_axidma.c +0 -1
@@ -26,7 +26,6 @@#include "qemu/timer.h" #include "hw/ptimer.h" #include "qemu/log.h" -#include "qapi/qmp/qerror.h" #include "qemu/main-loop.h" #include "hw/stream.h"
hw/misc/ivshmem.c +0 -1
@@ -22,7 +22,6 @@#include "hw/pci/msix.h" #include "sysemu/kvm.h" #include "migration/migration.h" -#include "qapi/qmp/qerror.h" #include "qemu/error-report.h" #include "qemu/event_notifier.h" #include "qemu/fifo8.h"
hw/net/xilinx_axienet.c +0 -1
@@ -26,7 +26,6 @@#include "qemu/log.h" #include "net/net.h" #include "net/checksum.h" -#include "qapi/qmp/qerror.h" #include "hw/stream.h"
hw/pci/pci-stub.c +1 -0
@@ -20,6 +20,7 @@#include "sysemu/sysemu.h" #include "monitor/monitor.h" +#include "qapi/qmp/qerror.h" #include "hw/pci/pci.h" #include "qmp-commands.h"
hw/pci/pcie.c +0 -1
@@ -26,7 +26,6 @@#include "hw/pci/pci_bus.h" #include "hw/pci/pcie_regs.h" #include "qemu/range.h" -#include "qapi/qmp/qerror.h" //#define DEBUG_PCIE #ifdef DEBUG_PCIE
hw/pci/shpc.c +0 -1
@@ -7,7 +7,6 @@#include "hw/pci/pci.h" #include "hw/pci/pci_bus.h" #include "hw/pci/msi.h" -#include "qapi/qmp/qerror.h" /* TODO: model power only and disabled slot states. */ /* TODO: handle SERR and wakeups */
hw/ppc/virtex_ml507.c +0 -1
@@ -41,7 +41,6 @@#include "ppc405.h" #include "sysemu/block-backend.h" -#include "qapi/qmp/qerror.h" #define EPAPR_MAGIC (0x45504150)#define FLASH_SIZE (16 * 1024 * 1024)
hw/s390x/s390-virtio.c +1 -0
@@ -22,6 +22,7 @@*/ #include "hw/hw.h" +#include "qapi/qmp/qerror.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "sysemu/sysemu.h"
hw/usb/redirect.c +1 -0
@@ -29,6 +29,7 @@#include "qemu/timer.h" #include "monitor/monitor.h" #include "sysemu/sysemu.h" +#include "qapi/qmp/qerror.h" #include "qemu/error-report.h" #include "qemu/iov.h" #include "sysemu/char.h"
hw/virtio/virtio-rng.c +0 -1
@@ -11,7 +11,6 @@#include "qemu/iov.h" #include "hw/qdev.h" -#include "qapi/qmp/qerror.h" #include "hw/virtio/virtio.h" #include "hw/virtio/virtio-rng.h" #include "sysemu/rng.h"
include/block/block_int.h +0 -1
@@ -31,7 +31,6 @@#include "block/coroutine.h" #include "qemu/timer.h" #include "qapi-types.h" -#include "qapi/qmp/qerror.h" #include "monitor/monitor.h" #include "qemu/hbitmap.h" #include "block/snapshot.h"
include/monitor/monitor.h +0 -1
@@ -2,7 +2,6 @@#define MONITOR_H #include "qemu-common.h" -#include "qapi/qmp/qerror.h" #include "qapi/qmp/qdict.h" #include "block/block.h" #include "qemu/readline.h"
include/qemu/sockets.h +0 -1
@@ -28,7 +28,6 @@ int inet_aton(const char *cp, struct in_addr *ia);#include "qemu/option.h" #include "qapi/error.h" -#include "qapi/qmp/qerror.h" #include "qapi-types.h" extern QemuOptsList socket_optslist;
migration/migration.c +1 -0
@@ -21,6 +21,7 @@#include "migration/qemu-file.h" #include "sysemu/sysemu.h" #include "block/block.h" +#include "qapi/qmp/qerror.h" #include "qemu/sockets.h" #include "migration/block.h" #include "qemu/thread.h"
migration/savevm.c +1 -0
@@ -37,6 +37,7 @@#include "qemu/timer.h" #include "audio/audio.h" #include "migration/migration.h" +#include "qapi/qmp/qerror.h" #include "qemu/error-report.h" #include "qemu/sockets.h" #include "qemu/queue.h"
monitor.c +1 -0
@@ -49,6 +49,7 @@#include "sysemu/kvm.h" #include "qemu/acl.h" #include "sysemu/tpm.h" +#include "qapi/qmp/qerror.h" #include "qapi/qmp/qint.h" #include "qapi/qmp/qfloat.h" #include "qapi/qmp/qlist.h"
net/net.c +1 -0
@@ -32,6 +32,7 @@#include "monitor/monitor.h" #include "qemu-common.h" +#include "qapi/qmp/qerror.h" #include "qemu/error-report.h" #include "qemu/sockets.h" #include "qemu/config-file.h"
numa.c +0 -1
@@ -31,7 +31,6 @@#include "qapi-visit.h" #include "qapi/opts-visitor.h" #include "qapi/dealloc-visitor.h" -#include "qapi/qmp/qerror.h" #include "hw/boards.h" #include "sysemu/hostmem.h" #include "qmp-commands.h"
qapi/qmp-output-visitor.c +0 -1
@@ -16,7 +16,6 @@#include "qemu/queue.h" #include "qemu-common.h" #include "qapi/qmp/types.h" -#include "qapi/qmp/qerror.h" typedef struct QStackEntry {
qapi/string-output-visitor.c +0 -1
@@ -13,7 +13,6 @@#include "qemu-common.h" #include "qapi/string-output-visitor.h" #include "qapi/visitor-impl.h" -#include "qapi/qmp/qerror.h" #include "qemu/host-utils.h" #include <math.h> #include "qemu/range.h"
qdev-monitor.c +1 -0
@@ -23,6 +23,7 @@#include "monitor/qdev.h" #include "qmp-commands.h" #include "sysemu/arch_init.h" +#include "qapi/qmp/qerror.h" #include "qemu/config-file.h" #include "qemu/error-report.h"
qemu-img.c +1 -0
@@ -23,6 +23,7 @@*/ #include "qapi-visit.h" #include "qapi/qmp-output-visitor.h" +#include "qapi/qmp/qerror.h" #include "qapi/qmp/qjson.h" #include "qemu-common.h" #include "qemu/option.h"
qmp.c +1 -0
@@ -24,6 +24,7 @@#include "hw/qdev.h" #include "sysemu/blockdev.h" #include "qom/qom-qobject.h" +#include "qapi/qmp/qerror.h" #include "qapi/qmp/qobject.h" #include "qapi/qmp-input-visitor.h" #include "hw/boards.h"
qobject/json-parser.c +0 -1
@@ -22,7 +22,6 @@#include "qapi/qmp/qbool.h" #include "qapi/qmp/json-parser.h" #include "qapi/qmp/json-lexer.h" -#include "qapi/qmp/qerror.h" typedef struct JSONParserContext {
scripts/qapi-commands.py +0 -1
@@ -329,7 +329,6 @@ h_comment = ''' fdef.write(mcgen(''' #include "qemu-common.h" #include "qemu/module.h" -#include "qapi/qmp/qerror.h" #include "qapi/qmp/types.h" #include "qapi/qmp/dispatch.h" #include "qapi/visitor.h"
stubs/dump.c +0 -1
@@ -13,7 +13,6 @@#include "qemu-common.h" #include "sysemu/dump-arch.h" -#include "qapi/qmp/qerror.h" #include "qmp-commands.h" int cpu_get_dump_info(ArchDumpInfo *info,
target-arm/cpu.c +0 -1
@@ -22,7 +22,6 @@#include "internals.h" #include "qemu-common.h" #include "hw/qdev-properties.h" -#include "qapi/qmp/qerror.h" #if !defined(CONFIG_USER_ONLY )#include "hw/loader.h" #endif
target-i386/kvm.c +0 -1
@@ -36,7 +36,6 @@#include <asm/hyperv.h> #include "hw/pci/pci.h" #include "migration/migration.h" -#include "qapi/qmp/qerror.h" #include "exec/memattrs.h" //#define DEBUG_KVM
ui/vnc.c +1 -0
@@ -34,6 +34,7 @@#include "qemu/timer.h" #include "qemu/acl.h" #include "qemu/config-file.h" +#include "qapi/qmp/qerror.h" #include "qapi/qmp/types.h" #include "qmp-commands.h" #include "qemu/osdep.h"
util/qemu-config.c +0 -1
@@ -2,7 +2,6 @@#include "qemu/error-report.h" #include "qemu/option.h" #include "qemu/config-file.h" -#include "qapi/qmp/qerror.h" #include "qapi/error.h" #include "qmp-commands.h"
Signature · 1 line
1.9.3
Re: [Qemu-devel] [PATCH 10/11] Include qapi/qmp/qerror.h exactly where needed
Quoted 43 lines · Markus Armbruster
In particular, don't include it into headers.
Signed-off-by Markus Armbruster <[email protected]>--- backends/hostmem.c | 1 - balloon.c | 1 + block.c | 1 + block/backup.c | 1 + block/commit.c | 1 + block/mirror.c | 1 + block/qcow.c | 1 + block/quorum.c | 1 + block/snapshot.c | 1 + block/stream.c | 1 + block/vmdk.c | 1 + blockdev.c | 1 + blockjob.c | 1 + dump.c | 1 + hmp.c | 1 + hw/char/serial-pci.c | 1 - hw/dma/xilinx_axidma.c | 1 - hw/misc/ivshmem.c | 1 - hw/net/xilinx_axienet.c | 1 - hw/pci/pci-stub.c | 1 + hw/pci/pcie.c | 1 - hw/pci/shpc.c | 1 - hw/ppc/virtex_ml507.c | 1 - hw/s390x/s390-virtio.c | 1 + hw/usb/redirect.c | 1 + hw/virtio/virtio-rng.c | 1 - include/block/block_int.h | 1 - include/monitor/monitor.h | 1 - include/qemu/sockets.h | 1 - migration/migration.c | 1 + migration/savevm.c | 1 + monitor.c | 1 + net/net.c | 1 + numa.c | 1 - qapi/qmp-output-visitor.c | 1 - qapi/string-output-visitor.c | 1 - qdev-monitor.c | 1 + qemu-img.c | 1 + qmp.c | 1 +
Quoted 8 lines
qobject/json-parser.c | 1 - scripts/qapi-commands.py | 1 - stubs/dump.c | 1 - target-arm/cpu.c | 1 - target-i386/kvm.c | 1 - ui/vnc.c | 1 + util/qemu-config.c | 1 - 46 files changed, 25 insertions(+), 21 deletions(-)
Re: [Qemu-devel] [PATCH 10/11] Include qapi/qmp/qerror.h exactly where needed
In reply to Markus ArmbrusterQuoted 6 lines · Markus Armbruster
In particular, don't include it into headers.
Signed-off-by Markus Armbruster <[email protected]>---
46 files changed, 25 insertions(+), 21 deletions(-)
Assuming this was done by deleting from headers, then adding it into .c files that no longer compiled. Were there any .c files where it was unused, and if so, how did you go about finding them? By grepping for QERR_?
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH 10/11] Include qapi/qmp/qerror.h exactly where needed
Quoted 6 lines · Eric Blake
Quoted 4 lines · Markus Armbruster
In particular, don't include it into headers.
Signed-off-by Markus Armbruster <[email protected]>---
Quoted 6 lines
Quoted 1 line
46 files changed, 25 insertions(+), 21 deletions(-)Assuming this was done by deleting from headers, then adding it into .c files that no longer compiled. Were there any .c files where it was unused, and if so, how did you go about finding them? By grepping for
QERR_?
Yes, I grepped for QERR_ in addition to compile. Compile can only find missing includes, grep also finds the superfluous ones, and covers code I can't easily compile locally.
Quoted 1 line
Reviewed-by Eric Blake <[email protected]>
Thanks!
PATCH 11/11 Include monitor/monitor.h exactly where needed
In reply to Markus ArmbrusterIn particular, don't include it into headers.
--- balloon.c | 2 +- blockdev-nbd.c | 1 - hw/core/platform-bus.c | 1 - hw/display/qxl.c | 1 - hw/i386/pc.c | 1 - hw/ide/ahci.c | 1 - hw/ppc/spapr_vio.c | 1 - hw/s390x/event-facility.c | 1 - hw/s390x/s390-virtio-bus.c | 1 - hw/s390x/s390-virtio.c | 1 - hw/s390x/virtio-ccw.c | 1 - hw/usb/ccid-card-emulated.c | 1 - hw/usb/ccid-card-passthru.c | 1 - hw/usb/dev-serial.c | 1 - hw/usb/dev-smartcard-reader.c | 1 - hw/usb/hcd-ehci.h | 1 - hw/usb/redirect.c | 1 - include/block/block_int.h | 1 - include/monitor/qdev.h | 2 +- include/sysemu/balloon.h | 1 - include/ui/console.h | 2 +- include/ui/qemu-spice.h | 2 -- migration/migration.c | 1 - net/l2tpv3.c | 1 - qmp.c | 1 + target-s390x/kvm.c | 1 - tpm.c | 1 - ui/input-legacy.c | 1 - ui/spice-display.c | 1 - 29 files changed, 4 insertions(+), 29 deletions(-)
balloon.c +1 -1
@@ -24,7 +24,7 @@* THE SOFTWARE. */ -#include "monitor/monitor.h" +#include "qemu-common.h" #include "exec/cpu-common.h" #include "sysemu/kvm.h" #include "sysemu/balloon.h"
blockdev-nbd.c +0 -1
@@ -12,7 +12,6 @@#include "sysemu/blockdev.h" #include "sysemu/block-backend.h" #include "hw/block/block.h" -#include "monitor/monitor.h" #include "qapi/qmp/qerror.h" #include "sysemu/sysemu.h" #include "qmp-commands.h"
hw/core/platform-bus.c +0 -1
@@ -20,7 +20,6 @@*/ #include "hw/platform-bus.h" -#include "monitor/monitor.h" #include "exec/address-spaces.h" #include "sysemu/sysemu.h"
hw/display/qxl.c +0 -1
@@ -25,7 +25,6 @@#include "qemu/timer.h" #include "qemu/queue.h" #include "qemu/atomic.h" -#include "monitor/monitor.h" #include "sysemu/sysemu.h" #include "trace.h"
hw/i386/pc.c +0 -1
@@ -31,7 +31,6 @@#include "hw/ide.h" #include "hw/pci/pci.h" #include "hw/pci/pci_bus.h" -#include "monitor/monitor.h" #include "hw/nvram/fw_cfg.h" #include "hw/timer/hpet.h" #include "hw/i386/smbios.h"
hw/ide/ahci.c +0 -1
@@ -28,7 +28,6 @@#include <hw/sysbus.h> #include "qemu/error-report.h" -#include "monitor/monitor.h" #include "sysemu/block-backend.h" #include "sysemu/dma.h" #include "internal.h"
hw/ppc/spapr_vio.c +0 -1
@@ -22,7 +22,6 @@#include "hw/hw.h" #include "sysemu/sysemu.h" #include "hw/boards.h" -#include "monitor/monitor.h" #include "hw/loader.h" #include "elf.h" #include "hw/sysbus.h"
hw/s390x/event-facility.c +0 -1
@@ -15,7 +15,6 @@* */ -#include "monitor/monitor.h" #include "sysemu/sysemu.h" #include "hw/s390x/sclp.h"
hw/s390x/s390-virtio-bus.c +0 -1
@@ -21,7 +21,6 @@#include "sysemu/block-backend.h" #include "sysemu/sysemu.h" #include "hw/boards.h" -#include "monitor/monitor.h" #include "hw/loader.h" #include "elf.h" #include "hw/virtio/virtio.h"
hw/s390x/s390-virtio.c +0 -1
@@ -28,7 +28,6 @@#include "sysemu/sysemu.h" #include "net/net.h" #include "hw/boards.h" -#include "monitor/monitor.h" #include "hw/loader.h" #include "hw/virtio/virtio.h" #include "hw/sysbus.h"
hw/s390x/virtio-ccw.c +0 -1
@@ -15,7 +15,6 @@#include "sysemu/blockdev.h" #include "sysemu/sysemu.h" #include "net/net.h" -#include "monitor/monitor.h" #include "hw/virtio/virtio.h" #include "hw/virtio/virtio-serial.h" #include "hw/virtio/virtio-net.h"
hw/usb/ccid-card-emulated.c +0 -1
@@ -33,7 +33,6 @@#include "qemu/thread.h" #include "sysemu/char.h" -#include "monitor/monitor.h" #include "ccid.h" #define DPRINTF (card, lvl, fmt, ...) \
hw/usb/ccid-card-passthru.c +0 -1
@@ -11,7 +11,6 @@#include "sysemu/char.h" #include "qemu/error-report.h" #include "qemu/sockets.h" -#include "monitor/monitor.h" #include "ccid.h" #include "libcacard/vscard_common.h"
hw/usb/dev-serial.c +0 -1
@@ -10,7 +10,6 @@#include "qemu-common.h" #include "qemu/error-report.h" -#include "monitor/monitor.h" #include "hw/usb.h" #include "hw/usb/desc.h" #include "sysemu/char.h"
hw/usb/dev-smartcard-reader.c +0 -1
@@ -38,7 +38,6 @@#include "qemu/error-report.h" #include "hw/usb.h" #include "hw/usb/desc.h" -#include "monitor/monitor.h" #include "ccid.h"
hw/usb/hcd-ehci.h +0 -1
@@ -20,7 +20,6 @@#include "hw/hw.h" #include "qemu/timer.h" #include "hw/usb.h" -#include "monitor/monitor.h" #include "sysemu/dma.h" #include "sysemu/sysemu.h" #include "hw/pci/pci.h"
hw/usb/redirect.c +0 -1
@@ -27,7 +27,6 @@#include "qemu-common.h" #include "qemu/timer.h" -#include "monitor/monitor.h" #include "sysemu/sysemu.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h"
include/block/block_int.h +0 -1
@@ -31,7 +31,6 @@#include "block/coroutine.h" #include "qemu/timer.h" #include "qapi-types.h" -#include "monitor/monitor.h" #include "qemu/hbitmap.h" #include "block/snapshot.h" #include "qemu/main-loop.h"
include/monitor/qdev.h +1 -1
@@ -2,7 +2,7 @@#define QEMU_QDEV_MONITOR_H #include "hw/qdev-core.h" -#include "monitor/monitor.h" +#include "qemu/typedefs.h" /*** monitor commands ***/
include/sysemu/balloon.h +0 -1
@@ -14,7 +14,6 @@#ifndef _QEMU_BALLOON_H#define _QEMU_BALLOON_H -#include "monitor/monitor.h" #include "qapi-types.h" typedef void (QEMUBalloonEvent )(void *opaque,ram_addr_t target);
include/ui/console.h +1 -1
@@ -5,7 +5,7 @@#include "qom/object.h" #include "qapi/qmp/qdict.h" #include "qemu/notify.h" -#include "monitor/monitor.h" +#include "qemu/typedefs.h" #include "qapi-types.h" #include "qapi/error.h"
include/ui/qemu-spice.h +0 -2
@@ -26,7 +26,6 @@#include "qemu/option.h" #include "qemu/config-file.h" -#include "monitor/monitor.h" extern int using_spice;
@@ -54,7 +53,6 @@ static inline CharDriverState *qemu_chr_open_spice_port(const char *name)#endif #else /* CONFIG_SPICE */ -#include "monitor/monitor.h" #define using_spice 0#define spice_displays 0
migration/migration.c +0 -1
@@ -17,7 +17,6 @@#include "qemu/error-report.h" #include "qemu/main-loop.h" #include "migration/migration.h" -#include "monitor/monitor.h" #include "migration/qemu-file.h" #include "sysemu/sysemu.h" #include "block/block.h"
net/l2tpv3.c +0 -1
@@ -28,7 +28,6 @@#include "config-host.h" #include "net/net.h" #include "clients.h" -#include "monitor/monitor.h" #include "qemu-common.h" #include "qemu/error-report.h" #include "qemu/option.h"
qmp.c +1 -0
@@ -14,6 +14,7 @@*/ #include "qemu-common.h" +#include "monitor/monitor.h" #include "sysemu/sysemu.h" #include "qmp-commands.h" #include "sysemu/char.h"
target-s390x/kvm.c +0 -1
@@ -36,7 +36,6 @@#include "cpu.h" #include "sysemu/device_tree.h" #include "qapi/qmp/qjson.h" -#include "monitor/monitor.h" #include "exec/gdbstub.h" #include "exec/address-spaces.h" #include "trace.h"
tpm.c +0 -1
@@ -13,7 +13,6 @@*/ #include "config-host.h" -#include "monitor/monitor.h" #include "qapi/qmp/qerror.h" #include "sysemu/tpm_backend.h" #include "sysemu/tpm.h"
ui/input-legacy.c +0 -1
@@ -23,7 +23,6 @@*/ #include "sysemu/sysemu.h" -#include "monitor/monitor.h" #include "ui/console.h" #include "qapi/error.h" #include "qmp-commands.h"
ui/spice-display.c +0 -1
@@ -19,7 +19,6 @@#include "ui/qemu-spice.h" #include "qemu/timer.h" #include "qemu/queue.h" -#include "monitor/monitor.h" #include "ui/console.h" #include "sysemu/sysemu.h" #include "trace.h"
Signature · 1 line
1.9.3
Re: [Qemu-devel] [PATCH 11/11] Include monitor/monitor.h exactly where needed
Quoted 26 lines · Markus Armbruster
In particular, don't include it into headers.
Signed-off-by Markus Armbruster <[email protected]>--- balloon.c | 2 +- blockdev-nbd.c | 1 - hw/core/platform-bus.c | 1 - hw/display/qxl.c | 1 - hw/i386/pc.c | 1 - hw/ide/ahci.c | 1 - hw/ppc/spapr_vio.c | 1 - hw/s390x/event-facility.c | 1 - hw/s390x/s390-virtio-bus.c | 1 - hw/s390x/s390-virtio.c | 1 - hw/s390x/virtio-ccw.c | 1 - hw/usb/ccid-card-emulated.c | 1 - hw/usb/ccid-card-passthru.c | 1 - hw/usb/dev-serial.c | 1 - hw/usb/dev-smartcard-reader.c | 1 - hw/usb/hcd-ehci.h | 1 - hw/usb/redirect.c | 1 - include/block/block_int.h | 1 - include/monitor/qdev.h | 2 +- include/sysemu/balloon.h | 1 - include/ui/console.h | 2 +- include/ui/qemu-spice.h | 2 --
Quoted 8 lines
migration/migration.c | 1 - net/l2tpv3.c | 1 - qmp.c | 1 + target-s390x/kvm.c | 1 - tpm.c | 1 - ui/input-legacy.c | 1 - ui/spice-display.c | 1 - 29 files changed, 4 insertions(+), 29 deletions(-)
Re: [Qemu-devel] [PATCH 11/11] Include monitor/monitor.h exactly where needed
In reply to Markus ArmbrusterQuoted 6 lines · Markus Armbruster
In particular, don't include it into headers.
Signed-off-by Markus Armbruster <[email protected]>---
29 files changed, 4 insertions(+), 29 deletions(-)
Again, it might be nice to call out in the commit message how you determined which files could drop it (was it via blanket deletion, then re-add if compilation failed?). But doesn't impact the patch being a nice cleanup, so:
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 3 lines · On Sat, 13 Jun 2015 16:20:47 +0200 Markus Armbruster <[email protected]> wrote:
After a bit over a year and many patches, QError is finally ripe. All that's left of
qerror.hafter this series is a bunch ofQERR_macros. Killing them is left for another day.
Excellent!
I did my best to review this series, but unfortunately my review is a bit weak because I'm not that familiar with some code paths (like QemuOpts) and I was unable to apply patches starting with patch 04/11.
But it does look good to me:
Quoted 169 lines
The diffstat looks a bit scary, but that's almost entirely due to mechanical changes like PATCH 05.
This series applies on top of my "[PATCH v2 0/7] qdev: Mostly wean off QError".
Markus Armbruster (11):
QemuOpts: Wean offqerror_report_err()
vl: Avoidqerror_report()outside QMP command handlers
vl: Useerror_report()for --display errors
qerror: EliminateQERR_DEVICE_NOT_FOUND
qerror: Clean upQERR_macros to expand into a single string
tpm: Avoidqerror_report()outside QMP command handlers
qmp: Wean offqerror_report()
qerror: Finally unused, clean up
qerror: Move #include out ofqerror.h
Includeqapi/qmp/qerror.hexactly where needed Includemonitor/monitor.hexactly where neededaudio/spiceaudio.c | 1 + audio/wavcapture.c | 1 + backends/hostmem.c | 1 - backends/rng-egd.c | 11 +-- backends/rng-random.c | 6 +- backends/rng.c | 2 +- backends/tpm.c | 2 +- balloon.c | 5 +- block.c | 4 +- block/backup.c | 5 +- block/commit.c | 3 +- block/curl.c | 1 + block/dmg.c | 1 + block/io.c | 1 + block/iscsi.c | 1 + block/mirror.c | 9 +-- block/qapi.c | 6 -- block/qcow.c | 5 +- block/qcow2-snapshot.c | 1 + block/qcow2.c | 4 +- block/qed.c | 4 +- block/quorum.c | 5 +- block/raw-posix.c | 2 + block/snapshot.c | 5 +- block/ssh.c | 2 + block/stream.c | 5 +- block/vhdx-log.c | 1 + block/vmdk.c | 14 ++-- block/vvfat.c | 1 + blockdev-nbd.c | 6 +- blockdev.c | 80 ++++++++++++--------- blockjob.c | 9 +-- cpus.c | 9 +-- dump.c | 13 ++-- hmp.c | 24 ++++--- hw/9pfs/virtio-9p.c | 1 + hw/char/serial-pci.c | 1 - hw/char/virtio-serial-bus.c | 1 + hw/core/nmi.c | 2 +- hw/core/platform-bus.c | 1 - hw/core/qdev-properties-system.c | 3 +- hw/core/qdev-properties.c | 12 ++-- hw/core/qdev.c | 9 +-- hw/display/g364fb.c | 1 + hw/display/qxl.c | 1 - hw/display/tcx.c | 1 + hw/dma/xilinx_axidma.c | 1 - hw/i386/pc.c | 2 +- hw/ide/ahci.c | 2 +- hw/intc/openpic.c | 6 +- hw/misc/ivshmem.c | 2 +- hw/net/xilinx_axienet.c | 1 - hw/pci/pci-stub.c | 3 +- hw/pci/pci.c | 1 + hw/pci/pcie.c | 1 - hw/pci/shpc.c | 1 - hw/ppc/spapr_pci.c | 8 +-- hw/ppc/spapr_vio.c | 1 - hw/ppc/virtex_ml507.c | 2 +- hw/s390x/event-facility.c | 1 - hw/s390x/s390-virtio-bus.c | 1 - hw/s390x/s390-virtio.c | 4 +- hw/s390x/virtio-ccw.c | 2 +- hw/scsi/vhost-scsi.c | 1 + hw/timer/hpet.c | 1 + hw/tpm/tpm_passthrough.c | 1 + hw/usb/bus.c | 1 + hw/usb/ccid-card-emulated.c | 1 - hw/usb/ccid-card-passthru.c | 2 +- hw/usb/dev-network.c | 2 +- hw/usb/dev-serial.c | 2 +- hw/usb/dev-smartcard-reader.c | 1 - hw/usb/dev-storage.c | 1 + hw/usb/hcd-ehci.h | 1 - hw/usb/host-libusb.c | 1 + hw/usb/redirect.c | 9 +-- hw/virtio/virtio-rng.c | 1 - include/block/block_int.h | 2 - include/monitor/monitor.h | 9 +-- include/monitor/qdev.h | 5 +- include/net/net.h | 2 +- include/qapi/qmp/qerror.h | 85 +++++++++------------- include/qapi/qmp/qobject.h | 1 - include/qemu/option.h | 5 +- include/qemu/sockets.h | 1 - include/sysemu/balloon.h | 1 - include/ui/console.h | 4 +- include/ui/qemu-spice.h | 2 - migration/migration.c | 38 +++++----- migration/qemu-file-buf.c | 1 + migration/qemu-file.c | 1 + migration/rdma.c | 1 + migration/savevm.c | 4 +- monitor.c | 104 +++++++++++---------------- net/l2tpv3.c | 1 - net/net.c | 41 +++++------ net/slirp.c | 1 + numa.c | 1 - qapi/opts-visitor.c | 24 +++---- qapi/qapi-visit-core.c | 28 ++++---- qapi/qmp-dispatch.c | 12 ++-- qapi/qmp-input-visitor.c | 28 ++++---- qapi/qmp-output-visitor.c | 1 - qapi/string-input-visitor.c | 24 +++---- qapi/string-output-visitor.c | 1 - qdev-monitor.c | 37 +++++----- qemu-char.c | 1 + qemu-img.c | 6 +- qemu-io-cmds.c | 1 + qemu-io.c | 4 +- qemu-nbd.c | 4 +- qga/commands-posix.c | 40 +++++------ qga/commands-win32.c | 66 ++++++++--------- qga/main.c | 4 +- qmp-commands.hx | 4 +- qmp.c | 97 ++++++++++--------------- qobject/Makefile.objs | 1 - qobject/json-parser.c | 1 - qobject/qerror.c | 148 --------------------------------------- qobject/qjson.c | 3 - qom/object.c | 18 ++--- scripts/qapi-commands.py | 42 ++--------- slirp/misc.c | 1 + stubs/Makefile.objs | 1 - stubs/arch-query-cpu-def.c | 2 +- stubs/dump.c | 1 - stubs/mon-is-qmp.c | 2 + stubs/mon-set-error.c | 8 --- target-arm/cpu.c | 1 - target-i386/cpu.c | 20 +++--- target-i386/kvm.c | 1 - target-s390x/kvm.c | 1 - tests/test-opts-visitor.c | 3 +- tests/test-qemu-opts.c | 2 +- tpm.c | 12 ++-- ui/input-legacy.c | 1 - ui/input.c | 4 +- ui/spice-core.c | 1 + ui/spice-display.c | 1 - ui/vnc.c | 10 +-- util/osdep.c | 1 + util/qemu-config.c | 1 - util/qemu-error.c | 5 +- util/qemu-option.c | 47 ++++++++----- vl.c | 143 +++++++++++++++++++++---------------- 145 files changed, 676 insertions(+), 845 deletions(-) delete mode 100644 qobject/qerror.c delete mode 100644 stubs/mon-set-error.c
Quoted 7 lines · Luiz Capitulino
Quoted 3 lines · On Sat, 13 Jun 2015 16:20:47 +0200 Markus Armbruster <[email protected]> wrote:
After a bit over a year and many patches, QError is finally ripe. All that's left of
qerror.hafter this series is a bunch ofQERR_macros. Killing them is left for another day.
Quoted 5 lines
Excellent!
I did my best to review this series, but unfortunately my review is a bit weak because I'm not that familiar with some code paths (like QemuOpts) and I was unable to apply patches starting with patch 04/11.
Did you apply on top of my "[PATCH v2 0/7] qdev: Mostly wean off QError"?
Quoted 3 lines
But it does look good to me:
Reviewed-by Luiz Capitulino <[email protected]>
Thanks!
Quoted 9 lines · On Tue, 16 Jun 2015 15:08:41 +0200 Markus Armbruster <[email protected]> wrote:
Quoted 7 lines · Luiz Capitulino
Quoted 3 lines · On Sat, 13 Jun 2015 16:20:47 +0200 Markus Armbruster <[email protected]> wrote:
After a bit over a year and many patches, QError is finally ripe. All that's left of
qerror.hafter this series is a bunch ofQERR_macros. Killing them is left for another day.
Quoted 8 lines
Quoted 5 lines
Excellent!
I did my best to review this series, but unfortunately my review is a bit weak because I'm not that familiar with some code paths (like QemuOpts) and I was unable to apply patches starting with patch 04/11.
Did you apply on top of my "[PATCH v2 0/7] qdev: Mostly wean off QError"?
No, I assumed it was already merged.
Quoted 6 lines
Quoted 3 lines
But it does look good to me:
Reviewed-by Luiz Capitulino <[email protected]>Thanks!