There are some enums that are declared in qemu_monitor.h but implemented in qemu_monitor_json.c. While from compiler and linker POV it doesn't matter, the code is cleaner if an enum is implemented in .c file that corresponds to .h file which declared the enum.
Signed-off-by: Michal Privoznik <mpriv...@redhat.com> --- src/qemu/qemu_monitor.c | 40 ++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.c | 34 ------------------------------ 2 files changed, 40 insertions(+), 34 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 0ff938a577..8fc2a49abf 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -111,6 +111,38 @@ static int qemuMonitorOnceInit(void) VIR_ONCE_GLOBAL_INIT(qemuMonitor); +VIR_ENUM_IMPL(qemuMonitorJob, + QEMU_MONITOR_JOB_TYPE_LAST, + "", + "commit", + "stream", + "mirror", + "backup", + "create", +); + +VIR_ENUM_IMPL(qemuMonitorJobStatus, + QEMU_MONITOR_JOB_STATUS_LAST, + "", + "created", + "running", + "paused", + "ready", + "standby", + "waiting", + "pending", + "aborting", + "concluded", + "undefined", + "null", +); + +VIR_ENUM_IMPL(qemuMonitorCPUProperty, + QEMU_MONITOR_CPU_PROPERTY_LAST, + "boolean", + "string", + "number", +); VIR_ENUM_IMPL(qemuMonitorMigrationStatus, QEMU_MONITOR_MIGRATION_STATUS_LAST, @@ -4473,6 +4505,14 @@ qemuMonitorTransactionBackup(virJSONValue *actions, } +VIR_ENUM_IMPL(qemuMonitorDirtyRateCalcMode, + QEMU_MONITOR_DIRTYRATE_CALC_MODE_LAST, + "page-sampling", + "dirty-bitmap", + "dirty-ring", +); + + int qemuMonitorStartDirtyRateCalc(qemuMonitor *mon, int seconds, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 345b81cd12..4d339f29b8 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -53,30 +53,6 @@ VIR_LOG_INIT("qemu.qemu_monitor_json"); #define LINE_ENDING "\r\n" -VIR_ENUM_IMPL(qemuMonitorJob, - QEMU_MONITOR_JOB_TYPE_LAST, - "", - "commit", - "stream", - "mirror", - "backup", - "create"); - -VIR_ENUM_IMPL(qemuMonitorJobStatus, - QEMU_MONITOR_JOB_STATUS_LAST, - "", - "created", - "running", - "paused", - "ready", - "standby", - "waiting", - "pending", - "aborting", - "concluded", - "undefined", - "null"); - static void qemuMonitorJSONHandleShutdown(qemuMonitor *mon, virJSONValue *data); static void qemuMonitorJSONHandleReset(qemuMonitor *mon, virJSONValue *data); static void qemuMonitorJSONHandleStop(qemuMonitor *mon, virJSONValue *data); @@ -5347,11 +5323,6 @@ qemuMonitorJSONGetCPUDefinitions(qemuMonitor *mon, } -VIR_ENUM_IMPL(qemuMonitorCPUProperty, - QEMU_MONITOR_CPU_PROPERTY_LAST, - "boolean", "string", "number", -); - static int qemuMonitorJSONParseCPUModelProperty(const char *key, virJSONValue *value, @@ -8740,11 +8711,6 @@ qemuMonitorJSONGetCPUMigratable(qemuMonitor *mon, migratable); } -VIR_ENUM_IMPL(qemuMonitorDirtyRateCalcMode, - QEMU_MONITOR_DIRTYRATE_CALC_MODE_LAST, - "page-sampling", - "dirty-bitmap", - "dirty-ring"); int qemuMonitorJSONStartDirtyRateCalc(qemuMonitor *mon, -- 2.34.1