diff options
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -40,6 +40,7 @@ #include "audio/audio.h" #include "migration.h" #include "kvm.h" +#include "balloon.h" #include <unistd.h> #include <fcntl.h> @@ -514,6 +515,31 @@ void hw_error(const char *fmt, ...) va_end(ap); abort(); } + +/***************/ +/* ballooning */ + +static QEMUBalloonEvent *qemu_balloon_event; +void *qemu_balloon_event_opaque; + +void qemu_add_balloon_handler(QEMUBalloonEvent *func, void *opaque) +{ + qemu_balloon_event = func; + qemu_balloon_event_opaque = opaque; +} + +void qemu_balloon(ram_addr_t target) +{ + if (qemu_balloon_event) + qemu_balloon_event(qemu_balloon_event_opaque, target); +} + +ram_addr_t qemu_balloon_status(void) +{ + if (qemu_balloon_event) + return qemu_balloon_event(qemu_balloon_event_opaque, 0); + return 0; +} /***********************************************************/ /* keyboard/mouse */ |