From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsFnL-0001IE-1X for qemu-devel@nongnu.org; Thu, 27 Jun 2013 13:15:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UsFnJ-0006pk-Ld for qemu-devel@nongnu.org; Thu, 27 Jun 2013 13:15:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17781) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsFnJ-0006pR-28 for qemu-devel@nongnu.org; Thu, 27 Jun 2013 13:15:41 -0400 Message-ID: <51CC732A.90001@redhat.com> Date: Thu, 27 Jun 2013 11:15:22 -0600 From: Eric Blake MIME-Version: 1.0 References: <51CB6946.90903@hds.com> In-Reply-To: <51CB6946.90903@hds.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2NAIDJAAHKKGURJCXVRKC" Subject: Re: [Qemu-devel] [PATCH v3] Add timestamp to error message List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Seiji Aguchi 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 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2NAIDJAAHKKGURJCXVRKC Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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. >=20 > +#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 op= tions before this line! > STEXI > @end table > ETEXI > + > +DEF("msg", HAS_ARG, QEMU_OPTION_msg, > + "-msg [timestamp=3Don|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). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2NAIDJAAHKKGURJCXVRKC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRzHMrAAoJEKeha0olJ0NqgL4H/jtP7Wn7ZJPlj3+R8OIf08Sn ic+scw5Mb7jQcrlSyUJywplkAo0pWS7FPV2tcHjk12XqWbEjT2vy4kChL8q/GCIR zxNqV7PVuZEDi6m4bcVG3juTYlESsj/wyuElIMFwPpl+7DuF624I6lRNLdyTtW/a DdxhpUnTmbv5Nd9gTxRK978ZXTwJRIpmZGJGktWVge1MAiI9136IO4C2/oe7WIgC ey7dla7qlKPd6g9XQEns/bqeD9OmKiOJ+aBFLVTqmdbDeMpqfDJghN5RiH0hIYak KoozggG7wHfqkfMETv1YwTvUHTlNaY+9tl++Uom3+cdq6ECHPQDXKtFQO0PWGgk= =ebhL -----END PGP SIGNATURE----- ------enig2NAIDJAAHKKGURJCXVRKC--