From: Eric Blake <eblake@redhat.com>
To: Seiji Aguchi <seiji.aguchi@hds.com>
Cc: kwolf@redhat.com, aliguori@us.ibm.com, tomoki.sekiyama@hds.com,
mst@redhat.com, stefanha@gmail.com, mtosatti@redhat.com,
qemu-devel@nongnu.org, armbru@redhat.com,
dle-develop@lists.sourceforge.net, av1474@comtv.ru,
stefanha@redhat.com, pbonzini@redhat.com, lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3] Add timestamp to error message
Date: Thu, 27 Jun 2013 11:15:22 -0600 [thread overview]
Message-ID: <51CC732A.90001@redhat.com> (raw)
In-Reply-To: <51CB6946.90903@hds.com>
[-- Attachment #1: Type: text/plain, Size: 1903 bytes --]
On 06/26/2013 04:20 PM, Seiji Aguchi wrote:
> [Issue]
> When we offer a customer support service and a problem happens
> in a customer's system, we try to understand the problem by
> comparing what the customer reports with message logs of the
> customer's system.
>
> +#include "qemu-common.h"
> +
> +/* "1970-01-01T00:00:00.999999Z" + '\0' */
> +#define TIMESTAMP_LEN 28
Self-documenting constants are nicer:
#define TIMESTAMP_LEN (sizeof("1970-01-01T00:00:00.999999Z")+1)
> +extern void qemu_get_timestamp_str(char (*timestr)[]);
Eww. I had a tough time parsing this signature. Isn't it the same as
the more legible:
extern void qemu_get_timestamp_str(char **timestr);
Furthermore, isn't the idea that you DON'T want to return a malloc'd
string, but require that the user pre-allocate storage that we write
into (since malloc during a log message reporting OOM is liable to fail,
but we still want the log to be best effort)? But then why do you need
a pointer to an array? Wouldn't it be better as:
extern void qemu_get_timestamp_str(char *timestr, size_t len)
where len is the length of timestr, and where the comments document that
len should be at least TIMESTAMP_LEN to avoid truncation (or even
assert() if it is not)?
> +++ b/qemu-options.hx
> @@ -3102,3 +3102,15 @@ HXCOMM This is the last statement. Insert new options before this line!
> STEXI
> @end table
> ETEXI
> +
> +DEF("msg", HAS_ARG, QEMU_OPTION_msg,
> + "-msg [timestamp=on|off]\n"
> + " output message with timestamp (default: off)\n",
> + QEMU_ARCH_ALL)
Did you test that the existing query-command-line-options QMP command
will list this option (just making sure that libvirt will be able to
know when to use this option).
--
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: 621 bytes --]
next prev parent reply other threads:[~2013-06-27 17:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-26 22:20 [Qemu-devel] [PATCH v3] Add timestamp to error message Seiji Aguchi
2013-06-27 1:59 ` Seiji Aguchi
2013-06-27 17:15 ` Eric Blake [this message]
2013-06-28 18:57 ` Seiji Aguchi
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=51CC732A.90001@redhat.com \
--to=eblake@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=armbru@redhat.com \
--cc=av1474@comtv.ru \
--cc=dle-develop@lists.sourceforge.net \
--cc=kwolf@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=seiji.aguchi@hds.com \
--cc=stefanha@gmail.com \
--cc=stefanha@redhat.com \
--cc=tomoki.sekiyama@hds.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 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.