From nobody Wed Oct 29 09:08:34 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1524761857638452.71244909266875; Thu, 26 Apr 2018 09:57:37 -0700 (PDT) Received: from localhost ([::1]:43526 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fBkD8-0000bQ-Oy for importer@patchew.org; Thu, 26 Apr 2018 12:57:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53850) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fBkAC-0006jS-Hr for qemu-devel@nongnu.org; Thu, 26 Apr 2018 12:54:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fBkAB-0001T7-4W for qemu-devel@nongnu.org; Thu, 26 Apr 2018 12:54:32 -0400 Received: from smtp03.citrix.com ([162.221.156.55]:34814) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fBkAA-0001Rn-PB for qemu-devel@nongnu.org; Thu, 26 Apr 2018 12:54:31 -0400 X-IronPort-AV: E=Sophos;i="5.49,330,1520899200"; d="scan'208";a="52864868" From: Ian Jackson To: Date: Thu, 26 Apr 2018 17:53:29 +0100 Message-ID: <1524761612-5307-5-git-send-email-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1524761612-5307-1-git-send-email-ian.jackson@eu.citrix.com> References: <1524761612-5307-1-git-send-email-ian.jackson@eu.citrix.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 162.221.156.55 Subject: [Qemu-devel] [RFC PATCH 4/7] error reporting: Fix some error messages to use ":" rather than ", " X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ian Jackson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alistair Francis Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This patch is the result of git-grep -l 'error_report.*strerror' | xargs perl -p -i~ ../t with ../t containing s{error_report\("(.*), \%s"(, .*)?, strerror\(errno\)\)\;}{error_report_e= rrno\("$1"$2)\;} Note the comma here ^ which is a one-character difference from the previous patch. The effect is that a lot of messages which used to say something went wrong, now say something went wrong: And of course we remove a lot of open-coded calls. Signed-off-by: Ian Jackson --- block/sheepdog.c | 16 ++++++++-------- scsi/qemu-pr-helper.c | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/block/sheepdog.c b/block/sheepdog.c index 387f59c..70e4bba 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -603,13 +603,13 @@ static coroutine_fn int send_co_req(int sockfd, Sheep= dogReq *hdr, void *data, =20 ret =3D qemu_co_send(sockfd, hdr, sizeof(*hdr)); if (ret !=3D sizeof(*hdr)) { - error_report("failed to send a req, %s", strerror(errno)); + error_report_errno("failed to send a req"); return -errno; } =20 ret =3D qemu_co_send(sockfd, data, *wlen); if (ret !=3D *wlen) { - error_report("failed to send a req, %s", strerror(errno)); + error_report_errno("failed to send a req"); return -errno; } =20 @@ -660,7 +660,7 @@ static coroutine_fn void do_co_req(void *opaque) =20 ret =3D qemu_co_recv(sockfd, hdr, sizeof(*hdr)); if (ret !=3D sizeof(*hdr)) { - error_report("failed to get a rsp, %s", strerror(errno)); + error_report_errno("failed to get a rsp"); ret =3D -errno; goto out; } @@ -672,7 +672,7 @@ static coroutine_fn void do_co_req(void *opaque) if (*rlen) { ret =3D qemu_co_recv(sockfd, data, *rlen); if (ret !=3D *rlen) { - error_report("failed to get the data, %s", strerror(errno)); + error_report_errno("failed to get the data"); ret =3D -errno; goto out; } @@ -809,7 +809,7 @@ static void coroutine_fn aio_read_response(void *opaque) /* read a header */ ret =3D qemu_co_recv(fd, &rsp, sizeof(rsp)); if (ret !=3D sizeof(rsp)) { - error_report("failed to get the header, %s", strerror(errno)); + error_report_errno("failed to get the header"); goto err; } =20 @@ -851,7 +851,7 @@ static void coroutine_fn aio_read_response(void *opaque) ret =3D qemu_co_recvv(fd, acb->qiov->iov, acb->qiov->niov, aio_req->iov_offset, rsp.data_length); if (ret !=3D rsp.data_length) { - error_report("failed to get the data, %s", strerror(errno)); + error_report_errno("failed to get the data"); goto err; } break; @@ -1362,14 +1362,14 @@ static void coroutine_fn add_aio_request(BDRVSheepd= ogState *s, AIOReq *aio_req, /* send a header */ ret =3D qemu_co_send(s->fd, &hdr, sizeof(hdr)); if (ret !=3D sizeof(hdr)) { - error_report("failed to send a req, %s", strerror(errno)); + error_report_errno("failed to send a req"); goto out; } =20 if (wlen) { ret =3D qemu_co_sendv(s->fd, iov, niov, aio_req->iov_offset, wlen); if (ret !=3D wlen) { - error_report("failed to send a data, %s", strerror(errno)); + error_report_errno("failed to send a data"); } } out: diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c index 663a8a8..ff56313 100644 --- a/scsi/qemu-pr-helper.c +++ b/scsi/qemu-pr-helper.c @@ -118,12 +118,12 @@ static void write_pidfile(void) =20 pidfd =3D qemu_open(pidfile, O_CREAT|O_WRONLY, S_IRUSR|S_IWUSR); if (pidfd =3D=3D -1) { - error_report("Cannot open pid file, %s", strerror(errno)); + error_report_errno("Cannot open pid file"); exit(EXIT_FAILURE); } =20 if (lockf(pidfd, F_TLOCK, 0)) { - error_report("Cannot lock pid file, %s", strerror(errno)); + error_report_errno("Cannot lock pid file"); goto fail; } if (ftruncate(pidfd, 0)) { --=20 2.1.4