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

View File

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

View File

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