From: Ian Jackson <ian.jackson@eu.citrix.com>
To: qemu-devel@nongnu.org
Cc: "Ian Jackson" <ian.jackson@eu.citrix.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Eric Blake" <eblake@redhat.com>,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Alistair Francis" <alistair.francis@xilinx.com>,
"Ian Jackson" <Ian.Jackson@eu.citrix.com>
Subject: [Qemu-devel] [RFC PATCH 4/7] error reporting: Fix some error messages to use ":" rather than ", "
Date: Thu, 26 Apr 2018 17:53:29 +0100 [thread overview]
Message-ID: <1524761612-5307-5-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1524761612-5307-1-git-send-email-ian.jackson@eu.citrix.com>
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_errno\("$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, <errno string>
now say
something went wrong: <errno string>
And of course we remove a lot of open-coded calls.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
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, SheepdogReq *hdr, void *data,
ret = qemu_co_send(sockfd, hdr, sizeof(*hdr));
if (ret != sizeof(*hdr)) {
- error_report("failed to send a req, %s", strerror(errno));
+ error_report_errno("failed to send a req");
return -errno;
}
ret = qemu_co_send(sockfd, data, *wlen);
if (ret != *wlen) {
- error_report("failed to send a req, %s", strerror(errno));
+ error_report_errno("failed to send a req");
return -errno;
}
@@ -660,7 +660,7 @@ static coroutine_fn void do_co_req(void *opaque)
ret = qemu_co_recv(sockfd, hdr, sizeof(*hdr));
if (ret != sizeof(*hdr)) {
- error_report("failed to get a rsp, %s", strerror(errno));
+ error_report_errno("failed to get a rsp");
ret = -errno;
goto out;
}
@@ -672,7 +672,7 @@ static coroutine_fn void do_co_req(void *opaque)
if (*rlen) {
ret = qemu_co_recv(sockfd, data, *rlen);
if (ret != *rlen) {
- error_report("failed to get the data, %s", strerror(errno));
+ error_report_errno("failed to get the data");
ret = -errno;
goto out;
}
@@ -809,7 +809,7 @@ static void coroutine_fn aio_read_response(void *opaque)
/* read a header */
ret = qemu_co_recv(fd, &rsp, sizeof(rsp));
if (ret != sizeof(rsp)) {
- error_report("failed to get the header, %s", strerror(errno));
+ error_report_errno("failed to get the header");
goto err;
}
@@ -851,7 +851,7 @@ static void coroutine_fn aio_read_response(void *opaque)
ret = qemu_co_recvv(fd, acb->qiov->iov, acb->qiov->niov,
aio_req->iov_offset, rsp.data_length);
if (ret != 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(BDRVSheepdogState *s, AIOReq *aio_req,
/* send a header */
ret = qemu_co_send(s->fd, &hdr, sizeof(hdr));
if (ret != sizeof(hdr)) {
- error_report("failed to send a req, %s", strerror(errno));
+ error_report_errno("failed to send a req");
goto out;
}
if (wlen) {
ret = qemu_co_sendv(s->fd, iov, niov, aio_req->iov_offset, wlen);
if (ret != 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)
pidfd = qemu_open(pidfile, O_CREAT|O_WRONLY, S_IRUSR|S_IWUSR);
if (pidfd == -1) {
- error_report("Cannot open pid file, %s", strerror(errno));
+ error_report_errno("Cannot open pid file");
exit(EXIT_FAILURE);
}
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)) {
--
2.1.4
next prev parent reply other threads:[~2018-04-26 16:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-26 16:53 [Qemu-devel] [RFC PATCH 0/7] Introduce error_[v]report_errno[val] Ian Jackson
2018-04-26 16:53 ` [Qemu-devel] [RFC PATCH 1/7] error reporting: Introduce errnoval parameter to vreport Ian Jackson
2018-04-26 17:24 ` Eric Blake
2018-04-26 17:32 ` Ian Jackson
2018-04-26 17:45 ` Eric Blake
2018-04-26 18:23 ` Ian Jackson
2018-04-26 18:12 ` Eric Blake
2018-04-26 16:53 ` [Qemu-devel] [RFC PATCH 2/7] error reporting: Provide error_report_errno (and error_vreport_errno) Ian Jackson
2018-04-26 17:27 ` Eric Blake
2018-04-26 16:53 ` [Qemu-devel] [RFC PATCH 3/7] error reporting: Use error_report_errno in obvious places Ian Jackson
2018-04-26 17:37 ` Eric Blake
2018-04-26 17:43 ` Ian Jackson
2018-04-26 18:07 ` Eric Blake
2018-04-26 16:53 ` Ian Jackson [this message]
2018-04-26 16:53 ` [Qemu-devel] [RFC PATCH 5/7] error reporting: Provide error_report_errnoval (and error_vreport_errnoval) Ian Jackson
2018-04-26 17:31 ` Eric Blake
2018-04-26 17:42 ` Ian Jackson
2018-04-26 16:53 ` [Qemu-devel] [RFC PATCH 6/7] error reporting: Use error_report_errnoval in obvious places Ian Jackson
2018-04-26 16:53 ` [Qemu-devel] [RFC PATCH 7/7] error reporting: HACKING: Say to use error_report_errno Ian Jackson
2018-04-26 17:51 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1524761612-5307-5-git-send-email-ian.jackson@eu.citrix.com \
--to=ian.jackson@eu.citrix.com \
--cc=alistair.francis@xilinx.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=f4bug@amsat.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).