summary refs log tree commit diff stats
path: root/include
diff options
context:
space:
mode:
authorzhenwei pi <pizhenwei@bytedance.com>2023-07-28 10:19:58 +0800
committerHanna Czenczek <hreitz@redhat.com>2023-08-29 10:49:24 +0200
commit8ba02c24ea25a7a1fa4931e266af7916c115da2c (patch)
tree8ae6439ade7d47afbf98fa1d2dd7c42e31398f52 /include
parentf5fe7c17ac4e309e47e78f0f9761aebc8d2f2c81 (diff)
downloadfocaccia-qemu-8ba02c24ea25a7a1fa4931e266af7916c115da2c.tar.gz
focaccia-qemu-8ba02c24ea25a7a1fa4931e266af7916c115da2c.zip
throttle: introduce enum ThrottleDirection
Use enum ThrottleDirection instead of number index.

Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20230728022006.1098509-2-pizhenwei@bytedance.com>
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/qemu/throttle.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/include/qemu/throttle.h b/include/qemu/throttle.h
index 05f6346137..9ca5ab8197 100644
--- a/include/qemu/throttle.h
+++ b/include/qemu/throttle.h
@@ -99,13 +99,18 @@ typedef struct ThrottleState {
     int64_t previous_leak;    /* timestamp of the last leak done */
 } ThrottleState;
 
+typedef enum {
+    THROTTLE_READ = 0,
+    THROTTLE_WRITE,
+    THROTTLE_MAX
+} ThrottleDirection;
+
 typedef struct ThrottleTimers {
-    QEMUTimer *timers[2];     /* timers used to do the throttling */
+    QEMUTimer *timers[THROTTLE_MAX];    /* timers used to do the throttling */
     QEMUClockType clock_type; /* the clock used */
 
     /* Callbacks */
-    QEMUTimerCB *read_timer_cb;
-    QEMUTimerCB *write_timer_cb;
+    QEMUTimerCB *timer_cb[THROTTLE_MAX];
     void *timer_opaque;
 } ThrottleTimers;