static int
chMonitorCreateSocket(const char *socket_path)
{
- struct sockaddr_un addr;
+ struct sockaddr_un addr = { 0 };
socklen_t addrlen = sizeof(addr);
int fd;
goto error;
}
- memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
if (virStrcpyStatic(addr.sun_path, socket_path) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
virDomainGraphicsListenAppendAddress(virDomainGraphicsDef *def,
const char *address)
{
- virDomainGraphicsListenDef glisten;
-
- memset(&glisten, 0, sizeof(glisten));
+ virDomainGraphicsListenDef glisten = { 0 };
glisten.type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS;
virDomainGraphicsListenAppendSocket(virDomainGraphicsDef *def,
const char *socketPath)
{
- virDomainGraphicsListenDef glisten;
-
- memset(&glisten, 0, sizeof(glisten));
+ virDomainGraphicsListenDef glisten = { 0 };
glisten.type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET;
size_t i;
int ret = -1;
virNetworkIPDef *ipdef = virNetworkIPDefByIndex(def, parentIndex);
- virNetworkDHCPHostDef host;
+ virNetworkDHCPHostDef host = { 0 };
bool partialOkay = (command == VIR_NETWORK_UPDATE_COMMAND_DELETE);
- memset(&host, 0, sizeof(host));
-
if (virNetworkDefUpdateCheckElementName(def, ctxt->node, "host") < 0)
goto cleanup;
{
size_t i;
virNetworkIPDef *ipdef = virNetworkIPDefByIndex(def, parentIndex);
- virNetworkDHCPRangeDef range;
-
- memset(&range, 0, sizeof(range));
+ virNetworkDHCPRangeDef range = { 0 };
if (virNetworkDefUpdateCheckElementName(def, ctxt->node, "range") < 0)
return -1;
{
size_t i;
int ret = -1;
- virNetworkForwardIfDef iface;
-
- memset(&iface, 0, sizeof(iface));
+ virNetworkForwardIfDef iface = { 0 };
if (virNetworkDefUpdateCheckElementName(def, ctxt->node, "interface") < 0)
goto cleanup;
size_t i;
int foundName = -1, foundDefault = -1;
int ret = -1;
- virPortGroupDef portgroup;
-
- memset(&portgroup, 0, sizeof(portgroup));
+ virPortGroupDef portgroup = { 0 };
if (virNetworkDefUpdateCheckElementName(def, ctxt->node, "portgroup") < 0)
goto cleanup;
size_t i, j, k;
int foundIdx = -1, ret = -1;
virNetworkDNSDef *dns = &def->dns;
- virNetworkDNSHostDef host;
+ virNetworkDNSHostDef host = { 0 };
bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST);
int foundCt = 0;
- memset(&host, 0, sizeof(host));
-
if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("DNS HOST records cannot be modified, "
size_t i;
int foundIdx = -1, ret = -1;
virNetworkDNSDef *dns = &def->dns;
- virNetworkDNSSrvDef srv;
+ virNetworkDNSSrvDef srv = { 0 };
bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST);
int foundCt = 0;
- memset(&srv, 0, sizeof(srv));
-
if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("DNS SRV records cannot be modified, "
{
int foundIdx, ret = -1;
virNetworkDNSDef *dns = &def->dns;
- virNetworkDNSTxtDef txt;
+ virNetworkDNSTxtDef txt = { 0 };
bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST);
- memset(&txt, 0, sizeof(txt));
-
if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("DNS TXT records cannot be modified, "
x86ParseMSR(xmlNodePtr node,
virCPUx86DataItem *item)
{
- virCPUx86MSR msr;
-
- memset(&msr, 0, sizeof(msr));
+ virCPUx86MSR msr = { 0 };
if (virXMLPropUInt(node, "index", 0, VIR_XML_PROP_REQUIRED, &msr.index) < 0)
return -1;
g_autofree char *url = NULL;
g_autofree char *vmx = NULL;
virVMXContext ctx;
- esxVMX_Data data;
+ esxVMX_Data data = { 0 };
g_autoptr(virDomainDef) def = NULL;
char *xml = NULL;
virCheckFlags(VIR_DOMAIN_XML_COMMON_FLAGS, NULL);
- memset(&data, 0, sizeof(data));
-
if (esxVI_EnsureSession(priv->primary) < 0)
return NULL;
{
esxPrivate *priv = conn->privateData;
virVMXContext ctx;
- esxVMX_Data data;
+ esxVMX_Data data = { 0 };
g_autoptr(virDomainDef) def = NULL;
char *xml = NULL;
virCheckFlags(0, NULL);
- memset(&data, 0, sizeof(data));
-
if (STRNEQ(nativeFormat, VMX_CONFIG_FORMAT_ARGV)) {
virReportError(VIR_ERR_INVALID_ARG,
_("Unsupported config format '%1$s'"), nativeFormat);
esxPrivate *priv = conn->privateData;
int virtualHW_version;
virVMXContext ctx;
- esxVMX_Data data;
+ esxVMX_Data data = { 0 };
g_autoptr(virDomainDef) def = NULL;
char *vmx = NULL;
virCheckFlags(0, NULL);
- memset(&data, 0, sizeof(data));
-
if (STRNEQ(nativeFormat, VMX_CONFIG_FORMAT_ARGV)) {
virReportError(VIR_ERR_INVALID_ARG,
_("Unsupported config format '%1$s'"), nativeFormat);
esxVI_ObjectContent *virtualMachine = NULL;
int virtualHW_version;
virVMXContext ctx;
- esxVMX_Data data;
+ esxVMX_Data data = { 0 };
g_autofree char *datastoreName = NULL;
g_autofree char *directoryName = NULL;
g_autofree char *escapedName = NULL;
if (flags & VIR_DOMAIN_DEFINE_VALIDATE)
parse_flags |= VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA;
- memset(&data, 0, sizeof(data));
-
if (esxVI_EnsureSession(priv->primary) < 0)
return NULL;
esxVI_VirtualMachineSnapshotTree *rootSnapshotList = NULL;
esxVI_VirtualMachineSnapshotTree *snapshotTree = NULL;
esxVI_VirtualMachineSnapshotTree *snapshotTreeParent = NULL;
- virDomainSnapshotDef def;
+ virDomainSnapshotDef def = { 0 };
char uuid_string[VIR_UUID_STRING_BUFLEN] = "";
char *xml = NULL;
virCheckFlags(0, NULL);
- memset(&def, 0, sizeof(def));
-
if (esxVI_EnsureSession(priv->primary) < 0)
return NULL;
char *xml = NULL;
esxPrivate *priv = iface->conn->privateData;
esxVI_PhysicalNic *physicalNic = NULL;
- virInterfaceDef def;
+ virInterfaceDef def = { 0 };
bool hasAddress = false;
virInterfaceProtocolDef *protocols;
- virInterfaceProtocolDef protocol;
- virSocketAddr socketAddress;
+ virInterfaceProtocolDef protocol = { 0 };
+ virSocketAddr socketAddress = { 0 };
virInterfaceIPDef *ips;
- virInterfaceIPDef ip;
+ virInterfaceIPDef ip = { 0 };
virCheckFlags(VIR_INTERFACE_XML_INACTIVE, NULL);
- memset(&def, 0, sizeof(def));
- memset(&protocol, 0, sizeof(protocol));
- memset(&socketAddress, 0, sizeof(socketAddress));
- memset(&ip, 0, sizeof(ip));
-
if (esxVI_EnsureSession(priv->primary) < 0 ||
esxVI_LookupPhysicalNicByMACAddress(priv->primary, iface->mac,
&physicalNic,
esxPrivate *priv = pool->conn->privateData;
esxVI_HostInternetScsiHba *hostInternetScsiHba = NULL;
esxVI_HostInternetScsiHbaStaticTarget *target;
- virStoragePoolDef def;
+ virStoragePoolDef def = { 0 };
virCheckFlags(0, NULL);
- memset(&def, 0, sizeof(def));
-
if (esxVI_LookupHostInternetScsiHba(priv->primary, &hostInternetScsiHba))
goto cleanup;
{
char *xml = NULL;
esxPrivate *priv = volume->conn->privateData;
- virStoragePoolDef pool;
+ virStoragePoolDef pool = { 0 };
esxVI_ScsiLun *scsiLunList = NULL;
esxVI_ScsiLun *scsiLun;
esxVI_HostScsiDisk *hostScsiDisk = NULL;
- virStorageVolDef def;
+ virStorageVolDef def = { 0 };
/* VIR_CRYPTO_HASH_SIZE_MD5 = VIR_UUID_BUFLEN = 16 */
unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5];
char uuid_string[VIR_UUID_STRING_BUFLEN] = "";
virCheckFlags(0, NULL);
- memset(&pool, 0, sizeof(pool));
- memset(&def, 0, sizeof(def));
-
if (esxVI_LookupScsiLunList(priv->primary, &scsiLunList) < 0)
goto cleanup;
esxVI_DatastoreHostMount *hostMount = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL;
esxVI_Boolean accessible = esxVI_Boolean_Undefined;
- virStoragePoolDef def;
+ virStoragePoolDef def = { 0 };
esxVI_DatastoreInfo *info = NULL;
esxVI_NasDatastoreInfo *nasInfo = NULL;
char *xml = NULL;
virCheckFlags(0, NULL);
- memset(&def, 0, sizeof(def));
-
if (esxVI_String_AppendValueListToList(&propertyNameList,
"summary.accessible\0"
"summary.capacity\0"
{
virStorageVolPtr volume = NULL;
esxPrivate *priv = pool->conn->privateData;
- virStoragePoolDef poolDef;
+ virStoragePoolDef poolDef = { 0 };
char *tmp;
g_autofree char *unescapedDatastorePath = NULL;
g_autofree char *unescapedDirectoryName = NULL;
virCheckFlags(0, NULL);
- memset(&poolDef, 0, sizeof(poolDef));
-
if (esxLookupVMFSStoragePoolType(priv->primary, pool->name,
&poolDef.type) < 0) {
goto cleanup;
{
virStorageVolPtr volume = NULL;
esxPrivate *priv = pool->conn->privateData;
- virStoragePoolDef poolDef;
+ virStoragePoolDef poolDef = { 0 };
g_autofree char *sourceDatastorePath = NULL;
char *tmp;
g_autofree char *unescapedDatastorePath = NULL;
virCheckFlags(0, NULL);
- memset(&poolDef, 0, sizeof(poolDef));
-
if (esxLookupVMFSStoragePoolType(priv->primary, pool->name,
&poolDef.type) < 0) {
goto cleanup;
unsigned int flags)
{
esxPrivate *priv = volume->conn->privateData;
- virStoragePoolDef pool;
+ virStoragePoolDef pool = { 0 };
g_autofree char *datastorePath = NULL;
esxVI_FileInfo *fileInfo = NULL;
esxVI_VmDiskFileInfo *vmDiskFileInfo = NULL;
esxVI_IsoImageFileInfo *isoImageFileInfo = NULL;
esxVI_FloppyImageFileInfo *floppyImageFileInfo = NULL;
- virStorageVolDef def;
+ virStorageVolDef def = { 0 };
char *xml = NULL;
virCheckFlags(0, NULL);
- memset(&pool, 0, sizeof(pool));
- memset(&def, 0, sizeof(def));
-
if (esxLookupVMFSStoragePoolType(priv->primary, volume->pool,
&pool.type) < 0) {
return NULL;
int
esxUtil_ResolveHostname(const char *hostname, char **ipAddress)
{
- struct addrinfo hints;
+ struct addrinfo hints = { 0 };
struct addrinfo *result = NULL;
int errcode;
g_autofree char *address = NULL;
- memset(&hints, 0, sizeof(hints));
-
hints.ai_flags = AI_ADDRCONFIG;
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_STREAM;
bool managed)
{
libxlDriverConfig *cfg = libxlDriverConfigGet(driver);
- libxlSavefileHeader hdr;
+ libxlSavefileHeader hdr = { 0 };
virObjectEvent *event = NULL;
g_autofree char *xml = NULL;
uint32_t xml_len;
goto cleanup;
xml_len = strlen(xml) + 1;
- memset(&hdr, 0, sizeof(hdr));
memcpy(hdr.magic, LIBXL_SAVE_MAGIC, sizeof(hdr.magic));
hdr.version = LIBXL_SAVE_VERSION;
hdr.xmlLen = xml_len;
virDomainBlockStatsPtr stats)
{
virDomainObj *vm;
- libxlBlockStats blkstats;
+ libxlBlockStats blkstats = { 0 };
int ret = -1;
if (!(vm = libxlDomObjFromDomain(dom)))
if (virDomainObjCheckActive(vm) < 0)
goto endjob;
- memset(&blkstats, 0, sizeof(libxlBlockStats));
if ((ret = libxlDomainBlockStatsGather(vm, path, &blkstats)) < 0)
goto endjob;
unsigned int flags)
{
virDomainObj *vm;
- libxlBlockStats blkstats;
+ libxlBlockStats blkstats = { 0 };
int nstats;
int ret = -1;
goto endjob;
}
- memset(&blkstats, 0, sizeof(libxlBlockStats));
if ((ret = libxlDomainBlockStatsGather(vm, path, &blkstats)) < 0)
goto endjob;
int *counter)
{
virLockManagerLockDaemonPrivate *priv = lock->privateData;
- virLockSpaceProtocolRegisterArgs args;
-
- memset(&args, 0, sizeof(args));
+ virLockSpaceProtocolRegisterArgs args = { 0 };
args.flags = 0;
memcpy(args.owner.uuid, priv->uuid, VIR_UUID_BUFLEN);
virNetClientProgram *program,
int *counter)
{
- virLockSpaceProtocolRestrictArgs args;
-
- memset(&args, 0, sizeof(args));
+ virLockSpaceProtocolRestrictArgs args = { 0 };
args.flags = 0;
{
virNetClient *client;
virNetClientProgram *program = NULL;
- virLockSpaceProtocolCreateLockSpaceArgs args;
+ virLockSpaceProtocolCreateLockSpaceArgs args = { 0 };
int rv = -1;
int counter = 0;
- memset(&args, 0, sizeof(args));
args.path = (char*)path;
if (!(client = virLockManagerLockDaemonConnectionNew(geteuid() == 0, &program)))
if (!(flags & VIR_LOCK_MANAGER_ACQUIRE_REGISTER_ONLY)) {
size_t i;
for (i = 0; i < priv->nresources; i++) {
- virLockSpaceProtocolAcquireResourceArgs args;
-
- memset(&args, 0, sizeof(args));
+ virLockSpaceProtocolAcquireResourceArgs args = { 0 };
args.path = priv->resources[i].lockspace;
args.name = priv->resources[i].name;
goto cleanup;
for (i = 0; i < priv->nresources; i++) {
- virLockSpaceProtocolReleaseResourceArgs args;
-
- memset(&args, 0, sizeof(args));
+ virLockSpaceProtocolReleaseResourceArgs args = { 0 };
if (priv->resources[i].lockspace)
args.path = priv->resources[i].lockspace;
ino_t *inode,
off_t *offset)
{
- struct virLogManagerProtocolDomainOpenLogFileArgs args;
- struct virLogManagerProtocolDomainOpenLogFileRet ret;
+ struct virLogManagerProtocolDomainOpenLogFileArgs args = { 0 };
+ struct virLogManagerProtocolDomainOpenLogFileRet ret = { 0 };
int *fdout = NULL;
size_t fdoutlen = 0;
int rv = -1;
- memset(&args, 0, sizeof(args));
- memset(&ret, 0, sizeof(ret));
-
args.driver = (char *)driver;
memcpy(args.dom.uuid, domuuid, VIR_UUID_BUFLEN);
args.dom.name = (char *)domname;
ino_t *inode,
off_t *offset)
{
- struct virLogManagerProtocolDomainGetLogFilePositionArgs args;
- struct virLogManagerProtocolDomainGetLogFilePositionRet ret;
-
- memset(&args, 0, sizeof(args));
- memset(&ret, 0, sizeof(ret));
+ struct virLogManagerProtocolDomainGetLogFilePositionArgs args = { 0 };
+ struct virLogManagerProtocolDomainGetLogFilePositionRet ret = { 0 };
args.path = (char *)path;
args.flags = flags;
size_t maxlen,
unsigned int flags)
{
- struct virLogManagerProtocolDomainReadLogFileArgs args;
- struct virLogManagerProtocolDomainReadLogFileRet ret;
-
- memset(&args, 0, sizeof(args));
- memset(&ret, 0, sizeof(ret));
+ struct virLogManagerProtocolDomainReadLogFileArgs args = { 0 };
+ struct virLogManagerProtocolDomainReadLogFileRet ret = { 0 };
args.path = (char *)path;
args.flags = flags;
const char *message,
unsigned int flags)
{
- struct virLogManagerProtocolDomainAppendLogFileArgs args;
+ struct virLogManagerProtocolDomainAppendLogFileArgs args = { 0 };
struct virLogManagerProtocolDomainAppendLogFileRet ret;
- memset(&args, 0, sizeof(args));
-
args.driver = (char *)driver;
memcpy(args.dom.uuid, domuuid, VIR_UUID_BUFLEN);
args.dom.name = (char *)domname;
virLXCControllerEventSendExit(virLXCController *ctrl,
int exitstatus)
{
- virLXCMonitorExitEventMsg msg;
+ virLXCMonitorExitEventMsg msg = { 0 };
VIR_DEBUG("Exit status %d (client=%p)", exitstatus, ctrl->client);
- memset(&msg, 0, sizeof(msg));
switch (exitstatus) {
case 0:
msg.status = VIR_LXC_MONITOR_EXIT_STATUS_SHUTDOWN;
virLXCControllerEventSendInit(virLXCController *ctrl,
pid_t initpid)
{
- virLXCMonitorInitEventMsg msg;
+ virLXCMonitorInitEventMsg msg = { 0 };
VIR_DEBUG("Init pid %lld", (long long)initpid);
- memset(&msg, 0, sizeof(msg));
msg.initpid = initpid;
virLXCControllerEventSend(ctrl,
int runlevel)
{
virLXCDomainObjPrivate *priv = vm->privateData;
- lxcDomainInitctlCallbackData data;
+ lxcDomainInitctlCallbackData data = { 0 };
size_t nfifos = 0;
size_t i;
int ret = -1;
- memset(&data, 0, sizeof(data));
-
data.runlevel = runlevel;
for (nfifos = 0; virInitctlFifos[nfifos]; nfifos++)
char *file)
{
virLXCDomainObjPrivate *priv = vm->privateData;
- struct lxcDomainAttachDeviceMknodData data;
-
- memset(&data, 0, sizeof(data));
+ struct lxcDomainAttachDeviceMknodData data = { 0 };
data.driver = driver;
data.mode = mode;
struct iphdr *pip;
struct udphdr *pup;
virNWFilterSnoopDHCPHdr *pd;
- virNWFilterSnoopIPLease ipl;
+ virNWFilterSnoopIPLease ipl = { 0 };
uint8_t mtype;
uint32_t leasetime;
uint32_t nwint;
if (virNWFilterSnoopDHCPGetOpt(pd, len, &mtype, &leasetime) < 0)
return -2;
- memset(&ipl, 0, sizeof(ipl));
-
memcpy(&nwint, &pd->d_yiaddr, sizeof(nwint));
virSocketAddrSetIPv4AddrNetOrder(&ipl.ipAddress, nwint);
bool forceWithPendingReq)
{
int rc;
- virNWFilterInst inst;
+ virNWFilterInst inst = { 0 };
bool instantiate = true;
g_autofree char *buf = NULL;
virNWFilterVarValue *lv;
bool reportIP = false;
g_autoptr(GHashTable) missing_vars = virHashNew(virNWFilterVarValueHashFree);
- memset(&inst, 0, sizeof(inst));
-
rc = virNWFilterDetermineMissingVarsRec(filter,
binding->filterparams,
missing_vars,
static int
qemuAgentOpenUnix(const char *socketpath)
{
- struct sockaddr_un addr;
+ struct sockaddr_un addr = { 0 };
int agentfd;
if ((agentfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
goto error;
}
- memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
if (virStrcpyStatic(addr.sun_path, socketpath) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
g_autofree char *txMsg = NULL;
g_autoptr(virJSONValue) rxObj = NULL;
unsigned long long id;
- qemuAgentMessage sync_msg;
+ qemuAgentMessage sync_msg = { 0 };
int rc;
- memset(&sync_msg, 0, sizeof(sync_msg));
-
if (virTimeMillisNow(&id) < 0)
return -1;
bool report_unsupported)
{
int ret = -1;
- qemuAgentMessage msg;
+ qemuAgentMessage msg = { 0 };
g_autofree char *cmdstr = NULL;
int await_event = agent->await_event;
*reply = NULL;
- memset(&msg, 0, sizeof(msg));
if (!agent->running) {
virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s",
int
qemuOpenChrChardevUNIXSocket(const virDomainChrSourceDef *dev)
{
- struct sockaddr_un addr;
+ struct sockaddr_un addr = { 0 };
socklen_t addrlen = sizeof(addr);
int fd;
goto error;
}
- memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
if (virStrcpyStatic(addr.sun_path, dev->data.nix.path) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
qemuDomainObjPrivate *priv;
virDomainDef *def = NULL;
virDomainDef *persistentDef = NULL;
- virDomainBlockIoTuneInfo info;
- virDomainBlockIoTuneInfo conf_info;
+ virDomainBlockIoTuneInfo info = { 0 };
+ virDomainBlockIoTuneInfo conf_info = { 0 };
int ret = -1;
size_t i;
virDomainDiskDef *conf_disk = NULL;
NULL) < 0)
return -1;
- memset(&info, 0, sizeof(info));
- memset(&conf_info, 0, sizeof(conf_info));
-
if (!(vm = qemuDomainObjFromDomain(dom)))
return -1;
static int
qemuMonitorOpenUnix(const char *monitor)
{
- struct sockaddr_un addr;
+ struct sockaddr_un addr = { 0 };
VIR_AUTOCLOSE monfd = -1;
int ret = -1;
return -1;
}
- memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
if (virStrcpyStatic(addr.sun_path, monitor) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
size_t len,
int fd)
{
- struct msghdr msg;
+ struct msghdr msg = { 0 };
struct iovec iov[1];
int ret;
char control[CMSG_SPACE(sizeof(int))];
struct cmsghdr *cmsg;
- memset(&msg, 0, sizeof(msg));
memset(control, 0, sizeof(control));
iov[0].iov_base = (void *)data;
virJSONValue **reply)
{
int ret = -1;
- qemuMonitorMessage msg;
+ qemuMonitorMessage msg = { 0 };
g_auto(virBuffer) cmdbuf = VIR_BUFFER_INITIALIZER;
*reply = NULL;
- memset(&msg, 0, sizeof(msg));
-
if (virJSONValueObjectHasKey(cmd, "execute")) {
g_autofree char *id = qemuMonitorNextCommandID(mon);
char *balloonpath,
int period)
{
- qemuMonitorJSONObjectProperty prop;
+ qemuMonitorJSONObjectProperty prop = { 0 };
/* Set to the value in memballoon (could enable or disable) */
- memset(&prop, 0, sizeof(qemuMonitorJSONObjectProperty));
prop.type = QEMU_MONITOR_OBJECT_PROPERTY_INT;
prop.val.iv = period;
if (qemuMonitorJSONSetObjectProperty(mon, balloonpath,
{
qemuDomainObjPrivate *priv = vm->privateData;
time_t now, then;
- struct tm thenbits;
+ struct tm thenbits = { 0 };
long localOffset;
int rv;
if (vm->def->clock.offset != VIR_DOMAIN_CLOCK_OFFSET_VARIABLE)
return;
- memset(&thenbits, 0, sizeof(thenbits));
qemuDomainObjEnterMonitor(vm);
now = time(NULL);
rv = qemuMonitorGetRTCTime(priv->mon, &thenbits);
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_lifecycle_msg data;
+ remote_domain_event_lifecycle_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
event, detail, callback->callbackID, callback->legacy);
/* build return data */
- memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
data.event = event;
data.detail = detail;
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_reboot_msg data;
+ remote_domain_event_reboot_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
dom->name, dom->id, callback->callbackID, callback->legacy);
/* build return data */
- memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
if (callback->legacy) {
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_rtc_change_msg data;
+ remote_domain_event_rtc_change_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
callback->callbackID, callback->legacy);
/* build return data */
- memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
data.offset = offset;
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_watchdog_msg data;
+ remote_domain_event_watchdog_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
dom->name, dom->id, action, callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
data.action = action;
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_io_error_msg data;
+ remote_domain_event_io_error_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
data.srcPath = g_strdup(srcPath);
data.devAlias = g_strdup(devAlias);
make_nonnull_domain(&data.dom, dom);
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_io_error_reason_msg data;
+ remote_domain_event_io_error_reason_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
data.srcPath = g_strdup(srcPath);
data.devAlias = g_strdup(devAlias);
data.reason = g_strdup(reason);
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_graphics_msg data;
+ remote_domain_event_graphics_msg data = { 0 };
size_t i;
if (callback->callbackID < 0 ||
VIR_DEBUG(" %s=%s", subject->identities[i].type, subject->identities[i].name);
/* build return data */
- memset(&data, 0, sizeof(data));
data.phase = phase;
data.local.family = local->family;
data.remote.family = remote->family;
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_block_job_msg data;
+ remote_domain_event_block_job_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
dom->name, dom->id, path, type, status, callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
data.path = g_strdup(path);
data.type = type;
data.status = status;
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_control_error_msg data;
+ remote_domain_event_control_error_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
dom->name, dom->id, callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
if (callback->legacy) {
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_disk_change_msg data;
+ remote_domain_event_disk_change_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
if (oldSrcPath) {
data.oldSrcPath = g_new0(remote_nonnull_string, 1);
*(data.oldSrcPath) = g_strdup(oldSrcPath);
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_tray_change_msg data;
+ remote_domain_event_tray_change_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
dom->name, dom->id, devAlias, reason, callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
-
data.devAlias = g_strdup(devAlias);
data.reason = reason;
make_nonnull_domain(&data.dom, dom);
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_pmwakeup_msg data;
+ remote_domain_event_pmwakeup_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
dom->name, dom->id, callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
if (callback->legacy) {
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_pmsuspend_msg data;
+ remote_domain_event_pmsuspend_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
dom->name, dom->id, callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
if (callback->legacy) {
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_balloon_change_msg data;
+ remote_domain_event_balloon_change_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
dom->name, dom->id, actual, callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
data.actual = actual;
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_pmsuspend_disk_msg data;
+ remote_domain_event_pmsuspend_disk_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
dom->name, dom->id, callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
make_nonnull_domain(&data.dom, dom);
if (callback->legacy) {
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_device_removed_msg data;
+ remote_domain_event_device_removed_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
dom->name, dom->id, devAlias, callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
-
data.devAlias = g_strdup(devAlias);
make_nonnull_domain(&data.dom, dom);
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_block_job_2_msg data;
+ remote_domain_event_block_job_2_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
dom->name, dom->id, dst, type, status, callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
data.callbackID = callback->callbackID;
data.dst = g_strdup(dst);
data.type = type;
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_callback_tunable_msg data;
+ remote_domain_event_callback_tunable_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
dom->name, dom->id, callback->callbackID, params, nparams);
/* build return data */
- memset(&data, 0, sizeof(data));
-
if (virTypedParamsSerialize(params, nparams,
REMOTE_DOMAIN_EVENT_TUNABLE_MAX,
(struct _virTypedParameterRemote **) &data.params.params_val,
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_callback_agent_lifecycle_msg data;
+ remote_domain_event_callback_agent_lifecycle_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
dom->name, dom->id, callback->callbackID, state, reason);
/* build return data */
- memset(&data, 0, sizeof(data));
data.callbackID = callback->callbackID;
make_nonnull_domain(&data.dom, dom);
data.state = state;
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_callback_device_added_msg data;
+ remote_domain_event_callback_device_added_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
dom->name, dom->id, devAlias, callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
-
data.devAlias = g_strdup(devAlias);
make_nonnull_domain(&data.dom, dom);
data.callbackID = callback->callbackID;
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_callback_migration_iteration_msg data;
+ remote_domain_event_callback_migration_iteration_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
dom->name, dom->id, callback->callbackID, iteration);
/* build return data */
- memset(&data, 0, sizeof(data));
data.callbackID = callback->callbackID;
make_nonnull_domain(&data.dom, dom);
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_callback_job_completed_msg data;
+ remote_domain_event_callback_job_completed_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
dom->name, dom->id, callback->callbackID, params, nparams);
/* build return data */
- memset(&data, 0, sizeof(data));
-
if (virTypedParamsSerialize(params, nparams,
REMOTE_DOMAIN_JOB_STATS_MAX,
(struct _virTypedParameterRemote **) &data.params.params_val,
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_callback_device_removal_failed_msg data;
+ remote_domain_event_callback_device_removal_failed_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
dom->name, dom->id, devAlias, callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
-
data.devAlias = g_strdup(devAlias);
make_nonnull_domain(&data.dom, dom);
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_callback_metadata_change_msg data;
+ remote_domain_event_callback_metadata_change_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
dom->name, dom->id, type, NULLSTR(nsuri), callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
-
data.type = type;
if (nsuri) {
data.nsuri = g_new0(remote_nonnull_string, 1);
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_block_threshold_msg data;
+ remote_domain_event_block_threshold_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
dom->name, dom->id, dev, NULLSTR(path), threshold, excess, callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
data.callbackID = callback->callbackID;
data.dev = g_strdup(dev);
if (path) {
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_memory_failure_msg data;
+ remote_domain_event_memory_failure_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
return -1;
/* build return data */
- memset(&data, 0, sizeof(data));
data.callbackID = callback->callbackID;
data.recipient = recipient;
data.action = action;
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_domain_event_memory_device_size_change_msg data;
+ remote_domain_event_memory_device_size_change_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainEventCheckACL(callback->client, conn, dom))
return -1;
/* build return data */
- memset(&data, 0, sizeof(data));
data.callbackID = callback->callbackID;
data.alias = g_strdup(alias);
data.size = size;
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_network_event_lifecycle_msg data;
+ remote_network_event_lifecycle_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayNetworkEventCheckACL(callback->client, conn, net))
event, detail, callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
make_nonnull_network(&data.net, net);
data.callbackID = callback->callbackID;
data.event = event;
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_storage_pool_event_lifecycle_msg data;
+ remote_storage_pool_event_lifecycle_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayStoragePoolEventCheckACL(callback->client, conn, pool))
event, detail, callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
make_nonnull_storage_pool(&data.pool, pool);
data.callbackID = callback->callbackID;
data.event = event;
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_storage_pool_event_refresh_msg data;
+ remote_storage_pool_event_refresh_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayStoragePoolEventCheckACL(callback->client, conn, pool))
callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
make_nonnull_storage_pool(&data.pool, pool);
data.callbackID = callback->callbackID;
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_node_device_event_lifecycle_msg data;
+ remote_node_device_event_lifecycle_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayNodeDeviceEventCheckACL(callback->client, conn, dev))
event, detail, callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
make_nonnull_node_device(&data.dev, dev);
data.callbackID = callback->callbackID;
data.event = event;
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_node_device_event_update_msg data;
+ remote_node_device_event_update_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayNodeDeviceEventCheckACL(callback->client, conn, dev))
callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
make_nonnull_node_device(&data.dev, dev);
data.callbackID = callback->callbackID;
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_secret_event_lifecycle_msg data;
+ remote_secret_event_lifecycle_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelaySecretEventCheckACL(callback->client, conn, secret))
event, detail, callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
make_nonnull_secret(&data.secret, secret);
data.callbackID = callback->callbackID;
data.event = event;
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- remote_secret_event_value_changed_msg data;
+ remote_secret_event_value_changed_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelaySecretEventCheckACL(callback->client, conn, secret))
callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
make_nonnull_secret(&data.secret, secret);
data.callbackID = callback->callbackID;
void *opaque)
{
daemonClientEventCallback *callback = opaque;
- qemu_domain_monitor_event_msg data;
+ qemu_domain_monitor_event_msg data = { 0 };
if (callback->callbackID < 0 ||
!remoteRelayDomainQemuMonitorEventCheckACL(callback->client, conn,
event, details, callback->callbackID);
/* build return data */
- memset(&data, 0, sizeof(data));
data.callbackID = callback->callbackID;
data.event = g_strdup(event);
data.seconds = seconds;
struct virNetMessageError *rerr,
remote_node_get_security_model_ret *ret)
{
- virSecurityModel secmodel;
+ virSecurityModel secmodel = { 0 };
int rv = -1;
virConnectPtr conn = remoteGetHypervisorConn(client);
if (!conn)
goto cleanup;
- memset(&secmodel, 0, sizeof(secmodel));
if (virNodeGetSecurityModel(conn, &secmodel) < 0)
goto cleanup;
(events & (VIR_STREAM_EVENT_ERROR | VIR_STREAM_EVENT_HANGUP))) {
int ret;
virNetMessage *msg;
- virNetMessageError rerr;
+ virNetMessageError rerr = { 0 };
virErrorPtr origErr;
virErrorPreserveLast(&origErr);
- memset(&rerr, 0, sizeof(rerr));
stream->closed = true;
virStreamEventRemoveCallback(stream->st);
virStreamAbort(stream->st);
/* Blocking, so indicate we have more todo later */
return 1;
} else if (ret < 0) {
- virNetMessageError rerr;
+ virNetMessageError rerr = { 0 };
virErrorPtr err;
virErrorPreserveLast(&err);
- memset(&rerr, 0, sizeof(rerr));
-
VIR_INFO("Stream send failed");
stream->closed = true;
virStreamEventRemoveCallback(stream->st);
ret = virStreamFinish(stream->st);
if (ret < 0) {
- virNetMessageError rerr;
- memset(&rerr, 0, sizeof(rerr));
+ virNetMessageError rerr = { 0 };
+
return virNetServerProgramSendReplyError(stream->prog,
client,
msg,
}
if (raise_error) {
- virNetMessageError rerr;
- memset(&rerr, 0, sizeof(rerr));
+ virNetMessageError rerr = { 0 };
+
return virNetServerProgramSendReplyError(stream->prog,
client,
msg,
ret = virStreamSendHole(stream->st, data.length, data.flags);
if (ret < 0) {
- virNetMessageError rerr;
-
- memset(&rerr, 0, sizeof(rerr));
+ virNetMessageError rerr = { 0 };
VIR_INFO("Stream send hole failed");
stream->closed = true;
daemonClientStream *stream)
{
virNetMessage *msg = NULL;
- virNetMessageError rerr;
+ virNetMessageError rerr = { 0 };
char *buffer;
size_t bufferLen = VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX;
int ret = -1;
if (!stream->tx)
return 0;
- memset(&rerr, 0, sizeof(rerr));
-
buffer = g_new0(char, bufferLen);
if (!(msg = virNetMessageNew(false)))
/* Now try and find out what URI the daemon used */
if (conn->uri == NULL) {
- remote_connect_get_uri_ret uriret;
+ remote_connect_get_uri_ret uriret = { 0 };
VIR_DEBUG("Trying to query remote URI");
- memset(&uriret, 0, sizeof(uriret));
if (call(conn, priv, 0,
REMOTE_PROC_CONNECT_GET_URI,
(xdrproc_t) xdr_void, (char *) NULL,
remoteAuthSASL(virConnectPtr conn, struct private_data *priv,
virConnectAuthPtr auth, const char *wantmech)
{
- remote_auth_sasl_init_ret iret;
+ remote_auth_sasl_init_ret iret = { 0 };
remote_auth_sasl_start_args sargs = {0};
- remote_auth_sasl_start_ret sret;
+ remote_auth_sasl_start_ret sret = { 0 };
const char *clientout;
char *serverin = NULL;
size_t clientoutlen, serverinlen;
const char *mechlist;
virNetSASLContext *saslCtxt;
virNetSASLSession *sasl = NULL;
- struct remoteAuthInteractState state;
-
- memset(&state, 0, sizeof(state));
+ struct remoteAuthInteractState state = { 0 };
VIR_DEBUG("Client initialize SASL authentication");
goto cleanup;
/* First call is to inquire about supported mechanisms in the server */
- memset(&iret, 0, sizeof(iret));
if (call(conn, priv, 0, REMOTE_PROC_AUTH_SASL_INIT,
(xdrproc_t) xdr_void, (char *)NULL,
(xdrproc_t) xdr_remote_auth_sasl_init_ret, (char *) &iret) != 0)
mech, clientoutlen, clientout);
/* Now send the initial auth data to the server */
- memset(&sret, 0, sizeof(sret));
if (call(conn, priv, 0, REMOTE_PROC_AUTH_SASL_START,
(xdrproc_t) xdr_remote_auth_sasl_start_args, (char *) &sargs,
(xdrproc_t) xdr_remote_auth_sasl_start_ret, (char *) &sret) != 0)
virNetClientProgramDispatchError(virNetClientProgram *prog G_GNUC_UNUSED,
virNetMessage *msg)
{
- virNetMessageError err;
+ virNetMessageError err = { 0 };
int ret = -1;
- memset(&err, 0, sizeof(err));
-
if (virNetMessageDecodePayload(msg, (xdrproc_t)xdr_virNetMessageError, &err) < 0)
goto cleanup;
int virNetClientStreamSetError(virNetClientStream *st,
virNetMessage *msg)
{
- virNetMessageError err;
+ virNetMessageError err = { 0 };
int ret = -1;
virObjectLock(st);
VIR_DEBUG("Overwriting existing stream error %s", NULLSTR(st->err.message));
virResetError(&st->err);
- memset(&err, 0, sizeof(err));
if (virNetMessageDecodePayload(msg, (xdrproc_t)xdr_virNetMessageError, &err) < 0)
goto cleanup;
virNetClientStream *st)
{
virNetMessage *msg;
- virNetStreamHole data;
+ virNetStreamHole data = { 0 };
int ret = -1;
VIR_DEBUG("client=%p st=%p", client, st);
msg = st->rx;
- memset(&data, 0, sizeof(data));
/* We should not be called unless there's VIR_NET_STREAM_HOLE
* message at the head of the list. But doesn't hurt to check */
unsigned int flags)
{
virNetMessage *msg = NULL;
- virNetStreamHole data;
+ virNetStreamHole data = { 0 };
int ret = -1;
VIR_DEBUG("st=%p length=%llu", st, length);
return -1;
}
- memset(&data, 0, sizeof(data));
data.length = length;
data.flags = flags;
void *opaque)
{
g_autofree virNetDaemonSignal *sigdata = NULL;
- struct sigaction sig_action;
+ struct sigaction sig_action = { 0 };
VIR_LOCK_GUARD lock = virObjectLockGuard(dmn);
if (virNetDaemonSignalSetup(dmn) < 0)
sigdata->func = func;
sigdata->opaque = opaque;
- memset(&sig_action, 0, sizeof(sig_action));
sig_action.sa_sigaction = virNetDaemonSignalHandler;
sig_action.sa_flags = SA_SIGINFO;
sigemptyset(&sig_action.sa_mask);
int maxSSF,
bool allowAnonymous)
{
- sasl_security_properties_t secprops;
+ sasl_security_properties_t secprops = { 0 };
int err;
int ret = -1;
minSSF, maxSSF, allowAnonymous, sasl->maxbufsize);
virObjectLock(sasl);
- memset(&secprops, 0, sizeof(secprops));
secprops.min_ssf = minSSF;
secprops.max_ssf = maxSSF;
virNetMessage *msg,
struct virNetMessageHeader *req)
{
- virNetMessageError rerr;
+ virNetMessageError rerr = { 0 };
virReportError(VIR_ERR_RPC,
_("Cannot find program %1$d version %2$d"), req->prog, req->vers);
- memset(&rerr, 0, sizeof(rerr));
return virNetServerProgramSendError(req->prog,
req->vers,
client,
virNetMessage *msg)
{
int ret = -1;
- virNetMessageError rerr;
-
- memset(&rerr, 0, sizeof(rerr));
+ virNetMessageError rerr = { 0 };
VIR_DEBUG("prog=%d ver=%d type=%d status=%d serial=%u proc=%d",
msg->header.prog, msg->header.vers, msg->header.type,
g_autofree char *ret = NULL;
int rv = -1;
virNetServerProgramProc *dispatcher = NULL;
- virNetMessageError rerr;
+ virNetMessageError rerr = { 0 };
size_t i;
g_autoptr(virIdentity) identity = NULL;
- memset(&rerr, 0, sizeof(rerr));
-
if (msg->header.status != VIR_NET_OK) {
virReportError(VIR_ERR_RPC,
_("Unexpected message status %1$u"),
long long length,
unsigned int flags)
{
- virNetStreamHole data;
+ virNetStreamHole data = { 0 };
VIR_DEBUG("client=%p msg=%p length=%lld", client, msg, length);
- memset(&data, 0, sizeof(data));
data.length = length;
data.flags = flags;
int family,
bool *hasFamily)
{
- struct addrinfo hints;
+ struct addrinfo hints = { 0 };
struct addrinfo *ai = NULL;
int gaierr;
- memset(&hints, 0, sizeof(hints));
hints.ai_family = family;
hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
hints.ai_socktype = SOCK_STREAM;
virNetSocket **socks = NULL;
size_t nsocks = 0;
struct addrinfo *ai = NULL;
- struct addrinfo hints;
+ struct addrinfo hints = { 0 };
int fd = -1;
size_t i;
int socketErrno = 0;
*retsocks = NULL;
*nretsocks = 0;
- memset(&hints, 0, sizeof(hints));
hints.ai_family = family;
hints.ai_flags = AI_PASSIVE;
hints.ai_socktype = SOCK_STREAM;
runp = ai;
while (runp) {
- virSocketAddr addr;
-
- memset(&addr, 0, sizeof(addr));
+ virSocketAddr addr = { 0 };
if ((fd = socket(runp->ai_family, runp->ai_socktype,
runp->ai_protocol)) < 0) {
gid_t grp,
virNetSocket **retsock)
{
- virSocketAddr addr;
+ virSocketAddr addr = { 0 };
mode_t oldmask;
int fd;
*retsock = NULL;
- memset(&addr, 0, sizeof(addr));
-
addr.len = sizeof(addr.data.un);
if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
bool unlinkUNIX,
virNetSocket **retsock)
{
- virSocketAddr addr;
+ virSocketAddr addr = { 0 };
*retsock = NULL;
- memset(&addr, 0, sizeof(addr));
-
addr.len = sizeof(addr.data);
if (getsockname(fd, &addr.data.sa, &addr.len) < 0) {
virReportSystemError(errno, "%s", _("Unable to get local socket name"));
virNetSocket **retsock)
{
struct addrinfo *ai = NULL;
- struct addrinfo hints;
+ struct addrinfo hints = { 0 };
int fd = -1;
- virSocketAddr localAddr;
- virSocketAddr remoteAddr;
+ virSocketAddr localAddr = { 0 };
+ virSocketAddr remoteAddr = { 0 };
struct addrinfo *runp;
int savedErrno = ENOENT;
int e;
*retsock = NULL;
- memset(&localAddr, 0, sizeof(localAddr));
- memset(&remoteAddr, 0, sizeof(remoteAddr));
-
- memset(&hints, 0, sizeof(hints));
hints.ai_family = family;
hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG | AI_V4MAPPED;
hints.ai_socktype = SOCK_STREAM;
VIR_AUTOCLOSE lockfd = -1;
int fd = -1;
int retries = 500;
- virSocketAddr localAddr;
- virSocketAddr remoteAddr;
+ virSocketAddr localAddr = { 0 };
+ virSocketAddr remoteAddr = { 0 };
g_autofree char *rundir = NULL;
int ret = -1;
bool daemonLaunched = false;
VIR_DEBUG("path=%s spawnDaemonPath=%s", path, NULLSTR(spawnDaemonPath));
- memset(&localAddr, 0, sizeof(localAddr));
- memset(&remoteAddr, 0, sizeof(remoteAddr));
-
remoteAddr.len = sizeof(remoteAddr.data.un);
if (spawnDaemonPath) {
virNetSocket *virNetSocketNewPostExecRestart(virJSONValue *object)
{
- virSocketAddr localAddr;
- virSocketAddr remoteAddr;
+ virSocketAddr localAddr = { 0 };
+ virSocketAddr remoteAddr = { 0 };
int fd, thepid, errfd;
bool isClient;
bool unlinkUNIX;
if (virJSONValueObjectGetBoolean(object, "unlinkUNIX", &unlinkUNIX) < 0)
unlinkUNIX = !isClient;
- memset(&localAddr, 0, sizeof(localAddr));
- memset(&remoteAddr, 0, sizeof(remoteAddr));
-
remoteAddr.len = sizeof(remoteAddr.data.stor);
if (getsockname(fd, &remoteAddr.data.sa, &remoteAddr.len) < 0) {
virReportSystemError(errno, "%s", _("Unable to get peer socket name"));
int virNetSocketAccept(virNetSocket *sock, virNetSocket **clientsock)
{
int fd = -1;
- virSocketAddr localAddr;
- virSocketAddr remoteAddr;
+ virSocketAddr localAddr = { 0 };
+ virSocketAddr remoteAddr = { 0 };
int ret = -1;
virObjectLock(sock);
*clientsock = NULL;
- memset(&localAddr, 0, sizeof(localAddr));
- memset(&remoteAddr, 0, sizeof(remoteAddr));
-
remoteAddr.len = sizeof(remoteAddr.data.stor);
if ((fd = accept(sock->fd, &remoteAddr.data.sa, &remoteAddr.len)) < 0) {
if (errno == ECONNABORTED ||
virNetSSHAuthenticatePrivkey(virNetSSHSession *sess,
virNetSSHAuthMethod *priv)
{
- virConnectCredential retr_passphrase;
+ virConnectCredential retr_passphrase = { 0 };
size_t i;
char *errmsg;
int ret;
return -1;
}
- memset(&retr_passphrase, 0, sizeof(virConnectCredential));
retr_passphrase.type = -1;
for (i = 0; i < sess->cred->ncredtype; i++) {
*/
for (i = 0; i < nextents; i++) {
g_autofree char *offset_str = NULL;
- virStorageVolSourceExtent extent;
+ virStorageVolSourceExtent extent = { 0 };
size_t j = (i * 2) + 1;
- memset(&extent, 0, sizeof(extent));
-
offset_str = g_match_info_fetch(info, j + 1);
if (virStrToLong_ull(offset_str, NULL, 10, &offset) < 0) {
virStorageBackendLogicalFindPoolSources(const char *srcSpec G_GNUC_UNUSED,
unsigned int flags)
{
- virStoragePoolSourceList sourceList;
+ virStoragePoolSourceList sourceList = { 0 };
size_t i;
char *retval = NULL;
virCheckFlags(0, NULL);
- memset(&sourceList, 0, sizeof(sourceList));
sourceList.type = VIR_STORAGE_POOL_LOGICAL;
if (virStorageBackendLogicalGetPoolSources(&sourceList) < 0)
virStorageBackendLogicalMatchPoolSource(virStoragePoolObj *pool)
{
virStoragePoolDef *def = virStoragePoolObjGetDef(pool);
- virStoragePoolSourceList sourceList;
+ virStoragePoolSourceList sourceList = { 0 };
virStoragePoolSource *thisSource = NULL;
size_t i, j;
int matchcount = 0;
bool ret = false;
- memset(&sourceList, 0, sizeof(sourceList));
sourceList.type = VIR_STORAGE_POOL_LOGICAL;
if (virStorageBackendLogicalGetPoolSources(&sourceList) < 0)
if (tb[NDA_DST]) {
g_autofree char *ipstr = NULL;
- virSocketAddr virAddr;
+ virSocketAddr virAddr = { 0 };
VIR_REALLOC_N(table->t, num + 1);
table->n = num + 1;
addr = RTA_DATA(tb[NDA_DST]);
- memset(&virAddr, 0, sizeof(virAddr));
virAddr.len = sizeof(virAddr.data.inet4);
virAddr.data.inet4.sin_family = AF_INET;
virAddr.data.inet4.sin_addr = *(struct in_addr *)addr;
const char *hostname)
{
unsigned int ncred;
- virConnectCredential cred;
+ virConnectCredential cred = { 0 };
g_autofree char *prompt = NULL;
char *ret = NULL;
return NULL;
}
- memset(&cred, 0, sizeof(virConnectCredential));
-
if (defaultUsername != NULL) {
prompt = g_strdup_printf(_("Enter username for %1$s [%2$s]"), hostname,
defaultUsername);
unsigned int valSize,
unsigned int maxEntries)
{
- union bpf_attr attr;
-
- memset(&attr, 0, sizeof(attr));
+ union bpf_attr attr = { 0 };
attr.map_type = mapType;
attr.key_size = keySize;
{
g_autofree char *logbuf = NULL;
int progfd = -1;
- union bpf_attr attr;
+ union bpf_attr attr = { 0 };
logbuf = g_new0(char, LOG_BUF_SIZE);
- memset(&attr, 0, sizeof(attr));
-
attr.prog_type = progType;
attr.insn_cnt = insnCnt;
attr.insns = (uintptr_t)insns;
int targetfd,
int attachType)
{
- union bpf_attr attr;
-
- memset(&attr, 0, sizeof(attr));
+ union bpf_attr attr = { 0 };
attr.target_fd = targetfd;
attr.attach_bpf_fd = progfd;
int targetfd,
int attachType)
{
- union bpf_attr attr;
-
- memset(&attr, 0, sizeof(attr));
+ union bpf_attr attr = { 0 };
attr.target_fd = targetfd;
attr.attach_bpf_fd = progfd;
unsigned int *progcnt,
void *progids)
{
- union bpf_attr attr;
+ union bpf_attr attr = { 0 };
int rc;
- memset(&attr, 0, sizeof(attr));
-
attr.query.target_fd = targetfd;
attr.query.attach_type = attachType;
attr.query.prog_cnt = maxprogids;
int
virBPFGetProg(unsigned int id)
{
- union bpf_attr attr;
-
- memset(&attr, 0, sizeof(attr));
+ union bpf_attr attr = { 0 };
attr.prog_id = id;
struct bpf_prog_info *info,
unsigned int **mapIDs)
{
- union bpf_attr attr;
+ union bpf_attr attr = { 0 };
int rc;
- memset(&attr, 0, sizeof(attr));
-
attr.info.bpf_fd = progfd;
attr.info.info_len = sizeof(struct bpf_prog_info);
attr.info.info = (uintptr_t)info;
int
virBPFGetMap(unsigned int id)
{
- union bpf_attr attr;
-
- memset(&attr, 0, sizeof(attr));
+ union bpf_attr attr = { 0 };
attr.map_id = id;
virBPFGetMapInfo(int mapfd,
struct bpf_map_info *info)
{
- union bpf_attr attr;
-
- memset(&attr, 0, sizeof(attr));
+ union bpf_attr attr = { 0 };
attr.info.bpf_fd = mapfd;
attr.info.info_len = sizeof(struct bpf_map_info);
void *key,
void *val)
{
- union bpf_attr attr;
-
- memset(&attr, 0, sizeof(attr));
+ union bpf_attr attr = { 0 };
attr.map_fd = mapfd;
attr.key = (uintptr_t)key;
void *key,
void *nextKey)
{
- union bpf_attr attr;
-
- memset(&attr, 0, sizeof(attr));
+ union bpf_attr attr = { 0 };
attr.map_fd = mapfd;
attr.key = (uintptr_t)key;
void *key,
void *val)
{
- union bpf_attr attr;
-
- memset(&attr, 0, sizeof(attr));
+ union bpf_attr attr = { 0 };
attr.map_fd = mapfd;
attr.key = (uintptr_t)key;
virBPFDeleteElem(int mapfd,
void *key)
{
- union bpf_attr attr;
-
- memset(&attr, 0, sizeof(attr));
+ union bpf_attr attr = { 0 };
attr.map_fd = mapfd;
attr.key = (uintptr_t)key;
virDMOpen(void)
{
VIR_AUTOCLOSE controlFD = -1;
- struct dm_ioctl dm;
+ struct dm_ioctl dm = { 0 };
g_autofree char *tmp = NULL;
int ret;
- memset(&dm, 0, sizeof(dm));
-
if ((controlFD = open(CONTROL_PATH, O_RDWR)) < 0) {
/* We can't talk to devmapper. Produce a warning and let
* the caller decide what to do next. */
{
g_autofree char *sanitizedPath = NULL;
g_autofree char *buf = NULL;
- struct dm_ioctl dm;
+ struct dm_ioctl dm = { 0 };
struct dm_target_deps *deps = NULL;
size_t i;
- memset(&dm, 0, sizeof(dm));
-
if (ttl == 0) {
errno = ELOOP;
return -1;
const char *path,
bool abstract)
{
- struct sockaddr_un sa;
+ struct sockaddr_un sa = { 0 };
virTimeBackOffVar timeout;
VIR_AUTOCLOSE fd = -1;
int ret;
return -1;
}
- memset(&sa, 0, sizeof(sa));
sa.sun_family = AF_UNIX;
if (abstract) {
if (virStrcpy(sa.sun_path+1, path, sizeof(sa.sun_path)-1) < 0)
{
int lofd = -1;
int fsfd = -1;
- struct loop_info64 lo;
+ struct loop_info64 lo = { 0 };
g_autofree char *loname = NULL;
int ret = -1;
if ((lofd = virFileLoopDeviceOpen(&loname)) < 0)
return -1;
- memset(&lo, 0, sizeof(lo));
lo.lo_flags = LO_FLAGS_AUTOCLEAR;
/* Set backing file name for LOOP_GET_STATUS64 queries */
virInitctlSetRunLevel(const char *fifo,
virInitctlRunLevel level)
{
- struct virInitctlRequest req;
+ struct virInitctlRequest req = { 0 };
int fd = -1;
int ret = -1;
const int open_flags = O_WRONLY|O_NONBLOCK|O_CLOEXEC|O_NOCTTY;
size_t i = 0;
- memset(&req, 0, sizeof(req));
-
req.magic = VIR_INITCTL_MAGIC;
req.sleeptime = 0;
req.cmd = VIR_INITCTL_CMD_RUNLVL;
"^\\s*(\\S+)\\s+(\\S+)\\s*$"
};
int vars[] = { 2 };
- struct virISCSITargetList list;
+ struct virISCSITargetList list = { 0 };
size_t i;
g_autoptr(virCommand) cmd = virCommandNewArgList(ISCSIADM,
"--mode", "discovery",
NULL);
}
- memset(&list, 0, sizeof(list));
-
if (virCommandRunRegex(cmd,
1,
regexes,
{
int buffd = -1;
int journalfd = (intptr_t) data;
- struct msghdr mh;
- struct sockaddr_un sa;
+ struct msghdr mh = { 0 };
+ struct sockaddr_un sa = { 0 };
union {
struct cmsghdr cmsghdr;
uint8_t buf[CMSG_SPACE(sizeof(int))];
- } control;
+ } control = { 0 };
struct cmsghdr *cmsg;
/* We use /dev/shm instead of /tmp here, since we want this to
* be a tmpfs, and one that is available from early boot on
}
}
- memset(&sa, 0, sizeof(sa));
sa.sun_family = AF_UNIX;
if (virStrcpyStatic(sa.sun_path, "/run/systemd/journal/socket") < 0)
return;
- memset(&mh, 0, sizeof(mh));
mh.msg_name = &sa;
mh.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(sa.sun_path);
mh.msg_iov = iov;
mh.msg_iov = NULL;
mh.msg_iovlen = 0;
- memset(&control, 0, sizeof(control));
mh.msg_control = &control;
mh.msg_controllen = sizeof(control);
#if defined(WITH_IF_INDEXTONAME)
char *virNetDevGetName(int ifindex)
{
- char name[IFNAMSIZ];
-
- memset(&name, 0, sizeof(name));
+ char name[IFNAMSIZ] = { 0 };
if (!if_indextoname(ifindex, name)) {
virReportSystemError(errno,
#if defined(SIOCGIFINDEX) && defined(WITH_STRUCT_IFREQ)
int virNetDevGetIndex(const char *ifname, int *ifindex)
{
- struct ifreq ifreq;
+ struct ifreq ifreq = { 0 };
VIR_AUTOCLOSE fd = socket(VIR_NETDEV_FAMILY, SOCK_DGRAM, 0);
if (fd < 0) {
return -1;
}
- memset(&ifreq, 0, sizeof(ifreq));
-
if (virStrcpyStatic(ifreq.ifr_name, ifname) < 0) {
virReportSystemError(ERANGE,
_("invalid interface name %1$s"),
void *arg,
size_t argsize)
{
- struct ifdrv ifd;
+ struct ifdrv ifd = { 0 };
VIR_AUTOCLOSE s = -1;
- memset(&ifd, 0, sizeof(ifd));
-
if ((s = socket(AF_LOCAL, SOCK_DGRAM, 0)) < 0) {
virReportSystemError(errno, "%s",
_("Cannot open network interface control socket"));
int virNetDevBridgeAddPort(const char *brname,
const char *ifname)
{
- struct ifbreq req;
+ struct ifbreq req = { 0 };
- memset(&req, 0, sizeof(req));
if (virStrcpyStatic(req.ifbr_ifsname, ifname) < 0) {
virReportSystemError(ERANGE,
_("Network interface name '%1$s' is too long"),
int virNetDevBridgeRemovePort(const char *brname,
const char *ifname)
{
- struct ifbreq req;
+ struct ifbreq req = { 0 };
- memset(&req, 0, sizeof(req));
if (virStrcpyStatic(req.ifbr_ifsname, ifname) < 0) {
virReportSystemError(ERANGE,
_("Network interface name '%1$s' is too long"),
virSocketAddr *peer)
{
struct nl_msg *nlmsg = NULL;
- struct ifaddrmsg ifa;
+ struct ifaddrmsg ifa = { 0 };
unsigned int ifindex;
void *addrData = NULL;
void *peerData = NULL;
nlmsg = virNetlinkMsgNew(messageType,
NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL);
- memset(&ifa, 0, sizeof(ifa));
-
ifa.ifa_prefixlen = prefix;
ifa.ifa_family = VIR_SOCKET_ADDR_FAMILY(addr);
ifa.ifa_index = ifindex;
{
unsigned int recvbuflen;
unsigned int ifindex;
- struct rtmsg rtmsg;
+ struct rtmsg rtmsg = { 0 };
void *gatewayData = NULL;
void *addrData = NULL;
size_t addrDataLen;
nlmsg = virNetlinkMsgNew(RTM_NEWROUTE,
NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL);
- memset(&rtmsg, 0, sizeof(rtmsg));
-
rtmsg.rtm_family = VIR_SOCKET_ADDR_FAMILY(gateway);
rtmsg.rtm_table = RT_TABLE_MAIN;
rtmsg.rtm_scope = RT_SCOPE_UNIVERSE;
int virNetDevTapDelete(const char *ifname,
const char *tunpath)
{
- struct ifreq try;
+ struct ifreq try = { 0 };
int fd;
int ret = -1;
return -1;
}
- memset(&try, 0, sizeof(struct ifreq));
try.ifr_flags = IFF_TAP|IFF_NO_PI;
if (virStrcpyStatic(try.ifr_name, ifname) < 0) {
virPerfEventType type,
pid_t pid)
{
- struct perf_event_attr attr;
+ struct perf_event_attr attr = { 0 };
struct virPerfEvent *event = &(perf->events[type]);
struct virPerfEventAttr *event_attr = &attrs[type];
}
}
- memset(&attr, 0, sizeof(attr));
attr.size = sizeof(attr);
attr.inherit = 1;
attr.disabled = 1;
if (WIFEXITED(status)) {
value = WEXITSTATUS(status);
} else if (WIFSIGNALED(status)) {
- struct sigaction act;
+ struct sigaction act = { 0 };
sigset_t sigs;
if (sigemptyset(&sigs) == 0 &&
sigaddset(&sigs, WTERMSIG(status)) == 0)
sigprocmask(SIG_UNBLOCK, &sigs, NULL);
- memset(&act, 0, sizeof(act));
act.sa_handler = SIG_DFL;
sigfillset(&act.sa_mask);
sigaction(WTERMSIG(status), &act, NULL);
{
char byte = 0;
struct iovec iov;
- struct msghdr msg;
+ struct msghdr msg = { 0 };
struct cmsghdr *cmsg;
char buf[CMSG_SPACE(sizeof(fd))];
/* send at least one char */
- memset(&msg, 0, sizeof(msg));
iov.iov_base = &byte;
iov.iov_len = 1;
msg.msg_iov = &iov;
{
char byte = 0;
struct iovec iov;
- struct msghdr msg;
+ struct msghdr msg = { 0 };
int fd = -1;
ssize_t len;
struct cmsghdr *cmsg;
}
/* send at least one char */
- memset(&msg, 0, sizeof(msg));
iov.iov_base = &byte;
iov.iov_len = 1;
msg.msg_iov = &iov;
int ai_flags,
bool reportError)
{
- struct addrinfo hints;
+ struct addrinfo hints = { 0 };
int err;
if (val == NULL) {
return -1;
}
- memset(&hints, 0, sizeof(hints));
hints.ai_family = family;
hints.ai_flags = ai_flags;
if ((err = getaddrinfo(val, NULL, &hints, res)) != 0) {
int virSocketAddrResolveService(const char *service)
{
struct addrinfo *res, *tmp;
- struct addrinfo hints;
+ struct addrinfo hints = { 0 };
int err;
int port = -1;
- memset(&hints, 0, sizeof(hints));
-
if ((err = getaddrinfo(NULL, service, &hints, &res)) != 0) {
virReportError(VIR_ERR_SYSTEM_ERROR,
_("Cannot parse socket service '%1$s': %2$s"),
char *
virURIFormat(virURI *uri)
{
- xmlURI xmluri;
+ xmlURI xmluri = { 0 };
g_autofree char *tmpserver = NULL;
char *ret;
- memset(&xmluri, 0, sizeof(xmluri));
-
xmluri.scheme = uri->scheme;
xmluri.server = uri->server;
xmluri.port = uri->port;
struct _vboxDriver *data = pool->conn->privateData;
PRUnichar *hddFormatUtf16 = NULL;
PRUnichar *hddNameUtf16 = NULL;
- virStoragePoolDef poolDef;
+ virStoragePoolDef poolDef = { 0 };
nsresult rc;
vboxIID hddIID;
unsigned char uuid[VIR_UUID_BUFLEN];
* so just assign it for now, change the behaviour
* when vbox supports pools.
*/
- memset(&poolDef, 0, sizeof(poolDef));
poolDef.type = VIR_STORAGE_POOL_DIR;
if ((def = virStorageVolDefParse(&poolDef, xml, NULL, parseFlags)) == NULL)
char *hddFormatUtf8 = NULL;
PRUint64 hddLogicalSize = 0;
PRUint64 hddActualSize = 0;
- virStoragePoolDef pool;
- virStorageVolDef def;
+ virStoragePoolDef pool = { 0 };
+ virStorageVolDef def = { 0 };
vboxIID hddIID;
PRUint32 hddstate;
nsresult rc;
virCheckFlags(0, NULL);
- memset(&pool, 0, sizeof(pool));
- memset(&def, 0, sizeof(def));
-
if (virUUIDParse(vol->key, uuid) < 0) {
virReportError(VIR_ERR_INVALID_ARG,
_("Could not parse UUID from '%1$s'"), vol->key);
virDomainDiskDef *disk,
virDomainDef *vmdef)
{
- virDomainDiskDef def;
+ virDomainDiskDef def = { 0 };
virDomainDeviceDriveAddress *drive;
- memset(&def, 0, sizeof(def));
-
if (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Unsupported disk address type '%1$s'"),
{
const struct testNSSData *data = opaque;
const bool existent = data->hostname && data->ipAddr && data->ipAddr[0];
- struct hostent resolved;
+ struct hostent resolved = { 0 };
char buf[BUF_SIZE] = { 0 };
char **addrList;
int rv, tmp_errno = 0, tmp_herrno = 0;
size_t i = 0;
- memset(&resolved, 0, sizeof(resolved));
-
rv = NSS_NAME(gethostbyname2)(data->hostname,
data->af,
&resolved,
addrList = resolved.h_addr_list;
i = 0;
while (*addrList) {
- virSocketAddr sa;
+ virSocketAddr sa = { 0 };
g_autofree char *ipAddr = NULL;
void *address = *addrList;
- memset(&sa, 0, sizeof(sa));
-
if (resolved.h_addrtype == AF_INET) {
virSocketAddrSetIPv4AddrNetOrder(&sa, *((uint32_t *) address));
} else {
g_autofree char *actualargv = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
g_autoptr(GHashTable) vars = virHashNew(virNWFilterVarValueHashFree);
- virNWFilterInst inst;
+ virNWFilterInst inst = { 0 };
int ret = -1;
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
- memset(&inst, 0, sizeof(inst));
-
virCommandSetDryRun(dryRunToken, &buf, true, true, NULL, NULL);
if (testSetDefaultParameters(vars) < 0)
{
const testGenericData *data = opaque;
virDomainXMLOption *xmlopt = data->xmlopt;
- qemuMonitorJSONObjectProperty prop;
+ qemuMonitorJSONObjectProperty prop = { 0 };
g_autoptr(qemuMonitorTest) test = NULL;
if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
return -1;
/* Present with path and property */
- memset(&prop, 0, sizeof(qemuMonitorJSONObjectProperty));
prop.type = QEMU_MONITOR_OBJECT_PROPERTY_BOOLEAN;
if (qemuMonitorJSONGetObjectProperty(qemuMonitorTestGetMonitor(test),
"/machine/i440fx",
{
const testGenericData *data = opaque;
virDomainXMLOption *xmlopt = data->xmlopt;
- qemuMonitorJSONObjectProperty prop;
+ qemuMonitorJSONObjectProperty prop = { 0 };
g_autoptr(qemuMonitorTest) test = NULL;
if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
return -1;
/* Let's attempt the setting */
- memset(&prop, 0, sizeof(qemuMonitorJSONObjectProperty));
prop.type = QEMU_MONITOR_OBJECT_PROPERTY_BOOLEAN;
prop.val.b = true;
if (qemuMonitorJSONSetObjectProperty(qemuMonitorTestGetMonitor(test),
GHashTable *schema)
{
g_autoptr(qemuMonitorTest) test = NULL;
- virDomainChrSourceDef src;
-
- memset(&src, 0, sizeof(src));
+ virDomainChrSourceDef src = { 0 };
if (!(test = qemuMonitorCommonTestNew(xmlopt, vm, &src)))
goto error;
qemuMonitorTestNewAgent(virDomainXMLOption *xmlopt)
{
g_autoptr(qemuMonitorTest) test = NULL;
- virDomainChrSourceDef src;
-
- memset(&src, 0, sizeof(src));
+ virDomainChrSourceDef src = { 0 };
if (!(test = qemuMonitorCommonTestNew(xmlopt, NULL, &src)))
goto error;
unsigned int parseFlags = info->parseFlags;
int ret = -1;
virDomainObj *vm = NULL;
- virDomainChrSourceDef monitor_chr;
+ virDomainChrSourceDef monitor_chr = { 0 };
g_autoptr(virConnect) conn = NULL;
virError *err = NULL;
g_autofree char *log = NULL;
virArch arch = VIR_ARCH_NONE;
g_autoptr(virIdentity) sysident = virIdentityGetSystem();
- memset(&monitor_chr, 0, sizeof(monitor_chr));
-
if (testQemuInfoInitArgs((struct testQemuInfo *) info) < 0)
goto cleanup;
const char *outputfile)
{
g_autofree char *actualData = NULL;
- virNodeInfo nodeinfo;
+ virNodeInfo nodeinfo = { 0 };
g_autoptr(FILE) cpuinfo = NULL;
cpuinfo = fopen(cpuinfofile, "r");
return -1;
}
- memset(&nodeinfo, 0, sizeof(nodeinfo));
if (virHostCPUGetInfoPopulateLinux(cpuinfo, arch,
&nodeinfo.cpus, &nodeinfo.mhz,
&nodeinfo.nodes, &nodeinfo.sockets,
static int testMessagePayloadEncode(const void *args G_GNUC_UNUSED)
{
- virNetMessageError err;
+ virNetMessageError err = { 0 };
virNetMessage *msg = virNetMessageNew(true);
int ret = -1;
static const char expect[] = {
if (!msg)
return -1;
- memset(&err, 0, sizeof(err));
-
err.code = VIR_ERR_INTERNAL_ERROR;
err.domain = VIR_FROM_RPC;
err.level = VIR_ERR_ERROR;
static int testMessagePayloadDecode(const void *args G_GNUC_UNUSED)
{
- virNetMessageError err;
+ virNetMessageError err = { 0 };
virNetMessage *msg = virNetMessageNew(true);
static char input_buffer[] = {
0x00, 0x00, 0x00, 0x74, /* Length */
};
int ret = -1;
- memset(&err, 0, sizeof(err));
-
if (!msg)
return -1;
struct sockaddr sa;
struct sockaddr_in sin;
struct sockaddr_in6 sin6;
- } sa;
+ } sa = { 0 };
socklen_t salen;
void *address = *addrList;
char host[NI_MAXHOST];
char port[NI_MAXSERV];
- memset(&sa, 0, sizeof(sa));
if (resolved.h_addrtype == AF_INET) {
sa.sin.sin_family = AF_INET;
memcpy(&sa.sin.sin_addr.s_addr,
{
virDomainInfo info;
g_autoptr(virshDomain) dom = NULL;
- virSecurityModel secmodel;
+ virSecurityModel secmodel = { 0 };
int persistent = 0;
bool ret = true;
int autostart;
has_managed_save ? _("yes") : _("no"));
/* Security model and label information */
- memset(&secmodel, 0, sizeof(secmodel));
if (virNodeGetSecurityModel(priv->conn, &secmodel) == -1) {
if (last_error->code != VIR_ERR_NO_SUPPORT) {
return false;
static bool
cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd)
{
- virDomainJobInfo info;
+ virDomainJobInfo info = { 0 };
g_autoptr(virshDomain) dom = NULL;
bool ret = false;
const char *unit;
if (vshCommandOptBool(cmd, "keep-completed"))
flags |= VIR_DOMAIN_JOB_STATS_KEEP_COMPLETED;
- memset(&info, 0, sizeof(info));
-
rc = virDomainGetJobStats(dom, &info.type, ¶ms, &nparams, flags);
if (rc == 0) {
if (virshDomainJobStatsToDomainJobInfo(params, nparams, &info) < 0)
size_t sz = s ? strlen(s) : 0;
char *buf;
char *ret;
- mbstate_t st;
-
- memset(&st, 0, sizeof(st));
+ mbstate_t st = { 0 };
buf = g_new0(char, (sz * HEX_ENCODE_LENGTH) + 1);