qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] This patch is used to move some struct definiti


From: Blue Swirl
Subject: Re: [Qemu-devel] [PATCH] This patch is used to move some struct definition, like QEMUTimer, QEMUClock, from .c to .h.
Date: Sat, 4 Feb 2012 10:22:09 +0000

On Tue, Jan 31, 2012 at 06:56, Wei Yang <address@hidden> wrote:
> Tested on i386 platform.
>
> Signed-off-by: Wei Yang<address@hidden>

Nack. Definitions should reside in files where they are used, only in
header files when they are used by multiple sources.

> ---
>  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
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]