qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v9 5/7] monitor: remove event_clock_type


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v9 5/7] monitor: remove event_clock_type
Date: Thu, 07 Jun 2018 16:32:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Peter Xu <address@hidden> writes:

> Instead, use a dynamic function to detect which clock we'll use.  The
> problem is that the old code will let monitor initialization depends on
> qtest_enabled().  After this change, we don't have such a dependency any
> more.
>
> Suggested-by: Markus Armbruster <address@hidden>
> Signed-off-by: Peter Xu <address@hidden>
> ---
>  monitor.c | 21 ++++++++++++---------
>  1 file changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index 2504696d76..bd9ab5597f 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -282,8 +282,6 @@ QmpCommandList qmp_commands, qmp_cap_negotiation_commands;
>  
>  Monitor *cur_mon;
>  
> -static QEMUClockType event_clock_type = QEMU_CLOCK_REALTIME;
> -
>  static void monitor_command_cb(void *opaque, const char *cmdline,
>                                 void *readline_opaque);
>  
> @@ -310,6 +308,15 @@ static inline bool monitor_is_hmp_non_interactive(const 
> Monitor *mon)
>      return !monitor_is_qmp(mon) && !monitor_uses_readline(mon);
>  }
>  
> +static inline QEMUClockType monitor_get_clock(void)
> +{
> +    if (qtest_enabled()) {
> +        return QEMU_CLOCK_VIRTUAL;
> +    } else {
> +        return QEMU_CLOCK_REALTIME;
> +    }

Suggest the more laconic

       return qtest_enabled() ? QEMU_CLOCK_VIRTUAL : QEMU_CLOCK_REALTIME;

A comment explaining why we want QEMU_CLOCK_VIRTUAL would be nice.

> +}
> +
>  /**
>   * Is the current monitor, if any, a QMP monitor?
>   */
[...]



reply via email to

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