From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46895) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtYu4-0003F4-CL for qemu-devel@nongnu.org; Fri, 11 Jan 2013 02:19:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TtYty-0007g3-QF for qemu-devel@nongnu.org; Fri, 11 Jan 2013 02:19:48 -0500 Received: from e28smtp03.in.ibm.com ([122.248.162.3]:45910) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtYty-0007ft-5e for qemu-devel@nongnu.org; Fri, 11 Jan 2013 02:19:42 -0500 Received: from /spool/local by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 11 Jan 2013 12:48:26 +0530 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id 62B47E004B for ; Fri, 11 Jan 2013 12:49:52 +0530 (IST) Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r0B7JZqC48300100 for ; Fri, 11 Jan 2013 12:49:35 +0530 Received: from d28av01.in.ibm.com (loopback [127.0.0.1]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r0B7JaXc010500 for ; Fri, 11 Jan 2013 07:19:36 GMT Message-ID: <50EFBD07.4010401@linux.vnet.ibm.com> Date: Fri, 11 Jan 2013 15:19:35 +0800 From: Lei Li MIME-Version: 1.0 References: <1357466820-12860-1-git-send-email-lilei@linux.vnet.ibm.com> <1357466820-12860-2-git-send-email-lilei@linux.vnet.ibm.com> <20130109113206.3ef4ced2@doriath.home> In-Reply-To: <20130109113206.3ef4ced2@doriath.home> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/3] qga: add support to get host time List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com On 01/09/2013 09:32 PM, Luiz Capitulino wrote: > On Sun, 6 Jan 2013 18:06:58 +0800 > Lei Li wrote: > >> Signed-off-by: Lei Li >> --- >> qga/commands-posix.c | 18 ++++++++++++++++++ >> qga/qapi-schema.json | 17 +++++++++++++++++ >> 2 files changed, 35 insertions(+), 0 deletions(-) >> >> diff --git a/qga/commands-posix.c b/qga/commands-posix.c >> index a657201..26b0fa0 100644 >> --- a/qga/commands-posix.c >> +++ b/qga/commands-posix.c >> @@ -91,6 +91,24 @@ exit_err: >> error_set(err, QERR_UNDEFINED_ERROR); >> } >> >> +static HostTimeInfo *get_host_time(void) >> +{ > Does this build? Because no one is using this function. Yes, this should be squashed into patch #2 as Mike also pointed out that. >> + int err; >> + qemu_timeval tq; >> + HostTimeInfo *host_time; >> + >> + err = qemu_gettimeofday(&tq); >> + if (err < 0) { > I'd recommend taking an Error * argument and setting it with > error_set_errno(). ok. > >> + return NULL; >> + } >> + >> + host_time = g_malloc0(sizeof(HostTimeInfo)); >> + host_time->seconds = tq.tv_sec; >> + host_time->microseconds = tq.tv_usec; >> + >> + return host_time; >> +} >> + >> typedef struct GuestFileHandle { >> uint64_t id; >> FILE *fh; >> diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json >> index ed0eb69..7793aff 100644 >> --- a/qga/qapi-schema.json >> +++ b/qga/qapi-schema.json >> @@ -83,6 +83,23 @@ >> { 'command': 'guest-ping' } >> >> ## >> +# @HostTimeInfo > I'm a bit confused, why do you call it HostTimeInfo if this runs > in the guest? I call it HostTimeInfo because it contains the host time information. But seems that all of you don't like this 'HostTimeInfo', 'TimeInfo' might be better? >> +# >> +# Information about host time. >> +# >> +# @seconds: "seconds" time from the host. >> +# >> +# @microseconds: "microseconds" time from the host. >> +# >> +# @utc-offset: information about utc offset. >> +# >> +# Since: 1.4 >> +## >> +{ 'type': 'HostTimeInfo', >> + 'data': { 'seconds': 'int', 'microseconds': 'int', >> + 'utc-offset': 'int' } } >> + >> +## >> # @GuestAgentCommandInfo: >> # >> # Information about guest agent commands. -- Lei