mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
maint: avoid static zero init in drivers
C guarantees that static variables are zero-initialized. Some older compilers (and also gcc -fno-zero-initialized-in-bss) create larger binaries if you explicitly zero-initialize a static variable. * src/libxl/libxl_driver.c: Fix initialization. * src/lxc/lxc_controller.c: Likewise. * src/openvz/openvz_util.c (openvzKBPerPages): Likewise. * src/phyp/phyp_driver.c: Likewise. * src/remote/remote_driver.c: Likewise. * src/test/test_driver.c: Likewise. * src/uml/uml_driver.c: Likewise. * src/vbox/vbox_XPCOMCGlue.c: Likewise. * src/vbox/vbox_tmpl.c: Likewise. * src/xen/xen_driver.c: Likewise. * src/xen/xen_hypervisor.c: Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
ff99c79195
commit
ec81cf8942
@ -76,7 +76,7 @@ VIR_LOG_INIT("libxl.libxl_driver");
|
||||
#define XEN_SCHED_CREDIT_NPARAM 2
|
||||
|
||||
|
||||
static libxlDriverPrivatePtr libxl_driver = NULL;
|
||||
static libxlDriverPrivatePtr libxl_driver;
|
||||
|
||||
/* Function declarations */
|
||||
static int
|
||||
|
@ -819,7 +819,7 @@ static int lxcControllerClearCapabilities(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool wantReboot = false;
|
||||
static bool wantReboot;
|
||||
static virMutex lock = VIR_MUTEX_INITIALIZER;
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* openvz_util.c: core driver methods for managing OpenVZ VEs
|
||||
*
|
||||
* Copyright (C) 2013 Red Hat, Inc.
|
||||
* Copyright (C) 2013-2014 Red Hat, Inc.
|
||||
* Copyright (C) 2012 Guido Günther
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@ -39,7 +39,7 @@
|
||||
long
|
||||
openvzKBPerPages(void)
|
||||
{
|
||||
static long kb_per_pages = 0;
|
||||
static long kb_per_pages;
|
||||
|
||||
if (kb_per_pages == 0) {
|
||||
kb_per_pages = sysconf(_SC_PAGESIZE);
|
||||
|
@ -68,9 +68,11 @@ VIR_LOG_INIT("phyp.phyp_driver");
|
||||
* URI: phyp://user@[hmc|ivm]/managed_system
|
||||
* */
|
||||
|
||||
static unsigned const int HMC = 0;
|
||||
static unsigned const int PHYP_IFACENAME_SIZE = 24;
|
||||
static unsigned const int PHYP_MAC_SIZE = 12;
|
||||
enum {
|
||||
HMC = 0,
|
||||
PHYP_IFACENAME_SIZE = 24,
|
||||
PHYP_MAC_SIZE = 12,
|
||||
};
|
||||
|
||||
static int
|
||||
waitsocket(int socket_fd, LIBSSH2_SESSION * session)
|
||||
|
@ -77,7 +77,7 @@ VIR_LOG_INIT("remote.remote_driver");
|
||||
deserializeTypedParameters(__FUNCTION__, ret_params_val, ret_params_len, \
|
||||
limit, params, nparams)
|
||||
|
||||
static bool inside_daemon = false;
|
||||
static bool inside_daemon;
|
||||
|
||||
struct private_data {
|
||||
virMutex lock;
|
||||
|
@ -471,7 +471,7 @@ static const char *defaultNodeXML =
|
||||
"</device>";
|
||||
|
||||
static const unsigned long long defaultPoolCap = (100 * 1024 * 1024 * 1024ull);
|
||||
static const unsigned long long defaultPoolAlloc = 0;
|
||||
static const unsigned long long defaultPoolAlloc;
|
||||
|
||||
static int testStoragePoolObjSetDefaults(virStoragePoolObjPtr pool);
|
||||
static int testNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info);
|
||||
|
@ -147,7 +147,7 @@ static int umlMonitorCommand(const struct uml_driver *driver,
|
||||
const char *cmd,
|
||||
char **reply);
|
||||
|
||||
static struct uml_driver *uml_driver = NULL;
|
||||
static struct uml_driver *uml_driver;
|
||||
|
||||
static int
|
||||
umlVMFilterRebuild(virDomainObjListIterator iter, void *data)
|
||||
|
@ -68,9 +68,9 @@ VIR_LOG_INIT("vbox.vbox_XPCOMCGlue");
|
||||
* Global Variables *
|
||||
*******************************************************************************/
|
||||
/** The dlopen handle for VBoxXPCOMC. */
|
||||
static void *hVBoxXPCOMC = NULL;
|
||||
static void *hVBoxXPCOMC;
|
||||
/** Pointer to the VBoxXPCOMC function table. */
|
||||
static PCVBOXXPCOM pVBoxFuncs_v2_2 = NULL;
|
||||
static PCVBOXXPCOM pVBoxFuncs_v2_2;
|
||||
/** Pointer to VBoxGetXPCOMCFunctions for the loaded VBoxXPCOMC so/dylib/dll. */
|
||||
PFNVBOXGETXPCOMCFUNCTIONS g_pfnGetFunctions = NULL;
|
||||
|
||||
|
@ -177,7 +177,7 @@ if (strUtf16) {\
|
||||
* them that way
|
||||
*/
|
||||
|
||||
static vboxGlobalData *g_pVBoxGlobalData = NULL;
|
||||
static vboxGlobalData *g_pVBoxGlobalData;
|
||||
|
||||
#endif /* !(VBOX_API_VERSION == 2002000) */
|
||||
|
||||
|
@ -91,8 +91,8 @@ xenUnifiedDomainGetVcpusInternal(virDomainPtr dom,
|
||||
int maplen);
|
||||
|
||||
|
||||
static bool is_privileged = false;
|
||||
static virSysinfoDefPtr hostsysinfo = NULL;
|
||||
static bool is_privileged;
|
||||
static virSysinfoDefPtr hostsysinfo;
|
||||
|
||||
static virDomainDefPtr xenGetDomainDefForID(virConnectPtr conn, int id)
|
||||
{
|
||||
|
@ -126,7 +126,7 @@ typedef privcmd_hypercall_t hypercall_t;
|
||||
# define SYS_IFACE_MIN_VERS_NUMA 4
|
||||
#endif
|
||||
|
||||
static int xen_ioctl_hypercall_cmd = 0;
|
||||
static int xen_ioctl_hypercall_cmd;
|
||||
static struct xenHypervisorVersions hv_versions = {
|
||||
.hv = 0,
|
||||
.hypervisor = 2,
|
||||
@ -134,7 +134,7 @@ static struct xenHypervisorVersions hv_versions = {
|
||||
.dom_interface = -1,
|
||||
};
|
||||
|
||||
static int kb_per_pages = 0;
|
||||
static int kb_per_pages;
|
||||
|
||||
/* Regular expressions used by xenHypervisorGetCapabilities, and
|
||||
* compiled once by xenHypervisorInit. Note that these are POSIX.2
|
||||
|
Loading…
Reference in New Issue
Block a user