src: Fix return types of .stateInitialize callbacks

The virStateDriver struct has .stateInitialize callback which is
declared to return virDrvStateInitResult enum. But some drivers
return a plain int in their implementation which is UB.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Michal Privoznik 2024-05-22 09:31:50 +02:00
parent 7dda4a03ac
commit 66b052263d
14 changed files with 24 additions and 22 deletions

View File

@ -1176,7 +1176,7 @@ bhyveStateCleanup(void)
return 0;
}
static int
static virDrvStateInitResult
bhyveStateInitialize(bool privileged,
const char *root,
bool monolithic G_GNUC_UNUSED,

View File

@ -1365,11 +1365,12 @@ static int chStateCleanup(void)
return 0;
}
static int chStateInitialize(bool privileged,
const char *root,
bool monolithic G_GNUC_UNUSED,
virStateInhibitCallback callback G_GNUC_UNUSED,
void *opaque G_GNUC_UNUSED)
static virDrvStateInitResult
chStateInitialize(bool privileged,
const char *root,
bool monolithic G_GNUC_UNUSED,
virStateInhibitCallback callback G_GNUC_UNUSED,
void *opaque G_GNUC_UNUSED)
{
int ret = VIR_DRV_STATE_INIT_ERROR;
int rv;

View File

@ -86,7 +86,7 @@ virNetcfDriverStateDispose(void *obj)
}
static int
static virDrvStateInitResult
netcfStateInitialize(bool privileged,
const char *root,
bool monolithic G_GNUC_UNUSED,

View File

@ -1091,7 +1091,7 @@ udevInterfaceIsActive(virInterfacePtr ifinfo)
static int
udevStateCleanup(void);
static int
static virDrvStateInitResult
udevStateInitialize(bool privileged,
const char *root,
bool monolithic G_GNUC_UNUSED,

View File

@ -645,7 +645,7 @@ libxlAddDom0(libxlDriverPrivate *driver)
return ret;
}
static int
static virDrvStateInitResult
libxlStateInitialize(bool privileged,
const char *root,
bool monolithic G_GNUC_UNUSED,

View File

@ -1429,11 +1429,12 @@ lxcSecurityInit(virLXCDriverConfig *cfg)
}
static int lxcStateInitialize(bool privileged,
const char *root,
bool monolithic G_GNUC_UNUSED,
virStateInhibitCallback callback G_GNUC_UNUSED,
void *opaque G_GNUC_UNUSED)
static virDrvStateInitResult
lxcStateInitialize(bool privileged,
const char *root,
bool monolithic G_GNUC_UNUSED,
virStateInhibitCallback callback G_GNUC_UNUSED,
void *opaque G_GNUC_UNUSED)
{
virLXCDriverConfig *cfg = NULL;
bool autostart = true;

View File

@ -576,7 +576,7 @@ firewalld_dbus_signal_callback(GDBusConnection *connection G_GNUC_UNUSED,
*
* Initialization function for the QEMU daemon
*/
static int
static virDrvStateInitResult
networkStateInitialize(bool privileged,
const char *root,
bool monolithic G_GNUC_UNUSED,

View File

@ -2229,7 +2229,7 @@ mdevctlEventHandleCallback(GFileMonitor *monitor G_GNUC_UNUSED,
}
static int
static virDrvStateInitResult
nodeStateInitialize(bool privileged,
const char *root,
bool monolithic G_GNUC_UNUSED,

View File

@ -208,7 +208,7 @@ nwfilterStateCleanup(void)
*
* Initialization function for the QEMU daemon
*/
static int
static virDrvStateInitResult
nwfilterStateInitialize(bool privileged,
const char *root,
bool monolithic G_GNUC_UNUSED,

View File

@ -546,7 +546,7 @@ qemuDomainFindMaxID(virDomainObj *vm,
*
* Initialization function for the QEMU daemon
*/
static int
static virDrvStateInitResult
qemuStateInitialize(bool privileged,
const char *root,
bool monolithic G_GNUC_UNUSED,

View File

@ -174,7 +174,7 @@ static void make_nonnull_domain_snapshot(remote_nonnull_domain_snapshot *snapsho
/* Helper functions for remoteOpen. */
static int
static virDrvStateInitResult
remoteStateInitialize(bool privileged G_GNUC_UNUSED,
const char *root G_GNUC_UNUSED,
bool monolithic,

View File

@ -488,7 +488,7 @@ secretStateCleanup(void)
}
static int
static virDrvStateInitResult
secretStateInitialize(bool privileged,
const char *root,
bool monolithic G_GNUC_UNUSED,

View File

@ -239,7 +239,7 @@ storageDriverAutostart(void)
*
* Initialization function for the Storage Driver
*/
static int
static virDrvStateInitResult
storageStateInitialize(bool privileged,
const char *root,
bool monolithic G_GNUC_UNUSED,

View File

@ -4068,7 +4068,7 @@ vzStateCleanup(void)
return 0;
}
static int
static virDrvStateInitResult
vzStateInitialize(bool privileged,
const char *root,
bool monolithic G_GNUC_UNUSED,