mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: use g_new0
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
73f7b6a0ef
commit
7d77fdb90f
@ -1452,8 +1452,7 @@ qemuAgentGetVCPUs(qemuAgentPtr agent,
|
|||||||
|
|
||||||
ndata = virJSONValueArraySize(data);
|
ndata = virJSONValueArraySize(data);
|
||||||
|
|
||||||
if (VIR_ALLOC_N(*info, ndata) < 0)
|
*info = g_new0(qemuAgentCPUInfo, ndata);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
for (i = 0; i < ndata; i++) {
|
for (i = 0; i < ndata; i++) {
|
||||||
virJSONValuePtr entry = virJSONValueArrayGet(data, i);
|
virJSONValuePtr entry = virJSONValueArrayGet(data, i);
|
||||||
@ -2148,8 +2147,7 @@ qemuAgentGetInterfaces(qemuAgentPtr agent,
|
|||||||
if (VIR_EXPAND_N(ifaces_ret, ifaces_count, 1) < 0)
|
if (VIR_EXPAND_N(ifaces_ret, ifaces_count, 1) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (VIR_ALLOC(ifaces_ret[ifaces_count - 1]) < 0)
|
ifaces_ret[ifaces_count - 1] = g_new0(virDomainInterface, 1);
|
||||||
goto error;
|
|
||||||
|
|
||||||
if (virHashAddEntry(ifaces_store, ifname_s,
|
if (virHashAddEntry(ifaces_store, ifname_s,
|
||||||
ifaces_ret[ifaces_count - 1]) < 0)
|
ifaces_ret[ifaces_count - 1]) < 0)
|
||||||
|
@ -169,8 +169,7 @@ qemuBlockNodeNameGetBackingChainBacking(virJSONValuePtr next,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC(data) < 0)
|
data = g_new0(qemuBlockNodeNameBackingChainData, 1);
|
||||||
return -1;
|
|
||||||
|
|
||||||
data->nodeformat = g_strdup(nodename);
|
data->nodeformat = g_strdup(nodename);
|
||||||
data->nodestorage = g_strdup(parentnodename);
|
data->nodestorage = g_strdup(parentnodename);
|
||||||
@ -415,8 +414,7 @@ qemuBlockStorageSourceGetURI(virStorageSourcePtr src)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC(uri) < 0)
|
uri = g_new0(virURI, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP) {
|
if (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP) {
|
||||||
uri->port = src->hosts->port;
|
uri->port = src->hosts->port;
|
||||||
@ -1595,8 +1593,7 @@ qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSourcePtr src,
|
|||||||
if (autoreadonly)
|
if (autoreadonly)
|
||||||
backendpropsflags |= QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_AUTO_READONLY;
|
backendpropsflags |= QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_AUTO_READONLY;
|
||||||
|
|
||||||
if (VIR_ALLOC(data) < 0)
|
data = g_new0(qemuBlockStorageSourceAttachData, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!(data->formatProps = qemuBlockStorageSourceGetBlockdevProps(src,
|
if (!(data->formatProps = qemuBlockStorageSourceGetBlockdevProps(src,
|
||||||
backingStore)) ||
|
backingStore)) ||
|
||||||
@ -1886,8 +1883,7 @@ qemuBlockStorageSourceChainDetachPrepareBlockdev(virStorageSourcePtr src)
|
|||||||
g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
|
g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
|
||||||
virStorageSourcePtr n;
|
virStorageSourcePtr n;
|
||||||
|
|
||||||
if (VIR_ALLOC(data) < 0)
|
data = g_new0(qemuBlockStorageSourceChainData, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) {
|
for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) {
|
||||||
if (!(backend = qemuBlockStorageSourceDetachPrepare(n, NULL)))
|
if (!(backend = qemuBlockStorageSourceDetachPrepare(n, NULL)))
|
||||||
@ -1916,8 +1912,7 @@ qemuBlockStorageSourceChainDetachPrepareDrive(virStorageSourcePtr src,
|
|||||||
g_autoptr(qemuBlockStorageSourceAttachData) backend = NULL;
|
g_autoptr(qemuBlockStorageSourceAttachData) backend = NULL;
|
||||||
g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
|
g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(data) < 0)
|
data = g_new0(qemuBlockStorageSourceChainData, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!(backend = qemuBlockStorageSourceDetachPrepare(src, driveAlias)))
|
if (!(backend = qemuBlockStorageSourceDetachPrepare(src, driveAlias)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -926,8 +926,7 @@ qemuInitCgroup(virDomainObjPtr vm,
|
|||||||
if (!vm->def->resource) {
|
if (!vm->def->resource) {
|
||||||
virDomainResourceDefPtr res;
|
virDomainResourceDefPtr res;
|
||||||
|
|
||||||
if (VIR_ALLOC(res) < 0)
|
res = g_new0(virDomainResourceDef, 1);
|
||||||
return -1;
|
|
||||||
|
|
||||||
res->partition = g_strdup("/machine");
|
res->partition = g_strdup("/machine");
|
||||||
|
|
||||||
@ -1252,8 +1251,7 @@ qemuCgroupEmulatorAllNodesAllow(virCgroupPtr cgroup,
|
|||||||
if (!(all_nodes_str = virBitmapFormat(all_nodes)))
|
if (!(all_nodes_str = virBitmapFormat(all_nodes)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (VIR_ALLOC(data) < 0)
|
data = g_new0(qemuCgroupEmulatorAllNodesData, 1);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (virCgroupNewThread(cgroup, VIR_CGROUP_THREAD_EMULATOR, 0,
|
if (virCgroupNewThread(cgroup, VIR_CGROUP_THREAD_EMULATOR, 0,
|
||||||
false, &data->emulatorCgroup) < 0)
|
false, &data->emulatorCgroup) < 0)
|
||||||
|
@ -640,9 +640,8 @@ virQEMUDriverConfigLoadProcessEntry(virQEMUDriverConfigPtr cfg,
|
|||||||
VIR_FREE(cfg->hugetlbfs);
|
VIR_FREE(cfg->hugetlbfs);
|
||||||
|
|
||||||
cfg->nhugetlbfs = virStringListLength((const char *const *)hugetlbfs);
|
cfg->nhugetlbfs = virStringListLength((const char *const *)hugetlbfs);
|
||||||
if (hugetlbfs[0] &&
|
if (hugetlbfs[0])
|
||||||
VIR_ALLOC_N(cfg->hugetlbfs, cfg->nhugetlbfs) < 0)
|
cfg->hugetlbfs = g_new0(virHugeTLBFS, cfg->nhugetlbfs);
|
||||||
return -1;
|
|
||||||
|
|
||||||
for (i = 0; hugetlbfs[i] != NULL; i++) {
|
for (i = 0; hugetlbfs[i] != NULL; i++) {
|
||||||
if (virQEMUDriverConfigHugeTLBFSInit(&cfg->hugetlbfs[i],
|
if (virQEMUDriverConfigHugeTLBFSInit(&cfg->hugetlbfs[i],
|
||||||
@ -839,12 +838,11 @@ virQEMUDriverConfigLoadNVRAMEntry(virQEMUDriverConfigPtr cfg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cfg->nfirmwares = virStringListLength((const char *const *)nvram);
|
cfg->nfirmwares = virStringListLength((const char *const *)nvram);
|
||||||
if (nvram[0] && VIR_ALLOC_N(cfg->firmwares, cfg->nfirmwares) < 0)
|
if (nvram[0])
|
||||||
return -1;
|
cfg->firmwares = g_new0(virFirmwarePtr, cfg->nfirmwares);
|
||||||
|
|
||||||
for (i = 0; nvram[i] != NULL; i++) {
|
for (i = 0; nvram[i] != NULL; i++) {
|
||||||
if (VIR_ALLOC(cfg->firmwares[i]) < 0)
|
cfg->firmwares[i] = g_new0(virFirmware, 1);
|
||||||
return -1;
|
|
||||||
if (virFirmwareParse(nvram[i], cfg->firmwares[i]) < 0)
|
if (virFirmwareParse(nvram[i], cfg->firmwares[i]) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1348,8 +1346,7 @@ virCapsPtr virQEMUDriverCreateCapabilities(virQEMUDriverPtr driver)
|
|||||||
;
|
;
|
||||||
caps->host.nsecModels = i;
|
caps->host.nsecModels = i;
|
||||||
|
|
||||||
if (VIR_ALLOC_N(caps->host.secModels, caps->host.nsecModels) < 0)
|
caps->host.secModels = g_new0(virCapsHostSecModel, caps->host.nsecModels);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
for (i = 0; sec_managers[i]; i++) {
|
for (i = 0; sec_managers[i]; i++) {
|
||||||
virCapsHostSecModelPtr sm = &caps->host.secModels[i];
|
virCapsHostSecModelPtr sm = &caps->host.secModels[i];
|
||||||
@ -1615,9 +1612,8 @@ qemuSharedDeviceEntryInsert(virQEMUDriverPtr driver,
|
|||||||
entry->domains[entry->ref - 1] = g_strdup(name);
|
entry->domains[entry->ref - 1] = g_strdup(name);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (VIR_ALLOC(entry) < 0 ||
|
entry = g_new0(qemuSharedDeviceEntry, 1);
|
||||||
VIR_ALLOC_N(entry->domains, 1) < 0)
|
entry->domains = g_new0(char *, 1);
|
||||||
goto error;
|
|
||||||
|
|
||||||
entry->domains[0] = g_strdup(name);
|
entry->domains[0] = g_strdup(name);
|
||||||
|
|
||||||
|
@ -3038,8 +3038,7 @@ qemuDomainUSBAddressAddHubs(virDomainDefPtr def)
|
|||||||
data.count, available_ports, hubs_needed);
|
data.count, available_ports, hubs_needed);
|
||||||
|
|
||||||
for (i = 0; i < hubs_needed; i++) {
|
for (i = 0; i < hubs_needed; i++) {
|
||||||
if (VIR_ALLOC(hub) < 0)
|
hub = g_new0(virDomainHubDef, 1);
|
||||||
return -1;
|
|
||||||
hub->type = VIR_DOMAIN_HUB_TYPE_USB;
|
hub->type = VIR_DOMAIN_HUB_TYPE_USB;
|
||||||
|
|
||||||
if (VIR_APPEND_ELEMENT(def->hubs, def->nhubs, hub) < 0)
|
if (VIR_APPEND_ELEMENT(def->hubs, def->nhubs, hub) < 0)
|
||||||
|
@ -928,8 +928,7 @@ qemuDomainFindOrCreateSCSIDiskController(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
/* No SCSI controller present, for backward compatibility we
|
/* No SCSI controller present, for backward compatibility we
|
||||||
* now hotplug a controller */
|
* now hotplug a controller */
|
||||||
if (VIR_ALLOC(cont) < 0)
|
cont = g_new0(virDomainControllerDef, 1);
|
||||||
return NULL;
|
|
||||||
cont->type = VIR_DOMAIN_CONTROLLER_TYPE_SCSI;
|
cont->type = VIR_DOMAIN_CONTROLLER_TYPE_SCSI;
|
||||||
cont->idx = controller;
|
cont->idx = controller;
|
||||||
if (model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DEFAULT)
|
if (model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DEFAULT)
|
||||||
@ -1243,11 +1242,9 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
|||||||
if (!tapfdSize)
|
if (!tapfdSize)
|
||||||
tapfdSize = vhostfdSize = 1;
|
tapfdSize = vhostfdSize = 1;
|
||||||
queueSize = tapfdSize;
|
queueSize = tapfdSize;
|
||||||
if (VIR_ALLOC_N(tapfd, tapfdSize) < 0)
|
tapfd = g_new0(int, tapfdSize);
|
||||||
goto cleanup;
|
|
||||||
memset(tapfd, -1, sizeof(*tapfd) * tapfdSize);
|
memset(tapfd, -1, sizeof(*tapfd) * tapfdSize);
|
||||||
if (VIR_ALLOC_N(vhostfd, vhostfdSize) < 0)
|
vhostfd = g_new0(int, vhostfdSize);
|
||||||
goto cleanup;
|
|
||||||
memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize);
|
memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize);
|
||||||
if (qemuInterfaceBridgeConnect(vm->def, driver, net,
|
if (qemuInterfaceBridgeConnect(vm->def, driver, net,
|
||||||
tapfd, &tapfdSize) < 0)
|
tapfd, &tapfdSize) < 0)
|
||||||
@ -1262,11 +1259,9 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
|||||||
if (!tapfdSize)
|
if (!tapfdSize)
|
||||||
tapfdSize = vhostfdSize = 1;
|
tapfdSize = vhostfdSize = 1;
|
||||||
queueSize = tapfdSize;
|
queueSize = tapfdSize;
|
||||||
if (VIR_ALLOC_N(tapfd, tapfdSize) < 0)
|
tapfd = g_new0(int, tapfdSize);
|
||||||
goto cleanup;
|
|
||||||
memset(tapfd, -1, sizeof(*tapfd) * tapfdSize);
|
memset(tapfd, -1, sizeof(*tapfd) * tapfdSize);
|
||||||
if (VIR_ALLOC_N(vhostfd, vhostfdSize) < 0)
|
vhostfd = g_new0(int, vhostfdSize);
|
||||||
goto cleanup;
|
|
||||||
memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize);
|
memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize);
|
||||||
if (qemuInterfaceDirectConnect(vm->def, driver, net,
|
if (qemuInterfaceDirectConnect(vm->def, driver, net,
|
||||||
tapfd, tapfdSize,
|
tapfd, tapfdSize,
|
||||||
@ -1282,10 +1277,9 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
|||||||
if (!tapfdSize)
|
if (!tapfdSize)
|
||||||
tapfdSize = vhostfdSize = 1;
|
tapfdSize = vhostfdSize = 1;
|
||||||
queueSize = tapfdSize;
|
queueSize = tapfdSize;
|
||||||
if (VIR_ALLOC_N(tapfd, tapfdSize) < 0)
|
tapfd = g_new0(int, tapfdSize);
|
||||||
goto cleanup;
|
|
||||||
memset(tapfd, -1, sizeof(*tapfd) * tapfdSize);
|
memset(tapfd, -1, sizeof(*tapfd) * tapfdSize);
|
||||||
if (VIR_ALLOC_N(vhostfd, vhostfdSize) < 0)
|
vhostfd = g_new0(int, vhostfdSize);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize);
|
memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize);
|
||||||
if (qemuInterfaceEthernetConnect(vm->def, driver, net,
|
if (qemuInterfaceEthernetConnect(vm->def, driver, net,
|
||||||
@ -1381,9 +1375,8 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC_N(tapfdName, tapfdSize) < 0 ||
|
tapfdName = g_new0(char *, tapfdSize);
|
||||||
VIR_ALLOC_N(vhostfdName, vhostfdSize) < 0)
|
vhostfdName = g_new0(char *, vhostfdSize);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
for (i = 0; i < tapfdSize; i++)
|
for (i = 0; i < tapfdSize; i++)
|
||||||
tapfdName[i] = g_strdup_printf("fd-%s%zu", net->info.alias, i);
|
tapfdName[i] = g_strdup_printf("fd-%s%zu", net->info.alias, i);
|
||||||
@ -1973,8 +1966,8 @@ qemuDomainChrPreInsert(virDomainDefPtr vmdef,
|
|||||||
*/
|
*/
|
||||||
if (vmdef->nserials == 0 && vmdef->nconsoles == 0 &&
|
if (vmdef->nserials == 0 && vmdef->nconsoles == 0 &&
|
||||||
chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL) {
|
chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL) {
|
||||||
if (!vmdef->consoles && VIR_ALLOC(vmdef->consoles) < 0)
|
if (!vmdef->consoles)
|
||||||
return -1;
|
vmdef->consoles = g_new0(virDomainChrDefPtr, 1);
|
||||||
|
|
||||||
/* We'll be dealing with serials[0] directly, so NULL is fine here. */
|
/* We'll be dealing with serials[0] directly, so NULL is fine here. */
|
||||||
if (!(vmdef->consoles[0] = virDomainChrDefNew(NULL))) {
|
if (!(vmdef->consoles[0] = virDomainChrDefNew(NULL))) {
|
||||||
|
@ -3309,8 +3309,7 @@ static void qemuMigrationSrcIOFunc(void *arg)
|
|||||||
VIR_DEBUG("Running migration tunnel; stream=%p, sock=%d",
|
VIR_DEBUG("Running migration tunnel; stream=%p, sock=%d",
|
||||||
data->st, data->sock);
|
data->st, data->sock);
|
||||||
|
|
||||||
if (VIR_ALLOC_N(buffer, TUNNEL_SEND_BUF_SIZE) < 0)
|
buffer = g_new0(char, TUNNEL_SEND_BUF_SIZE);
|
||||||
goto abrt;
|
|
||||||
|
|
||||||
fds[0].fd = data->sock;
|
fds[0].fd = data->sock;
|
||||||
fds[1].fd = data->wakeupRecvFD;
|
fds[1].fd = data->wakeupRecvFD;
|
||||||
@ -3414,8 +3413,7 @@ qemuMigrationSrcStartTunnel(virStreamPtr st,
|
|||||||
if (virPipe(wakeupFD) < 0)
|
if (virPipe(wakeupFD) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (VIR_ALLOC(io) < 0)
|
io = g_new0(qemuMigrationIOThread, 1);
|
||||||
goto error;
|
|
||||||
|
|
||||||
io->st = st;
|
io->st = st;
|
||||||
io->sock = sock;
|
io->sock = sock;
|
||||||
|
@ -1869,8 +1869,7 @@ qemuMonitorGetCPUInfo(qemuMonitorPtr mon,
|
|||||||
|
|
||||||
QEMU_CHECK_MONITOR(mon);
|
QEMU_CHECK_MONITOR(mon);
|
||||||
|
|
||||||
if (VIR_ALLOC_N(info, maxvcpus) < 0)
|
info = g_new0(qemuMonitorCPUInfo, maxvcpus);
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* initialize a few non-zero defaults */
|
/* initialize a few non-zero defaults */
|
||||||
qemuMonitorCPUInfoClear(info, maxvcpus);
|
qemuMonitorCPUInfoClear(info, maxvcpus);
|
||||||
@ -3684,11 +3683,9 @@ qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUModelInfo *orig)
|
|||||||
qemuMonitorCPUModelInfoPtr copy;
|
qemuMonitorCPUModelInfoPtr copy;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (VIR_ALLOC(copy) < 0)
|
copy = g_new0(qemuMonitorCPUModelInfo, 1);
|
||||||
goto error;
|
|
||||||
|
|
||||||
if (VIR_ALLOC_N(copy->props, orig->nprops) < 0)
|
copy->props = g_new0(qemuMonitorCPUProperty, orig->nprops);
|
||||||
goto error;
|
|
||||||
|
|
||||||
copy->name = g_strdup(orig->name);
|
copy->name = g_strdup(orig->name);
|
||||||
|
|
||||||
@ -3719,10 +3716,6 @@ qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUModelInfo *orig)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
|
|
||||||
error:
|
|
||||||
qemuMonitorCPUModelInfoFree(copy);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -155,8 +155,7 @@ qemuDomainGetPreservedMounts(virQEMUDriverConfigPtr cfg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC_N(paths, nmounts) < 0)
|
paths = g_new0(char *, nmounts);
|
||||||
goto error;
|
|
||||||
|
|
||||||
for (i = 0; i < nmounts; i++) {
|
for (i = 0; i < nmounts; i++) {
|
||||||
if (!(paths[i] = qemuDomainGetPreservedMountPath(cfg, vm, mounts[i])))
|
if (!(paths[i] = qemuDomainGetPreservedMountPath(cfg, vm, mounts[i])))
|
||||||
|
@ -103,8 +103,7 @@ virQEMUSaveDataNew(char *domXML,
|
|||||||
virQEMUSaveDataPtr data = NULL;
|
virQEMUSaveDataPtr data = NULL;
|
||||||
virQEMUSaveHeaderPtr header;
|
virQEMUSaveHeaderPtr header;
|
||||||
|
|
||||||
if (VIR_ALLOC(data) < 0)
|
data = g_new0(virQEMUSaveData, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
data->xml = g_steal_pointer(&domXML);
|
data->xml = g_steal_pointer(&domXML);
|
||||||
|
|
||||||
|
@ -196,8 +196,7 @@ qemuVhostUserParse(const char *path)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC(vu) < 0)
|
vu = g_new0(qemuVhostUser, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (qemuVhostUserTypeParse(path, doc, vu) < 0)
|
if (qemuVhostUserTypeParse(path, doc, vu) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -253,8 +252,7 @@ qemuVhostUserFetchParsedConfigs(bool privileged,
|
|||||||
|
|
||||||
npaths = virStringListLength((const char **)paths);
|
npaths = virStringListLength((const char **)paths);
|
||||||
|
|
||||||
if (VIR_ALLOC_N(vus, npaths) < 0)
|
vus = g_new0(qemuVhostUserPtr, npaths);
|
||||||
return -1;
|
|
||||||
|
|
||||||
for (i = 0; i < npaths; i++) {
|
for (i = 0; i < npaths; i++) {
|
||||||
if (!(vus[i] = qemuVhostUserParse(paths[i])))
|
if (!(vus[i] = qemuVhostUserParse(paths[i])))
|
||||||
@ -292,8 +290,7 @@ qemuVhostUserGPUFillCapabilities(qemuVhostUserPtr vu,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nfeatures = virJSONValueArraySize(featuresJSON);
|
nfeatures = virJSONValueArraySize(featuresJSON);
|
||||||
if (VIR_ALLOC_N(features, nfeatures) < 0)
|
features = g_new0(qemuVhostUserGPUFeature, nfeatures);
|
||||||
return -1;
|
|
||||||
|
|
||||||
for (i = 0; i < nfeatures; i++) {
|
for (i = 0; i < nfeatures; i++) {
|
||||||
virJSONValuePtr item = virJSONValueArrayGet(featuresJSON, i);
|
virJSONValuePtr item = virJSONValueArrayGet(featuresJSON, i);
|
||||||
@ -382,8 +379,8 @@ qemuVhostUserFillDomainGPU(virQEMUDriverPtr driver,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!video->driver && VIR_ALLOC(video->driver) < 0)
|
if (!video->driver)
|
||||||
goto end;
|
video->driver = g_new0(virDomainVideoDriverDef, 1);
|
||||||
|
|
||||||
VIR_FREE(video->driver->vhost_user_binary);
|
VIR_FREE(video->driver->vhost_user_binary);
|
||||||
video->driver->vhost_user_binary = g_strdup(vu->binary);
|
video->driver->vhost_user_binary = g_strdup(vu->binary);
|
||||||
@ -397,8 +394,8 @@ qemuVhostUserFillDomainGPU(virQEMUDriverPtr driver,
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!video->accel && VIR_ALLOC(video->accel) < 0)
|
if (!video->accel)
|
||||||
goto end;
|
video->accel = g_new0(virDomainVideoAccelDef, 1);
|
||||||
|
|
||||||
if (!video->accel->rendernode &&
|
if (!video->accel->rendernode &&
|
||||||
qemuVhostUserGPUHasFeature(&vu->capabilities.gpu,
|
qemuVhostUserGPUHasFeature(&vu->capabilities.gpu,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user