* [Qemu-devel] [PATCH v2] vl.c: print error message if load fw_cfg file failed
@ 2018-10-09 2:39 Li Qiang
2018-10-09 5:52 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 4+ messages in thread
From: Li Qiang @ 2018-10-09 2:39 UTC (permalink / raw)
To: pbonzini, f4bug; +Cc: qemu-devel, Li Qiang
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 929 bytes --]
It makes sense to print the error message while reading
file failed.
Change since v1:
free error
Signed-off-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
vl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/vl.c b/vl.c
index 4e25c78..69fc77c 100644
--- a/vl.c
+++ b/vl.c
@@ -2207,8 +2207,10 @@ static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp)
size = strlen(str); /* NUL terminator NOT included in fw_cfg blob */
buf = g_memdup(str, size);
} else {
- if (!g_file_get_contents(file, &buf, &size, NULL)) {
- error_report("can't load %s", file);
+ GError *error = NULL;
+ if (!g_file_get_contents(file, &buf, &size, &error)) {
+ error_report("can't load %s, %s", file, error->message);
+ g_error_free(error);
return -1;
}
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2] vl.c: print error message if load fw_cfg file failed
2018-10-09 2:39 [Qemu-devel] [PATCH v2] vl.c: print error message if load fw_cfg file failed Li Qiang
@ 2018-10-09 5:52 ` Philippe Mathieu-Daudé
2018-10-09 5:58 ` Li Qiang
0 siblings, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-10-09 5:52 UTC (permalink / raw)
To: Li Qiang, pbonzini, f4bug; +Cc: qemu-devel
Hi Li,
On 09/10/2018 04:39, Li Qiang wrote:
> It makes sense to print the error message while reading
> file failed.
OK
>
> Change since v1:
> free error
Changes are useful for reviewer, but not in the git history.
You can have them automatically stripped if you place them below the
next '---' separator.
Hopefully the maintainer taking this patch can clean this up.
>
> Signed-off-by: Li Qiang <liq3ea@gmail.com>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
Here goes comment not worth to stay forever in git history:
Since v1: ...
> vl.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index 4e25c78..69fc77c 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2207,8 +2207,10 @@ static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp)
> size = strlen(str); /* NUL terminator NOT included in fw_cfg blob */
> buf = g_memdup(str, size);
> } else {
> - if (!g_file_get_contents(file, &buf, &size, NULL)) {
> - error_report("can't load %s", file);
> + GError *error = NULL;
> + if (!g_file_get_contents(file, &buf, &size, &error)) {
> + error_report("can't load %s, %s", file, error->message);
If you ever respin, you can help Markus [1] effort using:
error_setg(errp, "can't load %s, %s", file, error->message);
Else your patch will clash with [2].
> + g_error_free(error);
> return -1;
> }
> }
>
Regards,
Phil.
[1] https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg01394.html
[2] https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg01406.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2] vl.c: print error message if load fw_cfg file failed
2018-10-09 5:52 ` Philippe Mathieu-Daudé
@ 2018-10-09 5:58 ` Li Qiang
2018-10-09 13:04 ` Markus Armbruster
0 siblings, 1 reply; 4+ messages in thread
From: Li Qiang @ 2018-10-09 5:58 UTC (permalink / raw)
To: philmd; +Cc: Paolo Bonzini, f4bug, Qemu Developers
Hello Philippe,
Philippe Mathieu-Daudé <philmd@redhat.com> 于2018年10月9日周二 下午1:52写道:
> Hi Li,
>
> On 09/10/2018 04:39, Li Qiang wrote:
> > It makes sense to print the error message while reading
> > file failed.
>
> OK
>
> >
> > Change since v1:
> > free error
>
> Changes are useful for reviewer, but not in the git history.
> You can have them automatically stripped if you place them below the
> next '---' separator.
>
>
Thanks for your advice.
> Hopefully the maintainer taking this patch can clean this up.
>
> >
> > Signed-off-by: Li Qiang <liq3ea@gmail.com>
> > Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> > ---
>
> Here goes comment not worth to stay forever in git history:
>
> Since v1: ...
>
> > vl.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/vl.c b/vl.c
> > index 4e25c78..69fc77c 100644
> > --- a/vl.c
> > +++ b/vl.c
> > @@ -2207,8 +2207,10 @@ static int parse_fw_cfg(void *opaque, QemuOpts
> *opts, Error **errp)
> > size = strlen(str); /* NUL terminator NOT included in fw_cfg
> blob */
> > buf = g_memdup(str, size);
> > } else {
> > - if (!g_file_get_contents(file, &buf, &size, NULL)) {
> > - error_report("can't load %s", file);
> > + GError *error = NULL;
> > + if (!g_file_get_contents(file, &buf, &size, &error)) {
> > + error_report("can't load %s, %s", file, error->message);
>
> If you ever respin, you can help Markus [1] effort using:
>
> error_setg(errp, "can't load %s, %s", file, error->message);
>
> Else your patch will clash with [2].
>
OK, I will send out this patch based Markus' tree or later when his patch
goes to upstream.
Thanks,
Li Qiang
>
> > + g_error_free(error);
> > return -1;
> > }
> > }
> >
>
> Regards,
>
> Phil.
>
> [1] https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg01394.html
> [2] https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg01406.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2] vl.c: print error message if load fw_cfg file failed
2018-10-09 5:58 ` Li Qiang
@ 2018-10-09 13:04 ` Markus Armbruster
0 siblings, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2018-10-09 13:04 UTC (permalink / raw)
To: Li Qiang; +Cc: philmd, Paolo Bonzini, f4bug, Qemu Developers
Li Qiang <liq3ea@gmail.com> writes:
> Hello Philippe,
>
> Philippe Mathieu-Daudé <philmd@redhat.com> 于2018年10月9日周二 下午1:52写道:
>
>> Hi Li,
>>
>> On 09/10/2018 04:39, Li Qiang wrote:
>> > It makes sense to print the error message while reading
>> > file failed.
[...]
>> > diff --git a/vl.c b/vl.c
>> > index 4e25c78..69fc77c 100644
>> > --- a/vl.c
>> > +++ b/vl.c
>> > @@ -2207,8 +2207,10 @@ static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp)
>> > size = strlen(str); /* NUL terminator NOT included in fw_cfg blob */
>> > buf = g_memdup(str, size);
>> > } else {
>> > - if (!g_file_get_contents(file, &buf, &size, NULL)) {
>> > - error_report("can't load %s", file);
>> > + GError *error = NULL;
>> > + if (!g_file_get_contents(file, &buf, &size, &error)) {
>> > + error_report("can't load %s, %s", file, error->message);
>>
>> If you ever respin, you can help Markus [1] effort using:
>>
>> error_setg(errp, "can't load %s, %s", file, error->message);
>>
>> Else your patch will clash with [2].
>>
>
> OK, I will send out this patch based Markus' tree or later when his patch
> goes to upstream.
Appreciated!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-10-09 13:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-09 2:39 [Qemu-devel] [PATCH v2] vl.c: print error message if load fw_cfg file failed Li Qiang
2018-10-09 5:52 ` Philippe Mathieu-Daudé
2018-10-09 5:58 ` Li Qiang
2018-10-09 13:04 ` Markus Armbruster
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.