Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/storage/storage_backend_disk.c | 4 +- src/storage/storage_backend_gluster.c | 8 ++-- src/storage/storage_backend_iscsi.c | 16 +++---- src/storage/storage_backend_iscsi_direct.c | 28 ++++++------ src/storage/storage_backend_logical.c | 8 ++-- src/storage/storage_backend_mpath.c | 6 +-- src/storage/storage_backend_rbd.c | 8 ++-- src/storage/storage_backend_scsi.c | 6 +-- src/storage/storage_backend_sheepdog.c | 4 +- src/storage/storage_backend_vstorage.c | 4 +- src/storage/storage_backend_zfs.c | 8 ++-- src/storage/storage_driver.c | 12 ++--- src/storage/storage_file_gluster.c | 10 ++--- src/storage/storage_util.c | 52 +++++++++++----------- 14 files changed, 87 insertions(+), 87 deletions(-) diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c index d4bd526c14..d971530cd8 100644 --- a/src/storage/storage_backend_disk.c +++ b/src/storage/storage_backend_disk.c @@ -605,14 +605,14 @@ virStorageBackendDiskPartFormat(virStoragePoolObjPtr pool, /* XXX Only support one extended partition */ switch (virStorageBackendDiskPartTypeToCreate(pool)) { case VIR_STORAGE_VOL_DISK_TYPE_PRIMARY: - virAsprintf(partFormat, "primary %s", partedFormat); + *partFormat = g_strdup_printf("primary %s", partedFormat); break; case VIR_STORAGE_VOL_DISK_TYPE_LOGICAL: /* make sure we have an extended partition */ if (virStoragePoolObjSearchVolume(pool, virStorageVolPartFindExtended, NULL)) { - virAsprintf(partFormat, "logical %s", partedFormat); + *partFormat = g_strdup_printf("logical %s", partedFormat); } else { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no extended partition found and no " diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c index 0022ed2f21..4a8ee3870d 100644 --- a/src/storage/storage_backend_gluster.c +++ b/src/storage/storage_backend_gluster.c @@ -101,7 +101,7 @@ virStorageBackendGlusterOpen(virStoragePoolObjPtr pool) return NULL; ret->volname = g_strdup(name); - virAsprintf(&ret->dir, "%s%s", dir ? dir : "/", trailing_slash ? "" : "/"); + ret->dir = g_strdup_printf("%s%s", dir ? dir : "/", trailing_slash ? "" : "/"); /* FIXME: Currently hard-coded to tcp transport; XML needs to be * extended to allow alternate transport */ @@ -109,7 +109,7 @@ virStorageBackendGlusterOpen(virStoragePoolObjPtr pool) goto error; ret->uri->scheme = g_strdup("gluster"); ret->uri->server = g_strdup(def->source.hosts[0].name); - virAsprintf(&ret->uri->path, "/%s%s", ret->volname, ret->dir); + ret->uri->path = g_strdup_printf("/%s%s", ret->volname, ret->dir); ret->uri->port = def->source.hosts[0].port; /* Actually connect to glfs */ @@ -193,10 +193,10 @@ virStorageBackendGlusterSetMetadata(virStorageBackendGlusterStatePtr state, vol->name = g_strdup(name); } - virAsprintf(&path, "%s%s%s", state->volname, state->dir, vol->name); + path = g_strdup_printf("%s%s%s", state->volname, state->dir, vol->name); tmp = state->uri->path; - virAsprintf(&state->uri->path, "/%s", path); + state->uri->path = g_strdup_printf("/%s", path); if (!(vol->target.path = virURIFormat(state->uri))) { VIR_FREE(state->uri->path); state->uri->path = tmp; diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c index b61abb7cbd..b85c9078f8 100644 --- a/src/storage/storage_backend_iscsi.c +++ b/src/storage/storage_backend_iscsi.c @@ -63,13 +63,13 @@ virStorageBackendISCSIPortal(virStoragePoolSourcePtr source) source->hosts[0].port = ISCSI_DEFAULT_TARGET_PORT; if (strchr(source->hosts[0].name, ':')) { - virAsprintf(&portal, "[%s]:%d,1", - source->hosts[0].name, - source->hosts[0].port); + portal = g_strdup_printf("[%s]:%d,1", + source->hosts[0].name, + source->hosts[0].port); } else { - virAsprintf(&portal, "%s:%d,1", - source->hosts[0].name, - source->hosts[0].port); + portal = g_strdup_printf("%s:%d,1", + source->hosts[0].name, + source->hosts[0].port); } return portal; @@ -133,8 +133,8 @@ virStorageBackendISCSIFindLUs(virStoragePoolObjPtr pool, uint32_t host; g_autofree char *sysfs_path = NULL; - virAsprintf(&sysfs_path, "/sys/class/iscsi_session/session%s/device", - session); + sysfs_path = g_strdup_printf("/sys/class/iscsi_session/session%s/device", + session); if (virStorageBackendISCSIGetHostNumber(sysfs_path, &host) < 0) return -1; diff --git a/src/storage/storage_backend_iscsi_direct.c b/src/storage/storage_backend_iscsi_direct.c index f0b27451f0..2afa617cc1 100644 --- a/src/storage/storage_backend_iscsi_direct.c +++ b/src/storage/storage_backend_iscsi_direct.c @@ -68,17 +68,17 @@ virStorageBackendISCSIDirectPortal(virStoragePoolSourcePtr source) return NULL; } if (source->hosts[0].port == 0) { - virAsprintf(&portal, "%s:%d", - source->hosts[0].name, - ISCSI_DEFAULT_TARGET_PORT); + portal = g_strdup_printf("%s:%d", + source->hosts[0].name, + ISCSI_DEFAULT_TARGET_PORT); } else if (strchr(source->hosts[0].name, ':')) { - virAsprintf(&portal, "[%s]:%d", - source->hosts[0].name, - source->hosts[0].port); + portal = g_strdup_printf("[%s]:%d", + source->hosts[0].name, + source->hosts[0].port); } else { - virAsprintf(&portal, "%s:%d", - source->hosts[0].name, - source->hosts[0].port); + portal = g_strdup_printf("%s:%d", + source->hosts[0].name, + source->hosts[0].port); } return portal; } @@ -230,11 +230,11 @@ virISCSIDirectSetVolumeAttributes(virStoragePoolObjPtr pool, { virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool); - virAsprintf(&vol->name, "%s%u", VOL_NAME_PREFIX, lun); - virAsprintf(&vol->key, "ip-%s-iscsi-%s-lun-%u", portal, - def->source.devices[0].path, lun); - virAsprintf(&vol->target.path, "ip-%s-iscsi-%s-lun-%u", portal, - def->source.devices[0].path, lun); + vol->name = g_strdup_printf("%s%u", VOL_NAME_PREFIX, lun); + vol->key = g_strdup_printf("ip-%s-iscsi-%s-lun-%u", portal, + def->source.devices[0].path, lun); + vol->target.path = g_strdup_printf("ip-%s-iscsi-%s-lun-%u", portal, + def->source.devices[0].path, lun); return 0; } diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c index 4a5d61e57d..48023abd1a 100644 --- a/src/storage/storage_backend_logical.c +++ b/src/storage/storage_backend_logical.c @@ -291,7 +291,7 @@ virStorageBackendLogicalMakeVol(char **const groups, } if (vol->target.path == NULL) - virAsprintf(&vol->target.path, "%s/%s", def->target.path, vol->name); + vol->target.path = g_strdup_printf("%s/%s", def->target.path, vol->name); /* Mark the (s) sparse/snapshot lv, e.g. the lv created using * the --virtualsize/-V option. We've already ignored the (t)hin @@ -313,8 +313,8 @@ virStorageBackendLogicalMakeVol(char **const groups, if (!(vol->target.backingStore = virStorageSourceNew())) goto cleanup; - virAsprintf(&vol->target.backingStore->path, "%s/%s", - def->target.path, groups[1]); + vol->target.backingStore->path = g_strdup_printf("%s/%s", + def->target.path, groups[1]); vol->target.backingStore->format = VIR_STORAGE_POOL_LOGICAL_LVM2; vol->target.backingStore->type = VIR_STORAGE_TYPE_BLOCK; @@ -912,7 +912,7 @@ virStorageBackendLogicalCreateVol(virStoragePoolObjPtr pool, vol->type = VIR_STORAGE_VOL_BLOCK; VIR_FREE(vol->target.path); - virAsprintf(&vol->target.path, "%s/%s", def->target.path, vol->name); + vol->target.path = g_strdup_printf("%s/%s", def->target.path, vol->name); if (virStorageBackendLogicalLVCreate(vol, def) < 0) return -1; diff --git a/src/storage/storage_backend_mpath.c b/src/storage/storage_backend_mpath.c index 6912977657..8843dffc30 100644 --- a/src/storage/storage_backend_mpath.c +++ b/src/storage/storage_backend_mpath.c @@ -53,9 +53,9 @@ virStorageBackendMpathNewVol(virStoragePoolObjPtr pool, vol->type = VIR_STORAGE_VOL_BLOCK; - virAsprintf(&(vol->name), "dm-%u", devnum); + (vol->name) = g_strdup_printf("dm-%u", devnum); - virAsprintf(&vol->target.path, "/dev/%s", dev); + vol->target.path = g_strdup_printf("/dev/%s", dev); if (virStorageBackendUpdateVolInfo(vol, true, VIR_STORAGE_VOL_OPEN_DEFAULT, 0) < 0) { @@ -163,7 +163,7 @@ virStorageBackendCreateVols(virStoragePoolObjPtr pool, if (is_mpath == 1) { - virAsprintf(&map_device, "mapper/%s", names->name); + map_device = g_strdup_printf("mapper/%s", names->name); if (virStorageBackendGetMinorNumber(names->name, &minor) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c index 491b85e0e0..5cf4acf65f 100644 --- a/src/storage/storage_backend_rbd.c +++ b/src/storage/storage_backend_rbd.c @@ -570,10 +570,10 @@ volStorageBackendRBDRefreshVolInfo(virStorageVolDefPtr vol, vol->target.allocation, info.obj_size, info.num_objs); VIR_FREE(vol->target.path); - virAsprintf(&vol->target.path, "%s/%s", def->source.name, vol->name); + vol->target.path = g_strdup_printf("%s/%s", def->source.name, vol->name); VIR_FREE(vol->key); - virAsprintf(&vol->key, "%s/%s", def->source.name, vol->name); + vol->key = g_strdup_printf("%s/%s", def->source.name, vol->name); ret = 0; @@ -891,10 +891,10 @@ virStorageBackendRBDCreateVol(virStoragePoolObjPtr pool, } VIR_FREE(vol->target.path); - virAsprintf(&vol->target.path, "%s/%s", def->source.name, vol->name); + vol->target.path = g_strdup_printf("%s/%s", def->source.name, vol->name); VIR_FREE(vol->key); - virAsprintf(&vol->key, "%s/%s", def->source.name, vol->name); + vol->key = g_strdup_printf("%s/%s", def->source.name, vol->name); return 0; } diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c index 80965bc349..9c0f041616 100644 --- a/src/storage/storage_backend_scsi.c +++ b/src/storage/storage_backend_scsi.c @@ -60,7 +60,7 @@ virStorageBackendSCSITriggerRescan(uint32_t host) VIR_DEBUG("Triggering rescan of host %d", host); - virAsprintf(&path, "%s/host%u/scan", LINUX_SYSFS_SCSI_HOST_PREFIX, host); + path = g_strdup_printf("%s/host%u/scan", LINUX_SYSFS_SCSI_HOST_PREFIX, host); VIR_DEBUG("Scan trigger path is '%s'", path); @@ -259,7 +259,7 @@ checkParent(const char *name, goto cleanup; } - virAsprintf(&scsi_host_name, "scsi_%s", name); + scsi_host_name = g_strdup_printf("scsi_%s", name); if (!(vhba_parent = virNodeDeviceGetParentName(conn, scsi_host_name))) goto cleanup; @@ -373,7 +373,7 @@ virStorageBackendSCSICheckPool(virStoragePoolObjPtr pool, if (virSCSIHostGetNumber(name, &host) < 0) return -1; - virAsprintf(&path, "%s/host%d", LINUX_SYSFS_SCSI_HOST_PREFIX, host); + path = g_strdup_printf("%s/host%d", LINUX_SYSFS_SCSI_HOST_PREFIX, host); *isActive = virFileExists(path); diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c index ff13d2d9bd..853a53115f 100644 --- a/src/storage/storage_backend_sheepdog.c +++ b/src/storage/storage_backend_sheepdog.c @@ -226,7 +226,7 @@ virStorageBackendSheepdogCreateVol(virStoragePoolObjPtr pool, vol->type = VIR_STORAGE_VOL_NETWORK; VIR_FREE(vol->key); - virAsprintf(&vol->key, "%s/%s", def->source.name, vol->name); + vol->key = g_strdup_printf("%s/%s", def->source.name, vol->name); VIR_FREE(vol->target.path); vol->target.path = g_strdup(vol->name); @@ -338,7 +338,7 @@ virStorageBackendSheepdogRefreshVol(virStoragePoolObjPtr pool, vol->type = VIR_STORAGE_VOL_NETWORK; VIR_FREE(vol->key); - virAsprintf(&vol->key, "%s/%s", def->source.name, vol->name); + vol->key = g_strdup_printf("%s/%s", def->source.name, vol->name); VIR_FREE(vol->target.path); vol->target.path = g_strdup(vol->name); diff --git a/src/storage/storage_backend_vstorage.c b/src/storage/storage_backend_vstorage.c index 9a34d87ec3..85ab8325ce 100644 --- a/src/storage/storage_backend_vstorage.c +++ b/src/storage/storage_backend_vstorage.c @@ -61,7 +61,7 @@ virStorageBackendVzPoolStart(virStoragePoolObjPtr pool) if (!(usr_name = virGetUserName(def->target.perms.uid))) return -1; - virAsprintf(&mode, "%o", def->target.perms.mode); + mode = g_strdup_printf("%o", def->target.perms.mode); cmd = virCommandNewArgList(VSTORAGE_MOUNT, "-c", def->source.name, @@ -90,7 +90,7 @@ virStorageBackendVzIsMounted(virStoragePoolObjPtr pool) char buf[1024]; g_autofree char *cluster = NULL; - virAsprintf(&cluster, "vstorage://%s", def->source.name); + cluster = g_strdup_printf("vstorage://%s", def->source.name); if ((mtab = fopen(_PATH_MOUNTED, "r")) == NULL) { virReportSystemError(errno, diff --git a/src/storage/storage_backend_zfs.c b/src/storage/storage_backend_zfs.c index 793eb06f5c..b708c7fd4a 100644 --- a/src/storage/storage_backend_zfs.c +++ b/src/storage/storage_backend_zfs.c @@ -87,7 +87,7 @@ virStorageBackendZFSCheckPool(virStoragePoolObjPtr pool G_GNUC_UNUSED, virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool); g_autofree char *devpath = NULL; - virAsprintf(&devpath, "/dev/zvol/%s", def->source.name); + devpath = g_strdup_printf("/dev/zvol/%s", def->source.name); *isActive = virFileIsDir(devpath); return 0; @@ -137,8 +137,8 @@ virStorageBackendZFSParseVol(virStoragePoolObjPtr pool, volume->key = g_strdup(tokens[0]); if (volume->target.path == NULL) { - virAsprintf(&volume->target.path, "%s/%s", def->target.path, - volume->name); + volume->target.path = g_strdup_printf("%s/%s", def->target.path, + volume->name); } if (virStrToLong_ull(tokens[1], NULL, 10, &volume->target.capacity) < 0) { @@ -305,7 +305,7 @@ virStorageBackendZFSCreateVol(virStoragePoolObjPtr pool, vol->type = VIR_STORAGE_VOL_BLOCK; VIR_FREE(vol->target.path); - virAsprintf(&vol->target.path, "%s/%s", def->target.path, vol->name); + vol->target.path = g_strdup_printf("%s/%s", def->target.path, vol->name); vol->key = g_strdup(vol->target.path); diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index dfe3dd1354..84d76eebd0 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -281,9 +281,9 @@ storageStateInitialize(bool privileged, if (!(configdir && rundir)) goto error; - virAsprintf(&driver->configDir, "%s/storage", configdir); - virAsprintf(&driver->autostartDir, "%s/storage/autostart", configdir); - virAsprintf(&driver->stateDir, "%s/storage/run", rundir); + driver->configDir = g_strdup_printf("%s/storage", configdir); + driver->autostartDir = g_strdup_printf("%s/storage/autostart", configdir); + driver->stateDir = g_strdup_printf("%s/storage/run", rundir); } driver->privileged = privileged; @@ -2289,7 +2289,7 @@ virStorageBackendPloopRestoreDesc(char *path) g_autofree char *refresh_tool = NULL; g_autofree char *desc = NULL; - virAsprintf(&desc, "%s/DiskDescriptor.xml", path); + desc = g_strdup_printf("%s/DiskDescriptor.xml", path); if (virFileRemove(desc, 0, 0) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -2851,8 +2851,8 @@ virStoragePoolObjBuildTempFilePath(virStoragePoolObjPtr obj, virStoragePoolDefPtr def = virStoragePoolObjGetDef(obj); char *tmp = NULL; - virAsprintf(&tmp, "%s/%s.%s.secret.XXXXXX", - driver->stateDir, def->name, voldef->name); + tmp = g_strdup_printf("%s/%s.%s.secret.XXXXXX", + driver->stateDir, def->name, voldef->name); return tmp; } diff --git a/src/storage/storage_file_gluster.c b/src/storage/storage_file_gluster.c index 1577239431..f389a94437 100644 --- a/src/storage/storage_file_gluster.c +++ b/src/storage/storage_file_gluster.c @@ -311,11 +311,11 @@ virStorageFileBackendGlusterGetUniqueIdentifier(virStorageSourcePtr src) priv))) return NULL; - virAsprintf(&priv->canonpath, "gluster://%s:%u/%s/%s", - src->hosts->name, - src->hosts->port, - src->volume, - filePath); + priv->canonpath = g_strdup_printf("gluster://%s:%u/%s/%s", + src->hosts->name, + src->hosts->port, + src->volume, + filePath); return priv->canonpath; } diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index 88fb8b5223..3427c2e446 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -898,7 +898,7 @@ storageBackendCreateQemuImgSetBacking(virStoragePoolObjPtr pool, * validation. */ if (*(info->backingPath) != '/') - virAsprintf(&absolutePath, "%s/%s", def->target.path, info->backingPath); + absolutePath = g_strdup_printf("%s/%s", def->target.path, info->backingPath); accessRetCode = access(absolutePath ? absolutePath : info->backingPath, R_OK); if (accessRetCode != 0) { @@ -1140,7 +1140,7 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool, _("path to secret data file is required")); goto error; } - virAsprintf(&info.secretAlias, "%s_encrypt0", vol->name); + info.secretAlias = g_strdup_printf("%s_encrypt0", vol->name); if (storageBackendCreateQemuImgSecretObject(cmd, secretPath, info.secretAlias) < 0) goto error; @@ -1153,7 +1153,7 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool, _("path to inputvol secret data file is required")); goto error; } - virAsprintf(&inputSecretAlias, "%s_encrypt0", inputvol->name); + inputSecretAlias = g_strdup_printf("%s_encrypt0", inputvol->name); if (storageBackendCreateQemuImgSecretObject(cmd, inputSecretPath, inputSecretAlias) < 0) goto error; @@ -1678,10 +1678,10 @@ storageBackendIsPloopDir(char *path) g_autofree char *root = NULL; g_autofree char *desc = NULL; - virAsprintf(&root, "%s/root.hds", path); + root = g_strdup_printf("%s/root.hds", path); if (!virFileExists(root)) return false; - virAsprintf(&desc, "%s/DiskDescriptor.xml", path); + desc = g_strdup_printf("%s/DiskDescriptor.xml", path); if (!virFileExists(desc)) return false; @@ -1699,7 +1699,7 @@ storageBackendRedoPloopUpdate(virStorageSourcePtr target, struct stat *sb, { g_autofree char *path = NULL; - virAsprintf(&path, "%s/root.hds", target->path); + path = g_strdup_printf("%s/root.hds", target->path); VIR_FORCE_CLOSE(*fd); if ((*fd = virStorageBackendVolOpen(path, sb, flags)) < 0) return -1; @@ -1949,7 +1949,7 @@ virStorageBackendStablePath(virStoragePoolObjPtr pool, */ retry: while ((direrr = virDirRead(dh, &dent, NULL)) > 0) { - virAsprintf(&stablepath, "%s/%s", def->target.path, dent->d_name); + stablepath = g_strdup_printf("%s/%s", def->target.path, dent->d_name); if (virFileLinkPointsTo(stablepath, devpath)) { VIR_DIR_CLOSE(dh); @@ -2045,7 +2045,7 @@ virStorageBackendVolCreateLocal(virStoragePoolObjPtr pool, } VIR_FREE(vol->target.path); - virAsprintf(&vol->target.path, "%s/%s", def->target.path, vol->name); + vol->target.path = g_strdup_printf("%s/%s", def->target.path, vol->name); if (virFileExists(vol->target.path)) { virReportError(VIR_ERR_OPERATION_INVALID, @@ -2282,7 +2282,7 @@ storageBackendResizeQemuImg(virStoragePoolObjPtr pool, storageBackendCreateQemuImgSecretPath(pool, vol))) goto cleanup; - virAsprintf(&secretAlias, "%s_encrypt0", vol->name); + secretAlias = g_strdup_printf("%s_encrypt0", vol->name); } /* Round capacity as qemu-img resize errors out on sizes which are not @@ -2419,7 +2419,7 @@ virStorageBackendVolUploadLocal(virStoragePoolObjPtr pool G_GNUC_UNUSED, return -1; } - virAsprintf(&path, "%s/root.hds", vol->target.path); + path = g_strdup_printf("%s/root.hds", vol->target.path); target_path = path; } @@ -2453,7 +2453,7 @@ virStorageBackendVolDownloadLocal(virStoragePoolObjPtr pool G_GNUC_UNUSED, " will be lost")); return -1; } - virAsprintf(&path, "%s/root.hds", vol->target.path); + path = g_strdup_printf("%s/root.hds", vol->target.path); target_path = path; } @@ -2665,9 +2665,9 @@ storageBackendVolWipePloop(virStorageVolDefPtr vol, return -1; } - virAsprintf(&target_path, "%s/root.hds", vol->target.path); + target_path = g_strdup_printf("%s/root.hds", vol->target.path); - virAsprintf(&disk_desc, "%s/DiskDescriptor.xml", vol->target.path); + disk_desc = g_strdup_printf("%s/DiskDescriptor.xml", vol->target.path); if (storageBackendVolWipeLocalFile(target_path, algorithm, vol->target.allocation, false) < 0) @@ -3525,7 +3525,7 @@ virStorageBackendRefreshLocal(virStoragePoolObjPtr pool) vol->name = g_strdup(ent->d_name); vol->type = VIR_STORAGE_VOL_FILE; - virAsprintf(&vol->target.path, "%s/%s", def->target.path, vol->name); + vol->target.path = g_strdup_printf("%s/%s", def->target.path, vol->name); vol->key = g_strdup(vol->target.path); @@ -3666,9 +3666,9 @@ virStorageBackendSCSINewLun(virStoragePoolObjPtr pool, * in the volume name. We only need uniqueness per-pool, so * just leave 'host' out */ - virAsprintf(&(vol->name), "unit:%u:%u:%u", bus, target, lun); + (vol->name) = g_strdup_printf("unit:%u:%u:%u", bus, target, lun); - virAsprintf(&devpath, "/dev/%s", dev); + devpath = g_strdup_printf("/dev/%s", dev); VIR_DEBUG("Trying to create volume for '%s'", devpath); @@ -3728,7 +3728,7 @@ getNewStyleBlockDevice(const char *lun_path, int direrr; g_autofree char *block_path = NULL; - virAsprintf(&block_path, "%s/block", lun_path); + block_path = g_strdup_printf("%s/block", lun_path); VIR_DEBUG("Looking for block device in '%s'", block_path); @@ -3806,8 +3806,8 @@ getBlockDevice(uint32_t host, *block_device = NULL; - virAsprintf(&lun_path, "/sys/bus/scsi/devices/%u:%u:%u:%u", host, bus, - target, lun); + lun_path = g_strdup_printf("/sys/bus/scsi/devices/%u:%u:%u:%u", host, bus, + target, lun); if (virDirOpen(&lun_dir, lun_path) < 0) goto cleanup; @@ -3859,8 +3859,8 @@ getDeviceType(uint32_t host, FILE *typefile; g_autofree char *type_path = NULL; - virAsprintf(&type_path, "/sys/bus/scsi/devices/%u:%u:%u:%u/type", host, - bus, target, lun); + type_path = g_strdup_printf("/sys/bus/scsi/devices/%u:%u:%u:%u/type", host, + bus, target, lun); typefile = fopen(type_path, "r"); if (typefile == NULL) { @@ -4048,11 +4048,11 @@ virStorageBackendFileSystemGetPoolSource(virStoragePoolObjPtr pool) if (def->type == VIR_STORAGE_POOL_NETFS) { if (def->source.format == VIR_STORAGE_POOL_NETFS_CIFS) { - virAsprintf(&src, "//%s/%s", def->source.hosts[0].name, - def->source.dir); + src = g_strdup_printf("//%s/%s", def->source.hosts[0].name, + def->source.dir); } else { - virAsprintf(&src, "%s:%s", def->source.hosts[0].name, - def->source.dir); + src = g_strdup_printf("%s:%s", def->source.hosts[0].name, + def->source.dir); } } else { src = g_strdup(def->source.devices[0].path); @@ -4168,7 +4168,7 @@ virStorageBackendFileSystemMountCmd(const char *cmdstr, g_autofree char *nfsVers = NULL; if (def->type == VIR_STORAGE_POOL_NETFS && def->source.protocolVer > 0) - virAsprintf(&nfsVers, "nfsvers=%u", def->source.protocolVer); + nfsVers = g_strdup_printf("nfsvers=%u", def->source.protocolVer); cmd = virCommandNew(cmdstr); if (netauto) -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list