From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41628) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WRTb7-0006No-Fk for qemu-devel@nongnu.org; Sat, 22 Mar 2014 17:37:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WRTb2-0006J8-Nt for qemu-devel@nongnu.org; Sat, 22 Mar 2014 17:36:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51870) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WRTb2-0006J1-FH for qemu-devel@nongnu.org; Sat, 22 Mar 2014 17:36:52 -0400 Message-ID: <532E0270.5010507@redhat.com> Date: Sat, 22 Mar 2014 17:36:48 -0400 From: Cole Robinson MIME-Version: 1.0 References: <176c909f6e01409b9dd8d37108f2df5dcf8edd17.1394579440.git.crobinso@redhat.com> <53200B1D.1020000@siemens.com> <532DD5FA.6000806@suse.de> In-Reply-To: <532DD5FA.6000806@suse.de> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/6] slirp: Remove default_mon usage List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-15?Q?Andreas_F=E4rber?= , Jan Kiszka , qemu-devel@nongnu.org Cc: Markus Armbruster , Luiz Capitulino On 03/22/2014 02:27 PM, Andreas F=E4rber wrote: > Am 12.03.2014 08:22, schrieb Jan Kiszka: >> On 2014-03-12 00:15, Cole Robinson wrote: >>> These errors don't seem user initiated, so forcibly printing to the >>> monitor doesn't seem right. Just print to stderr. >>> >>> Drop lprint since it's now unused. >>> >>> Cc: Jan Kiszka >>> Signed-off-by: Cole Robinson >>> --- >>> checkpatch flags some pre-existing tab issues, but I didn't retab. Sh= ould I? >>> >>> slirp/misc.c | 13 ++----------- >>> slirp/slirp.c | 8 ++++---- >>> slirp/slirp.h | 2 -- >>> 3 files changed, 6 insertions(+), 17 deletions(-) >>> >>> diff --git a/slirp/misc.c b/slirp/misc.c >>> index 6c1636f..662fb1d 100644 >>> --- a/slirp/misc.c >>> +++ b/slirp/misc.c >>> @@ -136,7 +136,7 @@ fork_exec(struct socket *so, const char *ex, int = do_pty) >>> if ((s =3D qemu_socket(AF_INET, SOCK_STREAM, 0)) < 0 || >>> bind(s, (struct sockaddr *)&addr, addrlen) < 0 || >>> listen(s, 1) < 0) { >>> - lprint("Error: inet socket: %s\n", strerror(errno)); >>> + fprintf(stderr, "Error: inet socket: %s\n", strerror(errno)); >>> closesocket(s); >>> =20 >>> return 0; >>> @@ -146,7 +146,7 @@ fork_exec(struct socket *so, const char *ex, int = do_pty) >>> pid =3D fork(); >>> switch(pid) { >>> case -1: >>> - lprint("Error: fork failed: %s\n", strerror(errno)); >>> + fprintf(stderr, "Error: fork failed: %s\n", strerror(errno)); >>> close(s); >>> return 0; >>> =20 >>> @@ -242,15 +242,6 @@ strdup(str) >>> } >>> #endif >>> =20 >>> -void lprint(const char *format, ...) >>> -{ >>> - va_list args; >>> - >>> - va_start(args, format); >>> - monitor_vprintf(default_mon, format, args); >>> - va_end(args); >>> -} >>> - >>> void slirp_connection_info(Slirp *slirp, Monitor *mon) >>> { >>> const char * const tcpstates[] =3D { >>> diff --git a/slirp/slirp.c b/slirp/slirp.c >>> index bad8dad..3fb48a4 100644 >>> --- a/slirp/slirp.c >>> +++ b/slirp/slirp.c >>> @@ -139,7 +139,7 @@ int get_dns_addr(struct in_addr *pdns_addr) >>> return -1; >>> =20 >>> #ifdef DEBUG >>> - lprint("IP address of your DNS(s): "); >>> + fprintf(stderr, "IP address of your DNS(s): "); >>> #endif >>> while (fgets(buff, 512, f) !=3D NULL) { >>> if (sscanf(buff, "nameserver%*[ \t]%256s", buff2) =3D=3D 1) = { >>> @@ -153,17 +153,17 @@ int get_dns_addr(struct in_addr *pdns_addr) >>> } >>> #ifdef DEBUG >>> else >>> - lprint(", "); >>> + fprintf(stderr, ", "); >>> #endif >>> if (++found > 3) { >>> #ifdef DEBUG >>> - lprint("(more)"); >>> + fprintf(stderr, "(more)"); >>> #endif >>> break; >>> } >>> #ifdef DEBUG >>> else >>> - lprint("%s", inet_ntoa(tmp_addr)); >>> + fprintf(stderr, "%s", inet_ntoa(tmp_addr)); >>> #endif >>> } >>> } >>> diff --git a/slirp/slirp.h b/slirp/slirp.h >>> index e4a1bd4..6589d7e 100644 >>> --- a/slirp/slirp.h >>> +++ b/slirp/slirp.h >>> @@ -287,8 +287,6 @@ void if_start(struct ttys *); >>> long gethostid(void); >>> #endif >>> =20 >>> -void lprint(const char *, ...) GCC_FMT_ATTR(1, 2); >>> - >>> #ifndef _WIN32 >>> #include >>> #endif >>> >> >> Reviewed-by: Jan Kiszka >=20 > The first two are not OK. Instead of fprintf(stderr), error_report() > should be used, which prints an optional timestamp and executable name > and doesn't need to be terminated with \n. >=20 Markus had the same comment. I posted v2 of this series yesterday which addresses this. - Cole