From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:58627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RuDcc-0006e5-AS for qemu-devel@nongnu.org; Sun, 05 Feb 2012 20:43:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RuDcY-0006Yh-7V for qemu-devel@nongnu.org; Sun, 05 Feb 2012 20:43:58 -0500 Received: from e28smtp06.in.ibm.com ([122.248.162.6]:38643) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RuDcX-0006WA-GV for qemu-devel@nongnu.org; Sun, 05 Feb 2012 20:43:54 -0500 Received: from /spool/local by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 6 Feb 2012 07:13:48 +0530 Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q161hi0t4341828 for ; Mon, 6 Feb 2012 07:13:46 +0530 Received: from d28av05.in.ibm.com (loopback [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q161hhk7003439 for ; Mon, 6 Feb 2012 12:43:43 +1100 Date: Mon, 6 Feb 2012 09:43:42 +0800 From: Richard Yang Message-ID: <20120206014341.GA4892@richard> References: <1327992986-28168-1-git-send-email-weiyang@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Subject: Re: [Qemu-devel] [PATCH] This patch is used to move some struct definition, like QEMUTimer, QEMUClock, from .c to .h. Reply-To: Richard Yang List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: Wei Yang , qemu-devel@nongnu.org On Sat, Feb 04, 2012 at 10:22:09AM +0000, Blue Swirl wrote: >On Tue, Jan 31, 2012 at 06:56, Wei Yang wrote: >> Tested on i386 platform. >> >> Signed-off-by: Wei Yang > >Nack. Definitions should reside in files where they are used, only in >header files when they are used by multiple sources. > Thanks, I got the idea :-) >> --- >>  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 >> -- >> 1.7.4.1 >> >> -- Richard Yang Help you, Help me