From: Eric Blake <eblake@redhat.com>
To: zhanghailiang <zhang.zhanghailiang@huawei.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, luonengjun@huawei.com,
lersek@redhat.com, peter.huangpeng@huawei.com,
lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3] dump: let dump_error return error info to caller
Date: Tue, 09 Sep 2014 09:10:36 -0600 [thread overview]
Message-ID: <540F186C.2030508@redhat.com> (raw)
In-Reply-To: <1409738096-35644-1-git-send-email-zhang.zhanghailiang@huawei.com>
[-- Attachment #1: Type: text/plain, Size: 2247 bytes --]
On 09/03/2014 03:54 AM, zhanghailiang wrote:
> The second parameter of dump_error is unused, but one purpose of
> using this function is to report the error info.
>
> Use error_set to return the error info to the caller.
>
> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
> ---
> V3:
> - Drop the '\n' in the message when call dump_error(comment of Eric Blake)
> V2:
> - Return the error reason to the caller which suggested by Luiz Capitulino.
> ---
> dump.c | 165 ++++++++++++++++++++++++++++++++---------------------------------
> 1 file changed, 82 insertions(+), 83 deletions(-)
>
> diff --git a/dump.c b/dump.c
> index 71d3e94..a08a711 100644
> --- a/dump.c
> +++ b/dump.c
> @@ -81,9 +81,10 @@ static int dump_cleanup(DumpState *s)
> return 0;
> }
>
> -static void dump_error(DumpState *s, const char *reason)
> +static void dump_error(DumpState *s, Error **errp, const char *reason)
I still think it is unusual to list the errp argument in the middle,
instead of the end. But not necessarily a show-stopper.
> -static int write_elf64_header(DumpState *s)
> +static int write_elf64_header(DumpState *s, Error **errp)
> {
> Elf64_Ehdr elf_header;
> int ret;
> @@ -126,14 +127,14 @@ static int write_elf64_header(DumpState *s)
>
> ret = fd_write_vmcore(&elf_header, sizeof(elf_header), s);
> if (ret < 0) {
> - dump_error(s, "dump: failed to write elf header.\n");
> + dump_error(s, errp, "dump: failed to write elf header.");
We tend to avoid trailing '.' in error messages
> +static int write_dump_pages(DumpState *s, Error **errp)
> {
> int ret = 0;
> DataCache page_desc, page_data;
> @@ -1241,7 +1244,7 @@ static int write_dump_pages(DumpState *s)
> ret = write_cache(&page_data, buf, TARGET_PAGE_SIZE, false);
> g_free(buf);
> if (ret < 0) {
> - dump_error(s, "dump: failed to write page data(zero page).\n");
> + dump_error(s, errp, "dump: failed to write page data(zero page).");
Pre-existing, but worth fixing: space before () in English sentences.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]
next prev parent reply other threads:[~2014-09-09 15:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-03 9:54 [Qemu-devel] [PATCH v3] dump: let dump_error return error info to caller zhanghailiang
2014-09-09 15:10 ` Eric Blake [this message]
2014-09-10 9:12 ` zhanghailiang
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=540F186C.2030508@redhat.com \
--to=eblake@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=lersek@redhat.com \
--cc=luonengjun@huawei.com \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=zhang.zhanghailiang@huawei.com \
/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).