From patchwork Tue Jan 31 06:56:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 139140 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id EAD3A104797 for ; Fri, 3 Feb 2012 00:44:36 +1100 (EST) Received: from localhost ([::1]:45540 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rswxj-0005ZT-LM for incoming@patchwork.ozlabs.org; Thu, 02 Feb 2012 08:44:31 -0500 Received: from eggs.gnu.org ([140.186.70.92]:38093) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rswxc-0005ZN-6w for qemu-devel@nongnu.org; Thu, 02 Feb 2012 08:44:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rswxb-0007ya-8b for qemu-devel@nongnu.org; Thu, 02 Feb 2012 08:44:24 -0500 Received: from [124.77.181.162] (port=43689 helo=richard) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RswxZ-0007yK-GH for qemu-devel@nongnu.org; Thu, 02 Feb 2012 08:44:23 -0500 Received: by richard (Postfix, from userid 1000) id 4061D4C30F3; Tue, 31 Jan 2012 14:56:27 +0800 (CST) From: Wei Yang To: qemu-devel@nongnu.org Date: Tue, 31 Jan 2012 14:56:26 +0800 Message-Id: <1327992986-28168-1-git-send-email-weiyang@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.4.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 124.77.181.162 Cc: Wei Yang Subject: [Qemu-devel] [PATCH] This patch is used to move some struct definition, like QEMUTimer, QEMUClock, from .c to .h. 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 Tested on i386 platform. Signed-off-by: Wei Yang --- qemu-timer.c | 40 ---------------------------------------- qemu-timer.h | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/qemu-timer.c b/qemu-timer.c index cd026c6..2b5cc48 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -46,46 +46,6 @@ #include "qemu-timer.h" -/***********************************************************/ -/* timers */ - -#define QEMU_CLOCK_REALTIME 0 -#define QEMU_CLOCK_VIRTUAL 1 -#define QEMU_CLOCK_HOST 2 - -struct QEMUClock { - int type; - int enabled; - - QEMUTimer *active_timers; - - NotifierList reset_notifiers; - int64_t last; -}; - -struct QEMUTimer { - QEMUClock *clock; - int64_t expire_time; /* in nanoseconds */ - int scale; - QEMUTimerCB *cb; - void *opaque; - struct QEMUTimer *next; -}; - -struct qemu_alarm_timer { - char const *name; - int (*start)(struct qemu_alarm_timer *t); - void (*stop)(struct qemu_alarm_timer *t); - void (*rearm)(struct qemu_alarm_timer *t, int64_t nearest_delta_ns); -#if defined(__linux__) - int fd; - timer_t timer; -#elif defined(_WIN32) - HANDLE timer; -#endif - char expired; - char pending; -}; static struct qemu_alarm_timer *alarm_timer; diff --git a/qemu-timer.h b/qemu-timer.h index 67ca72e..5bf2fc7 100644 --- a/qemu-timer.h +++ b/qemu-timer.h @@ -20,6 +20,47 @@ typedef struct QEMUClock QEMUClock; typedef void QEMUTimerCB(void *opaque); +/***********************************************************/ +/* timers */ + +#define QEMU_CLOCK_REALTIME 0 +#define QEMU_CLOCK_VIRTUAL 1 +#define QEMU_CLOCK_HOST 2 + +struct QEMUClock { + int type; + int enabled; + + QEMUTimer *active_timers; + + NotifierList reset_notifiers; + int64_t last; +}; + +struct QEMUTimer { + QEMUClock *clock; + int64_t expire_time; /* in nanoseconds */ + int scale; + QEMUTimerCB *cb; + void *opaque; + struct QEMUTimer *next; +}; + +struct qemu_alarm_timer { + char const *name; + int (*start)(struct qemu_alarm_timer *t); + void (*stop)(struct qemu_alarm_timer *t); + void (*rearm)(struct qemu_alarm_timer *t, int64_t nearest_delta_ns); +#if defined(__linux__) + int fd; + timer_t timer; +#elif defined(_WIN32) + HANDLE timer; +#endif + char expired; + char pending; +}; + /* The real time clock should be used only for stuff which does not change the virtual machine state, as it is run even if the virtual machine is stopped. The real time clock has a frequency of 1000