hw/ppc/spapr_drc.c: use g_autofree in drc_unrealize()
[qemu.git] / softmmu / runstate-action.c
blobae0761a9c3a371b669568ebf674ce1a3aaece81a
1 /*
2 * Copyright (c) 2020 Oracle and/or its affiliates.
4 * This work is licensed under the terms of the GNU GPL, version 2.
5 * See the COPYING file in the top-level directory.
7 */
9 #include "qemu/osdep.h"
10 #include "sysemu/runstate-action.h"
11 #include "sysemu/watchdog.h"
12 #include "qemu/config-file.h"
13 #include "qapi/error.h"
14 #include "qemu/option_int.h"
16 RebootAction reboot_action = REBOOT_ACTION_RESET;
17 ShutdownAction shutdown_action = SHUTDOWN_ACTION_POWEROFF;
18 PanicAction panic_action = PANIC_ACTION_SHUTDOWN;
21 * Receives actions to be applied for specific guest events
22 * and sets the internal state as requested.
24 void qmp_set_action(bool has_reboot, RebootAction reboot,
25 bool has_shutdown, ShutdownAction shutdown,
26 bool has_panic, PanicAction panic,
27 bool has_watchdog, WatchdogAction watchdog,
28 Error **errp)
30 if (has_reboot) {
31 reboot_action = reboot;
34 if (has_panic) {
35 panic_action = panic;
38 if (has_watchdog) {
39 qmp_watchdog_set_action(watchdog, errp);
42 /* Process shutdown last, in case the panic action needs to be altered */
43 if (has_shutdown) {
44 shutdown_action = shutdown;