mirror of
https://github.com/qemu/qemu.git
synced 2024-12-17 01:03:51 +08:00
944458b659
Previously there was a single instance of the timer used by monitor triggered announces, that's OK, but when combined with the previous change that lets you have announces for subsets of interfaces it's a bit restrictive if you want to do different things to different interfaces. Add an 'id' field to the announce, and maintain a list of the timers based on id. This allows you to for example: a) Start an announce going on interface eth0 for a long time b) Start an announce going on interface eth1 for a long time c) Kill the announce on eth0 while leaving eth1 going. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
45 lines
1.2 KiB
C
45 lines
1.2 KiB
C
/*
|
|
* Self-announce facility
|
|
* (c) 2017-2019 Red Hat, Inc.
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
* See the COPYING file in the top-level directory.
|
|
*/
|
|
|
|
#ifndef QEMU_NET_ANNOUNCE_H
|
|
#define QEMU_NET_ANNOUNCE_H
|
|
|
|
#include "qapi/qapi-types-net.h"
|
|
#include "qemu/timer.h"
|
|
|
|
struct AnnounceTimer {
|
|
QEMUTimer *tm;
|
|
AnnounceParameters params;
|
|
QEMUClockType type;
|
|
int round;
|
|
};
|
|
|
|
/* Returns: update the timer to the next time point */
|
|
int64_t qemu_announce_timer_step(AnnounceTimer *timer);
|
|
|
|
/*
|
|
* Delete the underlying timer and other data
|
|
* If 'free_named' true and the timer is a named timer, then remove
|
|
* it from the list of named timers and free the AnnounceTimer itself.
|
|
*/
|
|
void qemu_announce_timer_del(AnnounceTimer *timer, bool free_named);
|
|
|
|
/*
|
|
* Under BQL/main thread
|
|
* Reset the timer to the given parameters/type/notifier.
|
|
*/
|
|
void qemu_announce_timer_reset(AnnounceTimer *timer,
|
|
AnnounceParameters *params,
|
|
QEMUClockType type,
|
|
QEMUTimerCB *cb,
|
|
void *opaque);
|
|
|
|
void qemu_announce_self(AnnounceTimer *timer, AnnounceParameters *params);
|
|
|
|
#endif
|