From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZqnAG-0003Xw-Mb for qemu-devel@nongnu.org; Mon, 26 Oct 2015 15:10:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZqnAD-0008FF-Ce for qemu-devel@nongnu.org; Mon, 26 Oct 2015 15:10:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41946) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZqnAD-0008Ez-1l for qemu-devel@nongnu.org; Mon, 26 Oct 2015 15:10:37 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id B2DFC345B4E for ; Mon, 26 Oct 2015 19:10:35 +0000 (UTC) References: <1445879623-8403-1-git-send-email-ehabkost@redhat.com> From: Eric Blake Message-ID: <562E7AA7.3080300@redhat.com> Date: Mon, 26 Oct 2015 13:10:31 -0600 MIME-Version: 1.0 In-Reply-To: <1445879623-8403-1-git-send-email-ehabkost@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="80h3OqTdeOUDinqQf45QrnG7rtpWHNj5h" Subject: Re: [Qemu-devel] [PATCH] vl.c: Replace fprintf(stderr) with error_report() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Paolo Bonzini , Andrew Jones , Markus Armbruster This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --80h3OqTdeOUDinqQf45QrnG7rtpWHNj5h Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/26/2015 11:13 AM, Eduardo Habkost wrote: > This replaces most fprintf(stderr) calls on vl.c with error_report(). >=20 > The trailing newlines, "qemu:" and "error:" message prefixes were > removed. >=20 > The only remaining fprintf(stderr) calls are the ones at > qemu_kill_report(), because the error mesage is split in multiple > fprintf() calls. >=20 > Signed-off-by: Eduardo Habkost > --- > Not sure if this is appropriate post soft-freeze, but if we are going t= o apply > the max-cpus patch from Drew before 2.5.0, we could simply change all t= he > fprintf() calls in a single step. Soft freeze means no new features that didn't already have a patch review started - but this is a cleanup, not a new feature. I think it qualifies for 2.5 inclusion just fine. > --- > vl.c | 228 +++++++++++++++++++++++++++++++++--------------------------= -------- > 1 file changed, 112 insertions(+), 116 deletions(-) In addition to the things Markus pointed out, > @@ -950,7 +950,7 @@ static struct bt_device_s *bt_device_add(const char= *opt) > if (endp) { > vlan_id =3D strtol(endp + 6, &endp, 0); > if (*endp) { > - fprintf(stderr, "qemu: unrecognised bluetooth vlan Id\n");= > + error_report("unrecognised bluetooth vlan Id"); > return 0; Do we have any strong preference for US vs. UK spelling in user-visible messages? (I don't, but someone else might) > } > } > @@ -958,13 +958,13 @@ static struct bt_device_s *bt_device_add(const ch= ar *opt) > vlan =3D qemu_find_bt_vlan(vlan_id); > =20 > if (!vlan->slave) > - fprintf(stderr, "qemu: warning: adding a slave device to " > - "an empty scatternet %i\n", vlan_id); > + error_report("warning: adding a slave device to " > + "an empty scatternet %i", vlan_id); > =20 > if (!strcmp(devname, "keyboard")) > return bt_keyboard_init(vlan); > =20 > - fprintf(stderr, "qemu: unsupported bluetooth device `%s'\n", devna= me); > + error_report("unsupported bluetooth device `%s'", devname); Use of `' quoting is unusual these days; if it were me, I'd use this as a chance to switch to '' quoting. > @@ -3005,8 +3006,7 @@ int main(int argc, char **argv, char **envp) > runstate_init(); > =20 > if (qcrypto_init(&err) < 0) { > - fprintf(stderr, "Cannot initialize crypto: %s\n", > - error_get_pretty(err)); > + error_report("Cannot initialize crypto: %s", error_get_pretty(= err)); > exit(1); > } error_report_err() is nicer than manually calling error_report(error_get_pretty(err)) > @@ -3999,8 +3995,8 @@ int main(int argc, char **argv, char **envp) > } > =20 > if (machine_class =3D=3D NULL) { > - fprintf(stderr, "No machine specified, and there is no default= =2E\n" > - "Use -machine help to list supported machines!\n"); > + error_report("No machine specified, and there is no default.\n= " > + "Use -machine help to list supported machines!"); Indentation looks off. > @@ -4164,12 +4160,12 @@ int main(int argc, char **argv, char **envp) > if (display_type =3D=3D DT_NOGRAPHIC > && (default_parallel || default_serial > || default_monitor || default_virtcon)) { > - fprintf(stderr, "-nographic can not be used with -daemoniz= e\n"); > + error_report("-nographic can not be used with -daemonize")= ; s/can not/cannot/ while touching this > exit(1); > } > #ifdef CONFIG_CURSES > if (display_type =3D=3D DT_CURSES) { > - fprintf(stderr, "curses display can not be used with -daem= onize\n"); > + error_report("curses display can not be used with -daemoni= ze"); and again Whether you squash in those fixes, roll a v2, or send a followup, feel free to add: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --80h3OqTdeOUDinqQf45QrnG7rtpWHNj5h Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWLnqnAAoJEKeha0olJ0NqotAH/AxEYt80pGabeK3L7O4hpwms NjU7gttII56OQ1yEycpJy1YQ7g5ILlSPPrMeqBpS9J8kftg7xDFPinM0ksSvLjE/ VBcnuBQ0I+VfQ6bzBCpBQPfmb94PMza8s35CcptFCL+2fu1am1KBnMrirIVcEFJh VHBDLWR1VPGJ8dnMmiOxH+mcd/8F3Mlf9/sBbEhPFqsfHzBMVwfvePm6oh6FxWyV Uwkd+U0RpjeSuuE++IJOxuh/oUfYEdhEMPrjxQcGFeBsaCAaM+oLjQxz4eoY/50V BgGzLjMDhVGNvm7lSJ9Gk/UCzSGpUvnx+JMtzMGI2BbQoSKhygA6M0ADJP8SIG0= =ahUw -----END PGP SIGNATURE----- --80h3OqTdeOUDinqQf45QrnG7rtpWHNj5h--