From patchwork Sun Jan 6 10:06:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Li X-Patchwork-Id: 209732 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 108C22C0080 for ; Sun, 6 Jan 2013 21:07:59 +1100 (EST) Received: from localhost ([::1]:47637 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Trn93-0005zS-4N for incoming@patchwork.ozlabs.org; Sun, 06 Jan 2013 05:07:57 -0500 Received: from eggs.gnu.org ([208.118.235.92]:40899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Trn8Y-0004iX-L8 for qemu-devel@nongnu.org; Sun, 06 Jan 2013 05:07:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Trn8X-00082X-5E for qemu-devel@nongnu.org; Sun, 06 Jan 2013 05:07:26 -0500 Received: from e28smtp05.in.ibm.com ([122.248.162.5]:44206) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Trn8W-00082G-Hi for qemu-devel@nongnu.org; Sun, 06 Jan 2013 05:07:25 -0500 Received: from /spool/local by e28smtp05.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 6 Jan 2013 15:36:27 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp05.in.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sun, 6 Jan 2013 15:36:26 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id 34E21125804E for ; Sun, 6 Jan 2013 15:37:30 +0530 (IST) Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r06A7Hu133947812 for ; Sun, 6 Jan 2013 15:37:17 +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 r06A7J7W001751 for ; Sun, 6 Jan 2013 10:07:19 GMT Received: from localhost.localdomain ([9.125.31.140]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r06A74n0000464; Sun, 6 Jan 2013 10:07:18 GMT From: Lei Li To: qemu-devel@nongnu.org Date: Sun, 6 Jan 2013 18:06:59 +0800 Message-Id: <1357466820-12860-3-git-send-email-lilei@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1357466820-12860-1-git-send-email-lilei@linux.vnet.ibm.com> References: <1357466820-12860-1-git-send-email-lilei@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13010610-8256-0000-0000-000005B5B870 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 122.248.162.5 Cc: aliguori@us.ibm.com, mdroth@linux.vnet.ibm.com, Lei Li Subject: [Qemu-devel] [PATCH 2/3] qga: add guest-get-time command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Lei Li --- qga/commands-posix.c | 12 ++++++++++++ qga/qapi-schema.json | 17 +++++++++++++++++ 2 files changed, 29 insertions(+), 0 deletions(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 26b0fa0..190199d 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -109,6 +109,18 @@ static HostTimeInfo *get_host_time(void) return host_time; } +struct HostTimeInfo *qmp_guest_get_time(Error **errp) +{ + HostTimeInfo *host_time = get_host_time(); + + if (!host_time) { + error_set(errp, QERR_QGA_COMMAND_FAILED, "Failed to get host time"); + return NULL; + } + + return host_time; +} + typedef struct GuestFileHandle { uint64_t id; FILE *fh; diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json index 7793aff..4a8b93c 100644 --- a/qga/qapi-schema.json +++ b/qga/qapi-schema.json @@ -100,6 +100,23 @@ 'utc-offset': 'int' } } ## +# @guest-get-time: +# +# Get the information about host time in UTC and the +# UTC offset. +# +# This command tries to get the host time which is +# presumably correct, since need to be able to resynchronize +# clock to host in guest. +# +# Returns: @HostTimeInfo on success. +# +# Since 1.4 +## +{ 'command': 'guest-get-time', + 'returns': 'HostTimeInfo' } + +## # @GuestAgentCommandInfo: # # Information about guest agent commands.