aboutsummaryrefslogtreecommitdiff
path: root/hw/watchdog
diff options
context:
space:
mode:
authorWenchao Xia <wenchaoqemu@gmail.com>2014-06-18 08:43:42 +0200
committerLuiz Capitulino <lcapitulino@redhat.com>2014-06-23 11:12:27 -0400
commit99eaf09c73b213e32e297b1d08d035abb5b268e9 (patch)
tree6b8448ab6a146460e890a4e973fda1f99703efd9 /hw/watchdog
parente010ad8f1e14def33117576916a954d7a3778458 (diff)
qapi event: convert WATCHDOG
Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'hw/watchdog')
-rw-r--r--hw/watchdog/watchdog.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/hw/watchdog/watchdog.c b/hw/watchdog/watchdog.c
index f28161b2d6..4aebd34924 100644
--- a/hw/watchdog/watchdog.c
+++ b/hw/watchdog/watchdog.c
@@ -24,9 +24,9 @@
#include "qemu/config-file.h"
#include "qemu/queue.h"
#include "qapi/qmp/types.h"
-#include "monitor/monitor.h"
#include "sysemu/sysemu.h"
#include "sysemu/watchdog.h"
+#include "qapi-event.h"
/* Possible values for action parameter. */
#define WDT_RESET 1 /* Hard reset. */
@@ -101,15 +101,6 @@ int select_watchdog_action(const char *p)
return 0;
}
-static void watchdog_mon_event(const char *action)
-{
- QObject *data;
-
- data = qobject_from_jsonf("{ 'action': %s }", action);
- monitor_protocol_event(QEVENT_WATCHDOG, data);
- qobject_decref(data);
-}
-
/* This actually performs the "action" once a watchdog has expired,
* ie. reboot, shutdown, exit, etc.
*/
@@ -117,31 +108,31 @@ void watchdog_perform_action(void)
{
switch(watchdog_action) {
case WDT_RESET: /* same as 'system_reset' in monitor */
- watchdog_mon_event("reset");
+ qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_RESET, &error_abort);
qemu_system_reset_request();
break;
case WDT_SHUTDOWN: /* same as 'system_powerdown' in monitor */
- watchdog_mon_event("shutdown");
+ qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_SHUTDOWN, &error_abort);
qemu_system_powerdown_request();
break;
case WDT_POWEROFF: /* same as 'quit' command in monitor */
- watchdog_mon_event("poweroff");
+ qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_POWEROFF, &error_abort);
exit(0);
case WDT_PAUSE: /* same as 'stop' command in monitor */
- watchdog_mon_event("pause");
+ qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_PAUSE, &error_abort);
vm_stop(RUN_STATE_WATCHDOG);
break;
case WDT_DEBUG:
- watchdog_mon_event("debug");
+ qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_DEBUG, &error_abort);
fprintf(stderr, "watchdog: timer fired\n");
break;
case WDT_NONE:
- watchdog_mon_event("none");
+ qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_NONE, &error_abort);
break;
}
}