mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
throttle: Use throttle_config_init() to initialize ThrottleConfig
We can currently initialize ThrottleConfig by zeroing all its fields, but this will change with the new fields to define the length of the burst periods. This patch introduces a new throttle_config_init() function and uses it to replace all memset() calls that initialize ThrottleConfig directly. Signed-off-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
d5851089a8
commit
1588ab5d0b
4 changed files with 31 additions and 13 deletions
|
@ -171,10 +171,20 @@ void throttle_timers_attach_aio_context(ThrottleTimers *tt,
|
|||
tt->write_timer_cb, tt->timer_opaque);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the ThrottleConfig structure to a valid state
|
||||
* @cfg: the config to initialize
|
||||
*/
|
||||
void throttle_config_init(ThrottleConfig *cfg)
|
||||
{
|
||||
memset(cfg, 0, sizeof(*cfg));
|
||||
}
|
||||
|
||||
/* To be called first on the ThrottleState */
|
||||
void throttle_init(ThrottleState *ts)
|
||||
{
|
||||
memset(ts, 0, sizeof(ThrottleState));
|
||||
throttle_config_init(&ts->cfg);
|
||||
}
|
||||
|
||||
/* To be called first on the ThrottleTimers */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue