On 08.09.26 10:28, Akihiko Odaki wrote:
On 2026/09/05 5:57, Vladimir Sementsov-Ogievskiy wrote:
The action variables are now used only within system/runstate.c.
Move them and qmp_set_action() there, make the variables static,
and remove runstate-action.c and its header.
Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
---
MAINTAINERS | 1 -
include/system/runstate-action.h | 19 -------------
monitor/qmp-cmds.c | 1 -
system/meson.build | 1 -
system/runstate-action.c | 46 --------------------------------
system/runstate.c | 34 ++++++++++++++++++++++-
system/vl.c | 2 +-
ui/cocoa.m | 1 -
ui/sdl2.c | 1 -
9 files changed, 34 insertions(+), 72 deletions(-)
delete mode 100644 include/system/runstate-action.h
delete mode 100644 system/runstate-action.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 7183babd6aa..2cee4c71b7a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3514,7 +3514,6 @@ M: Paolo Bonzini <[email protected]>
S: Maintained
F: include/qemu/main-loop.h
F: include/system/runstate.h
-F: include/system/runstate-action.h
F: util/main-loop.c
F: util/qemu-timer*.c
F: system/vl.c
diff --git a/include/system/runstate-action.h b/include/system/runstate-action.h
deleted file mode 100644
index db4e3099ae5..00000000000
--- a/include/system/runstate-action.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (c) 2020 Oracle and/or its affiliates.
- *
- * This work is licensed under the terms of the GNU GPL, version 2.
- * See the COPYING file in the top-level directory.
- *
- */
-
-#ifndef RUNSTATE_ACTION_H
-#define RUNSTATE_ACTION_H
-
-#include "qapi/qapi-commands-run-state.h"
-
-/* in system/runstate-action.c */
-extern RebootAction reboot_action;
-extern ShutdownAction shutdown_action;
-extern PanicAction panic_action;
-
-#endif /* RUNSTATE_ACTION_H */
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
index 6d0ba75ff16..f89237eb238 100644
--- a/monitor/qmp-cmds.c
+++ b/monitor/qmp-cmds.c
@@ -22,7 +22,6 @@
#include "system/system.h"
#include "system/kvm.h"
#include "system/runstate.h"
-#include "system/runstate-action.h"
#include "system/block-backend.h"
#include "qapi/error.h"
#include "qapi/qapi-init-commands.h"
diff --git a/system/meson.build b/system/meson.build
index 41e2e4a292d..dd4622ae08c 100644
--- a/system/meson.build
+++ b/system/meson.build
@@ -22,7 +22,6 @@ system_ss.add(files(
'qdev-monitor.c',
'qtest.c',
'rtc.c',
- 'runstate-action.c',
'runstate.c',
'watchpoint.c',
))
diff --git a/system/runstate-action.c b/system/runstate-action.c
deleted file mode 100644
index f912bc837f2..00000000000
--- a/system/runstate-action.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2020 Oracle and/or its affiliates.
- *
- * This work is licensed under the terms of the GNU GPL, version 2.
- * See the COPYING file in the top-level directory.
- *
- */
-
-#include "qemu/osdep.h"
-#include "system/runstate-action.h"
-#include "system/watchdog.h"
-#include "qemu/config-file.h"
-#include "qapi/error.h"
-#include "qemu/option_int.h"
-
-RebootAction reboot_action = REBOOT_ACTION_RESET;
-ShutdownAction shutdown_action = SHUTDOWN_ACTION_POWEROFF;
-PanicAction panic_action = PANIC_ACTION_SHUTDOWN;
-
-/*
- * Receives actions to be applied for specific guest events
- * and sets the internal state as requested.
- */
-void qmp_set_action(bool has_reboot, RebootAction reboot,
- bool has_shutdown, ShutdownAction shutdown,
- bool has_panic, PanicAction panic,
- bool has_watchdog, WatchdogAction watchdog,
- Error **errp)
-{
- if (has_reboot) {
- reboot_action = reboot;
- }
-
- if (has_panic) {
- panic_action = panic;
- }
-
- if (has_watchdog) {
- qmp_watchdog_set_action(watchdog, errp);
- }
-
- /* Process shutdown last, in case the panic action needs to be altered */
- if (has_shutdown) {
- shutdown_action = shutdown;
- }
-}
diff --git a/system/runstate.c b/system/runstate.c
index 5d10ff0df99..a5f16da975e 100644
--- a/system/runstate.c
+++ b/system/runstate.c
@@ -2,6 +2,7 @@
* QEMU main system emulation loop
*
* Copyright (c) 2003-2020 QEMU contributors
+ * Copyright (c) 2020 Oracle and/or its affiliates.
The deleted runstate-action.c explicitly licensed qmp_set_action() under GPLv2.
The move retains only Oracle’s copyright line under the destination’s MIT
header. I guess noting that this file is licensed under GPLv2 is the right
thing to do here.
Hmm.. Funny thing.
To move qmp_set_action() we need an ack from Oracle. Alejandro could you ack it?
To move the whole system/runstate.c into GPLv2, we need and ack from "Copyright (c)
2003-2020 QEMU contributors", which is a lot more difficult.
To be honest, I don't believe, that qmp_set_action() worth worrying. It's a
small simple function. I think, we often move functions from one license to
another, and don't even look at them. This patch is noticeable because it
removes the whole file, and license is visible in the diff.
Any opinions?
--
Best regards,
Vladimir