On 2017年05月25日 02:05, Vladislav Yasevich wrote:
> Introdec
Typo.
Thanks
> an annoucement timer structure and initialization to
> be used by for self-annoucement.
>
> Based on the work by Germano Veit Michel <germano@redhat.com>
>
> Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
> ---
> include/migration/vmstate.h | 13 +++++++++++++
> migration/savevm.c | 22 ++++++++++++++++++++++
> 2 files changed, 35 insertions(+)
>
> diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
> index 8489659..a6bf84d 100644
> --- a/include/migration/vmstate.h
> +++ b/include/migration/vmstate.h
> @@ -1057,6 +1057,19 @@ void vmstate_register_ram(struct MemoryRegion *memory, DeviceState *dev);
> void vmstate_unregister_ram(struct MemoryRegion *memory, DeviceState *dev);
> void vmstate_register_ram_global(struct MemoryRegion *memory);
>
> +typedef struct AnnounceTimer {
> + QEMUTimer *tm;
> + AnnounceParameters params;
> + QEMUClockType type;
> + int round;
> +} AnnounceTimer;
> +
> +AnnounceTimer *qemu_announce_timer_new(AnnounceParameters *params,
> + QEMUClockType type);
> +AnnounceTimer *qemu_announce_timer_create(AnnounceParameters *params,
> + QEMUClockType type,
> + QEMUTimerCB *cb);
> +
> static inline
> int64_t self_announce_delay(int round)
> {
> diff --git a/migration/savevm.c b/migration/savevm.c
> index cee2837..607b090 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -230,6 +230,28 @@ static void qemu_announce_self_once(void *opaque)
> }
> }
>
> +AnnounceTimer *qemu_announce_timer_new(AnnounceParameters *params,
> + QEMUClockType type)
> +{
> + AnnounceTimer *timer = g_new(AnnounceTimer, 1);
> +
> + timer->params = *params;
> + timer->round = params->rounds;
> + timer->type = type;
> +
> + return timer;
> +}
> +
> +AnnounceTimer *qemu_announce_timer_create(AnnounceParameters *params,
> + QEMUClockType type,
> + QEMUTimerCB *cb)
> +{
> + AnnounceTimer *timer = qemu_announce_timer_new(params, type);
> +
> + timer->tm = timer_new_ms(type, cb, timer);
> + return timer;
> +}
> +
> void qemu_announce_self(void)
> {
> static QEMUTimer *timer;