mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
Use g_autofree instead of VIR_AUTOFREE
Since commit 44e7f02915
util: rewrite auto cleanup macros to use glib's equivalent
VIR_AUTOFREE is just an alias for g_autofree. Use the GLib macros
directly instead of our custom aliases.
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
2b2c67b401
commit
1e2ae2e311
@ -98,7 +98,7 @@ virDomainCheckpointDiskDefParseXML(xmlNodePtr node,
|
||||
xmlXPathContextPtr ctxt,
|
||||
virDomainCheckpointDiskDefPtr def)
|
||||
{
|
||||
VIR_AUTOFREE(char *) checkpoint = NULL;
|
||||
g_autofree char *checkpoint = NULL;
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
|
||||
ctxt->node = node;
|
||||
@ -133,7 +133,7 @@ virDomainCheckpointDefParse(xmlXPathContextPtr ctxt,
|
||||
size_t i;
|
||||
int n;
|
||||
char *tmp;
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
VIR_AUTOUNREF(virDomainCheckpointDefPtr) def = NULL;
|
||||
|
||||
if (!(def = virDomainCheckpointDefNew()))
|
||||
@ -210,7 +210,7 @@ virDomainCheckpointDefParseNode(xmlDocPtr xml,
|
||||
unsigned int flags)
|
||||
{
|
||||
VIR_AUTOPTR(xmlXPathContext) ctxt = NULL;
|
||||
VIR_AUTOFREE(char *) schema = NULL;
|
||||
g_autofree char *schema = NULL;
|
||||
|
||||
if (!virXMLNodeNameEqual(root, "domaincheckpoint")) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s", _("domaincheckpoint"));
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -133,8 +133,8 @@ secretXMLParseNode(xmlDocPtr xml, xmlNodePtr root)
|
||||
{
|
||||
VIR_AUTOPTR(xmlXPathContext) ctxt = NULL;
|
||||
VIR_AUTOPTR(virSecretDef) def = NULL;
|
||||
VIR_AUTOFREE(char *) prop = NULL;
|
||||
VIR_AUTOFREE(char *) uuidstr = NULL;
|
||||
g_autofree char *prop = NULL;
|
||||
g_autofree char *uuidstr = NULL;
|
||||
|
||||
if (!virXMLNodeNameEqual(root, "secret")) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
|
@ -437,7 +437,7 @@ virDomainSnapshotDefParseNode(xmlDocPtr xml,
|
||||
}
|
||||
|
||||
if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_VALIDATE) {
|
||||
VIR_AUTOFREE(char *) schema = NULL;
|
||||
g_autofree char *schema = NULL;
|
||||
|
||||
schema = virFileFindResource("domainsnapshot.rng",
|
||||
abs_top_srcdir "/docs/schemas",
|
||||
|
@ -535,10 +535,10 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
|
||||
virStoragePoolOptionsPtr options;
|
||||
int n;
|
||||
VIR_AUTOPTR(virStorageAuthDef) authdef = NULL;
|
||||
VIR_AUTOFREE(char *) port = NULL;
|
||||
VIR_AUTOFREE(char *) ver = NULL;
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodeset = NULL;
|
||||
VIR_AUTOFREE(char *) sourcedir = NULL;
|
||||
g_autofree char *port = NULL;
|
||||
g_autofree char *ver = NULL;
|
||||
g_autofree xmlNodePtr *nodeset = NULL;
|
||||
g_autofree char *sourcedir = NULL;
|
||||
|
||||
relnode = ctxt->node;
|
||||
ctxt->node = node;
|
||||
@ -554,7 +554,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
|
||||
}
|
||||
|
||||
if (options->formatFromString) {
|
||||
VIR_AUTOFREE(char *) format = NULL;
|
||||
g_autofree char *format = NULL;
|
||||
|
||||
format = virXPathString("string(./format/@type)", ctxt);
|
||||
if (format == NULL)
|
||||
@ -607,7 +607,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
|
||||
goto cleanup;
|
||||
|
||||
for (i = 0; i < nsource; i++) {
|
||||
VIR_AUTOFREE(char *) partsep = NULL;
|
||||
g_autofree char *partsep = NULL;
|
||||
virStoragePoolSourceDevice dev = { .path = NULL };
|
||||
dev.path = virXMLPropString(nodeset[i], "path");
|
||||
|
||||
@ -731,7 +731,7 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt,
|
||||
int ret = -1;
|
||||
xmlNodePtr relnode;
|
||||
xmlNodePtr node;
|
||||
VIR_AUTOFREE(char *) mode = NULL;
|
||||
g_autofree char *mode = NULL;
|
||||
|
||||
node = virXPathNode(permxpath, ctxt);
|
||||
if (node == NULL) {
|
||||
@ -802,8 +802,8 @@ static int
|
||||
virStoragePoolDefRefreshParse(xmlXPathContextPtr ctxt,
|
||||
virStoragePoolDefPtr def)
|
||||
{
|
||||
VIR_AUTOFREE(virStoragePoolDefRefreshPtr) refresh = NULL;
|
||||
VIR_AUTOFREE(char *) allocation = NULL;
|
||||
g_autofree virStoragePoolDefRefreshPtr refresh = NULL;
|
||||
g_autofree char *allocation = NULL;
|
||||
int tmp;
|
||||
|
||||
allocation = virXPathString("string(./refresh/volume/@allocation)", ctxt);
|
||||
@ -850,9 +850,9 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
|
||||
virStoragePoolDefPtr ret = NULL;
|
||||
xmlNodePtr source_node;
|
||||
VIR_AUTOPTR(virStoragePoolDef) def = NULL;
|
||||
VIR_AUTOFREE(char *) type = NULL;
|
||||
VIR_AUTOFREE(char *) uuid = NULL;
|
||||
VIR_AUTOFREE(char *) target_path = NULL;
|
||||
g_autofree char *type = NULL;
|
||||
g_autofree char *uuid = NULL;
|
||||
g_autofree char *target_path = NULL;
|
||||
|
||||
if (VIR_ALLOC(def) < 0)
|
||||
return NULL;
|
||||
@ -1279,12 +1279,12 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
|
||||
size_t i;
|
||||
int n;
|
||||
VIR_AUTOPTR(virStorageVolDef) def = NULL;
|
||||
VIR_AUTOFREE(char *) type = NULL;
|
||||
VIR_AUTOFREE(char *) allocation = NULL;
|
||||
VIR_AUTOFREE(char *) capacity = NULL;
|
||||
VIR_AUTOFREE(char *) unit = NULL;
|
||||
VIR_AUTOFREE(char *) backingStore = NULL;
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
|
||||
g_autofree char *type = NULL;
|
||||
g_autofree char *allocation = NULL;
|
||||
g_autofree char *capacity = NULL;
|
||||
g_autofree char *unit = NULL;
|
||||
g_autofree char *backingStore = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
|
||||
virCheckFlags(VIR_VOL_XML_PARSE_NO_CAPACITY |
|
||||
VIR_VOL_XML_PARSE_OPT_CAPACITY, NULL);
|
||||
@ -1328,7 +1328,7 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
|
||||
backingStore = NULL;
|
||||
|
||||
if (options->formatFromString) {
|
||||
VIR_AUTOFREE(char *) format = NULL;
|
||||
g_autofree char *format = NULL;
|
||||
|
||||
format = virXPathString("string(./backingStore/format/@type)", ctxt);
|
||||
if (format == NULL)
|
||||
@ -1375,7 +1375,7 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
|
||||
|
||||
def->target.path = virXPathString("string(./target/path)", ctxt);
|
||||
if (options->formatFromString) {
|
||||
VIR_AUTOFREE(char *) format = NULL;
|
||||
g_autofree char *format = NULL;
|
||||
|
||||
format = virXPathString("string(./target/format/@type)", ctxt);
|
||||
if (format == NULL)
|
||||
@ -1708,7 +1708,7 @@ virStoragePoolSaveState(const char *stateFile,
|
||||
virStoragePoolDefPtr def)
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
VIR_AUTOFREE(char *) xml = NULL;
|
||||
g_autofree char *xml = NULL;
|
||||
|
||||
virBufferAddLit(&buf, "<poolstate>\n");
|
||||
virBufferAdjustIndent(&buf, 2);
|
||||
@ -1736,7 +1736,7 @@ int
|
||||
virStoragePoolSaveConfig(const char *configFile,
|
||||
virStoragePoolDefPtr def)
|
||||
{
|
||||
VIR_AUTOFREE(char *) xml = NULL;
|
||||
g_autofree char *xml = NULL;
|
||||
|
||||
if (!(xml = virStoragePoolDefFormat(def))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
|
@ -1640,7 +1640,7 @@ virNetworkObjAddPort(virNetworkObjPtr net,
|
||||
const char *stateDir)
|
||||
{
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
VIR_AUTOFREE(char *) dir = NULL;
|
||||
g_autofree char *dir = NULL;
|
||||
|
||||
virUUIDFormat(portdef->uuid, uuidstr);
|
||||
|
||||
@ -1693,7 +1693,7 @@ virNetworkObjDeletePort(virNetworkObjPtr net,
|
||||
const char *stateDir)
|
||||
{
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
VIR_AUTOFREE(char *) dir = NULL;
|
||||
g_autofree char *dir = NULL;
|
||||
virNetworkPortDefPtr portdef;
|
||||
|
||||
virUUIDFormat(uuid, uuidstr);
|
||||
@ -1722,7 +1722,7 @@ int
|
||||
virNetworkObjDeleteAllPorts(virNetworkObjPtr net,
|
||||
const char *stateDir)
|
||||
{
|
||||
VIR_AUTOFREE(char *) dir = NULL;
|
||||
g_autofree char *dir = NULL;
|
||||
DIR *dh = NULL;
|
||||
struct dirent *de;
|
||||
int rc;
|
||||
@ -1881,7 +1881,7 @@ static int
|
||||
virNetworkObjLoadAllPorts(virNetworkObjPtr net,
|
||||
const char *stateDir)
|
||||
{
|
||||
VIR_AUTOFREE(char *) dir = NULL;
|
||||
g_autofree char *dir = NULL;
|
||||
DIR *dh = NULL;
|
||||
struct dirent *de;
|
||||
int ret = -1;
|
||||
|
@ -76,18 +76,18 @@ static virNetworkPortDefPtr
|
||||
virNetworkPortDefParseXML(xmlXPathContextPtr ctxt)
|
||||
{
|
||||
VIR_AUTOPTR(virNetworkPortDef) def = NULL;
|
||||
VIR_AUTOFREE(char *) uuid = NULL;
|
||||
g_autofree char *uuid = NULL;
|
||||
xmlNodePtr virtPortNode;
|
||||
xmlNodePtr vlanNode;
|
||||
xmlNodePtr bandwidthNode;
|
||||
xmlNodePtr addressNode;
|
||||
VIR_AUTOFREE(char *) trustGuestRxFilters = NULL;
|
||||
VIR_AUTOFREE(char *) mac = NULL;
|
||||
VIR_AUTOFREE(char *) macmgr = NULL;
|
||||
VIR_AUTOFREE(char *) mode = NULL;
|
||||
VIR_AUTOFREE(char *) plugtype = NULL;
|
||||
VIR_AUTOFREE(char *) managed = NULL;
|
||||
VIR_AUTOFREE(char *) driver = NULL;
|
||||
g_autofree char *trustGuestRxFilters = NULL;
|
||||
g_autofree char *mac = NULL;
|
||||
g_autofree char *macmgr = NULL;
|
||||
g_autofree char *mode = NULL;
|
||||
g_autofree char *plugtype = NULL;
|
||||
g_autofree char *managed = NULL;
|
||||
g_autofree char *driver = NULL;
|
||||
|
||||
if (VIR_ALLOC(def) < 0)
|
||||
return NULL;
|
||||
|
@ -1350,7 +1350,7 @@ x86ModelParseAncestor(virCPUx86ModelPtr model,
|
||||
xmlXPathContextPtr ctxt,
|
||||
virCPUx86MapPtr map)
|
||||
{
|
||||
VIR_AUTOFREE(char *) name = NULL;
|
||||
g_autofree char *name = NULL;
|
||||
virCPUx86ModelPtr ancestor;
|
||||
int rc;
|
||||
|
||||
@ -1385,7 +1385,7 @@ static int
|
||||
x86ModelParseSignatures(virCPUx86ModelPtr model,
|
||||
xmlXPathContextPtr ctxt)
|
||||
{
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
xmlNodePtr root = ctxt->node;
|
||||
size_t i;
|
||||
int n;
|
||||
@ -1436,7 +1436,7 @@ x86ModelParseVendor(virCPUx86ModelPtr model,
|
||||
xmlXPathContextPtr ctxt,
|
||||
virCPUx86MapPtr map)
|
||||
{
|
||||
VIR_AUTOFREE(char *) vendor = NULL;
|
||||
g_autofree char *vendor = NULL;
|
||||
int rc;
|
||||
|
||||
if ((rc = virXPathBoolean("boolean(./vendor)", ctxt)) <= 0)
|
||||
@ -1466,7 +1466,7 @@ x86ModelParseFeatures(virCPUx86ModelPtr model,
|
||||
xmlXPathContextPtr ctxt,
|
||||
virCPUx86MapPtr map)
|
||||
{
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
size_t i;
|
||||
int n;
|
||||
|
||||
@ -1474,7 +1474,7 @@ x86ModelParseFeatures(virCPUx86ModelPtr model,
|
||||
return n;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
VIR_AUTOFREE(char *) ftname = NULL;
|
||||
g_autofree char *ftname = NULL;
|
||||
virCPUx86FeaturePtr feature;
|
||||
|
||||
if (!(ftname = virXMLPropString(nodes[i], "name"))) {
|
||||
@ -2120,7 +2120,7 @@ x86Decode(virCPUDefPtr cpu,
|
||||
virCPUx86Data features = VIR_CPU_X86_DATA_INIT;
|
||||
virCPUx86VendorPtr vendor;
|
||||
virDomainCapsCPUModelPtr hvModel = NULL;
|
||||
VIR_AUTOFREE(char *) sigs = NULL;
|
||||
g_autofree char *sigs = NULL;
|
||||
uint32_t signature;
|
||||
ssize_t i;
|
||||
int rc;
|
||||
|
@ -86,7 +86,7 @@ int
|
||||
virDriverShouldAutostart(const char *dir,
|
||||
bool *autostart)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
*autostart = false;
|
||||
|
||||
@ -149,7 +149,7 @@ virGetConnectGeneric(virThreadLocalPtr threadPtr, const char *name)
|
||||
VIR_DEBUG("Return cached %s connection %p", name, conn);
|
||||
virObjectRef(conn);
|
||||
} else {
|
||||
VIR_AUTOFREE(char *) uri = NULL;
|
||||
g_autofree char *uri = NULL;
|
||||
const char *uriPath = geteuid() == 0 ? "/system" : "/session";
|
||||
|
||||
if (virAsprintf(&uri, "%s://%s", name, uriPath) < 0)
|
||||
|
@ -105,7 +105,7 @@ netcfStateInitialize(bool privileged,
|
||||
"%s/libvirt/interface", RUNSTATEDIR) < 0)
|
||||
goto error;
|
||||
} else {
|
||||
VIR_AUTOFREE(char *) rundir = NULL;
|
||||
g_autofree char *rundir = NULL;
|
||||
|
||||
if (!(rundir = virGetUserRuntimeDirectory()))
|
||||
goto error;
|
||||
|
@ -1184,7 +1184,7 @@ udevStateInitialize(bool privileged,
|
||||
"%s/libvirt/interface", RUNSTATEDIR) < 0)
|
||||
goto cleanup;
|
||||
} else {
|
||||
VIR_AUTOFREE(char *) rundir = NULL;
|
||||
g_autofree char *rundir = NULL;
|
||||
|
||||
if (!(rundir = virGetUserRuntimeDirectory()))
|
||||
goto cleanup;
|
||||
|
@ -122,7 +122,7 @@ getSocketPath(virURIPtr uri)
|
||||
}
|
||||
|
||||
if (!sock_path) {
|
||||
VIR_AUTOFREE(char *) sockbase = NULL;
|
||||
g_autofree char *sockbase = NULL;
|
||||
bool legacy = false;
|
||||
|
||||
if (!uri->scheme) {
|
||||
|
@ -180,7 +180,7 @@ xenConfigCopyStringOpt(virConfPtr conf, const char *name, char **value)
|
||||
static int
|
||||
xenConfigGetUUID(virConfPtr conf, const char *name, unsigned char *uuid)
|
||||
{
|
||||
VIR_AUTOFREE(char *) string = NULL;
|
||||
g_autofree char *string = NULL;
|
||||
int rc;
|
||||
|
||||
if (!uuid || !name || !conf) {
|
||||
@ -339,9 +339,9 @@ xenParseTimeOffset(virConfPtr conf, virDomainDefPtr def)
|
||||
static int
|
||||
xenParseEventsActions(virConfPtr conf, virDomainDefPtr def)
|
||||
{
|
||||
VIR_AUTOFREE(char *) on_poweroff = NULL;
|
||||
VIR_AUTOFREE(char *) on_reboot = NULL;
|
||||
VIR_AUTOFREE(char *) on_crash = NULL;
|
||||
g_autofree char *on_poweroff = NULL;
|
||||
g_autofree char *on_reboot = NULL;
|
||||
g_autofree char *on_crash = NULL;
|
||||
|
||||
if (xenConfigGetString(conf, "on_poweroff", &on_poweroff, "destroy") < 0)
|
||||
return -1;
|
||||
@ -504,8 +504,8 @@ xenParseCPUFeatures(virConfPtr conf,
|
||||
virDomainXMLOptionPtr xmlopt)
|
||||
{
|
||||
unsigned long count = 0;
|
||||
VIR_AUTOFREE(char *) cpus = NULL;
|
||||
VIR_AUTOFREE(char *) tsc_mode = NULL;
|
||||
g_autofree char *cpus = NULL;
|
||||
g_autofree char *tsc_mode = NULL;
|
||||
int val = 0;
|
||||
virDomainTimerDefPtr timer;
|
||||
|
||||
@ -915,7 +915,7 @@ xenParseCharDev(virConfPtr conf, virDomainDefPtr def, const char *nativeFormat)
|
||||
virDomainChrDefPtr chr = NULL;
|
||||
|
||||
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
|
||||
VIR_AUTOFREE(char *) parallel = NULL;
|
||||
g_autofree char *parallel = NULL;
|
||||
int rc;
|
||||
|
||||
if (xenConfigGetString(conf, "parallel", ¶llel, NULL) < 0)
|
||||
@ -960,7 +960,7 @@ xenParseCharDev(virConfPtr conf, virDomainDefPtr def, const char *nativeFormat)
|
||||
goto cleanup;
|
||||
}
|
||||
} else {
|
||||
VIR_AUTOFREE(char *) serial = NULL;
|
||||
g_autofree char *serial = NULL;
|
||||
|
||||
if (xenHandleConfGetValueStringListErrors(rc) < 0)
|
||||
goto cleanup;
|
||||
@ -1428,7 +1428,7 @@ xenParseSxprSound(virDomainDefPtr def,
|
||||
static int
|
||||
xenParseEmulatedDevices(virConfPtr conf, virDomainDefPtr def)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
|
||||
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
|
||||
if (xenConfigGetString(conf, "soundhw", &str, NULL) < 0)
|
||||
@ -1447,7 +1447,7 @@ static int
|
||||
xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr def, virCapsPtr caps)
|
||||
{
|
||||
virCapsDomainDataPtr capsdata = NULL;
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
int ret = -1;
|
||||
|
||||
if (xenConfigCopyString(conf, "name", &def->name) < 0)
|
||||
@ -2375,7 +2375,7 @@ xenFormatSound(virConfPtr conf, virDomainDefPtr def)
|
||||
{
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
const char * model;
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
size_t i;
|
||||
|
||||
if (def->os.type != VIR_DOMAIN_OSTYPE_HVM ||
|
||||
|
@ -64,9 +64,9 @@ extern int xlu_disk_parse(XLU_Config *cfg,
|
||||
static int xenParseCmdline(virConfPtr conf, char **r_cmdline)
|
||||
{
|
||||
char *cmdline = NULL;
|
||||
VIR_AUTOFREE(char *) root = NULL;
|
||||
VIR_AUTOFREE(char *) extra = NULL;
|
||||
VIR_AUTOFREE(char *) buf = NULL;
|
||||
g_autofree char *root = NULL;
|
||||
g_autofree char *extra = NULL;
|
||||
g_autofree char *buf = NULL;
|
||||
|
||||
if (xenConfigGetString(conf, "cmdline", &buf, NULL) < 0)
|
||||
return -1;
|
||||
@ -105,8 +105,8 @@ xenParseXLOS(virConfPtr conf, virDomainDefPtr def, virCapsPtr caps)
|
||||
size_t i;
|
||||
|
||||
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
|
||||
VIR_AUTOFREE(char *) bios = NULL;
|
||||
VIR_AUTOFREE(char *) boot = NULL;
|
||||
g_autofree char *bios = NULL;
|
||||
g_autofree char *boot = NULL;
|
||||
int val = 0;
|
||||
|
||||
if (xenConfigGetString(conf, "bios", &bios, NULL) < 0)
|
||||
@ -259,7 +259,7 @@ xenTranslateCPUFeature(const char *feature_name, bool from_libxl)
|
||||
static int
|
||||
xenParseXLCPUID(virConfPtr conf, virDomainDefPtr def)
|
||||
{
|
||||
VIR_AUTOFREE(char *) cpuid_str = NULL;
|
||||
g_autofree char *cpuid_str = NULL;
|
||||
char **cpuid_pairs = NULL;
|
||||
char **name_and_value = NULL;
|
||||
size_t i;
|
||||
|
@ -41,7 +41,7 @@ xenParseXMOS(virConfPtr conf, virDomainDefPtr def)
|
||||
size_t i;
|
||||
|
||||
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
|
||||
VIR_AUTOFREE(char *) boot = NULL;
|
||||
g_autofree char *boot = NULL;
|
||||
|
||||
if (VIR_ALLOC(def->os.loader) < 0 ||
|
||||
xenConfigCopyString(conf, "kernel", &def->os.loader->path) < 0)
|
||||
@ -69,8 +69,8 @@ xenParseXMOS(virConfPtr conf, virDomainDefPtr def)
|
||||
def->os.nBootDevs++;
|
||||
}
|
||||
} else {
|
||||
VIR_AUTOFREE(char *) extra = NULL;
|
||||
VIR_AUTOFREE(char *) root = NULL;
|
||||
g_autofree char *extra = NULL;
|
||||
g_autofree char *root = NULL;
|
||||
|
||||
if (xenConfigCopyStringOpt(conf, "bootloader", &def->os.bootloader) < 0)
|
||||
return -1;
|
||||
@ -415,7 +415,7 @@ xenFormatXMDisks(virConfPtr conf, virDomainDefPtr def)
|
||||
static int
|
||||
xenParseXMInputDevs(virConfPtr conf, virDomainDefPtr def)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
|
||||
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
|
||||
if (xenConfigGetString(conf, "usbdevice", &str, NULL) < 0)
|
||||
|
@ -211,7 +211,7 @@ lxcSetRootfs(virDomainDefPtr def,
|
||||
virConfPtr properties)
|
||||
{
|
||||
int type = VIR_DOMAIN_FS_TYPE_MOUNT;
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
|
||||
if (virConfGetValueString(properties, "lxc.rootfs.path", &value) <= 0) {
|
||||
virResetLastError();
|
||||
@ -756,7 +756,7 @@ lxcConvertNetworkSettings(virDomainDefPtr def, virConfPtr properties)
|
||||
static int
|
||||
lxcCreateConsoles(virDomainDefPtr def, virConfPtr properties)
|
||||
{
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
int nbttys = 0;
|
||||
virDomainChrDefPtr console;
|
||||
size_t i;
|
||||
@ -841,7 +841,7 @@ lxcIdmapWalkCallback(const char *name, virConfValuePtr value, void *data)
|
||||
static int
|
||||
lxcSetMemTune(virDomainDefPtr def, virConfPtr properties)
|
||||
{
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
unsigned long long size = 0;
|
||||
|
||||
if (virConfGetValueString(properties,
|
||||
@ -877,7 +877,7 @@ lxcSetMemTune(virDomainDefPtr def, virConfPtr properties)
|
||||
static int
|
||||
lxcSetCpuTune(virDomainDefPtr def, virConfPtr properties)
|
||||
{
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
|
||||
if (virConfGetValueString(properties, "lxc.cgroup.cpu.shares",
|
||||
&value) > 0) {
|
||||
@ -911,7 +911,7 @@ lxcSetCpuTune(virDomainDefPtr def, virConfPtr properties)
|
||||
static int
|
||||
lxcSetCpusetTune(virDomainDefPtr def, virConfPtr properties)
|
||||
{
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
virBitmapPtr nodeset = NULL;
|
||||
|
||||
if (virConfGetValueString(properties, "lxc.cgroup.cpuset.cpus",
|
||||
@ -1033,7 +1033,7 @@ lxcBlkioDeviceWalkCallback(const char *name, virConfValuePtr value, void *data)
|
||||
static int
|
||||
lxcSetBlkioTune(virDomainDefPtr def, virConfPtr properties)
|
||||
{
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
|
||||
if (virConfGetValueString(properties, "lxc.cgroup.blkio.weight",
|
||||
&value) > 0) {
|
||||
@ -1053,7 +1053,7 @@ lxcSetBlkioTune(virDomainDefPtr def, virConfPtr properties)
|
||||
static void
|
||||
lxcSetCapDrop(virDomainDefPtr def, virConfPtr properties)
|
||||
{
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
char **toDrop = NULL;
|
||||
const char *capString;
|
||||
size_t i;
|
||||
@ -1080,7 +1080,7 @@ lxcParseConfigString(const char *config,
|
||||
{
|
||||
virDomainDefPtr vmdef = NULL;
|
||||
VIR_AUTOPTR(virConf) properties = NULL;
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
|
||||
if (!(properties = virConfReadString(config, VIR_CONF_FLAG_LXC_FORMAT)))
|
||||
return NULL;
|
||||
|
@ -154,7 +154,7 @@ static int
|
||||
networkDnsmasqDefNamespaceParseOptions(networkDnsmasqXmlNsDefPtr nsdef,
|
||||
xmlXPathContextPtr ctxt)
|
||||
{
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
ssize_t nnodes;
|
||||
size_t i;
|
||||
|
||||
@ -676,9 +676,9 @@ firewalld_dbus_filter_bridge(DBusConnection *connection G_GNUC_UNUSED,
|
||||
} else if (dbus_message_is_signal(message,
|
||||
DBUS_INTERFACE_DBUS, "NameOwnerChanged")) {
|
||||
|
||||
VIR_AUTOFREE(char *) name = NULL;
|
||||
VIR_AUTOFREE(char *) old_owner = NULL;
|
||||
VIR_AUTOFREE(char *) new_owner = NULL;
|
||||
g_autofree char *name = NULL;
|
||||
g_autofree char *old_owner = NULL;
|
||||
g_autofree char *new_owner = NULL;
|
||||
|
||||
if (virDBusMessageDecode(message, "sss", &name, &old_owner, &new_owner) < 0) {
|
||||
VIR_WARN("Failed to decode DBus NameOwnerChanged message");
|
||||
@ -1470,7 +1470,7 @@ networkDnsmasqConfContents(virNetworkObjPtr obj,
|
||||
} else {
|
||||
/* IPv4 - dnsmasq requires a netmask rather than prefix */
|
||||
virSocketAddr netmask;
|
||||
VIR_AUTOFREE(char *) netmaskStr = NULL;
|
||||
g_autofree char *netmaskStr = NULL;
|
||||
|
||||
if (virSocketAddrPrefixToNetmask(prefix, &netmask, AF_INET) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
|
@ -622,7 +622,7 @@ nodeStateInitialize(bool privileged G_GNUC_UNUSED,
|
||||
"%s/libvirt/nodedev", RUNSTATEDIR) < 0)
|
||||
goto failure;
|
||||
} else {
|
||||
VIR_AUTOFREE(char *) rundir = NULL;
|
||||
g_autofree char *rundir = NULL;
|
||||
|
||||
if (!(rundir = virGetUserRuntimeDirectory()))
|
||||
goto failure;
|
||||
|
@ -1833,7 +1833,7 @@ nodeStateInitialize(bool privileged,
|
||||
"%s/libvirt/nodedev", RUNSTATEDIR) < 0)
|
||||
goto cleanup;
|
||||
} else {
|
||||
VIR_AUTOFREE(char *) rundir = NULL;
|
||||
g_autofree char *rundir = NULL;
|
||||
|
||||
if (!(rundir = virGetUserRuntimeDirectory()))
|
||||
goto cleanup;
|
||||
|
@ -279,7 +279,7 @@ qemuBlockDiskDetectNodes(virDomainDiskDefPtr disk,
|
||||
{
|
||||
qemuBlockNodeNameBackingChainDataPtr entry = NULL;
|
||||
virStorageSourcePtr src = disk->src;
|
||||
VIR_AUTOFREE(char *) alias = NULL;
|
||||
g_autofree char *alias = NULL;
|
||||
int ret = -1;
|
||||
|
||||
/* don't attempt the detection if the top level already has node names */
|
||||
@ -473,7 +473,7 @@ qemuBlockStorageSourceBuildJSONSocketAddress(virStorageNetHostDefPtr host,
|
||||
VIR_AUTOPTR(virJSONValue) server = NULL;
|
||||
const char *transport;
|
||||
const char *field;
|
||||
VIR_AUTOFREE(char *) port = NULL;
|
||||
g_autofree char *port = NULL;
|
||||
|
||||
switch ((virStorageNetHostTransport) host->transport) {
|
||||
case VIR_STORAGE_NET_HOST_TRANS_TCP:
|
||||
@ -567,7 +567,7 @@ static virJSONValuePtr
|
||||
qemuBlockStorageSourceBuildJSONInetSocketAddress(virStorageNetHostDefPtr host)
|
||||
{
|
||||
virJSONValuePtr ret = NULL;
|
||||
VIR_AUTOFREE(char *) port = NULL;
|
||||
g_autofree char *port = NULL;
|
||||
|
||||
if (host->transport != VIR_STORAGE_NET_HOST_TRANS_TCP) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
@ -697,7 +697,7 @@ qemuBlockStorageSourceGetCURLProps(virStorageSourcePtr src,
|
||||
const char *username = NULL;
|
||||
virJSONValuePtr ret = NULL;
|
||||
VIR_AUTOPTR(virURI) uri = NULL;
|
||||
VIR_AUTOFREE(char *) uristr = NULL;
|
||||
g_autofree char *uristr = NULL;
|
||||
|
||||
/**
|
||||
* Common options:
|
||||
@ -738,11 +738,11 @@ qemuBlockStorageSourceGetISCSIProps(virStorageSourcePtr src,
|
||||
bool onlytarget)
|
||||
{
|
||||
qemuDomainStorageSourcePrivatePtr srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
|
||||
VIR_AUTOFREE(char *) target = NULL;
|
||||
g_autofree char *target = NULL;
|
||||
char *lunStr = NULL;
|
||||
char *username = NULL;
|
||||
char *objalias = NULL;
|
||||
VIR_AUTOFREE(char *) portal = NULL;
|
||||
g_autofree char *portal = NULL;
|
||||
unsigned int lun = 0;
|
||||
virJSONValuePtr ret = NULL;
|
||||
|
||||
@ -1870,8 +1870,8 @@ qemuBlockSnapshotAddLegacy(virJSONValuePtr actions,
|
||||
bool reuse)
|
||||
{
|
||||
const char *format = virStorageFileFormatTypeToString(newsrc->format);
|
||||
VIR_AUTOFREE(char *) device = NULL;
|
||||
VIR_AUTOFREE(char *) source = NULL;
|
||||
g_autofree char *device = NULL;
|
||||
g_autofree char *source = NULL;
|
||||
|
||||
if (!(device = qemuAliasDiskDriveFromDisk(disk)))
|
||||
return -1;
|
||||
@ -1930,7 +1930,7 @@ qemuBlockGetBackingStoreString(virStorageSourcePtr src)
|
||||
int actualType = virStorageSourceGetActualType(src);
|
||||
VIR_AUTOPTR(virJSONValue) backingProps = NULL;
|
||||
VIR_AUTOPTR(virURI) uri = NULL;
|
||||
VIR_AUTOFREE(char *) backingJSON = NULL;
|
||||
g_autofree char *backingJSON = NULL;
|
||||
char *ret = NULL;
|
||||
|
||||
if (virStorageSourceIsLocalStorage(src)) {
|
||||
@ -1989,7 +1989,7 @@ qemuBlockStorageSourceCreateAddBacking(virStorageSourcePtr backing,
|
||||
virJSONValuePtr props,
|
||||
bool format)
|
||||
{
|
||||
VIR_AUTOFREE(char *) backingFileStr = NULL;
|
||||
g_autofree char *backingFileStr = NULL;
|
||||
const char *backingFormatStr = NULL;
|
||||
|
||||
if (!virStorageSourceIsBacking(backing))
|
||||
@ -2046,7 +2046,7 @@ qemuBlockStorageSourceCreateGetEncryptionLUKS(virStorageSourcePtr src,
|
||||
{
|
||||
qemuDomainStorageSourcePrivatePtr srcpriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
|
||||
VIR_AUTOPTR(virJSONValue) props = NULL;
|
||||
VIR_AUTOFREE(char *) cipheralg = NULL;
|
||||
g_autofree char *cipheralg = NULL;
|
||||
const char *keysecret = NULL;
|
||||
|
||||
if (srcpriv &&
|
||||
|
@ -225,7 +225,7 @@ qemuBlockJobDiskNewPull(virDomainObjPtr vm,
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL;
|
||||
VIR_AUTOFREE(char *) jobname = NULL;
|
||||
g_autofree char *jobname = NULL;
|
||||
|
||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) {
|
||||
if (virAsprintf(&jobname, "pull-%s-%s", disk->dst, disk->src->nodeformat) < 0)
|
||||
@ -256,7 +256,7 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm,
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL;
|
||||
VIR_AUTOFREE(char *) jobname = NULL;
|
||||
g_autofree char *jobname = NULL;
|
||||
qemuBlockJobType jobtype = QEMU_BLOCKJOB_TYPE_COMMIT;
|
||||
|
||||
if (topparent == NULL)
|
||||
@ -291,7 +291,7 @@ qemuBlockJobNewCreate(virDomainObjPtr vm,
|
||||
bool storage)
|
||||
{
|
||||
VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL;
|
||||
VIR_AUTOFREE(char *) jobname = NULL;
|
||||
g_autofree char *jobname = NULL;
|
||||
const char *nodename = src->nodeformat;
|
||||
|
||||
if (storage)
|
||||
@ -324,7 +324,7 @@ qemuBlockJobDiskNewCopy(virDomainObjPtr vm,
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL;
|
||||
VIR_AUTOFREE(char *) jobname = NULL;
|
||||
g_autofree char *jobname = NULL;
|
||||
|
||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) {
|
||||
if (virAsprintf(&jobname, "copy-%s-%s", disk->dst, disk->src->nodeformat) < 0)
|
||||
|
@ -2415,7 +2415,7 @@ virQEMUCapsProbeQMPMachineProps(virQEMUCapsPtr qemuCaps,
|
||||
for (i = 0; i < G_N_ELEMENTS(virQEMUCapsMachineProps); i++) {
|
||||
virQEMUCapsObjectTypeProps props = virQEMUCapsMachineProps[i];
|
||||
const char *canon = virQEMUCapsGetCanonicalMachine(qemuCaps, props.type);
|
||||
VIR_AUTOFREE(char *) type = NULL;
|
||||
g_autofree char *type = NULL;
|
||||
|
||||
if (!virQEMUCapsIsMachineSupported(qemuCaps, canon))
|
||||
continue;
|
||||
@ -4151,7 +4151,7 @@ virQEMUCapsKVMSupportsNesting(void)
|
||||
{
|
||||
static char const * const kmod[] = {"kvm_intel", "kvm_amd",
|
||||
"kvm_hv", "kvm"};
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
int rc;
|
||||
size_t i;
|
||||
|
||||
@ -4541,7 +4541,7 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
|
||||
qemuMonitorPtr mon)
|
||||
{
|
||||
int major, minor, micro;
|
||||
VIR_AUTOFREE(char *) package = NULL;
|
||||
g_autofree char *package = NULL;
|
||||
|
||||
/* @mon is supposed to be locked by callee */
|
||||
|
||||
|
@ -84,9 +84,9 @@ qemuCheckpointWriteMetadata(virDomainObjPtr vm,
|
||||
{
|
||||
unsigned int flags = VIR_DOMAIN_CHECKPOINT_FORMAT_SECURE;
|
||||
virDomainCheckpointDefPtr def = virDomainCheckpointObjGetDef(checkpoint);
|
||||
VIR_AUTOFREE(char *) newxml = NULL;
|
||||
VIR_AUTOFREE(char *) chkDir = NULL;
|
||||
VIR_AUTOFREE(char *) chkFile = NULL;
|
||||
g_autofree char *newxml = NULL;
|
||||
g_autofree char *chkDir = NULL;
|
||||
g_autofree char *chkFile = NULL;
|
||||
|
||||
newxml = virDomainCheckpointDefFormat(def, caps, xmlopt, flags);
|
||||
if (newxml == NULL)
|
||||
@ -119,7 +119,7 @@ qemuCheckpointDiscard(virQEMUDriverPtr driver,
|
||||
virDomainCheckpointDefPtr parentdef = NULL;
|
||||
size_t i, j;
|
||||
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
|
||||
VIR_AUTOFREE(char *) chkFile = NULL;
|
||||
g_autofree char *chkFile = NULL;
|
||||
|
||||
if (!metadata_only && !virDomainObjIsActive(vm)) {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||
|
@ -207,8 +207,8 @@ static int
|
||||
qemuBuildMasterKeyCommandLine(virCommandPtr cmd,
|
||||
qemuDomainObjPrivatePtr priv)
|
||||
{
|
||||
VIR_AUTOFREE(char *) alias = NULL;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *alias = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
/* If the -object secret does not exist, then just return. This just
|
||||
@ -299,7 +299,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
|
||||
virDomainDeviceInfoPtr info,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
VIR_AUTOFREE(char *) devStr = NULL;
|
||||
g_autofree char *devStr = NULL;
|
||||
const char *contAlias = NULL;
|
||||
bool contIsPHB = false;
|
||||
int contTargetIndex = 0;
|
||||
@ -698,7 +698,7 @@ qemuBuildSecretInfoProps(qemuDomainSecretInfoPtr secinfo,
|
||||
virJSONValuePtr *propsret)
|
||||
{
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(char *) keyid = NULL;
|
||||
g_autofree char *keyid = NULL;
|
||||
|
||||
if (!(keyid = qemuDomainGetMasterKeyAlias()))
|
||||
return -1;
|
||||
@ -1483,7 +1483,7 @@ bool
|
||||
qemuCheckFips(void)
|
||||
{
|
||||
if (virFileExists("/proc/sys/crypto/fips_enabled")) {
|
||||
VIR_AUTOFREE(char *) buf = NULL;
|
||||
g_autofree char *buf = NULL;
|
||||
|
||||
if (virFileReadAll("/proc/sys/crypto/fips_enabled", 10, &buf) < 0)
|
||||
return false;
|
||||
@ -1574,7 +1574,7 @@ static int
|
||||
qemuBuildDriveSourcePR(virBufferPtr buf,
|
||||
virDomainDiskDefPtr disk)
|
||||
{
|
||||
VIR_AUTOFREE(char *) alias = NULL;
|
||||
g_autofree char *alias = NULL;
|
||||
const char *defaultAlias = NULL;
|
||||
|
||||
if (!disk->src->pr)
|
||||
@ -1601,7 +1601,7 @@ qemuBuildDriveSourceStr(virDomainDiskDefPtr disk,
|
||||
qemuDomainSecretInfoPtr secinfo = NULL;
|
||||
qemuDomainSecretInfoPtr encinfo = NULL;
|
||||
VIR_AUTOPTR(virJSONValue) srcprops = NULL;
|
||||
VIR_AUTOFREE(char *) source = NULL;
|
||||
g_autofree char *source = NULL;
|
||||
bool rawluks = false;
|
||||
|
||||
if (srcpriv) {
|
||||
@ -1794,7 +1794,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
|
||||
goto error;
|
||||
|
||||
if (!qemuDiskBusNeedsDriveArg(disk->bus)) {
|
||||
VIR_AUTOFREE(char *) drivealias = qemuAliasDiskDriveFromDisk(disk);
|
||||
g_autofree char *drivealias = qemuAliasDiskDriveFromDisk(disk);
|
||||
if (!drivealias)
|
||||
goto error;
|
||||
|
||||
@ -1954,8 +1954,8 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
||||
g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER;
|
||||
const char *bus = virDomainDiskQEMUBusTypeToString(disk->bus);
|
||||
const char *contAlias;
|
||||
VIR_AUTOFREE(char *) backendAlias = NULL;
|
||||
VIR_AUTOFREE(char *) scsiVPDDeviceId = NULL;
|
||||
g_autofree char *backendAlias = NULL;
|
||||
g_autofree char *scsiVPDDeviceId = NULL;
|
||||
int controllerModel;
|
||||
|
||||
if (qemuCheckDiskConfig(disk, qemuCaps) < 0)
|
||||
@ -2312,7 +2312,7 @@ static int
|
||||
qemuCommandAddZPCIDevice(virCommandPtr cmd,
|
||||
virDomainDeviceInfoPtr dev)
|
||||
{
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
|
||||
virCommandAddArg(cmd, "-device");
|
||||
|
||||
@ -2355,9 +2355,9 @@ qemuBuildFloppyCommandLineControllerOptions(virCommandPtr cmd,
|
||||
virBufferAddLit(&fdc_opts, "isa-fdc,");
|
||||
|
||||
for (i = 0; i < def->ndisks; i++) {
|
||||
VIR_AUTOFREE(char *) backendAlias = NULL;
|
||||
VIR_AUTOFREE(char *) backendStr = NULL;
|
||||
VIR_AUTOFREE(char *) bootindexStr = NULL;
|
||||
g_autofree char *backendAlias = NULL;
|
||||
g_autofree char *backendStr = NULL;
|
||||
g_autofree char *bootindexStr = NULL;
|
||||
virDomainDiskDefPtr disk = def->disks[i];
|
||||
|
||||
if (disk->bus != VIR_DOMAIN_DISK_BUS_FDC)
|
||||
@ -2479,7 +2479,7 @@ qemuBuildDiskSourceCommandLine(virCommandPtr cmd,
|
||||
{
|
||||
VIR_AUTOPTR(qemuBlockStorageSourceChainData) data = NULL;
|
||||
VIR_AUTOPTR(virJSONValue) copyOnReadProps = NULL;
|
||||
VIR_AUTOFREE(char *) copyOnReadPropsStr = NULL;
|
||||
g_autofree char *copyOnReadPropsStr = NULL;
|
||||
size_t i;
|
||||
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) {
|
||||
@ -2522,7 +2522,7 @@ qemuBuildDiskCommandLine(virCommandPtr cmd,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
unsigned int bootindex)
|
||||
{
|
||||
VIR_AUTOFREE(char *) optstr = NULL;
|
||||
g_autofree char *optstr = NULL;
|
||||
|
||||
if (qemuBuildDiskSourceCommandLine(cmd, disk, qemuCaps) < 0)
|
||||
return -1;
|
||||
@ -2688,8 +2688,8 @@ qemuBuildFSDevCommandLine(virCommandPtr cmd,
|
||||
const virDomainDef *def,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
VIR_AUTOFREE(char *) fsdevstr = NULL;
|
||||
VIR_AUTOFREE(char *) devicestr = NULL;
|
||||
g_autofree char *fsdevstr = NULL;
|
||||
g_autofree char *devicestr = NULL;
|
||||
|
||||
virCommandAddArg(cmd, "-fsdev");
|
||||
if (!(fsdevstr = qemuBuildFSStr(fs)))
|
||||
@ -3152,7 +3152,7 @@ qemuBuildControllersByTypeCommandLine(virCommandPtr cmd,
|
||||
|
||||
for (i = 0; i < def->ncontrollers; i++) {
|
||||
virDomainControllerDefPtr cont = def->controllers[i];
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
|
||||
if (cont->type != type)
|
||||
continue;
|
||||
@ -3326,7 +3326,7 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
|
||||
const long system_page_size = virGetSystemPageSizeKB();
|
||||
virDomainMemoryAccess memAccess = mem->access;
|
||||
size_t i;
|
||||
VIR_AUTOFREE(char *) memPath = NULL;
|
||||
g_autofree char *memPath = NULL;
|
||||
bool prealloc = false;
|
||||
virBitmapPtr nodemask = NULL;
|
||||
int rc;
|
||||
@ -3585,7 +3585,7 @@ qemuBuildMemoryCellBackendStr(virDomainDefPtr def,
|
||||
virBufferPtr buf)
|
||||
{
|
||||
VIR_AUTOPTR(virJSONValue) props = NULL;
|
||||
VIR_AUTOFREE(char *) alias = NULL;
|
||||
g_autofree char *alias = NULL;
|
||||
int rc;
|
||||
virDomainMemoryDef mem = { 0 };
|
||||
unsigned long long memsize = virDomainNumaGetNodeMemorySize(def->numa,
|
||||
@ -3617,7 +3617,7 @@ qemuBuildMemoryDimmBackendStr(virBufferPtr buf,
|
||||
qemuDomainObjPrivatePtr priv)
|
||||
{
|
||||
VIR_AUTOPTR(virJSONValue) props = NULL;
|
||||
VIR_AUTOFREE(char *) alias = NULL;
|
||||
g_autofree char *alias = NULL;
|
||||
|
||||
if (!mem->info.alias) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
@ -3974,7 +3974,7 @@ qemuBuildHostNetStr(virDomainNetDefPtr net,
|
||||
virBufferAddLit(&buf, "user,");
|
||||
for (i = 0; i < net->guestIP.nips; i++) {
|
||||
const virNetDevIPAddr *ip = net->guestIP.ips[i];
|
||||
VIR_AUTOFREE(char *) addr = NULL;
|
||||
g_autofree char *addr = NULL;
|
||||
const char *prefix = "";
|
||||
|
||||
if (!(addr = virSocketAddrFormat(&ip->address)))
|
||||
@ -4072,7 +4072,7 @@ qemuBuildWatchdogCommandLine(virCommandPtr cmd,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
virDomainWatchdogDefPtr watchdog = def->watchdog;
|
||||
VIR_AUTOFREE(char *) optstr = NULL;
|
||||
g_autofree char *optstr = NULL;
|
||||
const char *action;
|
||||
int actualAction;
|
||||
|
||||
@ -4184,7 +4184,7 @@ qemuBuildNVRAMCommandLine(virCommandPtr cmd,
|
||||
return -1;
|
||||
}
|
||||
|
||||
VIR_AUTOFREE(char *) optstr = NULL;
|
||||
g_autofree char *optstr = NULL;
|
||||
virCommandAddArg(cmd, "-global");
|
||||
optstr = qemuBuildNVRAMDevStr(def->nvram);
|
||||
if (!optstr)
|
||||
@ -4322,7 +4322,7 @@ qemuBuildInputCommandLine(virCommandPtr cmd,
|
||||
|
||||
for (i = 0; i < def->ninputs; i++) {
|
||||
virDomainInputDefPtr input = def->inputs[i];
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
|
||||
if (qemuCommandAddExtDevice(cmd, &input->info) < 0)
|
||||
return -1;
|
||||
@ -4450,7 +4450,7 @@ qemuBuildSoundCommandLine(virCommandPtr cmd,
|
||||
|
||||
for (i = 0; i < def->nsounds; i++) {
|
||||
virDomainSoundDefPtr sound = def->sounds[i];
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
|
||||
/* Sadly pcspk device doesn't use -device syntax. Fortunately
|
||||
* we don't need to set any PCI address on it, so we don't
|
||||
@ -4470,7 +4470,7 @@ qemuBuildSoundCommandLine(virCommandPtr cmd,
|
||||
sound->model == VIR_DOMAIN_SOUND_MODEL_ICH9) {
|
||||
|
||||
for (j = 0; j < sound->ncodecs; j++) {
|
||||
VIR_AUTOFREE(char *) codecstr = NULL;
|
||||
g_autofree char *codecstr = NULL;
|
||||
virCommandAddArg(cmd, "-device");
|
||||
if (!(codecstr =
|
||||
qemuBuildSoundCodecStr(sound, sound->codecs[j],
|
||||
@ -4481,7 +4481,7 @@ qemuBuildSoundCommandLine(virCommandPtr cmd,
|
||||
virCommandAddArg(cmd, codecstr);
|
||||
}
|
||||
if (j == 0) {
|
||||
VIR_AUTOFREE(char *) codecstr = NULL;
|
||||
g_autofree char *codecstr = NULL;
|
||||
virDomainSoundCodecDef codec = {
|
||||
VIR_DOMAIN_SOUND_CODEC_TYPE_DUPLEX,
|
||||
0
|
||||
@ -4724,7 +4724,7 @@ qemuBuildVideoCommandLine(virCommandPtr cmd,
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < def->nvideos; i++) {
|
||||
VIR_AUTOFREE(char *) chardev = NULL;
|
||||
g_autofree char *chardev = NULL;
|
||||
virDomainVideoDefPtr video = def->videos[i];
|
||||
|
||||
if (video->backend == VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) {
|
||||
@ -4738,7 +4738,7 @@ qemuBuildVideoCommandLine(virCommandPtr cmd,
|
||||
}
|
||||
|
||||
for (i = 0; i < def->nvideos; i++) {
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
virDomainVideoDefPtr video = def->videos[i];
|
||||
|
||||
if (video->type == VIR_DOMAIN_VIDEO_TYPE_NONE)
|
||||
@ -4902,7 +4902,7 @@ qemuBuildHubCommandLine(virCommandPtr cmd,
|
||||
|
||||
for (i = 0; i < def->nhubs; i++) {
|
||||
virDomainHubDefPtr hub = def->hubs[i];
|
||||
VIR_AUTOFREE(char *) optstr = NULL;
|
||||
g_autofree char *optstr = NULL;
|
||||
|
||||
virCommandAddArg(cmd, "-device");
|
||||
if (!(optstr = qemuBuildHubDevStr(def, hub, qemuCaps)))
|
||||
@ -4932,7 +4932,7 @@ qemuBuildSCSIiSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
VIR_AUTOFREE(char *) netsource = NULL;
|
||||
g_autofree char *netsource = NULL;
|
||||
VIR_AUTOPTR(virJSONValue) srcprops = NULL;
|
||||
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
|
||||
virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = &scsisrc->u.iscsi;
|
||||
@ -5000,8 +5000,8 @@ qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
VIR_AUTOFREE(char *) source = NULL;
|
||||
VIR_AUTOFREE(char *) drivealias = NULL;
|
||||
g_autofree char *source = NULL;
|
||||
g_autofree char *drivealias = NULL;
|
||||
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
|
||||
|
||||
if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) {
|
||||
@ -5033,7 +5033,7 @@ qemuBuildSCSIHostdevDevStr(const virDomainDef *def,
|
||||
{
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
int model = -1;
|
||||
VIR_AUTOFREE(char *) driveAlias = NULL;
|
||||
g_autofree char *driveAlias = NULL;
|
||||
const char *contAlias;
|
||||
|
||||
model = qemuDomainFindSCSIControllerModel(def, dev->info);
|
||||
@ -5097,8 +5097,8 @@ qemuBuildChrChardevFileStr(virLogManagerPtr logManager,
|
||||
const char *appendarg, int appendval)
|
||||
{
|
||||
if (logManager) {
|
||||
VIR_AUTOFREE(char *) fdset = NULL;
|
||||
VIR_AUTOFREE(char *) fdpath = NULL;
|
||||
g_autofree char *fdset = NULL;
|
||||
g_autofree char *fdpath = NULL;
|
||||
int flags = 0;
|
||||
int logfd;
|
||||
|
||||
@ -5230,7 +5230,7 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager,
|
||||
qemuDomainChrSourcePrivatePtr chrSourcePriv = QEMU_DOMAIN_CHR_SOURCE_PRIVATE(dev);
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
bool telnet;
|
||||
VIR_AUTOFREE(char *) charAlias = NULL;
|
||||
g_autofree char *charAlias = NULL;
|
||||
|
||||
if (!(charAlias = qemuAliasChardevFromDevAlias(alias)))
|
||||
return NULL;
|
||||
@ -5320,7 +5320,7 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager,
|
||||
qemuBuildChrChardevReconnectStr(&buf, &dev->data.tcp.reconnect);
|
||||
|
||||
if (dev->data.tcp.haveTLS == VIR_TRISTATE_BOOL_YES) {
|
||||
VIR_AUTOFREE(char *) objalias = NULL;
|
||||
g_autofree char *objalias = NULL;
|
||||
const char *tlsCertEncSecAlias = NULL;
|
||||
|
||||
/* Add the secret object first if necessary. The
|
||||
@ -5424,7 +5424,7 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *def,
|
||||
{
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
virDomainHostdevSubsysMediatedDevPtr mdevsrc = &dev->source.subsys.u.mdev;
|
||||
VIR_AUTOFREE(char *) mdevPath = NULL;
|
||||
g_autofree char *mdevPath = NULL;
|
||||
const char *dev_str = NULL;
|
||||
|
||||
if (!(mdevPath = virMediatedDeviceGetSysfsPath(mdevsrc->uuidstr)))
|
||||
@ -5465,7 +5465,7 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd,
|
||||
for (i = 0; i < def->nhostdevs; i++) {
|
||||
virDomainHostdevDefPtr hostdev = def->hostdevs[i];
|
||||
virDomainHostdevSubsysPtr subsys = &hostdev->source.subsys;
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
|
||||
/* USB */
|
||||
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
||||
@ -5516,7 +5516,7 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd,
|
||||
if (virHostdevIsSCSIDevice(hostdev)) {
|
||||
virDomainHostdevSubsysSCSIPtr scsisrc =
|
||||
&hostdev->source.subsys.u.scsi;
|
||||
VIR_AUTOFREE(char *) drvstr = NULL;
|
||||
g_autofree char *drvstr = NULL;
|
||||
|
||||
if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) {
|
||||
virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc =
|
||||
@ -5546,7 +5546,7 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd,
|
||||
subsys->type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST) {
|
||||
if (hostdev->source.subsys.u.scsi_host.protocol ==
|
||||
VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_VHOST) {
|
||||
VIR_AUTOFREE(char *) vhostfdName = NULL;
|
||||
g_autofree char *vhostfdName = NULL;
|
||||
int vhostfd = -1;
|
||||
|
||||
if (virSCSIVHostOpenVhostSCSI(&vhostfd) < 0)
|
||||
@ -5628,7 +5628,7 @@ qemuBuildMonitorCommandLine(virLogManagerPtr logManager,
|
||||
virDomainDefPtr def,
|
||||
qemuDomainObjPrivatePtr priv)
|
||||
{
|
||||
VIR_AUTOFREE(char *) chrdev = NULL;
|
||||
g_autofree char *chrdev = NULL;
|
||||
unsigned int cdevflags = QEMU_BUILD_CHARDEV_TCP_NOWAIT |
|
||||
QEMU_BUILD_CHARDEV_UNIX_FD_PASS;
|
||||
if (priv->chardevStdioLogd)
|
||||
@ -5786,8 +5786,8 @@ qemuBuildRNGBackendProps(virDomainRNGDefPtr rng,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
virJSONValuePtr *props)
|
||||
{
|
||||
VIR_AUTOFREE(char *) objAlias = NULL;
|
||||
VIR_AUTOFREE(char *) charBackendAlias = NULL;
|
||||
g_autofree char *objAlias = NULL;
|
||||
g_autofree char *charBackendAlias = NULL;
|
||||
|
||||
if (virAsprintf(&objAlias, "obj%s", rng->info.alias) < 0)
|
||||
return -1;
|
||||
@ -5890,8 +5890,8 @@ qemuBuildRNGCommandLine(virLogManagerPtr logManager,
|
||||
VIR_AUTOPTR(virJSONValue) props = NULL;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
virDomainRNGDefPtr rng = def->rngs[i];
|
||||
VIR_AUTOFREE(char *) chardev = NULL;
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
g_autofree char *chardev = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
int rc;
|
||||
|
||||
if (!rng->info.alias) {
|
||||
@ -6387,7 +6387,7 @@ qemuBuildClockCommandLine(virCommandPtr cmd,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
size_t i;
|
||||
VIR_AUTOFREE(char *) rtcopt = NULL;
|
||||
g_autofree char *rtcopt = NULL;
|
||||
|
||||
virCommandAddArg(cmd, "-rtc");
|
||||
if (!(rtcopt = qemuBuildClockArgStr(&def->clock)))
|
||||
@ -6548,7 +6548,7 @@ qemuBuildBootCommandLine(virCommandPtr cmd,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
g_auto(virBuffer) boot_buf = VIR_BUFFER_INITIALIZER;
|
||||
VIR_AUTOFREE(char *) boot_opts_str = NULL;
|
||||
g_autofree char *boot_opts_str = NULL;
|
||||
|
||||
if (def->os.bootmenu) {
|
||||
if (def->os.bootmenu == VIR_TRISTATE_BOOL_YES)
|
||||
@ -6839,8 +6839,8 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
virArch hostarch = virArchFromHost();
|
||||
VIR_AUTOFREE(char *) cpu = NULL;
|
||||
VIR_AUTOFREE(char *) cpu_flags = NULL;
|
||||
g_autofree char *cpu = NULL;
|
||||
g_autofree char *cpu_flags = NULL;
|
||||
g_auto(virBuffer) cpu_buf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
size_t i;
|
||||
@ -7516,7 +7516,7 @@ qemuBuildMemPathStr(virQEMUDriverConfigPtr cfg,
|
||||
qemuDomainObjPrivatePtr priv)
|
||||
{
|
||||
const long system_page_size = virGetSystemPageSizeKB();
|
||||
VIR_AUTOFREE(char *) mem_path = NULL;
|
||||
g_autofree char *mem_path = NULL;
|
||||
|
||||
/* There are two cases where we want to put -mem-path onto
|
||||
* the command line: First one is when there are no guest
|
||||
@ -8386,16 +8386,16 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
|
||||
{
|
||||
virDomainDefPtr def = vm->def;
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(char *) nic = NULL;
|
||||
VIR_AUTOFREE(char *) host = NULL;
|
||||
VIR_AUTOFREE(char *) chardev = NULL;
|
||||
g_autofree char *nic = NULL;
|
||||
g_autofree char *host = NULL;
|
||||
g_autofree char *chardev = NULL;
|
||||
int *tapfd = NULL;
|
||||
size_t tapfdSize = 0;
|
||||
int *vhostfd = NULL;
|
||||
size_t vhostfdSize = 0;
|
||||
char **tapfdName = NULL;
|
||||
char **vhostfdName = NULL;
|
||||
VIR_AUTOFREE(char *) slirpfdName = NULL;
|
||||
g_autofree char *slirpfdName = NULL;
|
||||
virDomainNetType actualType = virDomainNetGetActualType(net);
|
||||
virNetDevBandwidthPtr actualBandwidth;
|
||||
bool requireNicdev = false;
|
||||
@ -8776,7 +8776,7 @@ qemuBuildSmartcardCommandLine(virLogManagerPtr logManager,
|
||||
{
|
||||
size_t i;
|
||||
virDomainSmartcardDefPtr smartcard;
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER;
|
||||
const char *database;
|
||||
const char *contAlias = NULL;
|
||||
@ -8970,8 +8970,8 @@ qemuBuildShmemDevStr(virDomainDefPtr def,
|
||||
virJSONValuePtr
|
||||
qemuBuildShmemBackendMemProps(virDomainShmemDefPtr shmem)
|
||||
{
|
||||
VIR_AUTOFREE(char *) mem_alias = NULL;
|
||||
VIR_AUTOFREE(char *) mem_path = NULL;
|
||||
g_autofree char *mem_alias = NULL;
|
||||
g_autofree char *mem_path = NULL;
|
||||
virJSONValuePtr ret = NULL;
|
||||
|
||||
if (virAsprintf(&mem_path, "/dev/shm/%s", shmem->name) < 0)
|
||||
@ -9002,8 +9002,8 @@ qemuBuildShmemCommandLine(virLogManagerPtr logManager,
|
||||
{
|
||||
VIR_AUTOPTR(virJSONValue) memProps = NULL;
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
VIR_AUTOFREE(char *) chardev = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
g_autofree char *chardev = NULL;
|
||||
int rc;
|
||||
unsigned int cdevflags = QEMU_BUILD_CHARDEV_TCP_NOWAIT |
|
||||
QEMU_BUILD_CHARDEV_UNIX_FD_PASS;
|
||||
@ -9120,7 +9120,7 @@ qemuBuildChrDeviceCommandLine(virCommandPtr cmd,
|
||||
virDomainChrDefPtr chr,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
|
||||
if (qemuBuildChrDeviceStr(&devstr, def, chr, qemuCaps) < 0)
|
||||
return -1;
|
||||
@ -9193,7 +9193,7 @@ qemuBuildSerialCommandLine(virLogManagerPtr logManager,
|
||||
|
||||
for (i = 0; i < def->nserials; i++) {
|
||||
virDomainChrDefPtr serial = def->serials[i];
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
|
||||
if (serial->source->type == VIR_DOMAIN_CHR_TYPE_SPICEPORT && !havespice)
|
||||
continue;
|
||||
@ -9249,7 +9249,7 @@ qemuBuildParallelsCommandLine(virLogManagerPtr logManager,
|
||||
|
||||
for (i = 0; i < def->nparallels; i++) {
|
||||
virDomainChrDefPtr parallel = def->parallels[i];
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
|
||||
if (!(devstr = qemuBuildChrChardevStr(logManager, secManager,
|
||||
cmd, cfg, def,
|
||||
@ -9671,9 +9671,9 @@ qemuBuildTPMBackendStr(const virDomainDef *def,
|
||||
{
|
||||
const virDomainTPMDef *tpm = def->tpm;
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
VIR_AUTOFREE(char *) cancel_path = NULL;
|
||||
VIR_AUTOFREE(char *) devset = NULL;
|
||||
VIR_AUTOFREE(char *) cancelset = NULL;
|
||||
g_autofree char *cancel_path = NULL;
|
||||
g_autofree char *devset = NULL;
|
||||
g_autofree char *cancelset = NULL;
|
||||
const char *tpmdev;
|
||||
|
||||
*tpmfd = -1;
|
||||
@ -9730,7 +9730,7 @@ qemuBuildTPMCommandLine(virCommandPtr cmd,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
char *optstr;
|
||||
VIR_AUTOFREE(char *) chardev = NULL;
|
||||
g_autofree char *chardev = NULL;
|
||||
int tpmfd = -1;
|
||||
int cancelfd = -1;
|
||||
char *fdset;
|
||||
@ -9962,7 +9962,7 @@ qemuBuildPRManagerInfoPropsInternal(const char *alias,
|
||||
virJSONValuePtr
|
||||
qemuBuildPRManagedManagerInfoProps(qemuDomainObjPrivatePtr priv)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
if (!(path = qemuDomainGetManagedPRSocketPath(priv)))
|
||||
return NULL;
|
||||
@ -10028,7 +10028,7 @@ virJSONValuePtr
|
||||
qemuBuildDBusVMStateInfoProps(const char *id,
|
||||
const char *addr)
|
||||
{
|
||||
VIR_AUTOFREE(char *) alias = qemuAliasDBusVMStateFromId(id);
|
||||
g_autofree char *alias = qemuAliasDBusVMStateFromId(id);
|
||||
|
||||
if (!alias)
|
||||
return NULL;
|
||||
@ -10240,7 +10240,7 @@ qemuBuildVsockCommandLine(virCommandPtr cmd,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
qemuDomainVsockPrivatePtr priv = (qemuDomainVsockPrivatePtr)vsock->privateData;
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
|
||||
if (!(devstr = qemuBuildVsockDevStr(def, vsock, qemuCaps, "")))
|
||||
return -1;
|
||||
@ -10612,7 +10612,7 @@ qemuBuildChannelChrDeviceStr(char **deviceStr,
|
||||
virDomainChrDefPtr chr)
|
||||
{
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(char *) addr = NULL;
|
||||
g_autofree char *addr = NULL;
|
||||
int port;
|
||||
|
||||
switch ((virDomainChrChannelTargetType)chr->targetType) {
|
||||
|
@ -181,8 +181,8 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
|
||||
virGetGroupID("tss", &cfg->swtpm_group) < 0)
|
||||
cfg->swtpm_group = 0; /* fall back to root */
|
||||
} else {
|
||||
VIR_AUTOFREE(char *) rundir = NULL;
|
||||
VIR_AUTOFREE(char *) cachedir = NULL;
|
||||
g_autofree char *rundir = NULL;
|
||||
g_autofree char *cachedir = NULL;
|
||||
|
||||
cachedir = virGetUserCacheDirectory();
|
||||
if (!cachedir)
|
||||
@ -618,8 +618,8 @@ virQEMUDriverConfigLoadProcessEntry(virQEMUDriverConfigPtr cfg,
|
||||
virConfPtr conf)
|
||||
{
|
||||
VIR_AUTOSTRINGLIST hugetlbfs = NULL;
|
||||
VIR_AUTOFREE(char *) stdioHandler = NULL;
|
||||
VIR_AUTOFREE(char *) corestr = NULL;
|
||||
g_autofree char *stdioHandler = NULL;
|
||||
g_autofree char *corestr = NULL;
|
||||
size_t i;
|
||||
|
||||
if (virConfGetValueStringList(conf, "hugetlbfs_mount", true,
|
||||
@ -848,8 +848,8 @@ virQEMUDriverConfigLoadSecurityEntry(virQEMUDriverConfigPtr cfg,
|
||||
{
|
||||
VIR_AUTOSTRINGLIST controllers = NULL;
|
||||
VIR_AUTOSTRINGLIST namespaces = NULL;
|
||||
VIR_AUTOFREE(char *) user = NULL;
|
||||
VIR_AUTOFREE(char *) group = NULL;
|
||||
g_autofree char *user = NULL;
|
||||
g_autofree char *group = NULL;
|
||||
size_t i, j;
|
||||
|
||||
if (virConfGetValueStringList(conf, "security_driver", true, &cfg->securityDriverNames) < 0)
|
||||
@ -967,8 +967,8 @@ static int
|
||||
virQEMUDriverConfigLoadSWTPMEntry(virQEMUDriverConfigPtr cfg,
|
||||
virConfPtr conf)
|
||||
{
|
||||
VIR_AUTOFREE(char *) swtpm_user = NULL;
|
||||
VIR_AUTOFREE(char *) swtpm_group = NULL;
|
||||
g_autofree char *swtpm_user = NULL;
|
||||
g_autofree char *swtpm_group = NULL;
|
||||
|
||||
if (virConfGetValueString(conf, "swtpm_user", &swtpm_user) < 0)
|
||||
return -1;
|
||||
@ -1244,7 +1244,7 @@ virCapsPtr virQEMUDriverCreateCapabilities(virQEMUDriverPtr driver)
|
||||
{
|
||||
size_t i, j;
|
||||
VIR_AUTOUNREF(virCapsPtr) caps = NULL;
|
||||
VIR_AUTOFREE(virSecurityManagerPtr) *sec_managers = NULL;
|
||||
g_autofree virSecurityManagerPtr *sec_managers = NULL;
|
||||
/* Security driver data */
|
||||
const char *doi, *model, *lbl, *type;
|
||||
const int virtTypes[] = {VIR_DOMAIN_VIRT_KVM,
|
||||
@ -1457,8 +1457,8 @@ qemuCheckUnprivSGIO(virHashTablePtr sharedDevices,
|
||||
const char *device_path,
|
||||
int sgio)
|
||||
{
|
||||
VIR_AUTOFREE(char *) sysfs_path = NULL;
|
||||
VIR_AUTOFREE(char *) key = NULL;
|
||||
g_autofree char *sysfs_path = NULL;
|
||||
g_autofree char *key = NULL;
|
||||
int val;
|
||||
|
||||
if (!(sysfs_path = virGetUnprivSGIOSysfsPath(device_path, NULL)))
|
||||
@ -1637,7 +1637,7 @@ qemuSharedDiskAddRemoveInternal(virQEMUDriverPtr driver,
|
||||
const char *name,
|
||||
bool addDisk)
|
||||
{
|
||||
VIR_AUTOFREE(char *) key = NULL;
|
||||
g_autofree char *key = NULL;
|
||||
int ret = -1;
|
||||
|
||||
if (virStorageSourceIsEmpty(disk->src) ||
|
||||
@ -1701,7 +1701,7 @@ qemuGetHostdevPath(virDomainHostdevDefPtr hostdev)
|
||||
{
|
||||
virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
|
||||
virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
|
||||
VIR_AUTOFREE(char *) dev_name = NULL;
|
||||
g_autofree char *dev_name = NULL;
|
||||
char *dev_path = NULL;
|
||||
|
||||
if (!(dev_name = virSCSIDeviceGetDevName(NULL,
|
||||
@ -1722,8 +1722,8 @@ qemuSharedHostdevAddRemoveInternal(virQEMUDriverPtr driver,
|
||||
const char *name,
|
||||
bool addDevice)
|
||||
{
|
||||
VIR_AUTOFREE(char *) dev_path = NULL;
|
||||
VIR_AUTOFREE(char *) key = NULL;
|
||||
g_autofree char *dev_path = NULL;
|
||||
g_autofree char *key = NULL;
|
||||
int ret = -1;
|
||||
|
||||
if (!qemuIsSharedHostdev(hostdev))
|
||||
@ -1816,7 +1816,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
|
||||
{
|
||||
virDomainDiskDefPtr disk = NULL;
|
||||
virDomainHostdevDefPtr hostdev = NULL;
|
||||
VIR_AUTOFREE(char *) sysfs_path = NULL;
|
||||
g_autofree char *sysfs_path = NULL;
|
||||
const char *path = NULL;
|
||||
int val = -1;
|
||||
|
||||
@ -1899,8 +1899,8 @@ char *
|
||||
qemuGetDomainHugepagePath(const virDomainDef *def,
|
||||
virHugeTLBFSPtr hugepage)
|
||||
{
|
||||
VIR_AUTOFREE(char *) base = qemuGetBaseHugepagePath(hugepage);
|
||||
VIR_AUTOFREE(char *) domPath = virDomainDefGetShortName(def);
|
||||
g_autofree char *base = qemuGetBaseHugepagePath(hugepage);
|
||||
g_autofree char *domPath = virDomainDefGetShortName(def);
|
||||
char *ret = NULL;
|
||||
|
||||
if (base && domPath)
|
||||
@ -1965,8 +1965,8 @@ qemuGetMemoryBackingDomainPath(const virDomainDef *def,
|
||||
virQEMUDriverConfigPtr cfg,
|
||||
char **path)
|
||||
{
|
||||
VIR_AUTOFREE(char *) shortName = NULL;
|
||||
VIR_AUTOFREE(char *) base = NULL;
|
||||
g_autofree char *shortName = NULL;
|
||||
g_autofree char *base = NULL;
|
||||
|
||||
if (!(shortName = virDomainDefGetShortName(def)) ||
|
||||
qemuGetMemoryBackingBasePath(cfg, &base) < 0 ||
|
||||
@ -1995,7 +1995,7 @@ qemuGetMemoryBackingPath(const virDomainDef *def,
|
||||
const char *alias,
|
||||
char **memPath)
|
||||
{
|
||||
VIR_AUTOFREE(char *) domainPath = NULL;
|
||||
g_autofree char *domainPath = NULL;
|
||||
|
||||
if (!alias) {
|
||||
/* This should never happen (TM) */
|
||||
|
@ -3012,9 +3012,9 @@ qemuDomainObjPrivateXMLParseBlockjobChain(xmlNodePtr node,
|
||||
|
||||
{
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
VIR_AUTOFREE(char *) format = NULL;
|
||||
VIR_AUTOFREE(char *) type = NULL;
|
||||
VIR_AUTOFREE(char *) index = NULL;
|
||||
g_autofree char *format = NULL;
|
||||
g_autofree char *type = NULL;
|
||||
g_autofree char *index = NULL;
|
||||
VIR_AUTOUNREF(virStorageSourcePtr) src = NULL;
|
||||
xmlNodePtr sourceNode;
|
||||
unsigned int xmlflags = VIR_DOMAIN_DEF_PARSE_STATUS;
|
||||
@ -3049,7 +3049,7 @@ qemuDomainObjPrivateXMLParseBlockjobNodename(qemuBlockJobDataPtr job,
|
||||
virStorageSourcePtr *src,
|
||||
xmlXPathContextPtr ctxt)
|
||||
{
|
||||
VIR_AUTOFREE(char *) nodename = NULL;
|
||||
g_autofree char *nodename = NULL;
|
||||
|
||||
*src = NULL;
|
||||
|
||||
@ -3080,8 +3080,8 @@ qemuDomainObjPrivateXMLParseBlockjobDataSpecific(qemuBlockJobDataPtr job,
|
||||
xmlXPathContextPtr ctxt,
|
||||
virDomainXMLOptionPtr xmlopt)
|
||||
{
|
||||
VIR_AUTOFREE(char *) createmode = NULL;
|
||||
VIR_AUTOFREE(char *) shallownew = NULL;
|
||||
g_autofree char *createmode = NULL;
|
||||
g_autofree char *shallownew = NULL;
|
||||
xmlNodePtr tmp;
|
||||
|
||||
switch ((qemuBlockJobType) job->type) {
|
||||
@ -3162,14 +3162,14 @@ qemuDomainObjPrivateXMLParseBlockjobData(virDomainObjPtr vm,
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
virDomainDiskDefPtr disk = NULL;
|
||||
VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL;
|
||||
VIR_AUTOFREE(char *) name = NULL;
|
||||
VIR_AUTOFREE(char *) typestr = NULL;
|
||||
g_autofree char *name = NULL;
|
||||
g_autofree char *typestr = NULL;
|
||||
int type;
|
||||
VIR_AUTOFREE(char *) statestr = NULL;
|
||||
g_autofree char *statestr = NULL;
|
||||
int state = QEMU_BLOCKJOB_STATE_FAILED;
|
||||
VIR_AUTOFREE(char *) diskdst = NULL;
|
||||
VIR_AUTOFREE(char *) newstatestr = NULL;
|
||||
VIR_AUTOFREE(char *) mirror = NULL;
|
||||
g_autofree char *diskdst = NULL;
|
||||
g_autofree char *newstatestr = NULL;
|
||||
g_autofree char *mirror = NULL;
|
||||
int newstate = -1;
|
||||
bool invalidData = false;
|
||||
xmlNodePtr tmp;
|
||||
@ -3245,9 +3245,9 @@ qemuDomainObjPrivateXMLParseBlockjobs(virDomainObjPtr vm,
|
||||
qemuDomainObjPrivatePtr priv,
|
||||
xmlXPathContextPtr ctxt)
|
||||
{
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
ssize_t nnodes = 0;
|
||||
VIR_AUTOFREE(char *) active = NULL;
|
||||
g_autofree char *active = NULL;
|
||||
int tmp;
|
||||
size_t i;
|
||||
|
||||
@ -3311,8 +3311,8 @@ qemuDomainObjPrivateXMLParseJobNBDSource(xmlNodePtr node,
|
||||
{
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||
VIR_AUTOFREE(char *) format = NULL;
|
||||
VIR_AUTOFREE(char *) type = NULL;
|
||||
g_autofree char *format = NULL;
|
||||
g_autofree char *type = NULL;
|
||||
VIR_AUTOUNREF(virStorageSourcePtr) migrSource = NULL;
|
||||
xmlNodePtr sourceNode;
|
||||
|
||||
@ -3469,7 +3469,7 @@ qemuDomainObjPrivateXMLParseSlirpFeatures(xmlNodePtr featuresNode,
|
||||
qemuSlirpPtr slirp)
|
||||
{
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
size_t i;
|
||||
int n;
|
||||
|
||||
@ -3482,7 +3482,7 @@ qemuDomainObjPrivateXMLParseSlirpFeatures(xmlNodePtr featuresNode,
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
VIR_AUTOFREE(char *) str = virXMLPropString(nodes[i], "name");
|
||||
g_autofree char *str = virXMLPropString(nodes[i], "name");
|
||||
int feature;
|
||||
|
||||
if (!str)
|
||||
@ -3646,8 +3646,8 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
|
||||
goto error;
|
||||
}
|
||||
for (i = 0; i < n; i++) {
|
||||
VIR_AUTOFREE(char *) alias = virXMLPropString(nodes[i], "alias");
|
||||
VIR_AUTOFREE(char *) pid = virXMLPropString(nodes[i], "pid");
|
||||
g_autofree char *alias = virXMLPropString(nodes[i], "alias");
|
||||
g_autofree char *pid = virXMLPropString(nodes[i], "pid");
|
||||
VIR_AUTOPTR(qemuSlirp) slirp = qemuSlirpNew();
|
||||
virDomainDeviceDef dev;
|
||||
|
||||
@ -3778,7 +3778,7 @@ static int
|
||||
qemuDomainDefNamespaceParseCommandlineArgs(qemuDomainXmlNsDefPtr nsdef,
|
||||
xmlXPathContextPtr ctxt)
|
||||
{
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
ssize_t nnodes;
|
||||
size_t i;
|
||||
|
||||
@ -3826,7 +3826,7 @@ static int
|
||||
qemuDomainDefNamespaceParseCommandlineEnv(qemuDomainXmlNsDefPtr nsdef,
|
||||
xmlXPathContextPtr ctxt)
|
||||
{
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
ssize_t nnodes;
|
||||
size_t i;
|
||||
|
||||
@ -3863,9 +3863,9 @@ static int
|
||||
qemuDomainDefNamespaceParseCaps(qemuDomainXmlNsDefPtr nsdef,
|
||||
xmlXPathContextPtr ctxt)
|
||||
{
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodesadd = NULL;
|
||||
g_autofree xmlNodePtr *nodesadd = NULL;
|
||||
ssize_t nnodesadd;
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodesdel = NULL;
|
||||
g_autofree xmlNodePtr *nodesdel = NULL;
|
||||
ssize_t nnodesdel;
|
||||
size_t i;
|
||||
|
||||
@ -9820,8 +9820,8 @@ qemuDomainRemoveInactiveCommon(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm)
|
||||
{
|
||||
virQEMUDriverConfigPtr cfg;
|
||||
VIR_AUTOFREE(char *) snapDir = NULL;
|
||||
VIR_AUTOFREE(char *) chkDir = NULL;
|
||||
g_autofree char *snapDir = NULL;
|
||||
g_autofree char *chkDir = NULL;
|
||||
|
||||
cfg = virQEMUDriverGetConfig(driver);
|
||||
|
||||
@ -11713,7 +11713,7 @@ ppc64VFIODeviceIsNV2Bridge(const char *device)
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS(nvlink2Files); i++) {
|
||||
VIR_AUTOFREE(char *) file = NULL;
|
||||
g_autofree char *file = NULL;
|
||||
|
||||
if ((virAsprintf(&file, "/sys/bus/pci/devices/%s/of_node/%s",
|
||||
device, nvlink2Files[i])) < 0)
|
||||
@ -11766,7 +11766,7 @@ getPPC64MemLockLimitBytes(virDomainDefPtr def)
|
||||
|
||||
pciAddr = &dev->source.subsys.u.pci.addr;
|
||||
if (virPCIDeviceAddressIsValid(pciAddr, false)) {
|
||||
VIR_AUTOFREE(char *) pciAddrStr = NULL;
|
||||
g_autofree char *pciAddrStr = NULL;
|
||||
|
||||
pciAddrStr = virPCIDeviceAddressAsString(pciAddr);
|
||||
if (ppc64VFIODeviceIsNV2Bridge(pciAddrStr)) {
|
||||
|
@ -1525,7 +1525,7 @@ qemuDomainCollectPCIAddress(virDomainDefPtr def G_GNUC_UNUSED,
|
||||
* inappropriate address types.
|
||||
*/
|
||||
if (!info->pciConnectFlags) {
|
||||
VIR_AUTOFREE(char *) addrStr = virPCIDeviceAddressAsString(&info->addr.pci);
|
||||
g_autofree char *addrStr = virPCIDeviceAddressAsString(&info->addr.pci);
|
||||
|
||||
VIR_WARN("qemuDomainDeviceCalculatePCIConnectFlags() thinks that the "
|
||||
"device with PCI address %s should not have a PCI address",
|
||||
@ -1723,7 +1723,7 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
|
||||
size_t i;
|
||||
virPCIDeviceAddress tmp_addr;
|
||||
bool qemuDeviceVideoUsable = virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
|
||||
VIR_AUTOFREE(char *) addrStr = NULL;
|
||||
g_autofree char *addrStr = NULL;
|
||||
virDomainPCIConnectFlags flags = (VIR_PCI_CONNECT_HOTPLUGGABLE
|
||||
| VIR_PCI_CONNECT_TYPE_PCI_DEVICE);
|
||||
|
||||
@ -1864,7 +1864,7 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
|
||||
size_t i;
|
||||
virPCIDeviceAddress tmp_addr;
|
||||
bool qemuDeviceVideoUsable = virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
|
||||
VIR_AUTOFREE(char *) addrStr = NULL;
|
||||
g_autofree char *addrStr = NULL;
|
||||
virDomainPCIConnectFlags flags = VIR_PCI_CONNECT_TYPE_PCIE_DEVICE;
|
||||
|
||||
for (i = 0; i < def->ncontrollers; i++) {
|
||||
|
@ -4921,7 +4921,7 @@ processRdmaGidStatusChangedEvent(virDomainObjPtr vm,
|
||||
{
|
||||
unsigned int prefix_len;
|
||||
virSocketAddr addr;
|
||||
VIR_AUTOFREE(char *) addrStr = NULL;
|
||||
g_autofree char *addrStr = NULL;
|
||||
int rc;
|
||||
|
||||
if (!virDomainObjIsActive(vm))
|
||||
@ -7520,7 +7520,7 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
|
||||
for (i = 0; i < vm->def->nnets; i++) {
|
||||
virDomainNetDefPtr net = vm->def->nets[i];
|
||||
unsigned int bootIndex = net->info.bootIndex;
|
||||
VIR_AUTOFREE(char *) model = NULL;
|
||||
g_autofree char *model = NULL;
|
||||
virMacAddr mac = net->mac;
|
||||
char *script = net->script;
|
||||
|
||||
@ -15777,14 +15777,14 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver,
|
||||
bool resume = false;
|
||||
int ret = -1;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
VIR_AUTOFREE(char *) xml = NULL;
|
||||
g_autofree char *xml = NULL;
|
||||
virDomainSnapshotDefPtr snapdef = virDomainSnapshotObjGetDef(snap);
|
||||
bool memory = snapdef->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL;
|
||||
bool memory_unlink = false;
|
||||
int thaw = 0; /* 1 if freeze succeeded, -1 if freeze failed */
|
||||
bool pmsuspended = false;
|
||||
int compressed;
|
||||
VIR_AUTOFREE(char *) compressedpath = NULL;
|
||||
g_autofree char *compressedpath = NULL;
|
||||
virQEMUSaveDataPtr data = NULL;
|
||||
|
||||
/* If quiesce was requested, then issue a freeze command, and a
|
||||
@ -17682,8 +17682,8 @@ qemuDomainBlockPullCommon(virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk;
|
||||
virStorageSourcePtr baseSource = NULL;
|
||||
unsigned int baseIndex = 0;
|
||||
VIR_AUTOFREE(char *) basePath = NULL;
|
||||
VIR_AUTOFREE(char *) backingPath = NULL;
|
||||
g_autofree char *basePath = NULL;
|
||||
g_autofree char *backingPath = NULL;
|
||||
unsigned long long speed = bandwidth;
|
||||
qemuBlockJobDataPtr job = NULL;
|
||||
bool persistjob = false;
|
||||
@ -18693,9 +18693,9 @@ qemuDomainBlockCommit(virDomainPtr dom,
|
||||
unsigned int baseIndex = 0;
|
||||
virStorageSourcePtr top_parent = NULL;
|
||||
bool clean_access = false;
|
||||
VIR_AUTOFREE(char *) topPath = NULL;
|
||||
VIR_AUTOFREE(char *) basePath = NULL;
|
||||
VIR_AUTOFREE(char *) backingPath = NULL;
|
||||
g_autofree char *topPath = NULL;
|
||||
g_autofree char *basePath = NULL;
|
||||
g_autofree char *backingPath = NULL;
|
||||
unsigned long long speed = bandwidth;
|
||||
qemuBlockJobDataPtr job = NULL;
|
||||
VIR_AUTOUNREF(virStorageSourcePtr) mirror = NULL;
|
||||
@ -21585,7 +21585,7 @@ qemuDomainGetStats(virConnectPtr conn,
|
||||
virDomainStatsRecordPtr *record,
|
||||
unsigned int flags)
|
||||
{
|
||||
VIR_AUTOFREE(virDomainStatsRecordPtr) tmp = NULL;
|
||||
g_autofree virDomainStatsRecordPtr tmp = NULL;
|
||||
VIR_AUTOPTR(virTypedParamList) params = NULL;
|
||||
size_t i;
|
||||
|
||||
@ -22841,7 +22841,7 @@ qemuDomainGetGuestInfo(virDomainPtr dom,
|
||||
qemuAgentPtr agent;
|
||||
int ret = -1;
|
||||
int maxparams = 0;
|
||||
VIR_AUTOFREE(char *) hostname = NULL;
|
||||
g_autofree char *hostname = NULL;
|
||||
unsigned int supportedTypes = types;
|
||||
int rc;
|
||||
|
||||
|
@ -43,8 +43,8 @@ qemuExtDeviceLogCommand(virQEMUDriverPtr driver,
|
||||
virCommandPtr cmd,
|
||||
const char *info)
|
||||
{
|
||||
VIR_AUTOFREE(char *) timestamp = virTimeStringNow();
|
||||
VIR_AUTOFREE(char *) cmds = virCommandToString(cmd, false);
|
||||
g_autofree char *timestamp = virTimeStringNow();
|
||||
g_autofree char *cmds = virCommandToString(cmd, false);
|
||||
|
||||
if (!timestamp || !cmds)
|
||||
return -1;
|
||||
|
@ -545,7 +545,7 @@ qemuFirmwareTargetParse(const char *path,
|
||||
|
||||
for (j = 0; j < nmachines; j++) {
|
||||
virJSONValuePtr machine = virJSONValueArrayGet(machines, j);
|
||||
VIR_AUTOFREE(char *) machineStr = NULL;
|
||||
g_autofree char *machineStr = NULL;
|
||||
|
||||
if (VIR_STRDUP(machineStr, virJSONValueGetString(machine)) < 0)
|
||||
goto cleanup;
|
||||
@ -618,7 +618,7 @@ qemuFirmwareFeatureParse(const char *path,
|
||||
qemuFirmwarePtr
|
||||
qemuFirmwareParse(const char *path)
|
||||
{
|
||||
VIR_AUTOFREE(char *) cont = NULL;
|
||||
g_autofree char *cont = NULL;
|
||||
VIR_AUTOPTR(virJSONValue) doc = NULL;
|
||||
VIR_AUTOPTR(qemuFirmware) fw = NULL;
|
||||
qemuFirmwarePtr ret = NULL;
|
||||
|
@ -136,7 +136,7 @@ static int
|
||||
qemuDomainAttachZPCIDevice(qemuMonitorPtr mon,
|
||||
virDomainDeviceInfoPtr info)
|
||||
{
|
||||
VIR_AUTOFREE(char *) devstr_zpci = NULL;
|
||||
g_autofree char *devstr_zpci = NULL;
|
||||
|
||||
if (!(devstr_zpci = qemuBuildZPCIDevStr(info)))
|
||||
return -1;
|
||||
@ -152,7 +152,7 @@ static int
|
||||
qemuDomainDetachZPCIDevice(qemuMonitorPtr mon,
|
||||
virDomainDeviceInfoPtr info)
|
||||
{
|
||||
VIR_AUTOFREE(char *) zpciAlias = NULL;
|
||||
g_autofree char *zpciAlias = NULL;
|
||||
|
||||
if (virAsprintf(&zpciAlias, "zpci%d", info->addr.pci.zpci.uid) < 0)
|
||||
return -1;
|
||||
@ -249,11 +249,11 @@ qemuDomainChangeMediaLegacy(virQEMUDriverPtr driver,
|
||||
bool force)
|
||||
{
|
||||
int rc;
|
||||
VIR_AUTOFREE(char *) driveAlias = NULL;
|
||||
g_autofree char *driveAlias = NULL;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||
const char *format = NULL;
|
||||
VIR_AUTOFREE(char *) sourcestr = NULL;
|
||||
g_autofree char *sourcestr = NULL;
|
||||
|
||||
if (!disk->info.alias) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@ -463,7 +463,7 @@ qemuDomainDetachDBusVMState(virQEMUDriverPtr driver,
|
||||
qemuDomainAsyncJob asyncJob)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
VIR_AUTOFREE(char *) alias = qemuAliasDBusVMStateFromId(id);
|
||||
g_autofree char *alias = qemuAliasDBusVMStateFromId(id);
|
||||
int ret;
|
||||
|
||||
if (!alias ||
|
||||
@ -507,7 +507,7 @@ qemuDomainChangeMediaBlockdev(virQEMUDriverPtr driver,
|
||||
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||
VIR_AUTOPTR(qemuBlockStorageSourceChainData) newbackend = NULL;
|
||||
VIR_AUTOPTR(qemuBlockStorageSourceChainData) oldbackend = NULL;
|
||||
VIR_AUTOFREE(char *) nodename = NULL;
|
||||
g_autofree char *nodename = NULL;
|
||||
int rc;
|
||||
|
||||
if (!virStorageSourceIsEmpty(oldsrc) &&
|
||||
@ -675,10 +675,10 @@ qemuDomainAttachDiskGeneric(virQEMUDriverPtr driver,
|
||||
VIR_AUTOPTR(qemuBlockStorageSourceChainData) data = NULL;
|
||||
int ret = -1;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
|
||||
VIR_AUTOPTR(virJSONValue) corProps = NULL;
|
||||
VIR_AUTOFREE(char *) corAlias = NULL;
|
||||
g_autofree char *corAlias = NULL;
|
||||
bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
|
||||
|
||||
if (qemuDomainStorageSourceChainAccessAllow(driver, vm, disk->src) < 0)
|
||||
@ -808,7 +808,7 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver,
|
||||
{
|
||||
int ret = -1;
|
||||
const char* type = virDomainControllerTypeToString(controller->type);
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virDomainDeviceDef dev = { VIR_DOMAIN_DEVICE_CONTROLLER,
|
||||
{ .controller = controller } };
|
||||
@ -1131,7 +1131,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virDomainDeviceDef dev = { VIR_DOMAIN_DEVICE_NET, { .net = net } };
|
||||
virErrorPtr originalError = NULL;
|
||||
VIR_AUTOFREE(char *) slirpfdName = NULL;
|
||||
g_autofree char *slirpfdName = NULL;
|
||||
int slirpfd = -1;
|
||||
char **tapfdName = NULL;
|
||||
int *tapfd = NULL;
|
||||
@ -1140,8 +1140,8 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
||||
int *vhostfd = NULL;
|
||||
size_t vhostfdSize = 0;
|
||||
size_t queueSize = 0;
|
||||
VIR_AUTOFREE(char *) nicstr = NULL;
|
||||
VIR_AUTOFREE(char *) netstr = NULL;
|
||||
g_autofree char *nicstr = NULL;
|
||||
g_autofree char *netstr = NULL;
|
||||
int ret = -1;
|
||||
bool releaseaddr = false;
|
||||
bool iface_connected = false;
|
||||
@ -1150,10 +1150,10 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
||||
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
|
||||
virDomainCCWAddressSetPtr ccwaddrs = NULL;
|
||||
size_t i;
|
||||
VIR_AUTOFREE(char *) charDevAlias = NULL;
|
||||
g_autofree char *charDevAlias = NULL;
|
||||
bool charDevPlugged = false;
|
||||
bool netdevPlugged = false;
|
||||
VIR_AUTOFREE(char *) netdev_name = NULL;
|
||||
g_autofree char *netdev_name = NULL;
|
||||
virConnectPtr conn = NULL;
|
||||
virErrorPtr save_err = NULL;
|
||||
|
||||
@ -1536,7 +1536,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
|
||||
{ .hostdev = hostdev } };
|
||||
virDomainDeviceInfoPtr info = hostdev->info;
|
||||
int ret;
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
bool releaseaddr = false;
|
||||
bool teardowncgroup = false;
|
||||
bool teardownlabel = false;
|
||||
@ -1702,7 +1702,7 @@ qemuDomainAddTLSObjects(virQEMUDriverPtr driver,
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virErrorPtr orig_err;
|
||||
VIR_AUTOFREE(char *) secAlias = NULL;
|
||||
g_autofree char *secAlias = NULL;
|
||||
|
||||
if (!tlsProps && !secProps)
|
||||
return 0;
|
||||
@ -1825,8 +1825,8 @@ qemuDomainDelChardevTLSObjects(virQEMUDriverPtr driver,
|
||||
{
|
||||
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
VIR_AUTOFREE(char *) tlsAlias = NULL;
|
||||
VIR_AUTOFREE(char *) secAlias = NULL;
|
||||
g_autofree char *tlsAlias = NULL;
|
||||
g_autofree char *secAlias = NULL;
|
||||
|
||||
if (dev->type != VIR_DOMAIN_CHR_TYPE_TCP ||
|
||||
dev->data.tcp.haveTLS != VIR_TRISTATE_BOOL_YES) {
|
||||
@ -1864,10 +1864,10 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriverPtr driver,
|
||||
int ret = -1;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virDomainDefPtr def = vm->def;
|
||||
VIR_AUTOFREE(char *) charAlias = NULL;
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
g_autofree char *charAlias = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
bool chardevAdded = false;
|
||||
VIR_AUTOFREE(char *) tlsAlias = NULL;
|
||||
g_autofree char *tlsAlias = NULL;
|
||||
const char *secAlias = NULL;
|
||||
bool need_release = false;
|
||||
virErrorPtr orig_err;
|
||||
@ -2097,14 +2097,14 @@ int qemuDomainAttachChrDevice(virQEMUDriverPtr driver,
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virErrorPtr orig_err;
|
||||
virDomainDefPtr vmdef = vm->def;
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
virDomainChrSourceDefPtr dev = chr->source;
|
||||
VIR_AUTOFREE(char *)charAlias = NULL;
|
||||
g_autofree char *charAlias = NULL;
|
||||
bool chardevAttached = false;
|
||||
bool teardowncgroup = false;
|
||||
bool teardowndevice = false;
|
||||
bool teardownlabel = false;
|
||||
VIR_AUTOFREE(char *) tlsAlias = NULL;
|
||||
g_autofree char *tlsAlias = NULL;
|
||||
const char *secAlias = NULL;
|
||||
bool need_release = false;
|
||||
bool guestfwd = false;
|
||||
@ -2209,10 +2209,10 @@ qemuDomainAttachRNGDevice(virQEMUDriverPtr driver,
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virDomainDeviceDef dev = { VIR_DOMAIN_DEVICE_RNG, { .rng = rng } };
|
||||
virErrorPtr orig_err;
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
VIR_AUTOFREE(char *) charAlias = NULL;
|
||||
VIR_AUTOFREE(char *) objAlias = NULL;
|
||||
VIR_AUTOFREE(char *) tlsAlias = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
g_autofree char *charAlias = NULL;
|
||||
g_autofree char *objAlias = NULL;
|
||||
g_autofree char *tlsAlias = NULL;
|
||||
const char *secAlias = NULL;
|
||||
bool releaseaddr = false;
|
||||
bool teardowncgroup = false;
|
||||
@ -2336,8 +2336,8 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver,
|
||||
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
|
||||
unsigned long long oldmem = virDomainDefGetMemoryTotal(vm->def);
|
||||
unsigned long long newmem = oldmem + mem->size;
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
VIR_AUTOFREE(char *) objalias = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
g_autofree char *objalias = NULL;
|
||||
bool objAdded = false;
|
||||
bool teardownlabel = false;
|
||||
bool teardowncgroup = false;
|
||||
@ -2472,7 +2472,7 @@ qemuDomainAttachHostUSBDevice(virQEMUDriverPtr driver,
|
||||
virDomainHostdevDefPtr hostdev)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
bool added = false;
|
||||
bool teardowncgroup = false;
|
||||
bool teardownlabel = false;
|
||||
@ -2547,10 +2547,10 @@ qemuDomainAttachHostSCSIDevice(virQEMUDriverPtr driver,
|
||||
int ret = -1;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virErrorPtr orig_err;
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
VIR_AUTOFREE(char *) drvstr = NULL;
|
||||
VIR_AUTOFREE(char *) drivealias = NULL;
|
||||
VIR_AUTOFREE(char *) secobjAlias = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
g_autofree char *drvstr = NULL;
|
||||
g_autofree char *drivealias = NULL;
|
||||
g_autofree char *secobjAlias = NULL;
|
||||
bool teardowncgroup = false;
|
||||
bool teardownlabel = false;
|
||||
bool teardowndevice = false;
|
||||
@ -2681,9 +2681,9 @@ qemuDomainAttachSCSIVHostDevice(virQEMUDriverPtr driver,
|
||||
virDomainDeviceDef dev = { VIR_DOMAIN_DEVICE_HOSTDEV,
|
||||
{ .hostdev = hostdev } };
|
||||
virDomainCCWAddressSetPtr ccwaddrs = NULL;
|
||||
VIR_AUTOFREE(char *) vhostfdName = NULL;
|
||||
g_autofree char *vhostfdName = NULL;
|
||||
int vhostfd = -1;
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
bool teardowncgroup = false;
|
||||
bool teardownlabel = false;
|
||||
bool teardowndevice = false;
|
||||
@ -2789,7 +2789,7 @@ qemuDomainAttachMediatedDevice(virQEMUDriverPtr driver,
|
||||
virDomainHostdevDefPtr hostdev)
|
||||
{
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
bool added = false;
|
||||
bool teardowncgroup = false;
|
||||
bool teardownlabel = false;
|
||||
@ -2938,9 +2938,9 @@ qemuDomainAttachShmemDevice(virQEMUDriverPtr driver,
|
||||
virDomainShmemDefPtr shmem)
|
||||
{
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(char *) shmstr = NULL;
|
||||
VIR_AUTOFREE(char *) charAlias = NULL;
|
||||
VIR_AUTOFREE(char *) memAlias = NULL;
|
||||
g_autofree char *shmstr = NULL;
|
||||
g_autofree char *charAlias = NULL;
|
||||
g_autofree char *memAlias = NULL;
|
||||
bool release_backing = false;
|
||||
bool release_address = true;
|
||||
virErrorPtr orig_err = NULL;
|
||||
@ -3060,7 +3060,7 @@ qemuDomainAttachWatchdog(virQEMUDriverPtr driver,
|
||||
virDomainDeviceDef dev = { VIR_DOMAIN_DEVICE_WATCHDOG, { .watchdog = watchdog } };
|
||||
virDomainWatchdogAction actualAction = watchdog->action;
|
||||
const char *actionStr = NULL;
|
||||
VIR_AUTOFREE(char *) watchdogstr = NULL;
|
||||
g_autofree char *watchdogstr = NULL;
|
||||
bool releaseAddress = false;
|
||||
int rv;
|
||||
|
||||
@ -3127,7 +3127,7 @@ qemuDomainAttachInputDevice(virQEMUDriverPtr driver,
|
||||
virDomainInputDefPtr input)
|
||||
{
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virDomainDeviceDef dev = { VIR_DOMAIN_DEVICE_INPUT,
|
||||
{ .input = input } };
|
||||
@ -3234,8 +3234,8 @@ qemuDomainAttachVsockDevice(virQEMUDriverPtr driver,
|
||||
virErrorPtr originalError = NULL;
|
||||
const char *fdprefix = "vsockfd";
|
||||
bool releaseaddr = false;
|
||||
VIR_AUTOFREE(char *) fdname = NULL;
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
g_autofree char *fdname = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
int ret = -1;
|
||||
|
||||
if (vm->def->vsock) {
|
||||
@ -3965,7 +3965,7 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver,
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
time_t now = time(NULL);
|
||||
const char *expire;
|
||||
VIR_AUTOFREE(char *) validTo = NULL;
|
||||
g_autofree char *validTo = NULL;
|
||||
const char *connected = NULL;
|
||||
const char *password;
|
||||
int ret = -1;
|
||||
@ -4236,7 +4236,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver,
|
||||
virDomainDeviceDef dev;
|
||||
size_t i;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
VIR_AUTOFREE(char *) corAlias = NULL;
|
||||
g_autofree char *corAlias = NULL;
|
||||
bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
|
||||
int ret = -1;
|
||||
|
||||
@ -4339,7 +4339,7 @@ qemuDomainRemoveMemoryDevice(virQEMUDriverPtr driver,
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
unsigned long long oldmem = virDomainDefGetMemoryTotal(vm->def);
|
||||
unsigned long long newmem = oldmem - mem->size;
|
||||
VIR_AUTOFREE(char *) backendAlias = NULL;
|
||||
g_autofree char *backendAlias = NULL;
|
||||
int rc;
|
||||
int idx;
|
||||
|
||||
@ -4438,8 +4438,8 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver,
|
||||
virDomainNetDefPtr net = NULL;
|
||||
size_t i;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
VIR_AUTOFREE(char *) drivealias = NULL;
|
||||
VIR_AUTOFREE(char *) objAlias = NULL;
|
||||
g_autofree char *drivealias = NULL;
|
||||
g_autofree char *objAlias = NULL;
|
||||
bool is_vfio = false;
|
||||
|
||||
VIR_DEBUG("Removing host device %s from domain %p %s",
|
||||
@ -4557,8 +4557,8 @@ qemuDomainRemoveNetDevice(virQEMUDriverPtr driver,
|
||||
{
|
||||
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
VIR_AUTOFREE(char *) hostnet_name = NULL;
|
||||
VIR_AUTOFREE(char *) charDevAlias = NULL;
|
||||
g_autofree char *hostnet_name = NULL;
|
||||
g_autofree char *charDevAlias = NULL;
|
||||
size_t i;
|
||||
int actualType = virDomainNetGetActualType(net);
|
||||
|
||||
@ -4661,7 +4661,7 @@ qemuDomainRemoveChrDevice(virQEMUDriverPtr driver,
|
||||
bool monitor)
|
||||
{
|
||||
virObjectEventPtr event;
|
||||
VIR_AUTOFREE(char *) charAlias = NULL;
|
||||
g_autofree char *charAlias = NULL;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
int rc = 0;
|
||||
|
||||
@ -4716,8 +4716,8 @@ qemuDomainRemoveRNGDevice(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
virDomainRNGDefPtr rng)
|
||||
{
|
||||
VIR_AUTOFREE(char *) charAlias = NULL;
|
||||
VIR_AUTOFREE(char *) objAlias = NULL;
|
||||
g_autofree char *charAlias = NULL;
|
||||
g_autofree char *objAlias = NULL;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
ssize_t idx;
|
||||
int rc = 0;
|
||||
@ -4778,8 +4778,8 @@ qemuDomainRemoveShmemDevice(virQEMUDriverPtr driver,
|
||||
{
|
||||
int rc;
|
||||
ssize_t idx = -1;
|
||||
VIR_AUTOFREE(char *) charAlias = NULL;
|
||||
VIR_AUTOFREE(char *) memAlias = NULL;
|
||||
g_autofree char *charAlias = NULL;
|
||||
g_autofree char *memAlias = NULL;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
|
||||
VIR_DEBUG("Removing shmem device %s from domain %p %s",
|
||||
@ -4880,7 +4880,7 @@ qemuDomainRemoveRedirdevDevice(virQEMUDriverPtr driver,
|
||||
virDomainRedirdevDefPtr dev)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
VIR_AUTOFREE(char *) charAlias = NULL;
|
||||
g_autofree char *charAlias = NULL;
|
||||
ssize_t idx;
|
||||
|
||||
VIR_DEBUG("Removing redirdev device %s from domain %p %s",
|
||||
@ -4983,7 +4983,7 @@ qemuDomainRemoveDevice(virQEMUDriverPtr driver,
|
||||
{
|
||||
virDomainDeviceInfoPtr info;
|
||||
virObjectEventPtr event;
|
||||
VIR_AUTOFREE(char *) alias = NULL;
|
||||
g_autofree char *alias = NULL;
|
||||
|
||||
/*
|
||||
* save the alias to use when sending a DEVICE_REMOVED event after
|
||||
|
@ -48,8 +48,8 @@ qemuBuildFileList(virHashTablePtr files, const char *dir)
|
||||
return 0;
|
||||
|
||||
while ((rc = virDirRead(dirp, &ent, dir)) > 0) {
|
||||
VIR_AUTOFREE(char *) filename = NULL;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *filename = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
struct stat sb;
|
||||
|
||||
if (STRPREFIX(ent->d_name, "."))
|
||||
@ -100,11 +100,11 @@ qemuInteropFetchConfigs(const char *name,
|
||||
bool privileged)
|
||||
{
|
||||
VIR_AUTOPTR(virHashTable) files = NULL;
|
||||
VIR_AUTOFREE(char *) homeConfig = NULL;
|
||||
VIR_AUTOFREE(char *) xdgConfig = NULL;
|
||||
VIR_AUTOFREE(char *) sysLocation = virFileBuildPath(QEMU_SYSTEM_LOCATION, name, NULL);
|
||||
VIR_AUTOFREE(char *) etcLocation = virFileBuildPath(QEMU_ETC_LOCATION, name, NULL);
|
||||
VIR_AUTOFREE(virHashKeyValuePairPtr) pairs = NULL;
|
||||
g_autofree char *homeConfig = NULL;
|
||||
g_autofree char *xdgConfig = NULL;
|
||||
g_autofree char *sysLocation = virFileBuildPath(QEMU_SYSTEM_LOCATION, name, NULL);
|
||||
g_autofree char *etcLocation = virFileBuildPath(QEMU_ETC_LOCATION, name, NULL);
|
||||
g_autofree virHashKeyValuePairPtr pairs = NULL;
|
||||
virHashKeyValuePairPtr tmp = NULL;
|
||||
|
||||
*configs = NULL;
|
||||
@ -119,7 +119,7 @@ qemuInteropFetchConfigs(const char *name,
|
||||
return -1;
|
||||
|
||||
if (!xdgConfig) {
|
||||
VIR_AUTOFREE(char *) home = virGetUserDirectory();
|
||||
g_autofree char *home = virGetUserDirectory();
|
||||
|
||||
if (!home)
|
||||
return -1;
|
||||
|
@ -869,7 +869,7 @@ qemuMigrationSrcNBDStorageCopyDriveMirror(virQEMUDriverPtr driver,
|
||||
unsigned long long mirror_speed,
|
||||
bool mirror_shallow)
|
||||
{
|
||||
VIR_AUTOFREE(char *) nbd_dest = NULL;
|
||||
g_autofree char *nbd_dest = NULL;
|
||||
int mon_ret;
|
||||
|
||||
if (strchr(host, ':')) {
|
||||
|
@ -1129,7 +1129,7 @@ qemuMonitorUpdateVideoMemorySize(qemuMonitorPtr mon,
|
||||
const char *videoName)
|
||||
{
|
||||
int rc = -1;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
QEMU_CHECK_MONITOR(mon);
|
||||
|
||||
@ -1159,7 +1159,7 @@ qemuMonitorUpdateVideoVram64Size(qemuMonitorPtr mon,
|
||||
const char *videoName)
|
||||
{
|
||||
int rc = -1;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
QEMU_CHECK_MONITOR(mon);
|
||||
|
||||
|
@ -2527,7 +2527,7 @@ static qemuBlockStatsPtr
|
||||
qemuMonitorJSONBlockStatsCollectData(virJSONValuePtr dev,
|
||||
int *nstats)
|
||||
{
|
||||
VIR_AUTOFREE(qemuBlockStatsPtr) bstats = NULL;
|
||||
g_autofree qemuBlockStatsPtr bstats = NULL;
|
||||
virJSONValuePtr parent;
|
||||
virJSONValuePtr parentstats;
|
||||
virJSONValuePtr stats;
|
||||
@ -2601,11 +2601,11 @@ qemuMonitorJSONGetOneBlockStatsInfo(virJSONValuePtr dev,
|
||||
virHashTablePtr hash,
|
||||
bool backingChain)
|
||||
{
|
||||
VIR_AUTOFREE(qemuBlockStatsPtr) bstats = NULL;
|
||||
g_autofree qemuBlockStatsPtr bstats = NULL;
|
||||
int nstats = 0;
|
||||
const char *qdevname = NULL;
|
||||
const char *nodename = NULL;
|
||||
VIR_AUTOFREE(char *) devicename = NULL;
|
||||
g_autofree char *devicename = NULL;
|
||||
virJSONValuePtr backing;
|
||||
|
||||
if (dev_name &&
|
||||
|
@ -5508,7 +5508,7 @@ qemuProcessStartValidate(virQEMUDriverPtr driver,
|
||||
return -1;
|
||||
|
||||
if (n > 0) {
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
|
||||
str = virStringListJoin((const char **)features, ", ");
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
|
@ -99,7 +99,7 @@ qemuSlirpNewForHelper(const char *helper)
|
||||
{
|
||||
VIR_AUTOPTR(qemuSlirp) slirp = NULL;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
VIR_AUTOFREE(char *) output = NULL;
|
||||
g_autofree char *output = NULL;
|
||||
VIR_AUTOPTR(virJSONValue) doc = NULL;
|
||||
virJSONValuePtr featuresJSON;
|
||||
size_t i, nfeatures;
|
||||
@ -150,8 +150,8 @@ qemuSlirpCreatePidFilename(virQEMUDriverConfigPtr cfg,
|
||||
const virDomainDef *def,
|
||||
const char *alias)
|
||||
{
|
||||
VIR_AUTOFREE(char *) shortName = NULL;
|
||||
VIR_AUTOFREE(char *) name = NULL;
|
||||
g_autofree char *shortName = NULL;
|
||||
g_autofree char *name = NULL;
|
||||
|
||||
if (!(shortName = virDomainDefGetShortName(def)) ||
|
||||
virAsprintf(&name, "%s-%s-slirp", shortName, alias) < 0)
|
||||
@ -221,7 +221,7 @@ qemuSlirpGetDBusPath(virQEMUDriverConfigPtr cfg,
|
||||
const virDomainDef *def,
|
||||
const char *alias)
|
||||
{
|
||||
VIR_AUTOFREE(char *) shortName = NULL;
|
||||
g_autofree char *shortName = NULL;
|
||||
char *path = NULL;
|
||||
|
||||
if (!(shortName = virDomainDefGetShortName(def)) ||
|
||||
@ -241,9 +241,9 @@ qemuSlirpStop(qemuSlirpPtr slirp,
|
||||
bool hot)
|
||||
{
|
||||
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
|
||||
VIR_AUTOFREE(char *) pidfile = NULL;
|
||||
VIR_AUTOFREE(char *) dbus_path = NULL;
|
||||
VIR_AUTOFREE(char *) id = qemuSlirpGetDBusVMStateId(net);
|
||||
g_autofree char *pidfile = NULL;
|
||||
g_autofree char *dbus_path = NULL;
|
||||
g_autofree char *id = qemuSlirpGetDBusVMStateId(net);
|
||||
virErrorPtr orig_err;
|
||||
pid_t pid;
|
||||
int rc;
|
||||
@ -298,10 +298,10 @@ qemuSlirpStart(qemuSlirpPtr slirp,
|
||||
{
|
||||
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
VIR_AUTOFREE(char *) pidfile = NULL;
|
||||
VIR_AUTOFREE(char *) dbus_path = NULL;
|
||||
VIR_AUTOFREE(char *) dbus_addr = NULL;
|
||||
VIR_AUTOFREE(char *) id = NULL;
|
||||
g_autofree char *pidfile = NULL;
|
||||
g_autofree char *dbus_path = NULL;
|
||||
g_autofree char *dbus_addr = NULL;
|
||||
g_autofree char *id = NULL;
|
||||
size_t i;
|
||||
const unsigned long long timeout = 5 * 1000; /* ms */
|
||||
pid_t pid = (pid_t) -1;
|
||||
@ -334,7 +334,7 @@ qemuSlirpStart(qemuSlirpPtr slirp,
|
||||
|
||||
for (i = 0; i < net->guestIP.nips; i++) {
|
||||
const virNetDevIPAddr *ip = net->guestIP.ips[i];
|
||||
VIR_AUTOFREE(char *) addr = NULL;
|
||||
g_autofree char *addr = NULL;
|
||||
const char *opt = "";
|
||||
|
||||
if (!(addr = virSocketAddrFormat(&ip->address)))
|
||||
@ -350,7 +350,7 @@ qemuSlirpStart(qemuSlirpPtr slirp,
|
||||
if (ip->prefix) {
|
||||
if (VIR_SOCKET_ADDR_IS_FAMILY(&ip->address, AF_INET)) {
|
||||
virSocketAddr netmask;
|
||||
VIR_AUTOFREE(char *) netmaskStr = NULL;
|
||||
g_autofree char *netmaskStr = NULL;
|
||||
|
||||
if (virSocketAddrPrefixToNetmask(ip->prefix, &netmask, AF_INET) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
|
@ -280,7 +280,7 @@ qemuTPMEmulatorGetPid(const char *swtpmStateDir,
|
||||
pid_t *pid)
|
||||
{
|
||||
int ret;
|
||||
VIR_AUTOFREE(char *) swtpm = virTPMGetSwtpm();
|
||||
g_autofree char *swtpm = virTPMGetSwtpm();
|
||||
char *pidfile = qemuTPMEmulatorCreatePidFilename(swtpmStateDir,
|
||||
shortName);
|
||||
if (!pidfile)
|
||||
@ -399,7 +399,7 @@ qemuTPMSetupEncryption(const unsigned char *secretuuid,
|
||||
int ret = -1;
|
||||
int pipefd[2] = { -1, -1 };
|
||||
virConnectPtr conn;
|
||||
VIR_AUTOFREE(uint8_t *) secret = NULL;
|
||||
g_autofree uint8_t *secret = NULL;
|
||||
size_t secret_len;
|
||||
virSecretLookupTypeDef seclookupdef = {
|
||||
.type = VIR_SECRET_LOOKUP_TYPE_UUID,
|
||||
@ -475,7 +475,7 @@ qemuTPMEmulatorRunSetup(const char *storagepath,
|
||||
int ret = -1;
|
||||
char uuid[VIR_UUID_STRING_BUFLEN];
|
||||
char *vmid = NULL;
|
||||
VIR_AUTOFREE(char *)swtpm_setup = virTPMGetSwtpmSetup();
|
||||
g_autofree char *swtpm_setup = virTPMGetSwtpmSetup();
|
||||
VIR_AUTOCLOSE pwdfile_fd = -1;
|
||||
|
||||
if (!swtpm_setup)
|
||||
@ -597,7 +597,7 @@ qemuTPMEmulatorBuildCommand(virDomainTPMDefPtr tpm,
|
||||
virCommandPtr cmd = NULL;
|
||||
bool created = false;
|
||||
char *pidfile;
|
||||
VIR_AUTOFREE(char *) swtpm = virTPMGetSwtpm();
|
||||
g_autofree char *swtpm = virTPMGetSwtpm();
|
||||
VIR_AUTOCLOSE pwdfile_fd = -1;
|
||||
VIR_AUTOCLOSE migpwdfile_fd = -1;
|
||||
const unsigned char *secretuuid = NULL;
|
||||
@ -713,7 +713,7 @@ qemuTPMEmulatorStop(const char *swtpmStateDir,
|
||||
virCommandPtr cmd;
|
||||
char *pathname;
|
||||
char *errbuf = NULL;
|
||||
VIR_AUTOFREE(char *) swtpm_ioctl = virTPMGetSwtpmIoctl();
|
||||
g_autofree char *swtpm_ioctl = virTPMGetSwtpmIoctl();
|
||||
|
||||
if (!swtpm_ioctl)
|
||||
return;
|
||||
|
@ -182,7 +182,7 @@ qemuVhostUserBinaryParse(const char *path,
|
||||
qemuVhostUserPtr
|
||||
qemuVhostUserParse(const char *path)
|
||||
{
|
||||
VIR_AUTOFREE(char *) cont = NULL;
|
||||
g_autofree char *cont = NULL;
|
||||
VIR_AUTOPTR(virJSONValue) doc = NULL;
|
||||
VIR_AUTOPTR(qemuVhostUser) vu = NULL;
|
||||
qemuVhostUserPtr ret = NULL;
|
||||
@ -351,7 +351,7 @@ qemuVhostUserFillDomainGPU(virQEMUDriverPtr driver,
|
||||
|
||||
for (i = 0; i < nvus; i++) {
|
||||
VIR_AUTOPTR(virJSONValue) doc = NULL;
|
||||
VIR_AUTOFREE(char *) output = NULL;
|
||||
g_autofree char *output = NULL;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
|
||||
vu = vus[i];
|
||||
|
@ -45,7 +45,7 @@ qemuVhostUserGPUCreatePidFilename(const char *stateDir,
|
||||
const char *shortName,
|
||||
const char *alias)
|
||||
{
|
||||
VIR_AUTOFREE(char *) devicename = NULL;
|
||||
g_autofree char *devicename = NULL;
|
||||
|
||||
if (virAsprintf(&devicename, "%s-%s-vhost-user-gpu", shortName, alias) < 0)
|
||||
return NULL;
|
||||
@ -73,7 +73,7 @@ qemuVhostUserGPUGetPid(const char *binPath,
|
||||
const char *alias,
|
||||
pid_t *pid)
|
||||
{
|
||||
VIR_AUTOFREE(char *) pidfile = NULL;
|
||||
g_autofree char *pidfile = NULL;
|
||||
|
||||
pidfile = qemuVhostUserGPUCreatePidFilename(stateDir, shortName, alias);
|
||||
if (!pidfile)
|
||||
@ -106,8 +106,8 @@ int qemuExtVhostUserGPUStart(virQEMUDriverPtr driver,
|
||||
virDomainVideoDefPtr video)
|
||||
{
|
||||
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
|
||||
VIR_AUTOFREE(char *) shortname = NULL;
|
||||
VIR_AUTOFREE(char *) pidfile = NULL;
|
||||
g_autofree char *shortname = NULL;
|
||||
g_autofree char *pidfile = NULL;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
int pair[2] = { -1, -1 };
|
||||
int cmdret = 0, rc;
|
||||
@ -210,8 +210,8 @@ void qemuExtVhostUserGPUStop(virQEMUDriverPtr driver,
|
||||
virDomainVideoDefPtr video)
|
||||
{
|
||||
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
|
||||
VIR_AUTOFREE(char *) pidfile = NULL;
|
||||
VIR_AUTOFREE(char *) shortname = NULL;
|
||||
g_autofree char *pidfile = NULL;
|
||||
g_autofree char *shortname = NULL;
|
||||
virErrorPtr orig_err;
|
||||
|
||||
shortname = virDomainDefGetShortName(vm->def);
|
||||
@ -253,7 +253,7 @@ qemuExtVhostUserGPUSetupCgroup(virQEMUDriverPtr driver,
|
||||
virCgroupPtr cgroup)
|
||||
{
|
||||
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
|
||||
VIR_AUTOFREE(char *) shortname = NULL;
|
||||
g_autofree char *shortname = NULL;
|
||||
int rc;
|
||||
pid_t pid;
|
||||
|
||||
|
@ -2177,8 +2177,8 @@ remoteDispatchProbeURI(bool readonly,
|
||||
ssize_t i;
|
||||
|
||||
for (i = 0; i < (ssize_t) G_N_ELEMENTS(drivers) && !*probeduri; i++) {
|
||||
VIR_AUTOFREE(char *) daemonname = NULL;
|
||||
VIR_AUTOFREE(char *) daemonpath = NULL;
|
||||
g_autofree char *daemonname = NULL;
|
||||
g_autofree char *daemonpath = NULL;
|
||||
|
||||
if (virAsprintf(&daemonname, "virt%sd", drivers[i]) < 0)
|
||||
return -1;
|
||||
@ -2223,7 +2223,7 @@ remoteDispatchProbeURI(bool readonly,
|
||||
ssize_t i;
|
||||
|
||||
for (i = 0; i < (ssize_t) G_N_ELEMENTS(drivers) && !*probeduri; i++) {
|
||||
VIR_AUTOFREE(char *) sockname = NULL;
|
||||
g_autofree char *sockname = NULL;
|
||||
|
||||
if (virAsprintf(&sockname, "%s/libvirt/virt%sd-%s",
|
||||
RUNSTATEDIR, drivers[i],
|
||||
@ -2262,7 +2262,7 @@ remoteDispatchConnectOpen(virNetServerPtr server G_GNUC_UNUSED,
|
||||
{
|
||||
const char *name;
|
||||
#ifdef VIRTPROXYD
|
||||
VIR_AUTOFREE(char *) probeduri = NULL;
|
||||
g_autofree char *probeduri = NULL;
|
||||
#endif
|
||||
unsigned int flags;
|
||||
struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
|
||||
|
@ -771,7 +771,7 @@ remoteGetUNIXSocketHelper(remoteDriverTransport transport,
|
||||
unsigned int flags)
|
||||
{
|
||||
char *sockname = NULL;
|
||||
VIR_AUTOFREE(char *) userdir = NULL;
|
||||
g_autofree char *userdir = NULL;
|
||||
|
||||
if (flags & VIR_DRV_OPEN_REMOTE_USER) {
|
||||
if (transport != REMOTE_DRIVER_TRANSPORT_UNIX) {
|
||||
@ -817,10 +817,10 @@ remoteGetUNIXSocket(remoteDriverTransport transport,
|
||||
unsigned int flags)
|
||||
{
|
||||
char *sock_name = NULL;
|
||||
VIR_AUTOFREE(char *) direct_daemon = NULL;
|
||||
VIR_AUTOFREE(char *) legacy_daemon = NULL;
|
||||
VIR_AUTOFREE(char *) direct_sock_name = NULL;
|
||||
VIR_AUTOFREE(char *) legacy_sock_name = NULL;
|
||||
g_autofree char *direct_daemon = NULL;
|
||||
g_autofree char *legacy_daemon = NULL;
|
||||
g_autofree char *direct_sock_name = NULL;
|
||||
g_autofree char *legacy_sock_name = NULL;
|
||||
|
||||
if (driver &&
|
||||
virAsprintf(&direct_daemon, "virt%sd", driver) < 0)
|
||||
@ -945,23 +945,23 @@ doRemoteOpen(virConnectPtr conn,
|
||||
{
|
||||
int transport;
|
||||
#ifndef WIN32
|
||||
VIR_AUTOFREE(char *) daemonPath = NULL;
|
||||
g_autofree char *daemonPath = NULL;
|
||||
#endif
|
||||
VIR_AUTOFREE(char *) tls_priority = NULL;
|
||||
VIR_AUTOFREE(char *) name = NULL;
|
||||
VIR_AUTOFREE(char *) command = NULL;
|
||||
VIR_AUTOFREE(char *) sockname = NULL;
|
||||
VIR_AUTOFREE(char *) netcat = NULL;
|
||||
VIR_AUTOFREE(char *) port = NULL;
|
||||
VIR_AUTOFREE(char *) authtype = NULL;
|
||||
VIR_AUTOFREE(char *) username = NULL;
|
||||
VIR_AUTOFREE(char *) pkipath = NULL;
|
||||
VIR_AUTOFREE(char *) keyfile = NULL;
|
||||
VIR_AUTOFREE(char *) sshauth = NULL;
|
||||
VIR_AUTOFREE(char *) knownHostsVerify = NULL;
|
||||
VIR_AUTOFREE(char *) knownHosts = NULL;
|
||||
VIR_AUTOFREE(char *) mode_str = NULL;
|
||||
VIR_AUTOFREE(char *) daemon_name = NULL;
|
||||
g_autofree char *tls_priority = NULL;
|
||||
g_autofree char *name = NULL;
|
||||
g_autofree char *command = NULL;
|
||||
g_autofree char *sockname = NULL;
|
||||
g_autofree char *netcat = NULL;
|
||||
g_autofree char *port = NULL;
|
||||
g_autofree char *authtype = NULL;
|
||||
g_autofree char *username = NULL;
|
||||
g_autofree char *pkipath = NULL;
|
||||
g_autofree char *keyfile = NULL;
|
||||
g_autofree char *sshauth = NULL;
|
||||
g_autofree char *knownHostsVerify = NULL;
|
||||
g_autofree char *knownHosts = NULL;
|
||||
g_autofree char *mode_str = NULL;
|
||||
g_autofree char *daemon_name = NULL;
|
||||
bool sanity = true;
|
||||
bool verify = true;
|
||||
#ifndef WIN32
|
||||
|
@ -476,8 +476,8 @@ secretStateInitialize(bool privileged,
|
||||
"%s/libvirt/secrets", RUNSTATEDIR) < 0)
|
||||
goto error;
|
||||
} else {
|
||||
VIR_AUTOFREE(char *) rundir = NULL;
|
||||
VIR_AUTOFREE(char *) cfgdir = NULL;
|
||||
g_autofree char *rundir = NULL;
|
||||
g_autofree char *cfgdir = NULL;
|
||||
|
||||
if (!(cfgdir = virGetUserConfigDirectory()))
|
||||
goto error;
|
||||
|
@ -162,9 +162,9 @@ static int
|
||||
virSecurityValidateTimestamp(const char *name,
|
||||
const char *path)
|
||||
{
|
||||
VIR_AUTOFREE(char *) expected_timestamp = NULL;
|
||||
VIR_AUTOFREE(char *) timestamp_name = NULL;
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *expected_timestamp = NULL;
|
||||
g_autofree char *timestamp_name = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
|
||||
if (!(expected_timestamp = virSecurityGetTimestamp()) ||
|
||||
!(timestamp_name = virSecurityGetTimestampAttrName(name)))
|
||||
@ -208,8 +208,8 @@ static int
|
||||
virSecurityAddTimestamp(const char *name,
|
||||
const char *path)
|
||||
{
|
||||
VIR_AUTOFREE(char *) timestamp_name = NULL;
|
||||
VIR_AUTOFREE(char *) timestamp_value = NULL;
|
||||
g_autofree char *timestamp_name = NULL;
|
||||
g_autofree char *timestamp_value = NULL;
|
||||
|
||||
if (!(timestamp_value = virSecurityGetTimestamp()) ||
|
||||
!(timestamp_name = virSecurityGetTimestampAttrName(name)))
|
||||
@ -223,7 +223,7 @@ static int
|
||||
virSecurityRemoveTimestamp(const char *name,
|
||||
const char *path)
|
||||
{
|
||||
VIR_AUTOFREE(char *) timestamp_name = NULL;
|
||||
g_autofree char *timestamp_name = NULL;
|
||||
|
||||
if (!(timestamp_name = virSecurityGetTimestampAttrName(name)))
|
||||
return -1;
|
||||
@ -265,9 +265,9 @@ virSecurityGetRememberedLabel(const char *name,
|
||||
const char *path,
|
||||
char **label)
|
||||
{
|
||||
VIR_AUTOFREE(char *) ref_name = NULL;
|
||||
VIR_AUTOFREE(char *) attr_name = NULL;
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *ref_name = NULL;
|
||||
g_autofree char *attr_name = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
unsigned int refcount = 0;
|
||||
|
||||
*label = NULL;
|
||||
@ -363,9 +363,9 @@ virSecuritySetRememberedLabel(const char *name,
|
||||
const char *path,
|
||||
const char *label)
|
||||
{
|
||||
VIR_AUTOFREE(char *) ref_name = NULL;
|
||||
VIR_AUTOFREE(char *) attr_name = NULL;
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *ref_name = NULL;
|
||||
g_autofree char *attr_name = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
unsigned int refcount = 0;
|
||||
|
||||
if (!(ref_name = virSecurityGetRefCountAttrName(name)))
|
||||
@ -448,12 +448,12 @@ virSecurityMoveRememberedLabel(const char *name,
|
||||
const char *src,
|
||||
const char *dst)
|
||||
{
|
||||
VIR_AUTOFREE(char *) ref_name = NULL;
|
||||
VIR_AUTOFREE(char *) ref_value = NULL;
|
||||
VIR_AUTOFREE(char *) attr_name = NULL;
|
||||
VIR_AUTOFREE(char *) attr_value = NULL;
|
||||
VIR_AUTOFREE(char *) timestamp_name = NULL;
|
||||
VIR_AUTOFREE(char *) timestamp_value = NULL;
|
||||
g_autofree char *ref_name = NULL;
|
||||
g_autofree char *ref_value = NULL;
|
||||
g_autofree char *attr_name = NULL;
|
||||
g_autofree char *attr_value = NULL;
|
||||
g_autofree char *timestamp_name = NULL;
|
||||
g_autofree char *timestamp_value = NULL;
|
||||
|
||||
if (!(ref_name = virSecurityGetRefCountAttrName(name)) ||
|
||||
!(attr_name = virSecurityGetAttrName(name)) ||
|
||||
|
@ -87,7 +87,7 @@ virStorageDriverLoadBackendModule(const char *name,
|
||||
const char *regfunc,
|
||||
bool forceload)
|
||||
{
|
||||
VIR_AUTOFREE(char *) modfile = NULL;
|
||||
g_autofree char *modfile = NULL;
|
||||
|
||||
if (!(modfile = virFileFindResourceFull(name,
|
||||
"libvirt_storage_backend_",
|
||||
|
@ -58,7 +58,7 @@ virStorageBackendDiskMakeDataVol(virStoragePoolObjPtr pool,
|
||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
||||
char *tmp, *partname;
|
||||
bool addVol = false;
|
||||
VIR_AUTOFREE(char *) devpath = NULL;
|
||||
g_autofree char *devpath = NULL;
|
||||
|
||||
/* Prepended path will be same for all partitions, so we can
|
||||
* strip the path to form a reasonable pool-unique name
|
||||
@ -359,7 +359,7 @@ virStorageBackendDiskReadPartitions(virStoragePoolObjPtr pool,
|
||||
.pool = pool,
|
||||
.vol = vol,
|
||||
};
|
||||
VIR_AUTOFREE(char *) parthelper_path = NULL;
|
||||
g_autofree char *parthelper_path = NULL;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
|
||||
if (!(parthelper_path = virFileFindResource("libvirt_parthelper",
|
||||
@ -413,7 +413,7 @@ static int
|
||||
virStorageBackendDiskReadGeometry(virStoragePoolObjPtr pool)
|
||||
{
|
||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
||||
VIR_AUTOFREE(char *) parthelper_path = NULL;
|
||||
g_autofree char *parthelper_path = NULL;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
|
||||
if (!(parthelper_path = virFileFindResource("libvirt_parthelper",
|
||||
@ -773,7 +773,7 @@ virStorageBackendDiskDeleteVol(virStoragePoolObjPtr pool,
|
||||
char *src_path = def->source.devices[0].path;
|
||||
char *srcname = last_component(src_path);
|
||||
bool isDevMapperDevice;
|
||||
VIR_AUTOFREE(char *) devpath = NULL;
|
||||
g_autofree char *devpath = NULL;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
|
||||
virCheckFlags(0, -1);
|
||||
@ -855,7 +855,7 @@ virStorageBackendDiskCreateVol(virStoragePoolObjPtr pool,
|
||||
unsigned long long startOffset = 0, endOffset = 0;
|
||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
||||
virErrorPtr save_err;
|
||||
VIR_AUTOFREE(char *)partFormat = NULL;
|
||||
g_autofree char *partFormat = NULL;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
|
||||
cmd = virCommandNewArgList(PARTED,
|
||||
|
@ -249,7 +249,7 @@ virStorageBackendFileSystemIsMounted(virStoragePoolObjPtr pool)
|
||||
struct mntent ent;
|
||||
char buf[1024];
|
||||
int rc1, rc2;
|
||||
VIR_AUTOFREE(char *) src = NULL;
|
||||
g_autofree char *src = NULL;
|
||||
|
||||
if ((mtab = fopen(_PATH_MOUNTED, "r")) == NULL) {
|
||||
virReportSystemError(errno,
|
||||
@ -298,7 +298,7 @@ virStorageBackendFileSystemMount(virStoragePoolObjPtr pool)
|
||||
{
|
||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
||||
int rc;
|
||||
VIR_AUTOFREE(char *) src = NULL;
|
||||
g_autofree char *src = NULL;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
|
||||
if (virStorageBackendFileSystemIsValid(pool) < 0)
|
||||
@ -576,7 +576,7 @@ virStoragePoolDefFSNamespaceParse(xmlXPathContextPtr ctxt,
|
||||
int nnodes;
|
||||
size_t i;
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(xmlNodePtr *)nodes = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
|
||||
nnodes = virXPathNodeSet("./fs:mount_opts/fs:option", ctxt, &nodes);
|
||||
if (nnodes < 0)
|
||||
|
@ -127,7 +127,7 @@ virStorageBackendGlusterOpen(virStoragePoolObjPtr pool)
|
||||
if (glfs_set_volfile_server(ret->vol, "tcp",
|
||||
ret->uri->server, ret->uri->port) < 0 ||
|
||||
glfs_init(ret->vol) < 0) {
|
||||
VIR_AUTOFREE(char *) uri = NULL;
|
||||
g_autofree char *uri = NULL;
|
||||
uri = virURIFormat(ret->uri);
|
||||
virReportSystemError(errno, _("failed to connect to %s"), NULLSTR(uri));
|
||||
goto error;
|
||||
@ -186,7 +186,7 @@ virStorageBackendGlusterSetMetadata(virStorageBackendGlusterStatePtr state,
|
||||
const char *name)
|
||||
{
|
||||
char *tmp;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
VIR_FREE(vol->key);
|
||||
VIR_FREE(vol->target.path);
|
||||
@ -240,7 +240,7 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state,
|
||||
int backingFormat;
|
||||
VIR_AUTOPTR(virStorageVolDef) vol = NULL;
|
||||
VIR_AUTOUNREF(virStorageSourcePtr) meta = NULL;
|
||||
VIR_AUTOFREE(char *) header = NULL;
|
||||
g_autofree char *header = NULL;
|
||||
|
||||
*volptr = NULL;
|
||||
|
||||
|
@ -131,7 +131,7 @@ virStorageBackendISCSIFindLUs(virStoragePoolObjPtr pool,
|
||||
const char *session)
|
||||
{
|
||||
uint32_t host;
|
||||
VIR_AUTOFREE(char *) sysfs_path = NULL;
|
||||
g_autofree char *sysfs_path = NULL;
|
||||
|
||||
if (virAsprintf(&sysfs_path,
|
||||
"/sys/class/iscsi_session/session%s/device", session) < 0)
|
||||
@ -160,7 +160,7 @@ virStorageBackendISCSIFindPoolSources(const char *srcSpec,
|
||||
.nsources = 0,
|
||||
.sources = NULL
|
||||
};
|
||||
VIR_AUTOFREE(char *) portal = NULL;
|
||||
g_autofree char *portal = NULL;
|
||||
VIR_AUTOPTR(virStoragePoolSource) source = NULL;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
@ -228,7 +228,7 @@ virStorageBackendISCSICheckPool(virStoragePoolObjPtr pool,
|
||||
{
|
||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(char *) session = NULL;
|
||||
g_autofree char *session = NULL;
|
||||
|
||||
*isActive = false;
|
||||
|
||||
@ -320,8 +320,8 @@ static int
|
||||
virStorageBackendISCSIStartPool(virStoragePoolObjPtr pool)
|
||||
{
|
||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
||||
VIR_AUTOFREE(char *) portal = NULL;
|
||||
VIR_AUTOFREE(char *) session = NULL;
|
||||
g_autofree char *portal = NULL;
|
||||
g_autofree char *session = NULL;
|
||||
|
||||
if (def->source.nhost != 1) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
@ -366,7 +366,7 @@ static int
|
||||
virStorageBackendISCSIRefreshPool(virStoragePoolObjPtr pool)
|
||||
{
|
||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
||||
VIR_AUTOFREE(char *) session = NULL;
|
||||
g_autofree char *session = NULL;
|
||||
|
||||
def->allocation = def->capacity = def->available = 0;
|
||||
|
||||
@ -385,8 +385,8 @@ static int
|
||||
virStorageBackendISCSIStopPool(virStoragePoolObjPtr pool)
|
||||
{
|
||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
||||
VIR_AUTOFREE(char *) portal = NULL;
|
||||
VIR_AUTOFREE(char *) session = NULL;
|
||||
g_autofree char *portal = NULL;
|
||||
g_autofree char *session = NULL;
|
||||
|
||||
if ((session = virStorageBackendISCSISession(pool, true)) == NULL)
|
||||
return 0;
|
||||
|
@ -423,7 +423,7 @@ virISCSIDirectUpdateTargets(struct iscsi_context *iscsi,
|
||||
}
|
||||
|
||||
for (tmp_addr = addr; tmp_addr; tmp_addr = tmp_addr->next) {
|
||||
VIR_AUTOFREE(char *) target = NULL;
|
||||
g_autofree char *target = NULL;
|
||||
|
||||
if (VIR_STRDUP(target, tmp_addr->target_name) < 0)
|
||||
goto cleanup;
|
||||
@ -490,7 +490,7 @@ virStorageBackendISCSIDirectFindPoolSources(const char *srcSpec,
|
||||
.nsources = 0,
|
||||
.sources = NULL
|
||||
};
|
||||
VIR_AUTOFREE(char *) portal = NULL;
|
||||
g_autofree char *portal = NULL;
|
||||
VIR_AUTOPTR(virStoragePoolSource) source = NULL;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
@ -560,7 +560,7 @@ virStorageBackendISCSIDirectSetConnection(virStoragePoolObjPtr pool,
|
||||
{
|
||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
||||
struct iscsi_context *iscsi = NULL;
|
||||
VIR_AUTOFREE(char *) portal = NULL;
|
||||
g_autofree char *portal = NULL;
|
||||
|
||||
if (!(iscsi = virISCSIDirectCreateContext(def->source.initiator.iqn)))
|
||||
goto error;
|
||||
@ -590,7 +590,7 @@ virStorageBackendISCSIDirectRefreshPool(virStoragePoolObjPtr pool)
|
||||
{
|
||||
struct iscsi_context *iscsi = NULL;
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(char *) portal = NULL;
|
||||
g_autofree char *portal = NULL;
|
||||
|
||||
if (!(iscsi = virStorageBackendISCSIDirectSetConnection(pool, &portal)))
|
||||
return -1;
|
||||
@ -626,7 +626,7 @@ virStorageBackendISCSIDirectVolWipeZero(virStorageVolDefPtr vol,
|
||||
struct scsi_task *task = NULL;
|
||||
int lun = 0;
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(unsigned char *) data = NULL;
|
||||
g_autofree unsigned char *data = NULL;
|
||||
|
||||
if (virStorageBackendISCSIDirectGetLun(vol, &lun) < 0)
|
||||
return ret;
|
||||
|
@ -128,9 +128,9 @@ virStorageBackendLogicalParseVolExtents(virStorageVolDefPtr vol,
|
||||
int err, nvars;
|
||||
unsigned long long offset, size, length;
|
||||
virStorageVolSourceExtent extent;
|
||||
VIR_AUTOFREE(char *) regex = NULL;
|
||||
VIR_AUTOFREE(regex_t *) reg = NULL;
|
||||
VIR_AUTOFREE(regmatch_t *) vars = NULL;
|
||||
g_autofree char *regex = NULL;
|
||||
g_autofree regex_t *reg = NULL;
|
||||
g_autofree regmatch_t *vars = NULL;
|
||||
|
||||
memset(&extent, 0, sizeof(extent));
|
||||
|
||||
@ -208,7 +208,7 @@ virStorageBackendLogicalParseVolExtents(virStorageVolDefPtr vol,
|
||||
for (i = 0; i < nextents; i++) {
|
||||
size_t j;
|
||||
int len;
|
||||
VIR_AUTOFREE(char *) offset_str = NULL;
|
||||
g_autofree char *offset_str = NULL;
|
||||
|
||||
j = (i * 2) + 1;
|
||||
len = vars[j].rm_eo - vars[j].rm_so;
|
||||
@ -463,8 +463,8 @@ virStorageBackendLogicalFindPoolSourcesFunc(char **const groups,
|
||||
size_t i;
|
||||
virStoragePoolSourceDevicePtr dev;
|
||||
virStoragePoolSource *thisSource;
|
||||
VIR_AUTOFREE(char *) pvname = NULL;
|
||||
VIR_AUTOFREE(char *) vgname = NULL;
|
||||
g_autofree char *pvname = NULL;
|
||||
g_autofree char *vgname = NULL;
|
||||
|
||||
if (VIR_STRDUP(pvname, groups[0]) < 0 ||
|
||||
VIR_STRDUP(vgname, groups[1]) < 0)
|
||||
|
@ -156,7 +156,7 @@ virStorageBackendCreateVols(virStoragePoolObjPtr pool,
|
||||
int is_mpath = 0;
|
||||
uint32_t minor = -1;
|
||||
uint32_t next;
|
||||
VIR_AUTOFREE(char *) map_device = NULL;
|
||||
g_autofree char *map_device = NULL;
|
||||
|
||||
do {
|
||||
is_mpath = virStorageBackendIsMultipath(names->name);
|
||||
|
@ -85,7 +85,7 @@ virStoragePoolDefRBDNamespaceParse(xmlXPathContextPtr ctxt,
|
||||
int nnodes;
|
||||
size_t i;
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(xmlNodePtr *)nodes = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
|
||||
nnodes = virXPathNodeSet("./rbd:config_opts/rbd:option", ctxt, &nodes);
|
||||
if (nnodes < 0)
|
||||
@ -198,7 +198,7 @@ virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr ptr,
|
||||
const char *osd_op_timeout = "30";
|
||||
const char *rbd_default_format = "2";
|
||||
virConnectPtr conn = NULL;
|
||||
VIR_AUTOFREE(char *) mon_buff = NULL;
|
||||
g_autofree char *mon_buff = NULL;
|
||||
|
||||
if (authdef) {
|
||||
VIR_DEBUG("Using cephx authorization, username: %s", authdef->username);
|
||||
@ -637,7 +637,7 @@ virStorageBackendRBDGetVolNames(virStorageBackendRBDStatePtr ptr)
|
||||
size_t nnames = 0;
|
||||
int rc;
|
||||
size_t max_size = 1024;
|
||||
VIR_AUTOFREE(char *) namebuf = NULL;
|
||||
g_autofree char *namebuf = NULL;
|
||||
const char *name;
|
||||
|
||||
while (true) {
|
||||
@ -655,7 +655,7 @@ virStorageBackendRBDGetVolNames(virStorageBackendRBDStatePtr ptr)
|
||||
}
|
||||
|
||||
for (name = namebuf; name < namebuf + max_size;) {
|
||||
VIR_AUTOFREE(char *) namedup = NULL;
|
||||
g_autofree char *namedup = NULL;
|
||||
|
||||
if (STREQ(name, ""))
|
||||
break;
|
||||
@ -772,7 +772,7 @@ virStorageBackendRBDCleanupSnapshots(rados_ioctx_t ioctx,
|
||||
int snap_count, protected;
|
||||
size_t i;
|
||||
rbd_image_t image = NULL;
|
||||
VIR_AUTOFREE(rbd_snap_info_t *) snaps = NULL;
|
||||
g_autofree rbd_snap_info_t *snaps = NULL;
|
||||
|
||||
if ((r = rbd_open(ioctx, vol->name, &image, NULL)) < 0) {
|
||||
virReportSystemError(-r, _("failed to open the RBD image '%s'"),
|
||||
@ -1042,7 +1042,7 @@ virStorageBackendRBDSnapshotFindNoDiff(rbd_image_t image,
|
||||
size_t i;
|
||||
int diff;
|
||||
rbd_image_info_t info;
|
||||
VIR_AUTOFREE(rbd_snap_info_t *) snaps = NULL;
|
||||
g_autofree rbd_snap_info_t *snaps = NULL;
|
||||
|
||||
if ((r = rbd_stat(image, &info, sizeof(info))) < 0) {
|
||||
virReportSystemError(-r, _("failed to stat the RBD image %s"),
|
||||
@ -1189,7 +1189,7 @@ virStorageBackendRBDCloneImage(rados_ioctx_t io,
|
||||
uint64_t stripe_unit;
|
||||
virBuffer snapname = VIR_BUFFER_INITIALIZER;
|
||||
rbd_image_t image = NULL;
|
||||
VIR_AUTOFREE(char *) snapname_buff = NULL;
|
||||
g_autofree char *snapname_buff = NULL;
|
||||
|
||||
if ((r = rbd_open(io, origvol, &image, NULL)) < 0) {
|
||||
virReportSystemError(-r, _("failed to open the RBD image %s"),
|
||||
@ -1362,7 +1362,7 @@ virStorageBackendRBDVolWipeZero(rbd_image_t image,
|
||||
int r = -1;
|
||||
unsigned long long offset = 0;
|
||||
unsigned long long length;
|
||||
VIR_AUTOFREE(char *) writebuf = NULL;
|
||||
g_autofree char *writebuf = NULL;
|
||||
|
||||
if (VIR_ALLOC_N(writebuf, info->obj_size * stripe_count) < 0)
|
||||
return -1;
|
||||
|
@ -56,7 +56,7 @@ static int
|
||||
virStorageBackendSCSITriggerRescan(uint32_t host)
|
||||
{
|
||||
VIR_AUTOCLOSE fd = -1;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
VIR_DEBUG("Triggering rescan of host %d", host);
|
||||
|
||||
@ -238,8 +238,8 @@ checkParent(const char *name,
|
||||
unsigned int host_num;
|
||||
bool retval = false;
|
||||
virConnectPtr conn = NULL;
|
||||
VIR_AUTOFREE(char *) scsi_host_name = NULL;
|
||||
VIR_AUTOFREE(char *) vhba_parent = NULL;
|
||||
g_autofree char *scsi_host_name = NULL;
|
||||
g_autofree char *vhba_parent = NULL;
|
||||
|
||||
VIR_DEBUG("name=%s, parent_name=%s", name, parent_name);
|
||||
|
||||
@ -290,7 +290,7 @@ createVport(virStoragePoolDefPtr def,
|
||||
{
|
||||
virStoragePoolFCRefreshInfoPtr cbdata = NULL;
|
||||
virThread thread;
|
||||
VIR_AUTOFREE(char *) name = NULL;
|
||||
g_autofree char *name = NULL;
|
||||
|
||||
VIR_DEBUG("configFile='%s' parent='%s', wwnn='%s' wwpn='%s'",
|
||||
NULLSTR(configFile), NULLSTR(fchost->parent),
|
||||
@ -355,8 +355,8 @@ virStorageBackendSCSICheckPool(virStoragePoolObjPtr pool,
|
||||
{
|
||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
||||
unsigned int host;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
VIR_AUTOFREE(char *) name = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
g_autofree char *name = NULL;
|
||||
|
||||
*isActive = false;
|
||||
|
||||
@ -390,7 +390,7 @@ virStorageBackendSCSIRefreshPool(virStoragePoolObjPtr pool)
|
||||
{
|
||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
||||
unsigned int host;
|
||||
VIR_AUTOFREE(char *) name = NULL;
|
||||
g_autofree char *name = NULL;
|
||||
|
||||
def->allocation = def->capacity = def->available = 0;
|
||||
|
||||
|
@ -137,7 +137,7 @@ static int
|
||||
virStorageBackendSheepdogRefreshAllVol(virStoragePoolObjPtr pool)
|
||||
{
|
||||
size_t i;
|
||||
VIR_AUTOFREE(char *) output = NULL;
|
||||
g_autofree char *output = NULL;
|
||||
VIR_AUTOSTRINGLIST lines = NULL;
|
||||
VIR_AUTOSTRINGLIST cells = NULL;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
@ -176,7 +176,7 @@ virStorageBackendSheepdogRefreshAllVol(virStoragePoolObjPtr pool)
|
||||
static int
|
||||
virStorageBackendSheepdogRefreshPool(virStoragePoolObjPtr pool)
|
||||
{
|
||||
VIR_AUTOFREE(char *) output = NULL;
|
||||
g_autofree char *output = NULL;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
|
||||
cmd = virCommandNewArgList(SHEEPDOGCLI, "node", "info", "-r", NULL);
|
||||
|
@ -38,9 +38,9 @@ static int
|
||||
virStorageBackendVzPoolStart(virStoragePoolObjPtr pool)
|
||||
{
|
||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
||||
VIR_AUTOFREE(char *) grp_name = NULL;
|
||||
VIR_AUTOFREE(char *) usr_name = NULL;
|
||||
VIR_AUTOFREE(char *) mode = NULL;
|
||||
g_autofree char *grp_name = NULL;
|
||||
g_autofree char *usr_name = NULL;
|
||||
g_autofree char *mode = NULL;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
int ret;
|
||||
|
||||
@ -88,7 +88,7 @@ virStorageBackendVzIsMounted(virStoragePoolObjPtr pool)
|
||||
FILE *mtab;
|
||||
struct mntent ent;
|
||||
char buf[1024];
|
||||
VIR_AUTOFREE(char *) cluster = NULL;
|
||||
g_autofree char *cluster = NULL;
|
||||
|
||||
if (virAsprintf(&cluster, "vstorage://%s", def->source.name) < 0)
|
||||
return -1;
|
||||
|
@ -52,7 +52,7 @@ static int
|
||||
virStorageBackendZFSVolModeNeeded(void)
|
||||
{
|
||||
int ret = -1, exit_code = -1;
|
||||
VIR_AUTOFREE(char *) error = NULL;
|
||||
g_autofree char *error = NULL;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
|
||||
/* 'zfs get' without arguments prints out
|
||||
@ -85,7 +85,7 @@ virStorageBackendZFSCheckPool(virStoragePoolObjPtr pool G_GNUC_UNUSED,
|
||||
bool *isActive)
|
||||
{
|
||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
||||
VIR_AUTOFREE(char *) devpath = NULL;
|
||||
g_autofree char *devpath = NULL;
|
||||
|
||||
if (virAsprintf(&devpath, "/dev/zvol/%s",
|
||||
def->source.name) < 0)
|
||||
@ -179,7 +179,7 @@ virStorageBackendZFSFindVols(virStoragePoolObjPtr pool,
|
||||
size_t i;
|
||||
VIR_AUTOSTRINGLIST lines = NULL;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
VIR_AUTOFREE(char *) volumes_list = NULL;
|
||||
g_autofree char *volumes_list = NULL;
|
||||
|
||||
/**
|
||||
* $ zfs list -Hp -t volume -o name,volsize -r test
|
||||
|
@ -137,7 +137,7 @@ storagePoolUpdateStateCallback(virStoragePoolObjPtr obj,
|
||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(obj);
|
||||
bool active = false;
|
||||
virStorageBackendPtr backend;
|
||||
VIR_AUTOFREE(char *) stateFile = NULL;
|
||||
g_autofree char *stateFile = NULL;
|
||||
|
||||
if ((backend = virStorageBackendForType(def->type)) == NULL) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@ -215,7 +215,7 @@ storageDriverAutostartCallback(virStoragePoolObjPtr obj,
|
||||
}
|
||||
|
||||
if (started) {
|
||||
VIR_AUTOFREE(char *) stateFile = NULL;
|
||||
g_autofree char *stateFile = NULL;
|
||||
|
||||
stateFile = virFileBuildPath(driver->stateDir, def->name, ".xml");
|
||||
if (!stateFile ||
|
||||
@ -256,8 +256,8 @@ storageStateInitialize(bool privileged,
|
||||
virStateInhibitCallback callback G_GNUC_UNUSED,
|
||||
void *opaque G_GNUC_UNUSED)
|
||||
{
|
||||
VIR_AUTOFREE(char *) configdir = NULL;
|
||||
VIR_AUTOFREE(char *) rundir = NULL;
|
||||
g_autofree char *configdir = NULL;
|
||||
g_autofree char *rundir = NULL;
|
||||
bool autostart = true;
|
||||
|
||||
if (VIR_ALLOC(driver) < 0)
|
||||
@ -739,7 +739,7 @@ storagePoolCreateXML(virConnectPtr conn,
|
||||
virObjectEventPtr event = NULL;
|
||||
unsigned int build_flags = 0;
|
||||
VIR_AUTOPTR(virStoragePoolDef) newDef = NULL;
|
||||
VIR_AUTOFREE(char *) stateFile = NULL;
|
||||
g_autofree char *stateFile = NULL;
|
||||
|
||||
virCheckFlags(VIR_STORAGE_POOL_CREATE_WITH_BUILD |
|
||||
VIR_STORAGE_POOL_CREATE_WITH_BUILD_OVERWRITE |
|
||||
@ -939,7 +939,7 @@ storagePoolCreate(virStoragePoolPtr pool,
|
||||
virObjectEventPtr event = NULL;
|
||||
int ret = -1;
|
||||
unsigned int build_flags = 0;
|
||||
VIR_AUTOFREE(char *) stateFile = NULL;
|
||||
g_autofree char *stateFile = NULL;
|
||||
bool restoreStarting = false;
|
||||
|
||||
virCheckFlags(VIR_STORAGE_POOL_CREATE_WITH_BUILD |
|
||||
@ -1091,7 +1091,7 @@ storagePoolDestroy(virStoragePoolPtr pool)
|
||||
virStorageBackendPtr backend;
|
||||
virObjectEventPtr event = NULL;
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(char *) stateFile = NULL;
|
||||
g_autofree char *stateFile = NULL;
|
||||
|
||||
if (!(obj = storagePoolObjFindByUUID(pool->uuid, pool->name)))
|
||||
goto cleanup;
|
||||
@ -1162,7 +1162,7 @@ storagePoolDelete(virStoragePoolPtr pool,
|
||||
virStorageBackendPtr backend;
|
||||
virObjectEventPtr event = NULL;
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(char *) stateFile = NULL;
|
||||
g_autofree char *stateFile = NULL;
|
||||
|
||||
if (!(obj = virStoragePoolObjFromStoragePool(pool)))
|
||||
return -1;
|
||||
@ -1231,7 +1231,7 @@ storagePoolRefresh(virStoragePoolPtr pool,
|
||||
virStoragePoolObjPtr obj;
|
||||
virStoragePoolDefPtr def;
|
||||
virStorageBackendPtr backend;
|
||||
VIR_AUTOFREE(char *) stateFile = NULL;
|
||||
g_autofree char *stateFile = NULL;
|
||||
int ret = -1;
|
||||
virObjectEventPtr event = NULL;
|
||||
|
||||
@ -1632,7 +1632,7 @@ storageVolLookupByPathCallback(virStoragePoolObjPtr obj,
|
||||
{
|
||||
struct storageVolLookupData *data = (struct storageVolLookupData *)opaque;
|
||||
virStoragePoolDefPtr def;
|
||||
VIR_AUTOFREE(char *) stable_path = NULL;
|
||||
g_autofree char *stable_path = NULL;
|
||||
|
||||
if (!virStoragePoolObjIsActive(obj))
|
||||
return false;
|
||||
@ -1740,7 +1740,7 @@ storagePoolLookupByTargetPath(virConnectPtr conn,
|
||||
virStoragePoolObjPtr obj;
|
||||
virStoragePoolDefPtr def;
|
||||
virStoragePoolPtr pool = NULL;
|
||||
VIR_AUTOFREE(char *) cleanpath = NULL;
|
||||
g_autofree char *cleanpath = NULL;
|
||||
|
||||
cleanpath = virFileSanitizePath(path);
|
||||
if (!cleanpath)
|
||||
@ -2296,8 +2296,8 @@ static int
|
||||
virStorageBackendPloopRestoreDesc(char *path)
|
||||
{
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
VIR_AUTOFREE(char *) refresh_tool = NULL;
|
||||
VIR_AUTOFREE(char *) desc = NULL;
|
||||
g_autofree char *refresh_tool = NULL;
|
||||
g_autofree char *desc = NULL;
|
||||
|
||||
if (virAsprintf(&desc, "%s/DiskDescriptor.xml", path) < 0)
|
||||
return -1;
|
||||
|
@ -261,7 +261,7 @@ virStorageFileBackendGlusterReadlinkCallback(const char *path,
|
||||
size_t bufsiz = 0;
|
||||
ssize_t ret;
|
||||
struct stat st;
|
||||
VIR_AUTOFREE(char *) buf = NULL;
|
||||
g_autofree char *buf = NULL;
|
||||
|
||||
*linkpath = NULL;
|
||||
|
||||
@ -301,7 +301,7 @@ static const char *
|
||||
virStorageFileBackendGlusterGetUniqueIdentifier(virStorageSourcePtr src)
|
||||
{
|
||||
virStorageFileBackendGlusterPrivPtr priv = src->drv->priv;
|
||||
VIR_AUTOFREE(char *) filePath = NULL;
|
||||
g_autofree char *filePath = NULL;
|
||||
|
||||
if (priv->canonpath)
|
||||
return priv->canonpath;
|
||||
|
@ -136,8 +136,8 @@ virStorageBackendCopyToFD(virStorageVolDefPtr vol,
|
||||
int wbytes = 0;
|
||||
int interval;
|
||||
struct stat st;
|
||||
VIR_AUTOFREE(char *) zerobuf = NULL;
|
||||
VIR_AUTOFREE(char *) buf = NULL;
|
||||
g_autofree char *zerobuf = NULL;
|
||||
g_autofree char *buf = NULL;
|
||||
VIR_AUTOCLOSE inputfd = -1;
|
||||
|
||||
if ((inputfd = open(inputvol->target.path, O_RDONLY)) < 0) {
|
||||
@ -599,7 +599,7 @@ storageBackendCreatePloop(virStoragePoolObjPtr pool G_GNUC_UNUSED,
|
||||
int ret = -1;
|
||||
bool created = false;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
VIR_AUTOFREE(char *) create_tool = NULL;
|
||||
g_autofree char *create_tool = NULL;
|
||||
|
||||
virCheckFlags(0, -1);
|
||||
|
||||
@ -668,7 +668,7 @@ storagePloopResize(virStorageVolDefPtr vol,
|
||||
unsigned long long capacity)
|
||||
{
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
VIR_AUTOFREE(char *) resize_tool = NULL;
|
||||
g_autofree char *resize_tool = NULL;
|
||||
|
||||
resize_tool = virFindFileInPath("ploop");
|
||||
if (!resize_tool) {
|
||||
@ -857,7 +857,7 @@ storageBackendCreateQemuImgSetBacking(virStoragePoolObjPtr pool,
|
||||
{
|
||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
||||
int accessRetCode = -1;
|
||||
VIR_AUTOFREE(char *) absolutePath = NULL;
|
||||
g_autofree char *absolutePath = NULL;
|
||||
|
||||
if (info->format == VIR_STORAGE_FILE_RAW) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
@ -919,7 +919,7 @@ storageBackendCreateQemuImgSetOptions(virCommandPtr cmd,
|
||||
virStorageEncryptionInfoDefPtr encinfo,
|
||||
struct _virStorageBackendQemuImgInfo *info)
|
||||
{
|
||||
VIR_AUTOFREE(char *) opts = NULL;
|
||||
g_autofree char *opts = NULL;
|
||||
|
||||
if (storageBackendCreateQemuImgOpts(encinfo, &opts, info) < 0)
|
||||
return -1;
|
||||
@ -941,7 +941,7 @@ storageBackendCreateQemuImgSecretObject(virCommandPtr cmd,
|
||||
const char *secretAlias)
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
VIR_AUTOFREE(char *) commandStr = NULL;
|
||||
g_autofree char *commandStr = NULL;
|
||||
|
||||
virBufferAsprintf(&buf, "secret,id=%s,file=", secretAlias);
|
||||
virQEMUBuildBufferEscapeComma(&buf, secretPath);
|
||||
@ -970,7 +970,7 @@ storageBackendResizeQemuImgImageOpts(virCommandPtr cmd,
|
||||
const char *secretAlias)
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
VIR_AUTOFREE(char *) commandStr = NULL;
|
||||
g_autofree char *commandStr = NULL;
|
||||
|
||||
virBufferAsprintf(&buf, "driver=luks,key-secret=%s,file.filename=",
|
||||
secretAlias);
|
||||
@ -1092,7 +1092,7 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool,
|
||||
virStorageEncryptionPtr enc = vol->target.encryption;
|
||||
virStorageEncryptionPtr inputenc = inputvol ? inputvol->target.encryption : NULL;
|
||||
virStorageEncryptionInfoDefPtr encinfo = NULL;
|
||||
VIR_AUTOFREE(char *) inputSecretAlias = NULL;
|
||||
g_autofree char *inputSecretAlias = NULL;
|
||||
|
||||
virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, NULL);
|
||||
|
||||
@ -1306,9 +1306,9 @@ storageBackendCreateQemuImg(virStoragePoolObjPtr pool,
|
||||
{
|
||||
int ret = -1;
|
||||
virStorageVolEncryptConvertStep convertStep = VIR_STORAGE_VOL_ENCRYPT_NONE;
|
||||
VIR_AUTOFREE(char *) create_tool = NULL;
|
||||
VIR_AUTOFREE(char *) secretPath = NULL;
|
||||
VIR_AUTOFREE(char *) inputSecretPath = NULL;
|
||||
g_autofree char *create_tool = NULL;
|
||||
g_autofree char *secretPath = NULL;
|
||||
g_autofree char *inputSecretPath = NULL;
|
||||
|
||||
virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, -1);
|
||||
|
||||
@ -1680,8 +1680,8 @@ virStorageBackendVolOpen(const char *path, struct stat *sb,
|
||||
static bool
|
||||
storageBackendIsPloopDir(char *path)
|
||||
{
|
||||
VIR_AUTOFREE(char *) root = NULL;
|
||||
VIR_AUTOFREE(char *) desc = NULL;
|
||||
g_autofree char *root = NULL;
|
||||
g_autofree char *desc = NULL;
|
||||
|
||||
if (virAsprintf(&root, "%s/root.hds", path) < 0)
|
||||
return false;
|
||||
@ -1704,7 +1704,7 @@ static int
|
||||
storageBackendRedoPloopUpdate(virStorageSourcePtr target, struct stat *sb,
|
||||
int *fd, unsigned int flags)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
if (virAsprintf(&path, "%s/root.hds", target->path) < 0)
|
||||
return -1;
|
||||
@ -1738,7 +1738,7 @@ storageBackendUpdateVolTargetInfo(virStorageVolType voltype,
|
||||
int rc;
|
||||
struct stat sb;
|
||||
ssize_t len = VIR_STORAGE_MAX_HEADER;
|
||||
VIR_AUTOFREE(char *) buf = NULL;
|
||||
g_autofree char *buf = NULL;
|
||||
VIR_AUTOCLOSE fd = -1;
|
||||
|
||||
if ((rc = virStorageBackendVolOpen(target->path, &sb, openflags)) < 0)
|
||||
@ -2262,9 +2262,9 @@ storageBackendResizeQemuImg(virStoragePoolObjPtr pool,
|
||||
const char *type;
|
||||
virStorageEncryptionPtr enc = vol->target.encryption;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
VIR_AUTOFREE(char *) img_tool = NULL;
|
||||
VIR_AUTOFREE(char *) secretPath = NULL;
|
||||
VIR_AUTOFREE(char *) secretAlias = NULL;
|
||||
g_autofree char *img_tool = NULL;
|
||||
g_autofree char *secretPath = NULL;
|
||||
g_autofree char *secretAlias = NULL;
|
||||
|
||||
if (enc && (enc->format == VIR_STORAGE_ENCRYPTION_FORMAT_QCOW ||
|
||||
enc->format == VIR_STORAGE_ENCRYPTION_FORMAT_DEFAULT) &&
|
||||
@ -2382,7 +2382,7 @@ storageBackendPloopHasSnapshots(char *path)
|
||||
{
|
||||
char *snap_tool = NULL;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
VIR_AUTOFREE(char *) output = NULL;
|
||||
g_autofree char *output = NULL;
|
||||
|
||||
snap_tool = virFindFileInPath("ploop");
|
||||
if (!snap_tool) {
|
||||
@ -2417,7 +2417,7 @@ virStorageBackendVolUploadLocal(virStoragePoolObjPtr pool G_GNUC_UNUSED,
|
||||
char *target_path = vol->target.path;
|
||||
int has_snap = 0;
|
||||
bool sparse = flags & VIR_STORAGE_VOL_UPLOAD_SPARSE_STREAM;
|
||||
VIR_AUTOFREE(char *)path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
virCheckFlags(VIR_STORAGE_VOL_UPLOAD_SPARSE_STREAM, -1);
|
||||
/* if volume has target format VIR_STORAGE_FILE_PLOOP
|
||||
@ -2458,7 +2458,7 @@ virStorageBackendVolDownloadLocal(virStoragePoolObjPtr pool G_GNUC_UNUSED,
|
||||
char *target_path = vol->target.path;
|
||||
int has_snap = 0;
|
||||
bool sparse = flags & VIR_STORAGE_VOL_DOWNLOAD_SPARSE_STREAM;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
virCheckFlags(VIR_STORAGE_VOL_DOWNLOAD_SPARSE_STREAM, -1);
|
||||
if (vol->target.format == VIR_STORAGE_FILE_PLOOP) {
|
||||
@ -2531,7 +2531,7 @@ storageBackendWipeLocal(const char *path,
|
||||
unsigned long long remaining = 0;
|
||||
off_t size;
|
||||
size_t write_size = 0;
|
||||
VIR_AUTOFREE(char *) writebuf = NULL;
|
||||
g_autofree char *writebuf = NULL;
|
||||
|
||||
if (VIR_ALLOC_N(writebuf, writebuf_length) < 0)
|
||||
return -1;
|
||||
@ -2673,9 +2673,9 @@ storageBackendVolWipePloop(virStorageVolDefPtr vol,
|
||||
unsigned int algorithm)
|
||||
{
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
VIR_AUTOFREE(char *) target_path = NULL;
|
||||
VIR_AUTOFREE(char *) disk_desc = NULL;
|
||||
VIR_AUTOFREE(char *) create_tool = NULL;
|
||||
g_autofree char *target_path = NULL;
|
||||
g_autofree char *disk_desc = NULL;
|
||||
g_autofree char *create_tool = NULL;
|
||||
|
||||
create_tool = virFindFileInPath("ploop");
|
||||
if (!create_tool) {
|
||||
@ -2755,7 +2755,7 @@ virStorageBackendBuildLocal(virStoragePoolObjPtr pool)
|
||||
mode_t mode;
|
||||
bool needs_create_as_uid;
|
||||
unsigned int dir_create_flags;
|
||||
VIR_AUTOFREE(char *) parent = NULL;
|
||||
g_autofree char *parent = NULL;
|
||||
|
||||
if (VIR_STRDUP(parent, def->target.path) < 0)
|
||||
return -1;
|
||||
@ -2839,8 +2839,8 @@ virStorageUtilGlusterExtractPoolSources(const char *host,
|
||||
size_t i;
|
||||
int nnodes;
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
|
||||
VIR_AUTOFREE(char *) volname = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
g_autofree char *volname = NULL;
|
||||
|
||||
if (!(doc = virXMLParseStringCtxt(xml, _("(gluster_cli_output)"), &ctxt)))
|
||||
goto cleanup;
|
||||
@ -2914,8 +2914,8 @@ virStorageBackendFindGlusterPoolSources(const char *host,
|
||||
{
|
||||
int rc;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
VIR_AUTOFREE(char *) glusterpath = NULL;
|
||||
VIR_AUTOFREE(char *) outbuf = NULL;
|
||||
g_autofree char *glusterpath = NULL;
|
||||
g_autofree char *outbuf = NULL;
|
||||
|
||||
if (!(glusterpath = virFindFileInPath("gluster"))) {
|
||||
if (report) {
|
||||
@ -3182,8 +3182,8 @@ virStorageBackendPARTEDFindLabel(const char *device,
|
||||
char *start, *end;
|
||||
int ret = VIR_STORAGE_PARTED_ERROR;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
VIR_AUTOFREE(char *) output = NULL;
|
||||
VIR_AUTOFREE(char *) error = NULL;
|
||||
g_autofree char *output = NULL;
|
||||
g_autofree char *error = NULL;
|
||||
|
||||
cmd = virCommandNew(PARTED);
|
||||
virCommandAddArgSet(cmd, args);
|
||||
@ -3667,7 +3667,7 @@ virStorageBackendSCSINewLun(virStoragePoolObjPtr pool,
|
||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
||||
int retval = -1;
|
||||
VIR_AUTOPTR(virStorageVolDef) vol = NULL;
|
||||
VIR_AUTOFREE(char *) devpath = NULL;
|
||||
g_autofree char *devpath = NULL;
|
||||
|
||||
/* Check if the pool is using a stable target path. The call to
|
||||
* virStorageBackendStablePath will fail if the pool target path
|
||||
@ -3757,7 +3757,7 @@ getNewStyleBlockDevice(const char *lun_path,
|
||||
struct dirent *block_dirent = NULL;
|
||||
int retval = -1;
|
||||
int direrr;
|
||||
VIR_AUTOFREE(char *) block_path = NULL;
|
||||
g_autofree char *block_path = NULL;
|
||||
|
||||
if (virAsprintf(&block_path, "%s/block", lun_path) < 0)
|
||||
goto cleanup;
|
||||
@ -3836,7 +3836,7 @@ getBlockDevice(uint32_t host,
|
||||
struct dirent *lun_dirent = NULL;
|
||||
int retval = -1;
|
||||
int direrr;
|
||||
VIR_AUTOFREE(char *) lun_path = NULL;
|
||||
g_autofree char *lun_path = NULL;
|
||||
|
||||
*block_device = NULL;
|
||||
|
||||
@ -3892,7 +3892,7 @@ getDeviceType(uint32_t host,
|
||||
char typestr[3];
|
||||
char *gottype, *p;
|
||||
FILE *typefile;
|
||||
VIR_AUTOFREE(char *) type_path = NULL;
|
||||
g_autofree char *type_path = NULL;
|
||||
|
||||
if (virAsprintf(&type_path, "/sys/bus/scsi/devices/%u:%u:%u:%u/type",
|
||||
host, bus, target, lun) < 0)
|
||||
@ -3953,7 +3953,7 @@ processLU(virStoragePoolObjPtr pool,
|
||||
{
|
||||
int retval = -1;
|
||||
int device_type;
|
||||
VIR_AUTOFREE(char *) block_device = NULL;
|
||||
g_autofree char *block_device = NULL;
|
||||
|
||||
VIR_DEBUG("Processing LU %u:%u:%u:%u",
|
||||
host, bus, target, lun);
|
||||
@ -4107,7 +4107,7 @@ virStorageBackendFileSystemMountAddOptions(virCommandPtr cmd,
|
||||
virStoragePoolDefPtr def,
|
||||
const char *providedOpts)
|
||||
{
|
||||
VIR_AUTOFREE(char *) mountOpts = NULL;
|
||||
g_autofree char *mountOpts = NULL;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
if (*default_mount_opts != '\0')
|
||||
@ -4206,7 +4206,7 @@ virStorageBackendFileSystemMountCmd(const char *cmdstr,
|
||||
bool cifsfs = (def->type == VIR_STORAGE_POOL_NETFS &&
|
||||
def->source.format == VIR_STORAGE_POOL_NETFS_CIFS);
|
||||
virCommandPtr cmd = NULL;
|
||||
VIR_AUTOFREE(char *) nfsVers = NULL;
|
||||
g_autofree char *nfsVers = NULL;
|
||||
|
||||
if (def->type == VIR_STORAGE_POOL_NETFS && def->source.protocolVer > 0 &&
|
||||
virAsprintf(&nfsVers, "nfsvers=%u", def->source.protocolVer) < 0)
|
||||
|
@ -202,7 +202,7 @@ testDomainDefNamespaceParse(xmlXPathContextPtr ctxt,
|
||||
int tmp, n;
|
||||
size_t i;
|
||||
unsigned int tmpuint;
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
|
||||
if (VIR_ALLOC(nsdata) < 0)
|
||||
return -1;
|
||||
@ -753,7 +753,7 @@ testParseXMLDocFromFile(xmlNodePtr node, const char *file, const char *type)
|
||||
xmlNodePtr ret = NULL;
|
||||
xmlDocPtr doc = NULL;
|
||||
char *absFile = NULL;
|
||||
VIR_AUTOFREE(char *) relFile = NULL;
|
||||
g_autofree char *relFile = NULL;
|
||||
|
||||
if ((relFile = virXMLPropString(node, "file"))) {
|
||||
absFile = testBuildFilename(file, relFile);
|
||||
@ -787,7 +787,7 @@ testParseNodeInfo(virNodeInfoPtr nodeInfo, xmlXPathContextPtr ctxt)
|
||||
{
|
||||
long l;
|
||||
int ret;
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
|
||||
ret = virXPathLong("string(/node/cpu/nodes[1])", ctxt, &l);
|
||||
if (ret == 0) {
|
||||
@ -935,7 +935,7 @@ testParseDomains(testDriverPtr privconn,
|
||||
int num, ret = -1;
|
||||
size_t i;
|
||||
virDomainObjPtr obj = NULL;
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
|
||||
num = virXPathNodeSet("/node/domain", ctxt, &nodes);
|
||||
if (num < 0)
|
||||
@ -997,7 +997,7 @@ testParseNetworks(testDriverPtr privconn,
|
||||
int num;
|
||||
size_t i;
|
||||
virNetworkObjPtr obj;
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
|
||||
num = virXPathNodeSet("/node/network", ctxt, &nodes);
|
||||
if (num < 0)
|
||||
@ -1034,7 +1034,7 @@ testParseInterfaces(testDriverPtr privconn,
|
||||
int num;
|
||||
size_t i;
|
||||
virInterfaceObjPtr obj;
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
|
||||
num = virXPathNodeSet("/node/interface", ctxt, &nodes);
|
||||
if (num < 0)
|
||||
@ -1073,8 +1073,8 @@ testOpenVolumesForPool(const char *file,
|
||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(obj);
|
||||
size_t i;
|
||||
int num;
|
||||
VIR_AUTOFREE(char *) vol_xpath = NULL;
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
|
||||
g_autofree char *vol_xpath = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
VIR_AUTOPTR(virStorageVolDef) volDef = NULL;
|
||||
|
||||
/* Find storage volumes */
|
||||
@ -1123,7 +1123,7 @@ testParseStorage(testDriverPtr privconn,
|
||||
int num;
|
||||
size_t i;
|
||||
virStoragePoolObjPtr obj;
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
|
||||
num = virXPathNodeSet("/node/pool", ctxt, &nodes);
|
||||
if (num < 0)
|
||||
@ -1172,7 +1172,7 @@ testParseNodedevs(testDriverPtr privconn,
|
||||
int num;
|
||||
size_t i;
|
||||
virNodeDeviceObjPtr obj;
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
|
||||
num = virXPathNodeSet("/node/device", ctxt, &nodes);
|
||||
if (num < 0)
|
||||
@ -1207,7 +1207,7 @@ testParseAuthUsers(testDriverPtr privconn,
|
||||
{
|
||||
int num;
|
||||
size_t i;
|
||||
VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
|
||||
num = virXPathNodeSet("/node/auth/user", ctxt, &nodes);
|
||||
if (num < 0)
|
||||
@ -1218,7 +1218,7 @@ testParseAuthUsers(testDriverPtr privconn,
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
VIR_AUTOFREE(char *) username = NULL;
|
||||
g_autofree char *username = NULL;
|
||||
|
||||
ctxt->node = nodes[i];
|
||||
username = virXPathString("string(.)", ctxt);
|
||||
@ -1382,8 +1382,8 @@ testConnectAuthenticate(virConnectPtr conn,
|
||||
testDriverPtr privconn = conn->privateData;
|
||||
int ret = -1;
|
||||
ssize_t i;
|
||||
VIR_AUTOFREE(char *) username = NULL;
|
||||
VIR_AUTOFREE(char *) password = NULL;
|
||||
g_autofree char *username = NULL;
|
||||
g_autofree char *password = NULL;
|
||||
|
||||
virObjectLock(privconn);
|
||||
if (privconn->numAuths == 0) {
|
||||
@ -2182,7 +2182,7 @@ testDomainSaveImageWrite(testDriverPtr driver,
|
||||
{
|
||||
int len;
|
||||
int fd = -1;
|
||||
VIR_AUTOFREE(char *) xml = NULL;
|
||||
g_autofree char *xml = NULL;
|
||||
|
||||
xml = virDomainDefFormat(def, driver->caps, VIR_DOMAIN_DEF_FORMAT_SECURE);
|
||||
|
||||
@ -2260,7 +2260,7 @@ testDomainSaveImageOpen(testDriverPtr driver,
|
||||
int fd = -1;
|
||||
int len;
|
||||
virDomainDefPtr def = NULL;
|
||||
VIR_AUTOFREE(char *) xml = NULL;
|
||||
g_autofree char *xml = NULL;
|
||||
|
||||
if ((fd = open(path, O_RDONLY)) < 0) {
|
||||
virReportSystemError(errno, _("cannot read domain image '%s'"), path);
|
||||
@ -3095,7 +3095,7 @@ testDomainRenameCallback(virDomainObjPtr privdom,
|
||||
virObjectEventPtr event_new = NULL;
|
||||
virObjectEventPtr event_old = NULL;
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(char *) new_dom_name = NULL;
|
||||
g_autofree char *new_dom_name = NULL;
|
||||
|
||||
virCheckFlags(0, -1);
|
||||
|
||||
@ -3412,7 +3412,7 @@ testDomainGetNumaParameters(virDomainPtr dom,
|
||||
virDomainObjPtr vm = NULL;
|
||||
virDomainDefPtr def = NULL;
|
||||
virDomainNumatuneMemMode mode = VIR_DOMAIN_NUMATUNE_MEM_STRICT;
|
||||
VIR_AUTOFREE(char *) nodeset = NULL;
|
||||
g_autofree char *nodeset = NULL;
|
||||
int ret = -1;
|
||||
|
||||
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
|
||||
@ -7435,7 +7435,7 @@ testNodeDeviceMockCreateVport(testDriverPtr driver,
|
||||
virNodeDeviceObjPtr obj = NULL, objcopy = NULL;
|
||||
virNodeDeviceDefPtr objdef;
|
||||
virObjectEventPtr event = NULL;
|
||||
VIR_AUTOFREE(char *) xml = NULL;
|
||||
g_autofree char *xml = NULL;
|
||||
|
||||
/* In the real code, we'd call virVHBAManageVport which would take the
|
||||
* wwnn/wwpn from the input XML in order to call the "vport_create"
|
||||
@ -7514,8 +7514,8 @@ testNodeDeviceCreateXML(virConnectPtr conn,
|
||||
virNodeDevicePtr dev = NULL, ret = NULL;
|
||||
virNodeDeviceObjPtr obj = NULL;
|
||||
virNodeDeviceDefPtr objdef;
|
||||
VIR_AUTOFREE(char *) wwnn = NULL;
|
||||
VIR_AUTOFREE(char *) wwpn = NULL;
|
||||
g_autofree char *wwnn = NULL;
|
||||
g_autofree char *wwpn = NULL;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
@ -7568,8 +7568,8 @@ testNodeDeviceDestroy(virNodeDevicePtr dev)
|
||||
virNodeDeviceObjPtr parentobj = NULL;
|
||||
virNodeDeviceDefPtr def;
|
||||
virObjectEventPtr event = NULL;
|
||||
VIR_AUTOFREE(char *) wwnn = NULL;
|
||||
VIR_AUTOFREE(char *) wwpn = NULL;
|
||||
g_autofree char *wwnn = NULL;
|
||||
g_autofree char *wwpn = NULL;
|
||||
|
||||
if (!(obj = testNodeDeviceObjFindByName(driver, dev->name)))
|
||||
return -1;
|
||||
|
@ -42,7 +42,7 @@
|
||||
static int
|
||||
runIO(const char *path, int fd, int oflags)
|
||||
{
|
||||
VIR_AUTOFREE(void *) base = NULL; /* Location to be freed */
|
||||
g_autofree void *base = NULL; /* Location to be freed */
|
||||
char *buf = NULL; /* Aligned location within base */
|
||||
size_t buflen = 1024*1024;
|
||||
intptr_t alignMask = 64*1024 - 1;
|
||||
|
@ -66,7 +66,7 @@ virArpTableGet(void)
|
||||
{
|
||||
int num = 0;
|
||||
int msglen;
|
||||
VIR_AUTOFREE(void *) nlData = NULL;
|
||||
g_autofree void *nlData = NULL;
|
||||
virArpTablePtr table = NULL;
|
||||
struct nlmsghdr* nh;
|
||||
struct rtattr * tb[NDA_MAX+1];
|
||||
@ -113,7 +113,7 @@ virArpTableGet(void)
|
||||
continue;
|
||||
|
||||
if (tb[NDA_DST]) {
|
||||
VIR_AUTOFREE(char *) ipstr = NULL;
|
||||
g_autofree char *ipstr = NULL;
|
||||
virSocketAddr virAddr;
|
||||
if (VIR_REALLOC_N(table->t, num + 1) < 0)
|
||||
goto cleanup;
|
||||
|
@ -96,7 +96,7 @@ void virAuditSend(virLogSourcePtr source,
|
||||
virAuditRecordType type G_GNUC_UNUSED, bool success,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
va_list args;
|
||||
|
||||
/* Duplicate later checks, to short circuit & avoid printf overhead
|
||||
|
@ -43,7 +43,7 @@ virAuthGetConfigFilePathURI(virURIPtr uri,
|
||||
{
|
||||
size_t i;
|
||||
const char *authenv = getenv("LIBVIRT_AUTH_FILE");
|
||||
VIR_AUTOFREE(char *) userdir = NULL;
|
||||
g_autofree char *userdir = NULL;
|
||||
|
||||
*path = NULL;
|
||||
|
||||
@ -145,7 +145,7 @@ virAuthGetUsernamePath(const char *path,
|
||||
{
|
||||
unsigned int ncred;
|
||||
virConnectCredential cred;
|
||||
VIR_AUTOFREE(char *) prompt = NULL;
|
||||
g_autofree char *prompt = NULL;
|
||||
char *ret = NULL;
|
||||
|
||||
if (virAuthGetCredential(servicename, hostname, "username", path, &ret) < 0)
|
||||
@ -210,7 +210,7 @@ virAuthGetUsername(virConnectPtr conn,
|
||||
const char *defaultUsername,
|
||||
const char *hostname)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
if (virAuthGetConfigFilePath(conn, &path) < 0)
|
||||
return NULL;
|
||||
@ -229,7 +229,7 @@ virAuthGetPasswordPath(const char *path,
|
||||
{
|
||||
unsigned int ncred;
|
||||
virConnectCredential cred;
|
||||
VIR_AUTOFREE(char *) prompt = NULL;
|
||||
g_autofree char *prompt = NULL;
|
||||
char *ret = NULL;
|
||||
|
||||
if (virAuthGetCredential(servicename, hostname, "password", path, &ret) < 0)
|
||||
@ -292,7 +292,7 @@ virAuthGetPassword(virConnectPtr conn,
|
||||
const char *username,
|
||||
const char *hostname)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
if (virAuthGetConfigFilePath(conn, &path) < 0)
|
||||
return NULL;
|
||||
|
@ -104,8 +104,8 @@ int virAuthConfigLookup(virAuthConfigPtr auth,
|
||||
const char *credname,
|
||||
const char **value)
|
||||
{
|
||||
VIR_AUTOFREE(char *) authgroup = NULL;
|
||||
VIR_AUTOFREE(char *) credgroup = NULL;
|
||||
g_autofree char *authgroup = NULL;
|
||||
g_autofree char *credgroup = NULL;
|
||||
const char *authcred;
|
||||
|
||||
*value = NULL;
|
||||
|
@ -436,7 +436,7 @@ void
|
||||
virBufferEscapeString(virBufferPtr buf, const char *format, const char *str)
|
||||
{
|
||||
int len;
|
||||
VIR_AUTOFREE(char *) escaped = NULL;
|
||||
g_autofree char *escaped = NULL;
|
||||
char *out;
|
||||
const char *cur;
|
||||
const char forbidden_characters[] = {
|
||||
@ -592,7 +592,7 @@ virBufferEscape(virBufferPtr buf, char escape, const char *toescape,
|
||||
const char *format, const char *str)
|
||||
{
|
||||
int len;
|
||||
VIR_AUTOFREE(char *) escaped = NULL;
|
||||
g_autofree char *escaped = NULL;
|
||||
char *out;
|
||||
const char *cur;
|
||||
|
||||
@ -689,7 +689,7 @@ void
|
||||
virBufferEscapeShell(virBufferPtr buf, const char *str)
|
||||
{
|
||||
int len;
|
||||
VIR_AUTOFREE(char *) escaped = NULL;
|
||||
g_autofree char *escaped = NULL;
|
||||
char *out;
|
||||
const char *cur;
|
||||
|
||||
|
@ -132,7 +132,7 @@ virCgroupPartitionNeedsEscaping(const char *path)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
int ret = 0;
|
||||
VIR_AUTOFREE(char *) line = NULL;
|
||||
g_autofree char *line = NULL;
|
||||
size_t buflen;
|
||||
|
||||
/* If it starts with 'cgroup.' or a '_' of any
|
||||
@ -284,7 +284,7 @@ virCgroupDetectPlacement(virCgroupPtr group,
|
||||
FILE *mapping = NULL;
|
||||
char line[1024];
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(char *) procfile = NULL;
|
||||
g_autofree char *procfile = NULL;
|
||||
|
||||
VIR_DEBUG("Detecting placement for pid %lld path %s",
|
||||
(long long) pid, path);
|
||||
@ -508,7 +508,7 @@ virCgroupSetValueStr(virCgroupPtr group,
|
||||
const char *key,
|
||||
const char *value)
|
||||
{
|
||||
VIR_AUTOFREE(char *) keypath = NULL;
|
||||
g_autofree char *keypath = NULL;
|
||||
|
||||
if (virCgroupPathOfController(group, controller, key, &keypath) < 0)
|
||||
return -1;
|
||||
@ -523,7 +523,7 @@ virCgroupGetValueStr(virCgroupPtr group,
|
||||
const char *key,
|
||||
char **value)
|
||||
{
|
||||
VIR_AUTOFREE(char *) keypath = NULL;
|
||||
g_autofree char *keypath = NULL;
|
||||
|
||||
if (virCgroupPathOfController(group, controller, key, &keypath) < 0)
|
||||
return -1;
|
||||
@ -537,7 +537,7 @@ virCgroupGetValueForBlkDev(const char *str,
|
||||
const char *path,
|
||||
char **value)
|
||||
{
|
||||
VIR_AUTOFREE(char *) prefix = NULL;
|
||||
g_autofree char *prefix = NULL;
|
||||
char **lines = NULL;
|
||||
int ret = -1;
|
||||
|
||||
@ -563,7 +563,7 @@ virCgroupSetValueU64(virCgroupPtr group,
|
||||
const char *key,
|
||||
unsigned long long int value)
|
||||
{
|
||||
VIR_AUTOFREE(char *) strval = NULL;
|
||||
g_autofree char *strval = NULL;
|
||||
|
||||
if (virAsprintf(&strval, "%llu", value) < 0)
|
||||
return -1;
|
||||
@ -578,7 +578,7 @@ virCgroupSetValueI64(virCgroupPtr group,
|
||||
const char *key,
|
||||
long long int value)
|
||||
{
|
||||
VIR_AUTOFREE(char *) strval = NULL;
|
||||
g_autofree char *strval = NULL;
|
||||
|
||||
if (virAsprintf(&strval, "%lld", value) < 0)
|
||||
return -1;
|
||||
@ -593,7 +593,7 @@ virCgroupGetValueI64(virCgroupPtr group,
|
||||
const char *key,
|
||||
long long int *value)
|
||||
{
|
||||
VIR_AUTOFREE(char *) strval = NULL;
|
||||
g_autofree char *strval = NULL;
|
||||
|
||||
if (virCgroupGetValueStr(group, controller, key, &strval) < 0)
|
||||
return -1;
|
||||
@ -615,7 +615,7 @@ virCgroupGetValueU64(virCgroupPtr group,
|
||||
const char *key,
|
||||
unsigned long long int *value)
|
||||
{
|
||||
VIR_AUTOFREE(char *) strval = NULL;
|
||||
g_autofree char *strval = NULL;
|
||||
|
||||
if (virCgroupGetValueStr(group, controller, key, &strval) < 0)
|
||||
return -1;
|
||||
@ -842,8 +842,8 @@ virCgroupNewPartition(const char *path,
|
||||
virCgroupPtr *group)
|
||||
{
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(char *) parentPath = NULL;
|
||||
VIR_AUTOFREE(char *) newPath = NULL;
|
||||
g_autofree char *parentPath = NULL;
|
||||
g_autofree char *newPath = NULL;
|
||||
virCgroupPtr parent = NULL;
|
||||
VIR_DEBUG("path=%s create=%d controllers=%x",
|
||||
path, create, controllers);
|
||||
@ -920,7 +920,7 @@ virCgroupNewDomainPartition(virCgroupPtr partition,
|
||||
bool create,
|
||||
virCgroupPtr *group)
|
||||
{
|
||||
VIR_AUTOFREE(char *)grpname = NULL;
|
||||
g_autofree char *grpname = NULL;
|
||||
|
||||
if (virAsprintf(&grpname, "%s.libvirt-%s",
|
||||
name, driver) < 0)
|
||||
@ -970,7 +970,7 @@ virCgroupNewThread(virCgroupPtr domain,
|
||||
bool create,
|
||||
virCgroupPtr *group)
|
||||
{
|
||||
VIR_AUTOFREE(char *) name = NULL;
|
||||
g_autofree char *name = NULL;
|
||||
int controllers;
|
||||
|
||||
switch (nameval) {
|
||||
@ -1123,7 +1123,7 @@ virCgroupNewMachineSystemd(const char *name,
|
||||
{
|
||||
int rv;
|
||||
virCgroupPtr init;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
size_t i;
|
||||
|
||||
VIR_DEBUG("Trying to setup machine '%s' via systemd", name);
|
||||
@ -2061,7 +2061,7 @@ virCgroupGetPercpuVcpuSum(virCgroupPtr group,
|
||||
virCgroupPtr group_vcpu = NULL;
|
||||
|
||||
while ((i = virBitmapNextSetBit(guestvcpus, i)) >= 0) {
|
||||
VIR_AUTOFREE(char *) buf = NULL;
|
||||
g_autofree char *buf = NULL;
|
||||
char *pos;
|
||||
unsigned long long tmp;
|
||||
ssize_t j;
|
||||
@ -2127,8 +2127,8 @@ virCgroupGetPercpuStats(virCgroupPtr group,
|
||||
size_t i;
|
||||
int need_cpus, total_cpus;
|
||||
char *pos;
|
||||
VIR_AUTOFREE(char *) buf = NULL;
|
||||
VIR_AUTOFREE(unsigned long long *) sum_cpu_time = NULL;
|
||||
g_autofree char *buf = NULL;
|
||||
g_autofree unsigned long long *sum_cpu_time = NULL;
|
||||
virTypedParameterPtr ent;
|
||||
int param_idx;
|
||||
unsigned long long cpu_time;
|
||||
@ -2359,7 +2359,7 @@ virCgroupRemoveRecursively(char *grppath)
|
||||
/* This is best-effort cleanup: we want to log failures with just
|
||||
* VIR_ERROR instead of normal virReportError */
|
||||
while ((direrr = virDirRead(grpdir, &ent, NULL)) > 0) {
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
if (ent->d_type != DT_DIR) continue;
|
||||
|
||||
@ -2429,7 +2429,7 @@ virCgroupKillInternal(virCgroupPtr group,
|
||||
{
|
||||
int ret = -1;
|
||||
bool killedAny = false;
|
||||
VIR_AUTOFREE(char *) keypath = NULL;
|
||||
g_autofree char *keypath = NULL;
|
||||
bool done = false;
|
||||
FILE *fp = NULL;
|
||||
VIR_DEBUG("group=%p path=%s signum=%d pids=%p",
|
||||
@ -2532,7 +2532,7 @@ virCgroupKillRecursiveInternal(virCgroupPtr group,
|
||||
int ret = -1;
|
||||
int rc;
|
||||
bool killedAny = false;
|
||||
VIR_AUTOFREE(char *) keypath = NULL;
|
||||
g_autofree char *keypath = NULL;
|
||||
DIR *dp = NULL;
|
||||
virCgroupPtr subgroup = NULL;
|
||||
struct dirent *ent;
|
||||
|
@ -92,10 +92,10 @@ virCgroupV1ValidateMachineGroup(virCgroupPtr group,
|
||||
const char *machinename)
|
||||
{
|
||||
size_t i;
|
||||
VIR_AUTOFREE(char *) partname = NULL;
|
||||
VIR_AUTOFREE(char *) scopename_old = NULL;
|
||||
VIR_AUTOFREE(char *) scopename_new = NULL;
|
||||
VIR_AUTOFREE(char *) partmachinename = NULL;
|
||||
g_autofree char *partname = NULL;
|
||||
g_autofree char *scopename_old = NULL;
|
||||
g_autofree char *scopename_new = NULL;
|
||||
g_autofree char *partmachinename = NULL;
|
||||
|
||||
if (virAsprintf(&partname, "%s.libvirt-%s",
|
||||
name, drivername) < 0)
|
||||
@ -228,8 +228,8 @@ virCgroupV1ResolveMountLink(const char *mntDir,
|
||||
const char *typeStr,
|
||||
virCgroupV1ControllerPtr controller)
|
||||
{
|
||||
VIR_AUTOFREE(char *) linkSrc = NULL;
|
||||
VIR_AUTOFREE(char *) tmp = NULL;
|
||||
g_autofree char *linkSrc = NULL;
|
||||
g_autofree char *tmp = NULL;
|
||||
char *dirName;
|
||||
struct stat sb;
|
||||
|
||||
@ -556,7 +556,7 @@ virCgroupV1CpuSetInherit(virCgroupPtr parent,
|
||||
|
||||
VIR_DEBUG("Setting up inheritance %s -> %s", parent->path, group->path);
|
||||
for (i = 0; i < G_N_ELEMENTS(inherit_values); i++) {
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
|
||||
if (virCgroupGetValueStr(parent,
|
||||
VIR_CGROUP_CONTROLLER_CPUSET,
|
||||
@ -612,7 +612,7 @@ virCgroupV1MakeGroup(virCgroupPtr parent,
|
||||
|
||||
VIR_DEBUG("Make group %s", group->path);
|
||||
for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
/* We must never mkdir() in systemd's hierarchy */
|
||||
if (i == VIR_CGROUP_CONTROLLER_SYSTEMD) {
|
||||
@ -682,7 +682,7 @@ virCgroupV1Remove(virCgroupPtr group)
|
||||
|
||||
VIR_DEBUG("Removing cgroup %s", group->path);
|
||||
for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
|
||||
VIR_AUTOFREE(char *) grppath = NULL;
|
||||
g_autofree char *grppath = NULL;
|
||||
|
||||
/* Skip over controllers not mounted */
|
||||
if (!group->legacy[i].mountPoint)
|
||||
@ -747,7 +747,7 @@ virCgroupV1HasEmptyTasks(virCgroupPtr cgroup,
|
||||
int controller)
|
||||
{
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(char *) content = NULL;
|
||||
g_autofree char *content = NULL;
|
||||
|
||||
if (!cgroup)
|
||||
return -1;
|
||||
@ -811,8 +811,8 @@ virCgroupV1BindMount(virCgroupPtr group,
|
||||
const char *mountopts)
|
||||
{
|
||||
size_t i;
|
||||
VIR_AUTOFREE(char *) opts = NULL;
|
||||
VIR_AUTOFREE(char *) root = NULL;
|
||||
g_autofree char *opts = NULL;
|
||||
g_autofree char *root = NULL;
|
||||
|
||||
if (!(root = virCgroupV1IdentifyRoot(group)))
|
||||
return -1;
|
||||
@ -842,7 +842,7 @@ virCgroupV1BindMount(virCgroupPtr group,
|
||||
continue;
|
||||
|
||||
if (!virFileExists(group->legacy[i].mountPoint)) {
|
||||
VIR_AUTOFREE(char *) src = NULL;
|
||||
g_autofree char *src = NULL;
|
||||
if (virAsprintf(&src, "%s%s",
|
||||
oldroot,
|
||||
group->legacy[i].mountPoint) < 0)
|
||||
@ -897,7 +897,7 @@ virCgroupV1SetOwner(virCgroupPtr cgroup,
|
||||
int direrr;
|
||||
|
||||
for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
|
||||
VIR_AUTOFREE(char *) base = NULL;
|
||||
g_autofree char *base = NULL;
|
||||
struct dirent *de;
|
||||
|
||||
if (!((1 << i) & controllers))
|
||||
@ -914,7 +914,7 @@ virCgroupV1SetOwner(virCgroupPtr cgroup,
|
||||
goto cleanup;
|
||||
|
||||
while ((direrr = virDirRead(dh, &de, base)) > 0) {
|
||||
VIR_AUTOFREE(char *) entry = NULL;
|
||||
g_autofree char *entry = NULL;
|
||||
|
||||
if (virAsprintf(&entry, "%s/%s", base, de->d_name) < 0)
|
||||
goto cleanup;
|
||||
@ -951,8 +951,8 @@ static int
|
||||
virCgroupV1SetBlkioWeight(virCgroupPtr group,
|
||||
unsigned int weight)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
|
||||
if (virCgroupV1PathOfController(group, VIR_CGROUP_CONTROLLER_BLKIO,
|
||||
"blkio.bfq.weight", &path) < 0) {
|
||||
@ -985,8 +985,8 @@ static int
|
||||
virCgroupV1GetBlkioWeight(virCgroupPtr group,
|
||||
unsigned int *weight)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
|
||||
if (virCgroupV1PathOfController(group, VIR_CGROUP_CONTROLLER_BLKIO,
|
||||
"blkio.bfq.weight", &path) < 0) {
|
||||
@ -1030,8 +1030,8 @@ virCgroupV1GetBlkioIoServiced(virCgroupPtr group,
|
||||
long long *requests_write)
|
||||
{
|
||||
long long stats_val;
|
||||
VIR_AUTOFREE(char *) str1 = NULL;
|
||||
VIR_AUTOFREE(char *) str2 = NULL;
|
||||
g_autofree char *str1 = NULL;
|
||||
g_autofree char *str2 = NULL;
|
||||
char *p1 = NULL;
|
||||
char *p2 = NULL;
|
||||
size_t i;
|
||||
@ -1124,9 +1124,9 @@ virCgroupV1GetBlkioIoDeviceServiced(virCgroupPtr group,
|
||||
long long *requests_read,
|
||||
long long *requests_write)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str1 = NULL;
|
||||
VIR_AUTOFREE(char *) str2 = NULL;
|
||||
VIR_AUTOFREE(char *) str3 = NULL;
|
||||
g_autofree char *str1 = NULL;
|
||||
g_autofree char *str2 = NULL;
|
||||
g_autofree char *str3 = NULL;
|
||||
char *p1 = NULL;
|
||||
char *p2 = NULL;
|
||||
size_t i;
|
||||
@ -1210,9 +1210,9 @@ virCgroupV1SetBlkioDeviceWeight(virCgroupPtr group,
|
||||
const char *devPath,
|
||||
unsigned int weight)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) blkstr = NULL;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *blkstr = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
if (!(blkstr = virCgroupGetBlockDevString(devPath)))
|
||||
return -1;
|
||||
@ -1240,9 +1240,9 @@ virCgroupV1GetBlkioDeviceWeight(virCgroupPtr group,
|
||||
const char *devPath,
|
||||
unsigned int *weight)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
if (virCgroupV1PathOfController(group, VIR_CGROUP_CONTROLLER_BLKIO,
|
||||
"blkio.weight_device", &path) < 0) {
|
||||
@ -1279,8 +1279,8 @@ virCgroupV1SetBlkioDeviceReadIops(virCgroupPtr group,
|
||||
const char *path,
|
||||
unsigned int riops)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) blkstr = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *blkstr = NULL;
|
||||
|
||||
if (!(blkstr = virCgroupGetBlockDevString(path)))
|
||||
return -1;
|
||||
@ -1300,8 +1300,8 @@ virCgroupV1GetBlkioDeviceReadIops(virCgroupPtr group,
|
||||
const char *path,
|
||||
unsigned int *riops)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
|
||||
if (virCgroupGetValueStr(group,
|
||||
VIR_CGROUP_CONTROLLER_BLKIO,
|
||||
@ -1331,8 +1331,8 @@ virCgroupV1SetBlkioDeviceWriteIops(virCgroupPtr group,
|
||||
const char *path,
|
||||
unsigned int wiops)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) blkstr = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *blkstr = NULL;
|
||||
|
||||
if (!(blkstr = virCgroupGetBlockDevString(path)))
|
||||
return -1;
|
||||
@ -1352,8 +1352,8 @@ virCgroupV1GetBlkioDeviceWriteIops(virCgroupPtr group,
|
||||
const char *path,
|
||||
unsigned int *wiops)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
|
||||
if (virCgroupGetValueStr(group,
|
||||
VIR_CGROUP_CONTROLLER_BLKIO,
|
||||
@ -1383,8 +1383,8 @@ virCgroupV1SetBlkioDeviceReadBps(virCgroupPtr group,
|
||||
const char *path,
|
||||
unsigned long long rbps)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) blkstr = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *blkstr = NULL;
|
||||
|
||||
if (!(blkstr = virCgroupGetBlockDevString(path)))
|
||||
return -1;
|
||||
@ -1404,8 +1404,8 @@ virCgroupV1GetBlkioDeviceReadBps(virCgroupPtr group,
|
||||
const char *path,
|
||||
unsigned long long *rbps)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
|
||||
if (virCgroupGetValueStr(group,
|
||||
VIR_CGROUP_CONTROLLER_BLKIO,
|
||||
@ -1435,8 +1435,8 @@ virCgroupV1SetBlkioDeviceWriteBps(virCgroupPtr group,
|
||||
const char *path,
|
||||
unsigned long long wbps)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) blkstr = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *blkstr = NULL;
|
||||
|
||||
if (!(blkstr = virCgroupGetBlockDevString(path)))
|
||||
return -1;
|
||||
@ -1456,8 +1456,8 @@ virCgroupV1GetBlkioDeviceWriteBps(virCgroupPtr group,
|
||||
const char *path,
|
||||
unsigned long long *wbps)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
|
||||
if (virCgroupGetValueStr(group,
|
||||
VIR_CGROUP_CONTROLLER_BLKIO,
|
||||
@ -1787,9 +1787,9 @@ virCgroupV1AllowDevice(virCgroupPtr group,
|
||||
int minor,
|
||||
int perms)
|
||||
{
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
VIR_AUTOFREE(char *) majorstr = NULL;
|
||||
VIR_AUTOFREE(char *) minorstr = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
g_autofree char *majorstr = NULL;
|
||||
g_autofree char *minorstr = NULL;
|
||||
|
||||
if ((major < 0 && VIR_STRDUP(majorstr, "*") < 0) ||
|
||||
(major >= 0 && virAsprintf(&majorstr, "%i", major) < 0))
|
||||
@ -1820,9 +1820,9 @@ virCgroupV1DenyDevice(virCgroupPtr group,
|
||||
int minor,
|
||||
int perms)
|
||||
{
|
||||
VIR_AUTOFREE(char *) devstr = NULL;
|
||||
VIR_AUTOFREE(char *) majorstr = NULL;
|
||||
VIR_AUTOFREE(char *) minorstr = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
g_autofree char *majorstr = NULL;
|
||||
g_autofree char *minorstr = NULL;
|
||||
|
||||
if ((major < 0 && VIR_STRDUP(majorstr, "*") < 0) ||
|
||||
(major >= 0 && virAsprintf(&majorstr, "%i", major) < 0))
|
||||
@ -1958,7 +1958,7 @@ virCgroupV1GetCpuCfsQuota(virCgroupPtr group,
|
||||
static bool
|
||||
virCgroupV1SupportsCpuBW(virCgroupPtr cgroup)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
if (!cgroup)
|
||||
return false;
|
||||
@ -1997,7 +1997,7 @@ virCgroupV1GetCpuacctStat(virCgroupPtr group,
|
||||
unsigned long long *user,
|
||||
unsigned long long *sys)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
char *p;
|
||||
static double scale = -1.0;
|
||||
|
||||
|
@ -66,8 +66,8 @@ virCgroupV2Available(void)
|
||||
return false;
|
||||
|
||||
while (getmntent_r(mounts, &entry, buf, sizeof(buf)) != NULL) {
|
||||
VIR_AUTOFREE(char *) contFile = NULL;
|
||||
VIR_AUTOFREE(char *) contStr = NULL;
|
||||
g_autofree char *contFile = NULL;
|
||||
g_autofree char *contStr = NULL;
|
||||
|
||||
if (STRNEQ(entry.mnt_type, "cgroup2"))
|
||||
continue;
|
||||
@ -100,8 +100,8 @@ virCgroupV2ValidateMachineGroup(virCgroupPtr group,
|
||||
const char *drivername,
|
||||
const char *machinename)
|
||||
{
|
||||
VIR_AUTOFREE(char *) partmachinename = NULL;
|
||||
VIR_AUTOFREE(char *) scopename = NULL;
|
||||
g_autofree char *partmachinename = NULL;
|
||||
g_autofree char *scopename = NULL;
|
||||
char *tmp;
|
||||
|
||||
if (virAsprintf(&partmachinename, "%s.libvirt-%s", machinename,
|
||||
@ -255,8 +255,8 @@ virCgroupV2ParseControllersFile(virCgroupPtr group,
|
||||
virCgroupPtr parent)
|
||||
{
|
||||
int rc;
|
||||
VIR_AUTOFREE(char *) contStr = NULL;
|
||||
VIR_AUTOFREE(char *) contFile = NULL;
|
||||
g_autofree char *contStr = NULL;
|
||||
g_autofree char *contFile = NULL;
|
||||
char **contList = NULL;
|
||||
char **tmp;
|
||||
|
||||
@ -379,8 +379,8 @@ virCgroupV2EnableController(virCgroupPtr group,
|
||||
int controller,
|
||||
bool report)
|
||||
{
|
||||
VIR_AUTOFREE(char *) val = NULL;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *val = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
if (virAsprintf(&val, "+%s",
|
||||
virCgroupV2ControllerTypeToString(controller)) < 0) {
|
||||
@ -413,7 +413,7 @@ virCgroupV2MakeGroup(virCgroupPtr parent,
|
||||
bool create,
|
||||
unsigned int flags)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
int controller;
|
||||
|
||||
if (flags & VIR_CGROUP_SYSTEMD) {
|
||||
@ -490,7 +490,7 @@ virCgroupV2MakeGroup(virCgroupPtr parent,
|
||||
static int
|
||||
virCgroupV2Remove(virCgroupPtr group)
|
||||
{
|
||||
VIR_AUTOFREE(char *) grppath = NULL;
|
||||
g_autofree char *grppath = NULL;
|
||||
int controller;
|
||||
|
||||
/* Don't delete the root group, if we accidentally
|
||||
@ -525,7 +525,7 @@ virCgroupV2HasEmptyTasks(virCgroupPtr cgroup,
|
||||
int controller)
|
||||
{
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(char *) content = NULL;
|
||||
g_autofree char *content = NULL;
|
||||
|
||||
ret = virCgroupGetValueStr(cgroup, controller, "cgroup.procs", &content);
|
||||
|
||||
@ -556,8 +556,8 @@ virCgroupV2BindMount(virCgroupPtr group,
|
||||
const char *oldroot,
|
||||
const char *mountopts)
|
||||
{
|
||||
VIR_AUTOFREE(char *) opts = NULL;
|
||||
VIR_AUTOFREE(char *) src = NULL;
|
||||
g_autofree char *opts = NULL;
|
||||
g_autofree char *src = NULL;
|
||||
|
||||
VIR_DEBUG("Mounting cgroups at '%s'", group->unified.mountPoint);
|
||||
|
||||
@ -589,7 +589,7 @@ virCgroupV2SetOwner(virCgroupPtr cgroup,
|
||||
gid_t gid,
|
||||
int controllers G_GNUC_UNUSED)
|
||||
{
|
||||
VIR_AUTOFREE(char *) base = NULL;
|
||||
g_autofree char *base = NULL;
|
||||
|
||||
if (virAsprintf(&base, "%s%s", cgroup->unified.mountPoint,
|
||||
cgroup->unified.placement) < 0) {
|
||||
@ -613,8 +613,8 @@ static int
|
||||
virCgroupV2SetBlkioWeight(virCgroupPtr group,
|
||||
unsigned int weight)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
const char *format = "%u";
|
||||
|
||||
if (virCgroupV2PathOfController(group, VIR_CGROUP_CONTROLLER_BLKIO,
|
||||
@ -649,8 +649,8 @@ static int
|
||||
virCgroupV2GetBlkioWeight(virCgroupPtr group,
|
||||
unsigned int *weight)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
char *tmp;
|
||||
|
||||
if (virCgroupV2PathOfController(group, VIR_CGROUP_CONTROLLER_BLKIO,
|
||||
@ -701,7 +701,7 @@ virCgroupV2GetBlkioIoServiced(virCgroupPtr group,
|
||||
long long *requests_write)
|
||||
{
|
||||
long long stats_val;
|
||||
VIR_AUTOFREE(char *) str1 = NULL;
|
||||
g_autofree char *str1 = NULL;
|
||||
char *p1;
|
||||
size_t i;
|
||||
|
||||
@ -765,8 +765,8 @@ virCgroupV2GetBlkioIoDeviceServiced(virCgroupPtr group,
|
||||
long long *requests_read,
|
||||
long long *requests_write)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str1 = NULL;
|
||||
VIR_AUTOFREE(char *) str2 = NULL;
|
||||
g_autofree char *str1 = NULL;
|
||||
g_autofree char *str2 = NULL;
|
||||
char *p1;
|
||||
size_t i;
|
||||
|
||||
@ -825,9 +825,9 @@ virCgroupV2SetBlkioDeviceWeight(virCgroupPtr group,
|
||||
const char *devPath,
|
||||
unsigned int weight)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) blkstr = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *blkstr = NULL;
|
||||
|
||||
if (!(blkstr = virCgroupGetBlockDevString(devPath)))
|
||||
return -1;
|
||||
@ -855,9 +855,9 @@ virCgroupV2GetBlkioDeviceWeight(virCgroupPtr group,
|
||||
const char *devPath,
|
||||
unsigned int *weight)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
char *tmp;
|
||||
|
||||
if (virCgroupV2PathOfController(group, VIR_CGROUP_CONTROLLER_BLKIO,
|
||||
@ -895,8 +895,8 @@ virCgroupV2SetBlkioDeviceReadIops(virCgroupPtr group,
|
||||
const char *path,
|
||||
unsigned int riops)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) blkstr = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *blkstr = NULL;
|
||||
|
||||
if (!(blkstr = virCgroupGetBlockDevString(path)))
|
||||
return -1;
|
||||
@ -921,8 +921,8 @@ virCgroupV2GetBlkioDeviceReadIops(virCgroupPtr group,
|
||||
const char *path,
|
||||
unsigned int *riops)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
const char *name = "riops=";
|
||||
char *tmp;
|
||||
|
||||
@ -966,8 +966,8 @@ virCgroupV2SetBlkioDeviceWriteIops(virCgroupPtr group,
|
||||
const char *path,
|
||||
unsigned int wiops)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) blkstr = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *blkstr = NULL;
|
||||
|
||||
if (!(blkstr = virCgroupGetBlockDevString(path)))
|
||||
return -1;
|
||||
@ -992,8 +992,8 @@ virCgroupV2GetBlkioDeviceWriteIops(virCgroupPtr group,
|
||||
const char *path,
|
||||
unsigned int *wiops)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
const char *name = "wiops=";
|
||||
char *tmp;
|
||||
|
||||
@ -1037,8 +1037,8 @@ virCgroupV2SetBlkioDeviceReadBps(virCgroupPtr group,
|
||||
const char *path,
|
||||
unsigned long long rbps)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) blkstr = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *blkstr = NULL;
|
||||
|
||||
if (!(blkstr = virCgroupGetBlockDevString(path)))
|
||||
return -1;
|
||||
@ -1063,8 +1063,8 @@ virCgroupV2GetBlkioDeviceReadBps(virCgroupPtr group,
|
||||
const char *path,
|
||||
unsigned long long *rbps)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
const char *name = "rbps=";
|
||||
char *tmp;
|
||||
|
||||
@ -1108,8 +1108,8 @@ virCgroupV2SetBlkioDeviceWriteBps(virCgroupPtr group,
|
||||
const char *path,
|
||||
unsigned long long wbps)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) blkstr = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *blkstr = NULL;
|
||||
|
||||
if (!(blkstr = virCgroupGetBlockDevString(path)))
|
||||
return -1;
|
||||
@ -1134,8 +1134,8 @@ virCgroupV2GetBlkioDeviceWriteBps(virCgroupPtr group,
|
||||
const char *path,
|
||||
unsigned long long *wbps)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
const char *name = "wbps=";
|
||||
char *tmp;
|
||||
|
||||
@ -1210,7 +1210,7 @@ virCgroupV2GetMemoryStat(virCgroupPtr group,
|
||||
unsigned long long *inactiveFile,
|
||||
unsigned long long *unevictable)
|
||||
{
|
||||
VIR_AUTOFREE(char *) stat = NULL;
|
||||
g_autofree char *stat = NULL;
|
||||
char *line = NULL;
|
||||
unsigned long long cacheVal = 0;
|
||||
unsigned long long activeAnonVal = 0;
|
||||
@ -1306,7 +1306,7 @@ static int
|
||||
virCgroupV2GetMemoryHardLimit(virCgroupPtr group,
|
||||
unsigned long long *kb)
|
||||
{
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
unsigned long long max;
|
||||
|
||||
if (virCgroupGetValueStr(group,
|
||||
@ -1366,7 +1366,7 @@ static int
|
||||
virCgroupV2GetMemorySoftLimit(virCgroupPtr group,
|
||||
unsigned long long *kb)
|
||||
{
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
unsigned long long high;
|
||||
|
||||
if (virCgroupGetValueStr(group,
|
||||
@ -1425,7 +1425,7 @@ static int
|
||||
virCgroupV2GetMemSwapHardLimit(virCgroupPtr group,
|
||||
unsigned long long *kb)
|
||||
{
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
unsigned long long max;
|
||||
|
||||
if (virCgroupGetValueStr(group,
|
||||
@ -1493,8 +1493,8 @@ static int
|
||||
virCgroupV2SetCpuCfsPeriod(virCgroupPtr group,
|
||||
unsigned long long cfs_period)
|
||||
{
|
||||
VIR_AUTOFREE(char *) value = NULL;
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *value = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
char *tmp;
|
||||
|
||||
/* The cfs_period should be greater or equal than 1ms, and less or equal
|
||||
@ -1531,7 +1531,7 @@ static int
|
||||
virCgroupV2GetCpuCfsPeriod(virCgroupPtr group,
|
||||
unsigned long long *cfs_period)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
char *tmp;
|
||||
|
||||
if (virCgroupGetValueStr(group, VIR_CGROUP_CONTROLLER_CPU,
|
||||
@ -1585,7 +1585,7 @@ static int
|
||||
virCgroupV2GetCpuCfsQuota(virCgroupPtr group,
|
||||
long long *cfs_quota)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
char *tmp;
|
||||
|
||||
if (virCgroupGetValueStr(group, VIR_CGROUP_CONTROLLER_CPU,
|
||||
@ -1611,7 +1611,7 @@ virCgroupV2GetCpuCfsQuota(virCgroupPtr group,
|
||||
static bool
|
||||
virCgroupV2SupportsCpuBW(virCgroupPtr cgroup)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
if (virCgroupV2PathOfController(cgroup, VIR_CGROUP_CONTROLLER_CPU,
|
||||
"cpu.max", &path) < 0) {
|
||||
@ -1627,7 +1627,7 @@ static int
|
||||
virCgroupV2GetCpuacctUsage(virCgroupPtr group,
|
||||
unsigned long long *usage)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
char *tmp;
|
||||
|
||||
if (virCgroupGetValueStr(group, VIR_CGROUP_CONTROLLER_CPUACCT,
|
||||
@ -1659,7 +1659,7 @@ virCgroupV2GetCpuacctStat(virCgroupPtr group,
|
||||
unsigned long long *user,
|
||||
unsigned long long *sys)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
char *tmp;
|
||||
unsigned long long userVal = 0;
|
||||
unsigned long long sysVal = 0;
|
||||
|
@ -547,11 +547,11 @@ virExec(virCommandPtr cmd)
|
||||
int childin = cmd->infd;
|
||||
int childout = -1;
|
||||
int childerr = -1;
|
||||
VIR_AUTOFREE(char *) binarystr = NULL;
|
||||
g_autofree char *binarystr = NULL;
|
||||
const char *binary = NULL;
|
||||
int ret;
|
||||
struct sigaction waxon, waxoff;
|
||||
VIR_AUTOFREE(gid_t *) groups = NULL;
|
||||
g_autofree gid_t *groups = NULL;
|
||||
int ngroups;
|
||||
|
||||
if (cmd->args[0][0] != '/') {
|
||||
@ -2170,7 +2170,7 @@ virCommandProcessIO(virCommandPtr cmd)
|
||||
size_t inlen = 0, outlen = 0, errlen = 0;
|
||||
size_t inoff = 0;
|
||||
int ret = 0;
|
||||
VIR_AUTOFREE(struct pollfd *) fds = NULL;
|
||||
g_autofree struct pollfd *fds = NULL;
|
||||
|
||||
if (dryRunBuffer || dryRunCallback) {
|
||||
VIR_DEBUG("Dry run requested, skipping I/O processing");
|
||||
@ -2541,7 +2541,7 @@ int
|
||||
virCommandRunAsync(virCommandPtr cmd, pid_t *pid)
|
||||
{
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
size_t i;
|
||||
bool synchronous = false;
|
||||
int infd[2] = {-1, -1};
|
||||
@ -2757,8 +2757,8 @@ virCommandWait(virCommandPtr cmd, int *exitstatus)
|
||||
if (exitstatus && (cmd->rawStatus || WIFEXITED(status))) {
|
||||
*exitstatus = cmd->rawStatus ? status : WEXITSTATUS(status);
|
||||
} else if (status) {
|
||||
VIR_AUTOFREE(char *) str = virCommandToString(cmd, false);
|
||||
VIR_AUTOFREE(char *) st = virProcessTranslateStatus(status);
|
||||
g_autofree char *str = virCommandToString(cmd, false);
|
||||
g_autofree char *st = virProcessTranslateStatus(status);
|
||||
bool haveErrMsg = cmd->errbuf && *cmd->errbuf && (*cmd->errbuf)[0];
|
||||
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@ -2885,7 +2885,7 @@ int virCommandHandshakeWait(virCommandPtr cmd)
|
||||
return -1;
|
||||
}
|
||||
if (c != '1') {
|
||||
VIR_AUTOFREE(char *) msg = NULL;
|
||||
g_autofree char *msg = NULL;
|
||||
ssize_t len;
|
||||
if (VIR_ALLOC_N(msg, 1024) < 0) {
|
||||
VIR_FORCE_CLOSE(cmd->handshakeWait[0]);
|
||||
@ -3021,7 +3021,7 @@ virCommandFree(virCommandPtr cmd)
|
||||
* combination with virCommandRunAsync():
|
||||
*
|
||||
* VIR_AUTOPTR(virCommand) cmd = virCommandNew*(...);
|
||||
* VIR_AUTOFREE(char *) buf = NULL;
|
||||
* g_autofree char *buf = NULL;
|
||||
*
|
||||
* ...
|
||||
*
|
||||
@ -3133,11 +3133,11 @@ virCommandRunRegex(virCommandPtr cmd,
|
||||
{
|
||||
int err;
|
||||
regex_t *reg;
|
||||
VIR_AUTOFREE(regmatch_t *) vars = NULL;
|
||||
g_autofree regmatch_t *vars = NULL;
|
||||
size_t i, j, k;
|
||||
int totgroups = 0, ngroup = 0, maxvars = 0;
|
||||
char **groups;
|
||||
VIR_AUTOFREE(char *) outbuf = NULL;
|
||||
g_autofree char *outbuf = NULL;
|
||||
VIR_AUTOSTRINGLIST lines = NULL;
|
||||
int ret = -1;
|
||||
|
||||
|
@ -1481,8 +1481,8 @@ virLastErrorPrefixMessage(const char *fmt, ...)
|
||||
{
|
||||
int save_errno = errno;
|
||||
virErrorPtr err = virGetLastError();
|
||||
VIR_AUTOFREE(char *) fmtmsg = NULL;
|
||||
VIR_AUTOFREE(char *) newmsg = NULL;
|
||||
g_autofree char *fmtmsg = NULL;
|
||||
g_autofree char *newmsg = NULL;
|
||||
va_list args;
|
||||
|
||||
if (!err)
|
||||
|
@ -613,7 +613,7 @@ static void virEventPollCleanupHandles(void)
|
||||
*/
|
||||
int virEventPollRunOnce(void)
|
||||
{
|
||||
VIR_AUTOFREE(struct pollfd *) fds = NULL;
|
||||
g_autofree struct pollfd *fds = NULL;
|
||||
int ret, timeout, nfds;
|
||||
|
||||
virMutexLock(&eventLoop.lock);
|
||||
|
@ -38,7 +38,7 @@
|
||||
bool
|
||||
virFCIsCapableRport(const char *rport)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
if (virBuildPath(&path, SYSFS_FC_RPORT_PATH, rport) < 0)
|
||||
return false;
|
||||
@ -51,7 +51,7 @@ virFCReadRportValue(const char *rport,
|
||||
const char *entry,
|
||||
char **result)
|
||||
{
|
||||
VIR_AUTOFREE(char *) buf = NULL;
|
||||
g_autofree char *buf = NULL;
|
||||
char *p = NULL;
|
||||
|
||||
if (virFileReadValueString(&buf, "%s/%s/%s",
|
||||
|
@ -216,7 +216,7 @@ virFileWrapperFdNew(int *fd, const char *name, unsigned int flags)
|
||||
bool output = false;
|
||||
int pipefd[2] = { -1, -1 };
|
||||
int mode = -1;
|
||||
VIR_AUTOFREE(char *) iohelper_path = NULL;
|
||||
g_autofree char *iohelper_path = NULL;
|
||||
|
||||
if (!flags) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
@ -504,7 +504,7 @@ virFileRewrite(const char *path,
|
||||
virFileRewriteFunc rewrite,
|
||||
const void *opaque)
|
||||
{
|
||||
VIR_AUTOFREE(char *) newfile = NULL;
|
||||
g_autofree char *newfile = NULL;
|
||||
int fd = -1;
|
||||
int ret = -1;
|
||||
|
||||
@ -772,7 +772,7 @@ int virFileLoopDeviceAssociate(const char *file,
|
||||
int lofd = -1;
|
||||
int fsfd = -1;
|
||||
struct loop_info64 lo;
|
||||
VIR_AUTOFREE(char *) loname = NULL;
|
||||
g_autofree char *loname = NULL;
|
||||
int ret = -1;
|
||||
|
||||
if ((lofd = virFileLoopDeviceOpen(&loname)) < 0)
|
||||
@ -832,7 +832,7 @@ int virFileLoopDeviceAssociate(const char *file,
|
||||
static int
|
||||
virFileNBDDeviceIsBusy(const char *dev_name)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
if (virAsprintf(&path, SYSFS_BLOCK_DIR "/%s/pid",
|
||||
dev_name) < 0)
|
||||
@ -892,7 +892,7 @@ virFileNBDLoadDriver(void)
|
||||
"administratively prohibited"));
|
||||
return false;
|
||||
} else {
|
||||
VIR_AUTOFREE(char *) errbuf = NULL;
|
||||
g_autofree char *errbuf = NULL;
|
||||
|
||||
if ((errbuf = virKModLoad(NBD_DRIVER, true))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
@ -908,8 +908,8 @@ int virFileNBDDeviceAssociate(const char *file,
|
||||
bool readonly,
|
||||
char **dev)
|
||||
{
|
||||
VIR_AUTOFREE(char *) nbddev = NULL;
|
||||
VIR_AUTOFREE(char *) qemunbd = NULL;
|
||||
g_autofree char *nbddev = NULL;
|
||||
g_autofree char *qemunbd = NULL;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
const char *fmtstr = NULL;
|
||||
|
||||
@ -1010,7 +1010,7 @@ int virFileDeleteTree(const char *dir)
|
||||
return -1;
|
||||
|
||||
while ((direrr = virDirRead(dh, &de, dir)) > 0) {
|
||||
VIR_AUTOFREE(char *) filepath = NULL;
|
||||
g_autofree char *filepath = NULL;
|
||||
struct stat sb;
|
||||
|
||||
if (virAsprintf(&filepath, "%s/%s",
|
||||
@ -1187,7 +1187,7 @@ static int
|
||||
safezero_slow(int fd, off_t offset, off_t len)
|
||||
{
|
||||
int r;
|
||||
VIR_AUTOFREE(char *) buf = NULL;
|
||||
g_autofree char *buf = NULL;
|
||||
unsigned long long remain, bytes;
|
||||
|
||||
if (lseek(fd, offset, SEEK_SET) < 0)
|
||||
@ -1546,7 +1546,7 @@ virFileRelLinkPointsTo(const char *directory,
|
||||
const char *checkLink,
|
||||
const char *checkDest)
|
||||
{
|
||||
VIR_AUTOFREE(char *) candidate = NULL;
|
||||
g_autofree char *candidate = NULL;
|
||||
|
||||
if (*checkLink == '/')
|
||||
return virFileLinkPointsTo(checkLink, checkDest);
|
||||
@ -1905,7 +1905,7 @@ virFileIsExecutable(const char *file)
|
||||
*/
|
||||
int virFileIsMountPoint(const char *file)
|
||||
{
|
||||
VIR_AUTOFREE(char *) parent = NULL;
|
||||
g_autofree char *parent = NULL;
|
||||
int ret;
|
||||
struct stat sb1, sb2;
|
||||
|
||||
@ -2114,7 +2114,7 @@ virFileAccessibleAs(const char *path, int mode,
|
||||
{
|
||||
pid_t pid = 0;
|
||||
int status, ret = 0;
|
||||
VIR_AUTOFREE(gid_t *) groups = NULL;
|
||||
g_autofree gid_t *groups = NULL;
|
||||
int ngroups;
|
||||
|
||||
if (uid == geteuid() &&
|
||||
@ -2226,7 +2226,7 @@ virFileOpenForked(const char *path, int openflags, mode_t mode,
|
||||
int recvfd_errno = 0;
|
||||
int fd = -1;
|
||||
int pair[2] = { -1, -1 };
|
||||
VIR_AUTOFREE(gid_t *) groups = NULL;
|
||||
g_autofree gid_t *groups = NULL;
|
||||
int ngroups;
|
||||
bool created = false;
|
||||
|
||||
@ -2514,7 +2514,7 @@ virFileRemove(const char *path,
|
||||
{
|
||||
pid_t pid;
|
||||
int status = 0, ret = 0;
|
||||
VIR_AUTOFREE(gid_t *) groups = NULL;
|
||||
g_autofree gid_t *groups = NULL;
|
||||
int ngroups;
|
||||
|
||||
if (!virFileRemoveNeedsSetuid(path, uid, gid)) {
|
||||
@ -2675,7 +2675,7 @@ virDirCreate(const char *path,
|
||||
struct stat st;
|
||||
pid_t pid;
|
||||
int status = 0, ret = 0;
|
||||
VIR_AUTOFREE(gid_t *) groups = NULL;
|
||||
g_autofree gid_t *groups = NULL;
|
||||
int ngroups;
|
||||
bool created = false;
|
||||
|
||||
@ -2984,7 +2984,7 @@ int virFileChownFiles(const char *name,
|
||||
return -1;
|
||||
|
||||
while ((direrr = virDirRead(dir, &ent, name)) > 0) {
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
if (virAsprintf(&path, "%s/%s", name, ent->d_name) < 0)
|
||||
goto cleanup;
|
||||
@ -3068,7 +3068,7 @@ int
|
||||
virFileMakePathWithMode(const char *path,
|
||||
mode_t mode)
|
||||
{
|
||||
VIR_AUTOFREE(char *) tmp = NULL;
|
||||
g_autofree char *tmp = NULL;
|
||||
|
||||
if (VIR_STRDUP(tmp, path) < 0) {
|
||||
errno = ENOMEM;
|
||||
@ -3083,7 +3083,7 @@ int
|
||||
virFileMakeParentPath(const char *path)
|
||||
{
|
||||
char *p;
|
||||
VIR_AUTOFREE(char *) tmp = NULL;
|
||||
g_autofree char *tmp = NULL;
|
||||
|
||||
VIR_DEBUG("path=%s", path);
|
||||
|
||||
@ -3132,7 +3132,7 @@ virFileOpenTty(int *ttymaster, char **ttyName, int rawmode)
|
||||
* doesn't have to worry about that mess? */
|
||||
int ret = -1;
|
||||
int slave = -1;
|
||||
VIR_AUTOFREE(char *) name = NULL;
|
||||
g_autofree char *name = NULL;
|
||||
|
||||
/* Unfortunately, we can't use the name argument of openpty, since
|
||||
* there is no guarantee on how large the buffer has to be.
|
||||
@ -3296,7 +3296,7 @@ virFileAbsPath(const char *path, char **abspath)
|
||||
if (VIR_STRDUP(*abspath, path) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
VIR_AUTOFREE(char *) buf = getcwd(NULL, 0);
|
||||
g_autofree char *buf = getcwd(NULL, 0);
|
||||
|
||||
if (buf == NULL)
|
||||
return -1;
|
||||
@ -3402,7 +3402,7 @@ virFileRemoveLastComponent(char *path)
|
||||
int virFilePrintf(FILE *fp, const char *msg, ...)
|
||||
{
|
||||
va_list vargs;
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
int ret;
|
||||
|
||||
va_start(vargs, msg);
|
||||
@ -3534,7 +3534,7 @@ int
|
||||
virFileIsSharedFSType(const char *path,
|
||||
int fstypes)
|
||||
{
|
||||
VIR_AUTOFREE(char *) dirpath = NULL;
|
||||
g_autofree char *dirpath = NULL;
|
||||
char *p = NULL;
|
||||
struct statfs sb;
|
||||
int statfs_ret;
|
||||
@ -3650,7 +3650,7 @@ virFileGetHugepageSize(const char *path,
|
||||
static int
|
||||
virFileGetDefaultHugepageSize(unsigned long long *size)
|
||||
{
|
||||
VIR_AUTOFREE(char *) meminfo = NULL;
|
||||
g_autofree char *meminfo = NULL;
|
||||
char *c;
|
||||
char *n;
|
||||
char *unit;
|
||||
@ -3999,8 +3999,8 @@ virFileCopyACLs(const char *src,
|
||||
int
|
||||
virFileComparePaths(const char *p1, const char *p2)
|
||||
{
|
||||
VIR_AUTOFREE(char *) res1 = NULL;
|
||||
VIR_AUTOFREE(char *) res2 = NULL;
|
||||
g_autofree char *res1 = NULL;
|
||||
g_autofree char *res2 = NULL;
|
||||
|
||||
/* Assume p1 and p2 are symlinks, so try to resolve and canonicalize them.
|
||||
* Canonicalization fails for example on file systems names like 'proc' or
|
||||
@ -4166,8 +4166,8 @@ virFileInData(int fd G_GNUC_UNUSED,
|
||||
int
|
||||
virFileReadValueInt(int *value, const char *format, ...)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
@ -4209,8 +4209,8 @@ virFileReadValueInt(int *value, const char *format, ...)
|
||||
int
|
||||
virFileReadValueUint(unsigned int *value, const char *format, ...)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
@ -4252,8 +4252,8 @@ virFileReadValueUint(unsigned int *value, const char *format, ...)
|
||||
int
|
||||
virFileReadValueScaledInt(unsigned long long *value, const char *format, ...)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
char *endp = NULL;
|
||||
va_list ap;
|
||||
|
||||
@ -4299,8 +4299,8 @@ virFileReadValueScaledInt(unsigned long long *value, const char *format, ...)
|
||||
int
|
||||
virFileReadValueBitmap(virBitmapPtr *value, const char *format, ...)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
@ -4341,7 +4341,7 @@ int
|
||||
virFileReadValueString(char **value, const char *format, ...)
|
||||
{
|
||||
int ret;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
|
@ -100,7 +100,7 @@ static char *
|
||||
virFileCacheGetFileName(virFileCachePtr cache,
|
||||
const char *name)
|
||||
{
|
||||
VIR_AUTOFREE(char *) namehash = NULL;
|
||||
g_autofree char *namehash = NULL;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
if (virCryptoHashString(VIR_CRYPTO_HASH_SHA256, name, &namehash) < 0)
|
||||
@ -130,7 +130,7 @@ virFileCacheLoad(virFileCachePtr cache,
|
||||
const char *name,
|
||||
void **data)
|
||||
{
|
||||
VIR_AUTOFREE(char *) file = NULL;
|
||||
g_autofree char *file = NULL;
|
||||
int ret = -1;
|
||||
void *loadData = NULL;
|
||||
|
||||
@ -182,7 +182,7 @@ virFileCacheSave(virFileCachePtr cache,
|
||||
const char *name,
|
||||
void *data)
|
||||
{
|
||||
VIR_AUTOFREE(char *) file = NULL;
|
||||
g_autofree char *file = NULL;
|
||||
|
||||
if (!(file = virFileCacheGetFileName(cache, name)))
|
||||
return -1;
|
||||
@ -335,7 +335,7 @@ virFileCacheLookupByFunc(virFileCachePtr cache,
|
||||
const void *iterData)
|
||||
{
|
||||
void *data = NULL;
|
||||
VIR_AUTOFREE(char *) name = NULL;
|
||||
g_autofree char *name = NULL;
|
||||
|
||||
virObjectLock(cache);
|
||||
|
||||
|
@ -504,7 +504,7 @@ void virFirewallRuleAddArgFormat(virFirewallPtr firewall,
|
||||
virFirewallRulePtr rule,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
VIR_AUTOFREE(char *) arg = NULL;
|
||||
g_autofree char *arg = NULL;
|
||||
va_list list;
|
||||
|
||||
VIR_FIREWALL_RULE_RETURN_IF_ERROR(firewall, rule);
|
||||
@ -668,7 +668,7 @@ virFirewallApplyRuleDirect(virFirewallRulePtr rule,
|
||||
const char *bin = virFirewallLayerCommandTypeToString(rule->layer);
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
int status;
|
||||
VIR_AUTOFREE(char *) error = NULL;
|
||||
g_autofree char *error = NULL;
|
||||
|
||||
if (!bin) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@ -692,7 +692,7 @@ virFirewallApplyRuleDirect(virFirewallRulePtr rule,
|
||||
if (ignoreErrors) {
|
||||
VIR_DEBUG("Ignoring error running command");
|
||||
} else {
|
||||
VIR_AUTOFREE(char *) args = virCommandToString(cmd, false);
|
||||
g_autofree char *args = virCommandToString(cmd, false);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to apply firewall rules %s: %s"),
|
||||
NULLSTR(args), NULLSTR(error));
|
||||
@ -719,8 +719,8 @@ virFirewallApplyRule(virFirewallPtr firewall,
|
||||
virFirewallRulePtr rule,
|
||||
bool ignoreErrors)
|
||||
{
|
||||
VIR_AUTOFREE(char *) output = NULL;
|
||||
VIR_AUTOFREE(char *) str = virFirewallRuleToString(rule);
|
||||
g_autofree char *output = NULL;
|
||||
g_autofree char *str = virFirewallRuleToString(rule);
|
||||
VIR_AUTOSTRINGLIST lines = NULL;
|
||||
VIR_INFO("Applying rule '%s'", NULLSTR(str));
|
||||
|
||||
|
@ -85,7 +85,7 @@ virFirewallDGetVersion(unsigned long *version)
|
||||
int ret = -1;
|
||||
DBusConnection *sysbus = virDBusGetSystemBus();
|
||||
DBusMessage *reply = NULL;
|
||||
VIR_AUTOFREE(char *) versionStr = NULL;
|
||||
g_autofree char *versionStr = NULL;
|
||||
|
||||
if (!sysbus)
|
||||
return -1;
|
||||
@ -132,7 +132,7 @@ virFirewallDGetBackend(void)
|
||||
DBusConnection *sysbus = virDBusGetSystemBus();
|
||||
DBusMessage *reply = NULL;
|
||||
virError error;
|
||||
VIR_AUTOFREE(char *) backendStr = NULL;
|
||||
g_autofree char *backendStr = NULL;
|
||||
int backend = -1;
|
||||
|
||||
if (!sysbus)
|
||||
|
@ -131,7 +131,7 @@ static int virHooksFound = -1;
|
||||
static int
|
||||
virHookCheck(int no, const char *driver)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
if (driver == NULL) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@ -240,7 +240,7 @@ virHookCall(int driver,
|
||||
char **output)
|
||||
{
|
||||
int ret;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
const char *drvstr;
|
||||
const char *opstr;
|
||||
|
@ -179,7 +179,7 @@ virHostdevManagerNew(void)
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
VIR_AUTOFREE(char *) rundir = NULL;
|
||||
g_autofree char *rundir = NULL;
|
||||
mode_t old_umask;
|
||||
|
||||
if (!(rundir = virGetUserRuntimeDirectory()))
|
||||
@ -306,7 +306,7 @@ virHostdevPCISysfsPath(virDomainHostdevDefPtr hostdev,
|
||||
static int
|
||||
virHostdevIsVirtualFunction(virDomainHostdevDefPtr hostdev)
|
||||
{
|
||||
VIR_AUTOFREE(char *) sysfs_path = NULL;
|
||||
g_autofree char *sysfs_path = NULL;
|
||||
|
||||
if (virHostdevPCISysfsPath(hostdev, &sysfs_path) < 0)
|
||||
return -1;
|
||||
@ -321,7 +321,7 @@ virHostdevNetDevice(virDomainHostdevDefPtr hostdev,
|
||||
char **linkdev,
|
||||
int *vf)
|
||||
{
|
||||
VIR_AUTOFREE(char *) sysfs_path = NULL;
|
||||
g_autofree char *sysfs_path = NULL;
|
||||
|
||||
if (virHostdevPCISysfsPath(hostdev, &sysfs_path) < 0)
|
||||
return -1;
|
||||
@ -447,7 +447,7 @@ static int
|
||||
virHostdevSaveNetConfig(virDomainHostdevDefPtr hostdev,
|
||||
const char *stateDir)
|
||||
{
|
||||
VIR_AUTOFREE(char *) linkdev = NULL;
|
||||
g_autofree char *linkdev = NULL;
|
||||
int vf = -1;
|
||||
|
||||
if (!virHostdevIsPCINetDevice(hostdev) ||
|
||||
@ -486,7 +486,7 @@ static int
|
||||
virHostdevSetNetConfig(virDomainHostdevDefPtr hostdev,
|
||||
const unsigned char *uuid)
|
||||
{
|
||||
VIR_AUTOFREE(char *) linkdev = NULL;
|
||||
g_autofree char *linkdev = NULL;
|
||||
virNetDevVlanPtr vlan;
|
||||
virNetDevVPortProfilePtr virtPort;
|
||||
int vf = -1;
|
||||
@ -534,9 +534,9 @@ virHostdevRestoreNetConfig(virDomainHostdevDefPtr hostdev,
|
||||
const char *stateDir,
|
||||
const char *oldStateDir)
|
||||
{
|
||||
VIR_AUTOFREE(char *) linkdev = NULL;
|
||||
VIR_AUTOFREE(virMacAddrPtr) MAC = NULL;
|
||||
VIR_AUTOFREE(virMacAddrPtr) adminMAC = NULL;
|
||||
g_autofree char *linkdev = NULL;
|
||||
g_autofree virMacAddrPtr MAC = NULL;
|
||||
g_autofree virMacAddrPtr adminMAC = NULL;
|
||||
VIR_AUTOPTR(virNetDevVlan) vlan = NULL;
|
||||
virNetDevVPortProfilePtr virtPort;
|
||||
int vf = -1;
|
||||
@ -804,8 +804,8 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
|
||||
mgr->inactivePCIHostdevs) < 0)
|
||||
goto reattachdevs;
|
||||
} else {
|
||||
VIR_AUTOFREE(char *) driverPath = NULL;
|
||||
VIR_AUTOFREE(char *) driverName = NULL;
|
||||
g_autofree char *driverPath = NULL;
|
||||
g_autofree char *driverName = NULL;
|
||||
int stub;
|
||||
|
||||
/* Unmanaged devices should already have been marked as
|
||||
|
@ -255,7 +255,7 @@ virHostMemGetStats(int cellNum G_GNUC_UNUSED,
|
||||
#ifdef __linux__
|
||||
{
|
||||
int ret;
|
||||
VIR_AUTOFREE(char *) meminfo_path = NULL;
|
||||
g_autofree char *meminfo_path = NULL;
|
||||
FILE *meminfo;
|
||||
int max_node;
|
||||
|
||||
@ -312,8 +312,8 @@ virHostMemGetStats(int cellNum G_GNUC_UNUSED,
|
||||
static int
|
||||
virHostMemSetParameterValue(virTypedParameterPtr param)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
VIR_AUTOFREE(char *) strval = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
g_autofree char *strval = NULL;
|
||||
int rc = -1;
|
||||
|
||||
char *field = strchr(param->field, '_');
|
||||
@ -341,7 +341,7 @@ virHostMemParametersAreAllSupported(virTypedParameterPtr params,
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < nparams; i++) {
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
virTypedParameterPtr param = ¶ms[i];
|
||||
|
||||
char *field = strchr(param->field, '_');
|
||||
@ -408,8 +408,8 @@ static int
|
||||
virHostMemGetParameterValue(const char *field,
|
||||
void *value)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
VIR_AUTOFREE(char *) buf = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
g_autofree char *buf = NULL;
|
||||
char *tmp = NULL;
|
||||
int rc = -1;
|
||||
|
||||
|
@ -344,7 +344,7 @@ static char *iptablesFormatNetwork(virSocketAddr *netaddr,
|
||||
unsigned int prefix)
|
||||
{
|
||||
virSocketAddr network;
|
||||
VIR_AUTOFREE(char *) netstr = NULL;
|
||||
g_autofree char *netstr = NULL;
|
||||
char *ret;
|
||||
|
||||
if (!(VIR_SOCKET_ADDR_IS_FAMILY(netaddr, AF_INET) ||
|
||||
@ -383,7 +383,7 @@ iptablesForwardAllowOut(virFirewallPtr fw,
|
||||
const char *physdev,
|
||||
int action)
|
||||
{
|
||||
VIR_AUTOFREE(char *) networkstr = NULL;
|
||||
g_autofree char *networkstr = NULL;
|
||||
virFirewallLayer layer = VIR_SOCKET_ADDR_FAMILY(netaddr) == AF_INET ?
|
||||
VIR_FIREWALL_LAYER_IPV4 : VIR_FIREWALL_LAYER_IPV6;
|
||||
|
||||
@ -474,7 +474,7 @@ iptablesForwardAllowRelatedIn(virFirewallPtr fw,
|
||||
{
|
||||
virFirewallLayer layer = VIR_SOCKET_ADDR_FAMILY(netaddr) == AF_INET ?
|
||||
VIR_FIREWALL_LAYER_IPV4 : VIR_FIREWALL_LAYER_IPV6;
|
||||
VIR_AUTOFREE(char *) networkstr = NULL;
|
||||
g_autofree char *networkstr = NULL;
|
||||
|
||||
if (!(networkstr = iptablesFormatNetwork(netaddr, prefix)))
|
||||
return -1;
|
||||
@ -565,7 +565,7 @@ iptablesForwardAllowIn(virFirewallPtr fw,
|
||||
{
|
||||
virFirewallLayer layer = VIR_SOCKET_ADDR_FAMILY(netaddr) == AF_INET ?
|
||||
VIR_FIREWALL_LAYER_IPV4 : VIR_FIREWALL_LAYER_IPV6;
|
||||
VIR_AUTOFREE(char *) networkstr = NULL;
|
||||
g_autofree char *networkstr = NULL;
|
||||
|
||||
if (!(networkstr = iptablesFormatNetwork(netaddr, prefix)))
|
||||
return -1;
|
||||
@ -813,11 +813,11 @@ iptablesForwardMasquerade(virFirewallPtr fw,
|
||||
const char *protocol,
|
||||
int action)
|
||||
{
|
||||
VIR_AUTOFREE(char *) networkstr = NULL;
|
||||
VIR_AUTOFREE(char *) addrStartStr = NULL;
|
||||
VIR_AUTOFREE(char *) addrEndStr = NULL;
|
||||
VIR_AUTOFREE(char *) portRangeStr = NULL;
|
||||
VIR_AUTOFREE(char *) natRangeStr = NULL;
|
||||
g_autofree char *networkstr = NULL;
|
||||
g_autofree char *addrStartStr = NULL;
|
||||
g_autofree char *addrEndStr = NULL;
|
||||
g_autofree char *portRangeStr = NULL;
|
||||
g_autofree char *natRangeStr = NULL;
|
||||
virFirewallRulePtr rule;
|
||||
|
||||
if (!(networkstr = iptablesFormatNetwork(netaddr, prefix)))
|
||||
@ -974,7 +974,7 @@ iptablesForwardDontMasquerade(virFirewallPtr fw,
|
||||
const char *destaddr,
|
||||
int action)
|
||||
{
|
||||
VIR_AUTOFREE(char *) networkstr = NULL;
|
||||
g_autofree char *networkstr = NULL;
|
||||
|
||||
if (!(networkstr = iptablesFormatNetwork(netaddr, prefix)))
|
||||
return -1;
|
||||
|
@ -88,7 +88,7 @@ virISCSIGetSession(const char *devpath,
|
||||
.devpath = devpath,
|
||||
};
|
||||
int exitstatus = 0;
|
||||
VIR_AUTOFREE(char *) error = NULL;
|
||||
g_autofree char *error = NULL;
|
||||
|
||||
VIR_AUTOPTR(virCommand) cmd = virCommandNewArgList(ISCSIADM, "--mode",
|
||||
"session", NULL);
|
||||
@ -122,9 +122,9 @@ virStorageBackendIQNFound(const char *initiatoriqn,
|
||||
{
|
||||
int ret = IQN_ERROR;
|
||||
char *line = NULL;
|
||||
VIR_AUTOFREE(char *) outbuf = NULL;
|
||||
VIR_AUTOFREE(char *) iface = NULL;
|
||||
VIR_AUTOFREE(char *) iqn = NULL;
|
||||
g_autofree char *outbuf = NULL;
|
||||
g_autofree char *iface = NULL;
|
||||
g_autofree char *iqn = NULL;
|
||||
VIR_AUTOPTR(virCommand) cmd = virCommandNewArgList(ISCSIADM,
|
||||
"--mode", "iface", NULL);
|
||||
|
||||
@ -208,8 +208,8 @@ virStorageBackendCreateIfaceIQN(const char *initiatoriqn,
|
||||
char **ifacename)
|
||||
{
|
||||
int exitstatus = -1;
|
||||
VIR_AUTOFREE(char *) iface_name = NULL;
|
||||
VIR_AUTOFREE(char *) temp_ifacename = NULL;
|
||||
g_autofree char *iface_name = NULL;
|
||||
g_autofree char *temp_ifacename = NULL;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
|
||||
if (virAsprintf(&temp_ifacename,
|
||||
@ -286,7 +286,7 @@ virISCSIConnection(const char *portal,
|
||||
NULL
|
||||
};
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
VIR_AUTOFREE(char *) ifacename = NULL;
|
||||
g_autofree char *ifacename = NULL;
|
||||
|
||||
cmd = virCommandNewArgs(baseargv);
|
||||
virCommandAddArgSet(cmd, extraargv);
|
||||
@ -369,7 +369,7 @@ virISCSIGetTargets(char **const groups,
|
||||
void *data)
|
||||
{
|
||||
struct virISCSITargetList *list = data;
|
||||
VIR_AUTOFREE(char *) target = NULL;
|
||||
g_autofree char *target = NULL;
|
||||
|
||||
if (VIR_STRDUP(target, groups[1]) < 0)
|
||||
return -1;
|
||||
@ -471,7 +471,7 @@ virISCSIScanTargets(const char *portal,
|
||||
size_t *ntargets,
|
||||
char ***targets)
|
||||
{
|
||||
VIR_AUTOFREE(char *) ifacename = NULL;
|
||||
g_autofree char *ifacename = NULL;
|
||||
|
||||
if (ntargets)
|
||||
*ntargets = 0;
|
||||
|
@ -502,7 +502,7 @@ virJSONValueNewNumber(const char *data)
|
||||
virJSONValuePtr
|
||||
virJSONValueNewNumberInt(int data)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
if (virAsprintf(&str, "%i", data) < 0)
|
||||
return NULL;
|
||||
return virJSONValueNewNumber(str);
|
||||
@ -512,7 +512,7 @@ virJSONValueNewNumberInt(int data)
|
||||
virJSONValuePtr
|
||||
virJSONValueNewNumberUint(unsigned int data)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
if (virAsprintf(&str, "%u", data) < 0)
|
||||
return NULL;
|
||||
return virJSONValueNewNumber(str);
|
||||
@ -522,7 +522,7 @@ virJSONValueNewNumberUint(unsigned int data)
|
||||
virJSONValuePtr
|
||||
virJSONValueNewNumberLong(long long data)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
if (virAsprintf(&str, "%lld", data) < 0)
|
||||
return NULL;
|
||||
return virJSONValueNewNumber(str);
|
||||
@ -532,7 +532,7 @@ virJSONValueNewNumberLong(long long data)
|
||||
virJSONValuePtr
|
||||
virJSONValueNewNumberUlong(unsigned long long data)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
if (virAsprintf(&str, "%llu", data) < 0)
|
||||
return NULL;
|
||||
return virJSONValueNewNumber(str);
|
||||
@ -542,7 +542,7 @@ virJSONValueNewNumberUlong(unsigned long long data)
|
||||
virJSONValuePtr
|
||||
virJSONValueNewNumberDouble(double data)
|
||||
{
|
||||
VIR_AUTOFREE(char *) str = NULL;
|
||||
g_autofree char *str = NULL;
|
||||
if (virDoubleToStr(&str, data) < 0)
|
||||
return NULL;
|
||||
return virJSONValueNewNumber(str);
|
||||
@ -1215,7 +1215,7 @@ virJSONValueGetArrayAsBitmap(const virJSONValue *val,
|
||||
{
|
||||
virJSONValuePtr elem;
|
||||
size_t i;
|
||||
VIR_AUTOFREE(unsigned long long *) elems = NULL;
|
||||
g_autofree unsigned long long *elems = NULL;
|
||||
unsigned long long maxelem = 0;
|
||||
|
||||
*bitmap = NULL;
|
||||
|
@ -146,8 +146,8 @@ bool
|
||||
virKModIsBlacklisted(const char *module)
|
||||
{
|
||||
size_t i;
|
||||
VIR_AUTOFREE(char *) drvblklst = NULL;
|
||||
VIR_AUTOFREE(char *) outbuf = NULL;
|
||||
g_autofree char *drvblklst = NULL;
|
||||
g_autofree char *outbuf = NULL;
|
||||
|
||||
if (virAsprintfQuiet(&drvblklst, "blacklist %s\n", module) < 0)
|
||||
return false;
|
||||
|
@ -48,7 +48,7 @@ virLeaseReadCustomLeaseFile(virJSONValuePtr leases_array_new,
|
||||
const char *ip_to_delete,
|
||||
char **server_duid)
|
||||
{
|
||||
VIR_AUTOFREE(char *) lease_entries = NULL;
|
||||
g_autofree char *lease_entries = NULL;
|
||||
VIR_AUTOPTR(virJSONValue) leases_array = NULL;
|
||||
long long expirytime;
|
||||
int custom_lease_file_len = 0;
|
||||
@ -215,7 +215,7 @@ virLeaseNew(virJSONValuePtr *lease_ret,
|
||||
VIR_AUTOPTR(virJSONValue) lease_new = NULL;
|
||||
const char *exptime_tmp = getenv("DNSMASQ_LEASE_EXPIRES");
|
||||
long long expirytime = 0;
|
||||
VIR_AUTOFREE(char *) exptime = NULL;
|
||||
g_autofree char *exptime = NULL;
|
||||
|
||||
/* In case hostname is still unknown, use the last known one */
|
||||
if (!hostname)
|
||||
|
@ -76,8 +76,8 @@ static int
|
||||
virMediatedDeviceGetSysfsDeviceAPI(virMediatedDevicePtr dev,
|
||||
char **device_api)
|
||||
{
|
||||
VIR_AUTOFREE(char *) buf = NULL;
|
||||
VIR_AUTOFREE(char *) file = NULL;
|
||||
g_autofree char *buf = NULL;
|
||||
g_autofree char *file = NULL;
|
||||
char *tmp = NULL;
|
||||
|
||||
if (virAsprintf(&file, "%s/mdev_type/device_api", dev->path) < 0)
|
||||
@ -108,7 +108,7 @@ static int
|
||||
virMediatedDeviceCheckModel(virMediatedDevicePtr dev,
|
||||
virMediatedDeviceModelType model)
|
||||
{
|
||||
VIR_AUTOFREE(char *) dev_api = NULL;
|
||||
g_autofree char *dev_api = NULL;
|
||||
int actual_model;
|
||||
|
||||
if (virMediatedDeviceGetSysfsDeviceAPI(dev, &dev_api) < 0)
|
||||
@ -142,7 +142,7 @@ virMediatedDeviceNew(const char *uuidstr, virMediatedDeviceModelType model)
|
||||
{
|
||||
virMediatedDevicePtr ret = NULL;
|
||||
VIR_AUTOPTR(virMediatedDevice) dev = NULL;
|
||||
VIR_AUTOFREE(char *) sysfspath = NULL;
|
||||
g_autofree char *sysfspath = NULL;
|
||||
|
||||
if (!(sysfspath = virMediatedDeviceGetSysfsPath(uuidstr)))
|
||||
return NULL;
|
||||
@ -210,9 +210,9 @@ virMediatedDeviceGetPath(virMediatedDevicePtr dev)
|
||||
char *
|
||||
virMediatedDeviceGetIOMMUGroupDev(const char *uuidstr)
|
||||
{
|
||||
VIR_AUTOFREE(char *) result_path = NULL;
|
||||
VIR_AUTOFREE(char *) iommu_path = NULL;
|
||||
VIR_AUTOFREE(char *) dev_path = virMediatedDeviceGetSysfsPath(uuidstr);
|
||||
g_autofree char *result_path = NULL;
|
||||
g_autofree char *iommu_path = NULL;
|
||||
g_autofree char *dev_path = virMediatedDeviceGetSysfsPath(uuidstr);
|
||||
char *vfio_path = NULL;
|
||||
|
||||
if (!dev_path)
|
||||
@ -241,7 +241,7 @@ virMediatedDeviceGetIOMMUGroupDev(const char *uuidstr)
|
||||
int
|
||||
virMediatedDeviceGetIOMMUGroupNum(const char *uuidstr)
|
||||
{
|
||||
VIR_AUTOFREE(char *) vfio_path = NULL;
|
||||
g_autofree char *vfio_path = NULL;
|
||||
char *group_num_str = NULL;
|
||||
unsigned int group_num = -1;
|
||||
|
||||
|
@ -120,7 +120,7 @@ static int virNetDevBridgeSet(const char *brname,
|
||||
int fd, /* control socket */
|
||||
struct ifreq *ifr) /* pre-filled bridge name */
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
if (virAsprintf(&path, SYSFS_NET_DIR "%s/bridge/%s", brname, paramname) < 0)
|
||||
return -1;
|
||||
@ -162,14 +162,14 @@ static int virNetDevBridgeGet(const char *brname,
|
||||
unsigned long *value) /* current value */
|
||||
{
|
||||
struct ifreq ifr;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
VIR_AUTOCLOSE fd = -1;
|
||||
|
||||
if (virAsprintf(&path, SYSFS_NET_DIR "%s/bridge/%s", brname, paramname) < 0)
|
||||
return -1;
|
||||
|
||||
if (virFileExists(path)) {
|
||||
VIR_AUTOFREE(char *) valuestr = NULL;
|
||||
g_autofree char *valuestr = NULL;
|
||||
|
||||
if (virFileReadAll(path, INT_BUFSIZE_BOUND(unsigned long),
|
||||
&valuestr) < 0)
|
||||
@ -219,7 +219,7 @@ virNetDevBridgePortSet(const char *brname,
|
||||
{
|
||||
char valuestr[INT_BUFSIZE_BOUND(value)];
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
snprintf(valuestr, sizeof(valuestr), "%lu", value);
|
||||
|
||||
@ -248,8 +248,8 @@ virNetDevBridgePortGet(const char *brname,
|
||||
const char *paramname,
|
||||
unsigned long *value)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
VIR_AUTOFREE(char *) valuestr = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
g_autofree char *valuestr = NULL;
|
||||
|
||||
if (virAsprintf(&path, SYSFS_NET_DIR "%s/brif/%s/%s",
|
||||
brname, ifname, paramname) < 0)
|
||||
@ -953,7 +953,7 @@ virNetDevBridgeFDBAddDel(const virMacAddr *mac, const char *ifname,
|
||||
unsigned int recvbuflen;
|
||||
struct ndmsg ndm = { .ndm_family = PF_BRIDGE, .ndm_state = NUD_NOARP };
|
||||
VIR_AUTOPTR(virNetlinkMsg) nl_msg = NULL;
|
||||
VIR_AUTOFREE(struct nlmsghdr *) resp = NULL;
|
||||
g_autofree struct nlmsghdr *resp = NULL;
|
||||
|
||||
if (virNetDevGetIndex(ifname, &ndm.ndm_ifindex) < 0)
|
||||
return -1;
|
||||
|
@ -168,10 +168,10 @@ virNetDevIPAddrAdd(const char *ifname,
|
||||
unsigned int recvbuflen;
|
||||
VIR_AUTOPTR(virNetlinkMsg) nlmsg = NULL;
|
||||
VIR_AUTOPTR(virSocketAddr) broadcast = NULL;
|
||||
VIR_AUTOFREE(struct nlmsghdr *) resp = NULL;
|
||||
VIR_AUTOFREE(char *) ipStr = NULL;
|
||||
VIR_AUTOFREE(char *) peerStr = NULL;
|
||||
VIR_AUTOFREE(char *) bcastStr = NULL;
|
||||
g_autofree struct nlmsghdr *resp = NULL;
|
||||
g_autofree char *ipStr = NULL;
|
||||
g_autofree char *peerStr = NULL;
|
||||
g_autofree char *bcastStr = NULL;
|
||||
|
||||
ipStr = virSocketAddrFormat(addr);
|
||||
if (peer && VIR_SOCKET_ADDR_VALID(peer))
|
||||
@ -240,7 +240,7 @@ virNetDevIPAddrDel(const char *ifname,
|
||||
{
|
||||
unsigned int recvbuflen;
|
||||
VIR_AUTOPTR(virNetlinkMsg) nlmsg = NULL;
|
||||
VIR_AUTOFREE(struct nlmsghdr *) resp = NULL;
|
||||
g_autofree struct nlmsghdr *resp = NULL;
|
||||
|
||||
if (!(nlmsg = virNetDevCreateNetlinkAddressMessage(RTM_DELADDR, ifname,
|
||||
addr, prefix,
|
||||
@ -290,9 +290,9 @@ virNetDevIPRouteAdd(const char *ifname,
|
||||
virSocketAddr defaultAddr;
|
||||
virSocketAddrPtr actualAddr;
|
||||
VIR_AUTOPTR(virNetlinkMsg) nlmsg = NULL;
|
||||
VIR_AUTOFREE(char *) toStr = NULL;
|
||||
VIR_AUTOFREE(char *) viaStr = NULL;
|
||||
VIR_AUTOFREE(struct nlmsghdr *) resp = NULL;
|
||||
g_autofree char *toStr = NULL;
|
||||
g_autofree char *viaStr = NULL;
|
||||
g_autofree struct nlmsghdr *resp = NULL;
|
||||
|
||||
actualAddr = addr;
|
||||
|
||||
@ -450,7 +450,7 @@ virNetDevIPWaitDadFinish(virSocketAddrPtr *addrs, size_t count)
|
||||
|
||||
/* Periodically query netlink until DAD finishes on all known addresses. */
|
||||
while (dad && time(NULL) < max_time) {
|
||||
VIR_AUTOFREE(struct nlmsghdr *) resp = NULL;
|
||||
g_autofree struct nlmsghdr *resp = NULL;
|
||||
|
||||
if (virNetlinkCommand(nlmsg, &resp, &recvbuflen, 0, 0,
|
||||
NETLINK_ROUTE, 0) < 0)
|
||||
@ -482,8 +482,8 @@ virNetDevIPWaitDadFinish(virSocketAddrPtr *addrs, size_t count)
|
||||
static int
|
||||
virNetDevIPGetAcceptRA(const char *ifname)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
VIR_AUTOFREE(char *) buf = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
g_autofree char *buf = NULL;
|
||||
char *suffix;
|
||||
int accept_ra = -1;
|
||||
|
||||
@ -534,7 +534,7 @@ virNetDevIPCheckIPv6ForwardingCallback(struct nlmsghdr *resp,
|
||||
struct rtattr *rta_attr;
|
||||
int accept_ra = -1;
|
||||
int ifindex = -1;
|
||||
VIR_AUTOFREE(char *) ifname = NULL;
|
||||
g_autofree char *ifname = NULL;
|
||||
|
||||
/* Ignore messages other than route ones */
|
||||
if (resp->nlmsg_type != RTM_NEWROUTE)
|
||||
@ -689,9 +689,9 @@ virNetDevIPAddrAdd(const char *ifname,
|
||||
{
|
||||
virSocketAddr broadcast;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
VIR_AUTOFREE(char *) addrstr = NULL;
|
||||
VIR_AUTOFREE(char *) bcaststr = NULL;
|
||||
VIR_AUTOFREE(char *) peerstr = NULL;
|
||||
g_autofree char *addrstr = NULL;
|
||||
g_autofree char *bcaststr = NULL;
|
||||
g_autofree char *peerstr = NULL;
|
||||
|
||||
if (!(addrstr = virSocketAddrFormat(addr)))
|
||||
return -1;
|
||||
@ -744,7 +744,7 @@ virNetDevIPAddrDel(const char *ifname,
|
||||
unsigned int prefix)
|
||||
{
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
VIR_AUTOFREE(char *) addrstr = NULL;
|
||||
g_autofree char *addrstr = NULL;
|
||||
|
||||
if (!(addrstr = virSocketAddrFormat(addr)))
|
||||
return -1;
|
||||
@ -779,8 +779,8 @@ virNetDevIPRouteAdd(const char *ifname,
|
||||
unsigned int metric)
|
||||
{
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
VIR_AUTOFREE(char *) addrstr = NULL;
|
||||
VIR_AUTOFREE(char *) gatewaystr = NULL;
|
||||
g_autofree char *addrstr = NULL;
|
||||
g_autofree char *gatewaystr = NULL;
|
||||
|
||||
if (!(addrstr = virSocketAddrFormat(addr)))
|
||||
return -1;
|
||||
@ -1072,7 +1072,7 @@ virNetDevIPInfoAddToDev(const char *ifname,
|
||||
{
|
||||
size_t i;
|
||||
int prefix;
|
||||
VIR_AUTOFREE(char *) ipStr = NULL;
|
||||
g_autofree char *ipStr = NULL;
|
||||
|
||||
/* add all IP addresses */
|
||||
for (i = 0; i < ipInfo->nips; i++) {
|
||||
|
@ -289,7 +289,7 @@ bool
|
||||
virNetDevMacVLanIsMacvtap(const char *ifname)
|
||||
{
|
||||
int ifindex;
|
||||
VIR_AUTOFREE(char *) tapname = NULL;
|
||||
g_autofree char *tapname = NULL;
|
||||
|
||||
if (virNetDevGetIndex(ifname, &ifindex) < 0)
|
||||
return false;
|
||||
@ -388,7 +388,7 @@ virNetDevMacVLanTapOpen(const char *ifname,
|
||||
int ret = -1;
|
||||
int ifindex;
|
||||
size_t i = 0;
|
||||
VIR_AUTOFREE(char *) tapname = NULL;
|
||||
g_autofree char *tapname = NULL;
|
||||
|
||||
if (virNetDevGetIndex(ifname, &ifindex) < 0)
|
||||
return -1;
|
||||
|
@ -142,10 +142,10 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
|
||||
char ifuuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
char vmuuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
VIR_AUTOFREE(char *) attachedmac_ex_id = NULL;
|
||||
VIR_AUTOFREE(char *) ifaceid_ex_id = NULL;
|
||||
VIR_AUTOFREE(char *) profile_ex_id = NULL;
|
||||
VIR_AUTOFREE(char *) vmid_ex_id = NULL;
|
||||
g_autofree char *attachedmac_ex_id = NULL;
|
||||
g_autofree char *ifaceid_ex_id = NULL;
|
||||
g_autofree char *profile_ex_id = NULL;
|
||||
g_autofree char *vmid_ex_id = NULL;
|
||||
|
||||
virMacAddrFormat(macaddr, macaddrstr);
|
||||
virUUIDFormat(ovsport->interfaceID, ifuuidstr);
|
||||
@ -387,7 +387,7 @@ virNetDevOpenvswitchInterfaceStats(const char *ifname,
|
||||
virDomainInterfaceStatsPtr stats)
|
||||
{
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
VIR_AUTOFREE(char *) output = NULL;
|
||||
g_autofree char *output = NULL;
|
||||
|
||||
cmd = virCommandNew(OVSVSCTL);
|
||||
virNetDevOpenvswitchAddTimeout(cmd);
|
||||
|
@ -393,7 +393,7 @@ int virNetDevTapCreate(char **ifname,
|
||||
if (strstr(*ifname, "%d") != NULL) {
|
||||
size_t i;
|
||||
for (i = 0; i <= IF_MAXUNIT; i++) {
|
||||
VIR_AUTOFREE(char *) newname = NULL;
|
||||
g_autofree char *newname = NULL;
|
||||
|
||||
if (virAsprintf(&newname, *ifname, i) < 0)
|
||||
goto cleanup;
|
||||
@ -415,7 +415,7 @@ int virNetDevTapCreate(char **ifname,
|
||||
}
|
||||
|
||||
if (tapfd) {
|
||||
VIR_AUTOFREE(char *) dev_path = NULL;
|
||||
g_autofree char *dev_path = NULL;
|
||||
if (virAsprintf(&dev_path, "/dev/%s", ifr.ifr_name) < 0)
|
||||
goto cleanup;
|
||||
|
||||
@ -580,7 +580,7 @@ virNetDevTapReattachBridge(const char *tapname,
|
||||
unsigned int *actualMTU)
|
||||
{
|
||||
bool useOVS = false;
|
||||
VIR_AUTOFREE(char *) master = NULL;
|
||||
g_autofree char *master = NULL;
|
||||
|
||||
if (virNetDevGetMaster(tapname, &master) < 0)
|
||||
return -1;
|
||||
|
@ -42,7 +42,7 @@ virMutex virNetDevVethCreateMutex = VIR_MUTEX_INITIALIZER;
|
||||
static int virNetDevVethExists(int devNum)
|
||||
{
|
||||
int ret;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
if (virAsprintf(&path, SYSFS_NET_DIR "vnet%d/", devNum) < 0)
|
||||
return -1;
|
||||
@ -118,8 +118,8 @@ int virNetDevVethCreate(char** veth1, char** veth2)
|
||||
#define MAX_VETH_RETRIES 10
|
||||
|
||||
for (i = 0; i < MAX_VETH_RETRIES; i++) {
|
||||
VIR_AUTOFREE(char *) veth1auto = NULL;
|
||||
VIR_AUTOFREE(char *) veth2auto = NULL;
|
||||
g_autofree char *veth1auto = NULL;
|
||||
g_autofree char *veth2auto = NULL;
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
|
||||
int status;
|
||||
|
@ -296,7 +296,7 @@ int virNetlinkCommand(struct nl_msg *nl_msg,
|
||||
.nl_groups = 0,
|
||||
};
|
||||
struct pollfd fds[1];
|
||||
VIR_AUTOFREE(struct nlmsghdr *) temp_resp = NULL;
|
||||
g_autofree struct nlmsghdr *temp_resp = NULL;
|
||||
VIR_AUTOPTR(virNetlinkHandle) nlhandle = NULL;
|
||||
int len = 0;
|
||||
|
||||
@ -345,7 +345,7 @@ virNetlinkDumpCommand(struct nl_msg *nl_msg,
|
||||
return -1;
|
||||
|
||||
while (!end) {
|
||||
VIR_AUTOFREE(struct nlmsghdr *) resp = NULL;
|
||||
g_autofree struct nlmsghdr *resp = NULL;
|
||||
|
||||
len = nl_recv(nlhandle, &nladdr, (unsigned char **)&resp, NULL);
|
||||
VIR_WARNINGS_NO_CAST_ALIGN
|
||||
@ -397,7 +397,7 @@ virNetlinkDumpLink(const char *ifname, int ifindex,
|
||||
};
|
||||
unsigned int recvbuflen;
|
||||
VIR_AUTOPTR(virNetlinkMsg) nl_msg = NULL;
|
||||
VIR_AUTOFREE(struct nlmsghdr *) resp = NULL;
|
||||
g_autofree struct nlmsghdr *resp = NULL;
|
||||
|
||||
if (ifname && ifindex <= 0 && virNetDevGetIndex(ifname, &ifindex) < 0)
|
||||
return -1;
|
||||
@ -508,7 +508,7 @@ virNetlinkNewLink(const char *ifname,
|
||||
unsigned int buflen;
|
||||
struct ifinfomsg ifinfo = { .ifi_family = AF_UNSPEC };
|
||||
VIR_AUTOPTR(virNetlinkMsg) nl_msg = NULL;
|
||||
VIR_AUTOFREE(struct nlmsghdr *) resp = NULL;
|
||||
g_autofree struct nlmsghdr *resp = NULL;
|
||||
|
||||
*error = 0;
|
||||
|
||||
@ -614,7 +614,7 @@ virNetlinkDelLink(const char *ifname, virNetlinkDelLinkFallback fallback)
|
||||
struct ifinfomsg ifinfo = { .ifi_family = AF_UNSPEC };
|
||||
unsigned int recvbuflen;
|
||||
VIR_AUTOPTR(virNetlinkMsg) nl_msg = NULL;
|
||||
VIR_AUTOFREE(struct nlmsghdr *) resp = NULL;
|
||||
g_autofree struct nlmsghdr *resp = NULL;
|
||||
|
||||
nl_msg = nlmsg_alloc_simple(RTM_DELLINK,
|
||||
NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL);
|
||||
@ -698,7 +698,7 @@ virNetlinkGetNeighbor(void **nlData, uint32_t src_pid, uint32_t dst_pid)
|
||||
};
|
||||
unsigned int recvbuflen;
|
||||
VIR_AUTOPTR(virNetlinkMsg) nl_msg = NULL;
|
||||
VIR_AUTOFREE(struct nlmsghdr *) resp = NULL;
|
||||
g_autofree struct nlmsghdr *resp = NULL;
|
||||
|
||||
nl_msg = nlmsg_alloc_simple(RTM_GETNEIGH, NLM_F_DUMP | NLM_F_REQUEST);
|
||||
if (!nl_msg) {
|
||||
@ -848,7 +848,7 @@ virNetlinkEventCallback(int watch,
|
||||
size_t i;
|
||||
int length;
|
||||
bool handled = false;
|
||||
VIR_AUTOFREE(struct nlmsghdr *) msg = NULL;
|
||||
g_autofree struct nlmsghdr *msg = NULL;
|
||||
|
||||
length = nl_recv(srv->netlinknh, &peer,
|
||||
(unsigned char **)&msg, &creds);
|
||||
|
@ -240,7 +240,7 @@ static int
|
||||
virNodeSuspendSupportsTargetPMUtils(unsigned int target, bool *supported)
|
||||
{
|
||||
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||
VIR_AUTOFREE(char *) binary = NULL;
|
||||
g_autofree char *binary = NULL;
|
||||
int status;
|
||||
|
||||
*supported = false;
|
||||
|
@ -257,8 +257,8 @@ virNumaGetNodeCPUs(int node,
|
||||
int max_n_cpus = virNumaGetMaxCPUs();
|
||||
int mask_n_bytes = max_n_cpus / 8;
|
||||
size_t i;
|
||||
VIR_AUTOFREE(unsigned long *) mask = NULL;
|
||||
VIR_AUTOFREE(unsigned long *) allonesmask = NULL;
|
||||
g_autofree unsigned long *mask = NULL;
|
||||
g_autofree unsigned long *allonesmask = NULL;
|
||||
VIR_AUTOPTR(virBitmap) cpumap = NULL;
|
||||
|
||||
*cpus = NULL;
|
||||
@ -612,8 +612,8 @@ virNumaGetHugePageInfo(int node,
|
||||
unsigned long long *page_free)
|
||||
{
|
||||
char *end;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
VIR_AUTOFREE(char *) buf = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
g_autofree char *buf = NULL;
|
||||
|
||||
if (page_avail) {
|
||||
if (virNumaGetHugePageInfoPath(&path, node,
|
||||
@ -762,10 +762,10 @@ virNumaGetPages(int node,
|
||||
bool exchange;
|
||||
long system_page_size;
|
||||
unsigned long long huge_page_sum = 0;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
VIR_AUTOFREE(unsigned int *) tmp_size = NULL;
|
||||
VIR_AUTOFREE(unsigned long long *) tmp_avail = NULL;
|
||||
VIR_AUTOFREE(unsigned long long *) tmp_free = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
g_autofree unsigned int *tmp_size = NULL;
|
||||
g_autofree unsigned long long *tmp_avail = NULL;
|
||||
g_autofree unsigned long long *tmp_free = NULL;
|
||||
|
||||
/* sysconf() returns page size in bytes,
|
||||
* but we are storing the page size in kibibytes. */
|
||||
@ -881,8 +881,8 @@ virNumaSetPagePoolSize(int node,
|
||||
{
|
||||
char *end;
|
||||
unsigned long long nr_count;
|
||||
VIR_AUTOFREE(char *) nr_path = NULL;
|
||||
VIR_AUTOFREE(char *) nr_buf = NULL;
|
||||
g_autofree char *nr_path = NULL;
|
||||
g_autofree char *nr_buf = NULL;
|
||||
|
||||
if (page_size == virGetSystemPageSizeKB()) {
|
||||
/* Special case as kernel handles system pages
|
||||
|
@ -239,7 +239,7 @@ int
|
||||
virPCIDeviceGetDriverPathAndName(virPCIDevicePtr dev, char **path, char **name)
|
||||
{
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(char *) drvlink = NULL;
|
||||
g_autofree char *drvlink = NULL;
|
||||
|
||||
*path = *name = NULL;
|
||||
/* drvlink = "/sys/bus/pci/dddd:bb:ss.ff/driver" */
|
||||
@ -378,8 +378,8 @@ virPCIDeviceRead32(virPCIDevicePtr dev, int cfgfd, unsigned int pos)
|
||||
static int
|
||||
virPCIDeviceReadClass(virPCIDevicePtr dev, uint16_t *device_class)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
VIR_AUTOFREE(char *) id_str = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
g_autofree char *id_str = NULL;
|
||||
unsigned int value;
|
||||
|
||||
if (!(path = virPCIFile(dev->name, "class")))
|
||||
@ -569,7 +569,7 @@ virPCIDeviceDetectFunctionLevelReset(virPCIDevicePtr dev, int cfgfd)
|
||||
{
|
||||
uint32_t caps;
|
||||
uint8_t pos;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
int found;
|
||||
|
||||
/* The PCIe Function Level Reset capability allows
|
||||
@ -919,8 +919,8 @@ virPCIDeviceReset(virPCIDevicePtr dev,
|
||||
virPCIDeviceList *activeDevs,
|
||||
virPCIDeviceList *inactiveDevs)
|
||||
{
|
||||
VIR_AUTOFREE(char *) drvPath = NULL;
|
||||
VIR_AUTOFREE(char *) drvName = NULL;
|
||||
g_autofree char *drvPath = NULL;
|
||||
g_autofree char *drvName = NULL;
|
||||
int ret = -1;
|
||||
int fd = -1;
|
||||
int hdrType = -1;
|
||||
@ -1002,7 +1002,7 @@ static int
|
||||
virPCIProbeStubDriver(virPCIStubDriver driver)
|
||||
{
|
||||
const char *drvname = NULL;
|
||||
VIR_AUTOFREE(char *) drvpath = NULL;
|
||||
g_autofree char *drvpath = NULL;
|
||||
bool probed = false;
|
||||
|
||||
if (driver == VIR_PCI_STUB_DRIVER_NONE ||
|
||||
@ -1019,7 +1019,7 @@ virPCIProbeStubDriver(virPCIStubDriver driver)
|
||||
return 0;
|
||||
|
||||
if (!probed) {
|
||||
VIR_AUTOFREE(char *) errbuf = NULL;
|
||||
g_autofree char *errbuf = NULL;
|
||||
probed = true;
|
||||
if ((errbuf = virKModLoad(drvname, true))) {
|
||||
VIR_WARN("failed to load driver %s: %s", drvname, errbuf);
|
||||
@ -1050,9 +1050,9 @@ virPCIProbeStubDriver(virPCIStubDriver driver)
|
||||
int
|
||||
virPCIDeviceUnbind(virPCIDevicePtr dev)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
VIR_AUTOFREE(char *) drvpath = NULL;
|
||||
VIR_AUTOFREE(char *) driver = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
g_autofree char *drvpath = NULL;
|
||||
g_autofree char *driver = NULL;
|
||||
|
||||
if (virPCIDeviceGetDriverPathAndName(dev, &drvpath, &driver) < 0)
|
||||
return -1;
|
||||
@ -1116,7 +1116,7 @@ static int
|
||||
virPCIDeviceBindWithDriverOverride(virPCIDevicePtr dev,
|
||||
const char *driverName)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
if (!(path = virPCIFile(dev->name, "driver_override")))
|
||||
return -1;
|
||||
@ -1150,8 +1150,8 @@ static int
|
||||
virPCIDeviceBindToStub(virPCIDevicePtr dev)
|
||||
{
|
||||
const char *stubDriverName;
|
||||
VIR_AUTOFREE(char *) stubDriverPath = NULL;
|
||||
VIR_AUTOFREE(char *) driverLink = NULL;
|
||||
g_autofree char *stubDriverPath = NULL;
|
||||
g_autofree char *driverLink = NULL;
|
||||
|
||||
/* Check the device is configured to use one of the known stub drivers */
|
||||
if (dev->stubDriver == VIR_PCI_STUB_DRIVER_NONE) {
|
||||
@ -1263,7 +1263,7 @@ virPCIDeviceReattach(virPCIDevicePtr dev,
|
||||
static char *
|
||||
virPCIDeviceReadID(virPCIDevicePtr dev, const char *id_name)
|
||||
{
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
char *id_str;
|
||||
|
||||
if (!(path = virPCIFile(dev->name, id_name)))
|
||||
@ -1371,8 +1371,8 @@ virPCIDeviceNew(unsigned int domain,
|
||||
unsigned int function)
|
||||
{
|
||||
VIR_AUTOPTR(virPCIDevice) dev = NULL;
|
||||
VIR_AUTOFREE(char *) vendor = NULL;
|
||||
VIR_AUTOFREE(char *) product = NULL;
|
||||
g_autofree char *vendor = NULL;
|
||||
g_autofree char *product = NULL;
|
||||
|
||||
if (VIR_ALLOC(dev) < 0)
|
||||
return NULL;
|
||||
@ -1736,7 +1736,7 @@ int virPCIDeviceFileIterate(virPCIDevicePtr dev,
|
||||
virPCIDeviceFileActor actor,
|
||||
void *opaque)
|
||||
{
|
||||
VIR_AUTOFREE(char *) pcidir = NULL;
|
||||
g_autofree char *pcidir = NULL;
|
||||
DIR *dir = NULL;
|
||||
int ret = -1;
|
||||
struct dirent *ent;
|
||||
@ -1751,7 +1751,7 @@ int virPCIDeviceFileIterate(virPCIDevicePtr dev,
|
||||
goto cleanup;
|
||||
|
||||
while ((direrr = virDirRead(dir, &ent, pcidir)) > 0) {
|
||||
VIR_AUTOFREE(char *) file = NULL;
|
||||
g_autofree char *file = NULL;
|
||||
/* Device assignment requires:
|
||||
* $PCIDIR/config, $PCIDIR/resource, $PCIDIR/resourceNNN,
|
||||
* $PCIDIR/rom, $PCIDIR/reset, $PCIDIR/vendor, $PCIDIR/device
|
||||
@ -1789,7 +1789,7 @@ virPCIDeviceAddressIOMMUGroupIterate(virPCIDeviceAddressPtr orig,
|
||||
virPCIDeviceAddressActor actor,
|
||||
void *opaque)
|
||||
{
|
||||
VIR_AUTOFREE(char *) groupPath = NULL;
|
||||
g_autofree char *groupPath = NULL;
|
||||
DIR *groupDir = NULL;
|
||||
int ret = -1;
|
||||
struct dirent *ent;
|
||||
@ -1939,9 +1939,9 @@ virPCIDeviceAddressGetIOMMUGroupAddresses(virPCIDeviceAddressPtr devAddr,
|
||||
int
|
||||
virPCIDeviceAddressGetIOMMUGroupNum(virPCIDeviceAddressPtr addr)
|
||||
{
|
||||
VIR_AUTOFREE(char *) devName = NULL;
|
||||
VIR_AUTOFREE(char *) devPath = NULL;
|
||||
VIR_AUTOFREE(char *) groupPath = NULL;
|
||||
g_autofree char *devName = NULL;
|
||||
g_autofree char *devPath = NULL;
|
||||
g_autofree char *groupPath = NULL;
|
||||
const char *groupNumStr;
|
||||
unsigned int groupNum;
|
||||
|
||||
@ -1980,8 +1980,8 @@ virPCIDeviceAddressGetIOMMUGroupNum(virPCIDeviceAddressPtr addr)
|
||||
char *
|
||||
virPCIDeviceGetIOMMUGroupDev(virPCIDevicePtr dev)
|
||||
{
|
||||
VIR_AUTOFREE(char *) devPath = NULL;
|
||||
VIR_AUTOFREE(char *) groupPath = NULL;
|
||||
g_autofree char *devPath = NULL;
|
||||
g_autofree char *groupPath = NULL;
|
||||
char *groupDev = NULL;
|
||||
|
||||
if (!(devPath = virPCIFile(dev->name, "iommu_group")))
|
||||
@ -2213,7 +2213,7 @@ virPCIGetDeviceAddressFromSysfsLink(const char *device_link)
|
||||
{
|
||||
virPCIDeviceAddressPtr bdf = NULL;
|
||||
char *config_address = NULL;
|
||||
VIR_AUTOFREE(char *) device_path = NULL;
|
||||
g_autofree char *device_path = NULL;
|
||||
|
||||
if (!virFileExists(device_link)) {
|
||||
VIR_DEBUG("'%s' does not exist", device_link);
|
||||
@ -2261,7 +2261,7 @@ int
|
||||
virPCIGetPhysicalFunction(const char *vf_sysfs_path,
|
||||
virPCIDeviceAddressPtr *pf)
|
||||
{
|
||||
VIR_AUTOFREE(char *) device_link = NULL;
|
||||
g_autofree char *device_link = NULL;
|
||||
|
||||
*pf = NULL;
|
||||
|
||||
@ -2291,8 +2291,8 @@ virPCIGetVirtualFunctions(const char *sysfs_path,
|
||||
{
|
||||
int ret = -1;
|
||||
size_t i;
|
||||
VIR_AUTOFREE(char *) totalvfs_file = NULL;
|
||||
VIR_AUTOFREE(char *) totalvfs_str = NULL;
|
||||
g_autofree char *totalvfs_file = NULL;
|
||||
g_autofree char *totalvfs_str = NULL;
|
||||
virPCIDeviceAddressPtr config_addr = NULL;
|
||||
|
||||
*virtual_functions = NULL;
|
||||
@ -2315,7 +2315,7 @@ virPCIGetVirtualFunctions(const char *sysfs_path,
|
||||
}
|
||||
|
||||
do {
|
||||
VIR_AUTOFREE(char *) device_link = NULL;
|
||||
g_autofree char *device_link = NULL;
|
||||
/* look for virtfn%d links until one isn't found */
|
||||
if (virAsprintf(&device_link, "%s/virtfn%zu", sysfs_path, *num_virtual_functions) < 0)
|
||||
goto error;
|
||||
@ -2357,7 +2357,7 @@ virPCIGetVirtualFunctions(const char *sysfs_path,
|
||||
int
|
||||
virPCIIsVirtualFunction(const char *vf_sysfs_device_link)
|
||||
{
|
||||
VIR_AUTOFREE(char *) vf_sysfs_physfn_link = NULL;
|
||||
g_autofree char *vf_sysfs_physfn_link = NULL;
|
||||
|
||||
if (virAsprintf(&vf_sysfs_physfn_link, "%s/physfn",
|
||||
vf_sysfs_device_link) < 0)
|
||||
@ -2455,9 +2455,9 @@ virPCIGetNetName(const char *device_link_sysfs_path,
|
||||
char *physPortID,
|
||||
char **netname)
|
||||
{
|
||||
VIR_AUTOFREE(char *) pcidev_sysfs_net_path = NULL;
|
||||
VIR_AUTOFREE(char *) firstEntryName = NULL;
|
||||
VIR_AUTOFREE(char *) thisPhysPortID = NULL;
|
||||
g_autofree char *pcidev_sysfs_net_path = NULL;
|
||||
g_autofree char *firstEntryName = NULL;
|
||||
g_autofree char *thisPhysPortID = NULL;
|
||||
int ret = -1;
|
||||
DIR *dir = NULL;
|
||||
struct dirent *entry = NULL;
|
||||
@ -2545,9 +2545,9 @@ virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path,
|
||||
int *vf_index)
|
||||
{
|
||||
virPCIDeviceAddressPtr pf_config_address = NULL;
|
||||
VIR_AUTOFREE(char *) pf_sysfs_device_path = NULL;
|
||||
VIR_AUTOFREE(char *) vfname = NULL;
|
||||
VIR_AUTOFREE(char *) vfPhysPortID = NULL;
|
||||
g_autofree char *pf_sysfs_device_path = NULL;
|
||||
g_autofree char *vfname = NULL;
|
||||
g_autofree char *vfPhysPortID = NULL;
|
||||
int ret = -1;
|
||||
|
||||
if (virPCIGetPhysicalFunction(vf_sysfs_device_path, &pf_config_address) < 0)
|
||||
@ -2615,7 +2615,7 @@ virPCIGetMdevTypes(const char *sysfspath,
|
||||
int dirret = -1;
|
||||
DIR *dir = NULL;
|
||||
struct dirent *entry;
|
||||
VIR_AUTOFREE(char *) types_path = NULL;
|
||||
g_autofree char *types_path = NULL;
|
||||
VIR_AUTOPTR(virMediatedDeviceType) mdev_type = NULL;
|
||||
virMediatedDeviceTypePtr *mdev_types = NULL;
|
||||
size_t ntypes = 0;
|
||||
@ -2633,7 +2633,7 @@ virPCIGetMdevTypes(const char *sysfspath,
|
||||
}
|
||||
|
||||
while ((dirret = virDirRead(dir, &entry, types_path)) > 0) {
|
||||
VIR_AUTOFREE(char *) tmppath = NULL;
|
||||
g_autofree char *tmppath = NULL;
|
||||
/* append the type id to the path and read the attributes from there */
|
||||
if (virAsprintf(&tmppath, "%s/%s", types_path, entry->d_name) < 0)
|
||||
goto cleanup;
|
||||
|
@ -177,7 +177,7 @@ virPerfRdtAttrInit(void)
|
||||
{
|
||||
char *tmp = NULL;
|
||||
unsigned int attr_type = 0;
|
||||
VIR_AUTOFREE(char *) buf = NULL;
|
||||
g_autofree char *buf = NULL;
|
||||
|
||||
if (virFileReadAllQuiet("/sys/devices/intel_cqm/type", 10, &buf) < 0)
|
||||
return -1;
|
||||
@ -221,7 +221,7 @@ virPerfEventEnable(virPerfPtr perf,
|
||||
}
|
||||
|
||||
if (type == VIR_PERF_EVENT_CMT) {
|
||||
VIR_AUTOFREE(char *) buf = NULL;
|
||||
g_autofree char *buf = NULL;
|
||||
|
||||
if (virFileReadAll("/sys/devices/intel_cqm/events/llc_occupancy.scale",
|
||||
10, &buf) < 0)
|
||||
|
@ -97,7 +97,7 @@ int virPidFileWrite(const char *dir,
|
||||
const char *name,
|
||||
pid_t pid)
|
||||
{
|
||||
VIR_AUTOFREE(char *) pidfile = NULL;
|
||||
g_autofree char *pidfile = NULL;
|
||||
|
||||
if (name == NULL || dir == NULL)
|
||||
return -EINVAL;
|
||||
@ -159,7 +159,7 @@ int virPidFileRead(const char *dir,
|
||||
const char *name,
|
||||
pid_t *pid)
|
||||
{
|
||||
VIR_AUTOFREE(char *) pidfile = NULL;
|
||||
g_autofree char *pidfile = NULL;
|
||||
|
||||
*pid = 0;
|
||||
|
||||
@ -204,10 +204,10 @@ int virPidFileReadPathIfAlive(const char *path,
|
||||
const char deletedText[] = " (deleted)";
|
||||
size_t deletedTextLen = strlen(deletedText);
|
||||
pid_t retPid;
|
||||
VIR_AUTOFREE(char *) procPath = NULL;
|
||||
VIR_AUTOFREE(char *) procLink = NULL;
|
||||
VIR_AUTOFREE(char *) resolvedBinPath = NULL;
|
||||
VIR_AUTOFREE(char *) resolvedProcLink = NULL;
|
||||
g_autofree char *procPath = NULL;
|
||||
g_autofree char *procLink = NULL;
|
||||
g_autofree char *resolvedBinPath = NULL;
|
||||
g_autofree char *resolvedProcLink = NULL;
|
||||
|
||||
/* only set this at the very end on success */
|
||||
*pid = -1;
|
||||
@ -300,7 +300,7 @@ int virPidFileReadIfAlive(const char *dir,
|
||||
pid_t *pid,
|
||||
const char *binpath)
|
||||
{
|
||||
VIR_AUTOFREE(char *) pidfile = NULL;
|
||||
g_autofree char *pidfile = NULL;
|
||||
|
||||
if (name == NULL || dir == NULL)
|
||||
return -EINVAL;
|
||||
@ -326,7 +326,7 @@ int virPidFileDeletePath(const char *pidfile)
|
||||
int virPidFileDelete(const char *dir,
|
||||
const char *name)
|
||||
{
|
||||
VIR_AUTOFREE(char *) pidfile = NULL;
|
||||
g_autofree char *pidfile = NULL;
|
||||
|
||||
if (name == NULL || dir == NULL)
|
||||
return -EINVAL;
|
||||
@ -426,7 +426,7 @@ int virPidFileAcquire(const char *dir,
|
||||
bool waitForLock,
|
||||
pid_t pid)
|
||||
{
|
||||
VIR_AUTOFREE(char *) pidfile = NULL;
|
||||
g_autofree char *pidfile = NULL;
|
||||
|
||||
if (name == NULL || dir == NULL)
|
||||
return -EINVAL;
|
||||
@ -465,7 +465,7 @@ int virPidFileRelease(const char *dir,
|
||||
const char *name,
|
||||
int fd)
|
||||
{
|
||||
VIR_AUTOFREE(char *) pidfile = NULL;
|
||||
g_autofree char *pidfile = NULL;
|
||||
|
||||
if (name == NULL || dir == NULL)
|
||||
return -EINVAL;
|
||||
@ -483,7 +483,7 @@ virPidFileConstructPath(bool privileged,
|
||||
const char *progname,
|
||||
char **pidfile)
|
||||
{
|
||||
VIR_AUTOFREE(char *) rundir = NULL;
|
||||
g_autofree char *rundir = NULL;
|
||||
|
||||
if (privileged) {
|
||||
/*
|
||||
|
@ -158,7 +158,7 @@ virProcessAbort(pid_t pid)
|
||||
int saved_errno;
|
||||
int ret;
|
||||
int status;
|
||||
VIR_AUTOFREE(char *) tmp = NULL;
|
||||
g_autofree char *tmp = NULL;
|
||||
|
||||
if (pid <= 0)
|
||||
return;
|
||||
@ -237,7 +237,7 @@ virProcessWait(pid_t pid, int *exitstatus, bool raw)
|
||||
{
|
||||
int ret;
|
||||
int status;
|
||||
VIR_AUTOFREE(char *) st = NULL;
|
||||
g_autofree char *st = NULL;
|
||||
|
||||
if (pid <= 0) {
|
||||
if (pid != -1)
|
||||
@ -581,7 +581,7 @@ int virProcessGetPids(pid_t pid, size_t *npids, pid_t **pids)
|
||||
DIR *dir = NULL;
|
||||
int value;
|
||||
struct dirent *ent;
|
||||
VIR_AUTOFREE(char *) taskPath = NULL;
|
||||
g_autofree char *taskPath = NULL;
|
||||
|
||||
*npids = 0;
|
||||
*pids = NULL;
|
||||
@ -630,7 +630,7 @@ int virProcessGetNamespaces(pid_t pid,
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS(ns); i++) {
|
||||
int fd;
|
||||
VIR_AUTOFREE(char *) nsfile = NULL;
|
||||
g_autofree char *nsfile = NULL;
|
||||
|
||||
if (virAsprintf(&nsfile, "/proc/%llu/ns/%s",
|
||||
(long long) pid,
|
||||
@ -950,8 +950,8 @@ int virProcessGetStartTime(pid_t pid,
|
||||
{
|
||||
char *tmp;
|
||||
int len;
|
||||
VIR_AUTOFREE(char *) filename = NULL;
|
||||
VIR_AUTOFREE(char *) buf = NULL;
|
||||
g_autofree char *filename = NULL;
|
||||
g_autofree char *buf = NULL;
|
||||
VIR_AUTOSTRINGLIST tokens = NULL;
|
||||
|
||||
if (virAsprintf(&filename, "/proc/%llu/stat", (long long) pid) < 0)
|
||||
@ -1052,7 +1052,7 @@ static int virProcessNamespaceHelper(pid_t pid G_GNUC_UNUSED,
|
||||
virProcessNamespaceHelperData *data = opaque;
|
||||
int fd = -1;
|
||||
int ret = -1;
|
||||
VIR_AUTOFREE(char *) path = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
if (virAsprintf(&path, "/proc/%lld/ns/mnt", (long long) data->pid) < 0)
|
||||
goto cleanup;
|
||||
@ -1157,7 +1157,7 @@ virProcessRunInFork(virProcessForkCallback cb,
|
||||
_exit(ret < 0 ? EXIT_CANCELED : ret);
|
||||
} else {
|
||||
int status;
|
||||
VIR_AUTOFREE(char *) buf = NULL;
|
||||
g_autofree char *buf = NULL;
|
||||
|
||||
VIR_FORCE_CLOSE(errfd[1]);
|
||||
ignore_value(virFileReadHeaderFD(errfd[0], 1024, &buf));
|
||||
@ -1237,7 +1237,7 @@ virProcessNamespaceAvailable(unsigned int ns)
|
||||
int cpid;
|
||||
char *childStack;
|
||||
int stacksize = getpagesize() * 4;
|
||||
VIR_AUTOFREE(char *)stack = NULL;
|
||||
g_autofree char *stack = NULL;
|
||||
|
||||
if (ns & VIR_PROCESS_NAMESPACE_MNT)
|
||||
flags |= CLONE_NEWNS;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user