qemuMonitorTestAddHandler: Remove return value

The function always returns 0. Remove the return value and fix callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2023-05-22 14:07:50 +02:00
parent d74f8e95e3
commit 594fe5f882
3 changed files with 49 additions and 46 deletions

View File

@ -475,10 +475,9 @@ testQemuAgentShutdown(const void *data)
priv.event = QEMU_AGENT_EVENT_SHUTDOWN; priv.event = QEMU_AGENT_EVENT_SHUTDOWN;
priv.mode = "halt"; priv.mode = "halt";
if (qemuMonitorTestAddHandler(test, "guest-shutdown", qemuMonitorTestAddHandler(test, "guest-shutdown",
qemuAgentShutdownTestMonitorHandler, qemuAgentShutdownTestMonitorHandler,
&priv, NULL) < 0) &priv, NULL);
return -1;
if (qemuAgentShutdown(qemuMonitorTestGetAgent(test), if (qemuAgentShutdown(qemuMonitorTestGetAgent(test),
QEMU_AGENT_SHUTDOWN_HALT) < 0) QEMU_AGENT_SHUTDOWN_HALT) < 0)
@ -487,10 +486,9 @@ testQemuAgentShutdown(const void *data)
priv.event = QEMU_AGENT_EVENT_SHUTDOWN; priv.event = QEMU_AGENT_EVENT_SHUTDOWN;
priv.mode = "powerdown"; priv.mode = "powerdown";
if (qemuMonitorTestAddHandler(test, "guest-shutdown", qemuMonitorTestAddHandler(test, "guest-shutdown",
qemuAgentShutdownTestMonitorHandler, qemuAgentShutdownTestMonitorHandler,
&priv, NULL) < 0) &priv, NULL);
return -1;
if (qemuAgentShutdown(qemuMonitorTestGetAgent(test), if (qemuAgentShutdown(qemuMonitorTestGetAgent(test),
QEMU_AGENT_SHUTDOWN_POWERDOWN) < 0) QEMU_AGENT_SHUTDOWN_POWERDOWN) < 0)
@ -499,11 +497,10 @@ testQemuAgentShutdown(const void *data)
priv.event = QEMU_AGENT_EVENT_RESET; priv.event = QEMU_AGENT_EVENT_RESET;
priv.mode = "reboot"; priv.mode = "reboot";
if (qemuMonitorTestAddHandler(test, qemuMonitorTestAddHandler(test,
"guest-shutdown", "guest-shutdown",
qemuAgentShutdownTestMonitorHandler, qemuAgentShutdownTestMonitorHandler,
&priv, NULL) < 0) &priv, NULL);
return -1;
if (qemuAgentShutdown(qemuMonitorTestGetAgent(test), if (qemuAgentShutdown(qemuMonitorTestGetAgent(test),
QEMU_AGENT_SHUTDOWN_REBOOT) < 0) QEMU_AGENT_SHUTDOWN_REBOOT) < 0)
@ -691,10 +688,9 @@ testQemuAgentTimeout(const void *data)
if (virTestGetExpensive() == 0) if (virTestGetExpensive() == 0)
return EXIT_AM_SKIP; return EXIT_AM_SKIP;
if (qemuMonitorTestAddHandler(test, NULL, qemuMonitorTestAddHandler(test, NULL,
qemuAgentTimeoutTestMonitorHandler, qemuAgentTimeoutTestMonitorHandler,
NULL, NULL) < 0) NULL, NULL);
return -1;
if (qemuAgentFSFreeze(qemuMonitorTestGetAgent(test), NULL, 0) != -1) { if (qemuAgentFSFreeze(qemuMonitorTestGetAgent(test), NULL, 0) != -1) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@ -706,11 +702,10 @@ testQemuAgentTimeout(const void *data)
if (qemuMonitorTestAddAgentSyncResponse(test) < 0) if (qemuMonitorTestAddAgentSyncResponse(test) < 0)
return -1; return -1;
if (qemuMonitorTestAddHandler(test, qemuMonitorTestAddHandler(test,
NULL, NULL,
qemuAgentTimeoutTestMonitorHandler, qemuAgentTimeoutTestMonitorHandler,
NULL, NULL) < 0) NULL, NULL);
return -1;
if (qemuAgentArbitraryCommand(qemuMonitorTestGetAgent(test), if (qemuAgentArbitraryCommand(qemuMonitorTestGetAgent(test),
"{\"execute\":\"ble\"}", "{\"execute\":\"ble\"}",

View File

@ -441,7 +441,7 @@ qemuMonitorTestFree(qemuMonitorTest *test)
} }
int void
qemuMonitorTestAddHandler(qemuMonitorTest *test, qemuMonitorTestAddHandler(qemuMonitorTest *test,
const char *identifier, const char *identifier,
qemuMonitorTestResponseCallback cb, qemuMonitorTestResponseCallback cb,
@ -460,8 +460,6 @@ qemuMonitorTestAddHandler(qemuMonitorTest *test,
VIR_WITH_MUTEX_LOCK_GUARD(&test->lock) { VIR_WITH_MUTEX_LOCK_GUARD(&test->lock) {
VIR_APPEND_ELEMENT(test->items, test->nitems, item); VIR_APPEND_ELEMENT(test->items, test->nitems, item);
} }
return 0;
} }
void * void *
@ -604,10 +602,12 @@ qemuMonitorTestAddItem(qemuMonitorTest *test,
data->command_name = g_strdup(command_name); data->command_name = g_strdup(command_name);
data->response = g_strdup(response); data->response = g_strdup(response);
return qemuMonitorTestAddHandler(test, qemuMonitorTestAddHandler(test,
command_name, command_name,
qemuMonitorTestProcessCommandDefault, qemuMonitorTestProcessCommandDefault,
data, qemuMonitorTestHandlerDataFree); data, qemuMonitorTestHandlerDataFree);
return 0;
} }
@ -684,10 +684,12 @@ qemuMonitorTestAddItemVerbatim(qemuMonitorTest *test,
data->cmderr = g_strdup(cmderr); data->cmderr = g_strdup(cmderr);
data->command_name = g_steal_pointer(&reformatted); data->command_name = g_steal_pointer(&reformatted);
return qemuMonitorTestAddHandler(test, qemuMonitorTestAddHandler(test,
command, command,
qemuMonitorTestProcessCommandVerbatim, qemuMonitorTestProcessCommandVerbatim,
data, qemuMonitorTestHandlerDataFree); data, qemuMonitorTestHandlerDataFree);
return 0;
} }
@ -732,10 +734,12 @@ qemuMonitorTestAddAgentSyncResponse(qemuMonitorTest *test)
return -1; return -1;
} }
return qemuMonitorTestAddHandler(test, qemuMonitorTestAddHandler(test,
"agent-sync", "agent-sync",
qemuMonitorTestProcessGuestAgentSync, qemuMonitorTestProcessGuestAgentSync,
NULL, NULL); NULL, NULL);
return 0;
} }
@ -841,10 +845,12 @@ qemuMonitorTestAddItemParams(qemuMonitorTest *test,
va_end(args); va_end(args);
return qemuMonitorTestAddHandler(test, qemuMonitorTestAddHandler(test,
cmdname, cmdname,
qemuMonitorTestProcessCommandWithArgs, qemuMonitorTestProcessCommandWithArgs,
data, qemuMonitorTestHandlerDataFree); data, qemuMonitorTestHandlerDataFree);
return 0;
error: error:
va_end(args); va_end(args);
@ -939,10 +945,12 @@ qemuMonitorTestAddItemExpect(qemuMonitorTest *test,
} }
} }
return qemuMonitorTestAddHandler(test, qemuMonitorTestAddHandler(test,
cmdname, cmdname,
qemuMonitorTestProcessCommandWithArgStr, qemuMonitorTestProcessCommandWithArgStr,
data, qemuMonitorTestHandlerDataFree); data, qemuMonitorTestHandlerDataFree);
return 0;
} }

View File

@ -30,7 +30,7 @@ typedef int (*qemuMonitorTestResponseCallback)(qemuMonitorTest *test,
qemuMonitorTestItem *item, qemuMonitorTestItem *item,
const char *message); const char *message);
int void
qemuMonitorTestAddHandler(qemuMonitorTest *test, qemuMonitorTestAddHandler(qemuMonitorTest *test,
const char *identifier, const char *identifier,
qemuMonitorTestResponseCallback cb, qemuMonitorTestResponseCallback cb,