Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- src/storage_file/storage_file_backend.c | 8 ++-- src/storage_file/storage_file_backend_fs.c | 6 +-- .../storage_file_backend_gluster.c | 16 +++---- src/storage_file/storage_file_probe.c | 13 +++-- src/storage_file/storage_source.c | 36 +++++++------- .../storage_source_backingstore.c | 47 +++++++++---------- 6 files changed, 59 insertions(+), 67 deletions(-) diff --git a/src/storage_file/storage_file_backend.c b/src/storage_file/storage_file_backend.c index 94944ea356..03583803de 100644 --- a/src/storage_file/storage_file_backend.c +++ b/src/storage_file/storage_file_backend.c @@ -90,8 +90,7 @@ virStorageFileBackendRegister(virStorageFileBackend *backend) if (virStorageFileBackendsCount >= VIR_STORAGE_BACKENDS_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Too many drivers, cannot register storage file " - "backend '%s'"), + _("Too many drivers, cannot register storage file backend '%1$s'"), virStorageTypeToString(backend->type)); return -1; } @@ -130,12 +129,11 @@ virStorageFileBackendForType(int type, if (type == VIR_STORAGE_TYPE_NETWORK) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("missing storage backend for network files " - "using %s protocol"), + _("missing storage backend for network files using %1$s protocol"), virStorageNetProtocolTypeToString(protocol)); } else { virReportError(VIR_ERR_INTERNAL_ERROR, - _("missing storage backend for '%s' storage"), + _("missing storage backend for '%1$s' storage"), virStorageTypeToString(type)); } diff --git a/src/storage_file/storage_file_backend_fs.c b/src/storage_file/storage_file_backend_fs.c index c657cb0277..1de822200d 100644 --- a/src/storage_file/storage_file_backend_fs.c +++ b/src/storage_file/storage_file_backend_fs.c @@ -102,20 +102,20 @@ virStorageFileBackendFileRead(virStorageSource *src, if ((fd = virFileOpenAs(src->path, O_RDONLY, 0, drv->uid, drv->gid, 0)) < 0) { - virReportSystemError(-fd, _("Failed to open file '%s'"), + virReportSystemError(-fd, _("Failed to open file '%1$s'"), src->path); return -1; } if (offset > 0) { if (lseek(fd, offset, SEEK_SET) == (off_t) -1) { - virReportSystemError(errno, _("cannot seek into '%s'"), src->path); + virReportSystemError(errno, _("cannot seek into '%1$s'"), src->path); return -1; } } if ((ret = virFileReadHeaderFD(fd, len, buf)) < 0) { - virReportSystemError(errno, _("cannot read header '%s'"), src->path); + virReportSystemError(errno, _("cannot read header '%1$s'"), src->path); return -1; } diff --git a/src/storage_file/storage_file_backend_gluster.c b/src/storage_file/storage_file_backend_gluster.c index 72341cf2c5..d018d5422e 100644 --- a/src/storage_file/storage_file_backend_gluster.c +++ b/src/storage_file/storage_file_backend_gluster.c @@ -83,7 +83,7 @@ virStorageFileBackendGlusterInitServer(virStorageFileBackendGlusterPriv *priv, if (glfs_set_volfile_server(priv->vol, transport, hoststr, port) < 0) { virReportSystemError(errno, - _("failed to set gluster volfile server '%s'"), + _("failed to set gluster volfile server '%1$s'"), hoststr); return -1; } @@ -101,7 +101,7 @@ virStorageFileBackendGlusterInit(virStorageSource *src) if (!src->volume) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("missing gluster volume name for path '%s'"), + _("missing gluster volume name for path '%1$s'"), src->path); return -1; } @@ -115,7 +115,7 @@ virStorageFileBackendGlusterInit(virStorageSource *src) if (!(priv->vol = glfs_new(src->volume))) { virReportError(VIR_ERR_OPERATION_FAILED, - _("failed to create glfs object for '%s'"), src->volume); + _("failed to create glfs object for '%1$s'"), src->volume); goto error; } @@ -126,8 +126,8 @@ virStorageFileBackendGlusterInit(virStorageSource *src) if (glfs_init(priv->vol) < 0) { virReportSystemError(errno, - _("failed to initialize gluster connection " - "(src=%p priv=%p)"), src, priv); + _("failed to initialize gluster connection (src=%1$p priv=%2$p)"), + src, priv); goto error; } @@ -197,14 +197,14 @@ virStorageFileBackendGlusterRead(virStorageSource *src, *buf = NULL; if (!(fd = glfs_open(priv->vol, src->path, O_RDONLY))) { - virReportSystemError(errno, _("Failed to open file '%s'"), + virReportSystemError(errno, _("Failed to open file '%1$s'"), src->path); return -1; } if (offset > 0) { if (glfs_lseek(fd, offset, SEEK_SET) == (off_t) -1) { - virReportSystemError(errno, _("cannot seek into '%s'"), src->path); + virReportSystemError(errno, _("cannot seek into '%1$s'"), src->path); goto cleanup; } } @@ -219,7 +219,7 @@ virStorageFileBackendGlusterRead(virStorageSource *src, continue; if (r < 0) { VIR_FREE(*buf); - virReportSystemError(errno, _("unable to read '%s'"), src->path); + virReportSystemError(errno, _("unable to read '%1$s'"), src->path); return r; } if (r == 0) diff --git a/src/storage_file/storage_file_probe.c b/src/storage_file/storage_file_probe.c index 9465af5d96..a96d01ecc7 100644 --- a/src/storage_file/storage_file_probe.c +++ b/src/storage_file/storage_file_probe.c @@ -900,7 +900,7 @@ virStorageFileProbeGetMetadata(virStorageSource *meta, if (meta->format <= VIR_STORAGE_FILE_NONE || meta->format >= VIR_STORAGE_FILE_LAST) { - virReportSystemError(EINVAL, _("unknown storage file meta->format %d"), + virReportSystemError(EINVAL, _("unknown storage file meta->format %1$d"), meta->format); return -1; } @@ -916,8 +916,7 @@ virStorageFileProbeGetMetadata(virStorageSource *meta, } else { if (meta->encryption->format != expt_fmt) { virReportError(VIR_ERR_XML_ERROR, - _("encryption format %d doesn't match " - "expected format %d"), + _("encryption format %1$d doesn't match expected format %2$d"), meta->encryption->format, expt_fmt); return -1; } @@ -1004,12 +1003,12 @@ virStorageFileProbeFormat(const char *path, uid_t uid, gid_t gid) g_autofree char *header = NULL; if ((fd = virFileOpenAs(path, O_RDONLY, 0, uid, gid, 0)) < 0) { - virReportSystemError(-fd, _("Failed to open file '%s'"), path); + virReportSystemError(-fd, _("Failed to open file '%1$s'"), path); return -1; } if (fstat(fd, &sb) < 0) { - virReportSystemError(errno, _("cannot stat file '%s'"), path); + virReportSystemError(errno, _("cannot stat file '%1$s'"), path); return -1; } @@ -1018,12 +1017,12 @@ virStorageFileProbeFormat(const char *path, uid_t uid, gid_t gid) return VIR_STORAGE_FILE_DIR; if (lseek(fd, 0, SEEK_SET) == (off_t)-1) { - virReportSystemError(errno, _("cannot set to start of '%s'"), path); + virReportSystemError(errno, _("cannot set to start of '%1$s'"), path); return -1; } if ((len = virFileReadHeaderFD(fd, len, &header)) < 0) { - virReportSystemError(errno, _("cannot read header '%s'"), path); + virReportSystemError(errno, _("cannot read header '%1$s'"), path); return -1; } diff --git a/src/storage_file/storage_source.c b/src/storage_file/storage_source.c index 0846c400c8..47fc1edbd2 100644 --- a/src/storage_file/storage_source.c +++ b/src/storage_file/storage_source.c @@ -159,7 +159,7 @@ virStorageSourceGetMetadataFromFD(const char *path, if (fstat(fd, &sb) < 0) { virReportSystemError(errno, - _("cannot stat file '%s'"), path); + _("cannot stat file '%1$s'"), path); return NULL; } @@ -175,12 +175,12 @@ virStorageSourceGetMetadataFromFD(const char *path, } if (lseek(fd, 0, SEEK_SET) == (off_t)-1) { - virReportSystemError(errno, _("cannot seek to start of '%s'"), meta->path); + virReportSystemError(errno, _("cannot seek to start of '%1$s'"), meta->path); return NULL; } if ((len = virFileReadHeaderFD(fd, len, &buf)) < 0) { - virReportSystemError(errno, _("cannot read header '%s'"), meta->path); + virReportSystemError(errno, _("cannot read header '%1$s'"), meta->path); return NULL; } @@ -243,7 +243,7 @@ virStorageSourceChainLookup(virStorageSource *chain, idx != 0 && STRNEQ(diskTarget, target)) { virReportError(VIR_ERR_INVALID_ARG, - _("requested target '%s' does not match target '%s'"), + _("requested target '%1$s' does not match target '%2$s'"), target, diskTarget); return NULL; } @@ -301,20 +301,20 @@ virStorageSourceChainLookup(virStorageSource *chain, error: if (idx) { virReportError(VIR_ERR_INVALID_ARG, - _("could not find backing store index '%u' in chain for '%s'"), + _("could not find backing store index '%1$u' in chain for '%2$s'"), idx, NULLSTR(start)); } else if (name) { if (startFrom) virReportError(VIR_ERR_INVALID_ARG, - _("could not find image '%s' beneath '%s' in chain for '%s'"), + _("could not find image '%1$s' beneath '%2$s' in chain for '%3$s'"), name, NULLSTR(startFrom->path), NULLSTR(start)); else virReportError(VIR_ERR_INVALID_ARG, - _("could not find image '%s' in chain for '%s'"), + _("could not find image '%1$s' in chain for '%2$s'"), name, NULLSTR(start)); } else { virReportError(VIR_ERR_INVALID_ARG, - _("could not find base image in chain for '%s'"), + _("could not find base image in chain for '%1$s'"), NULLSTR(start)); } *parent = NULL; @@ -645,7 +645,7 @@ virStorageSourceUpdateBackingSizes(virStorageSource *src, */ if ((end = lseek(fd, 0, SEEK_END)) == (off_t)-1) { virReportSystemError(errno, - _("failed to seek to end of %s"), src->path); + _("failed to seek to end of %1$s"), src->path); return -1; } src->physical = end; @@ -679,7 +679,7 @@ virStorageSourceUpdateCapacity(virStorageSource *src, * physical size. */ if (format == VIR_STORAGE_FILE_NONE) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("no disk format for %s was specified"), + _("no disk format for %1$s was specified"), src->path); return -1; } @@ -1269,24 +1269,21 @@ virStorageSourceReportBrokenChain(int errcode, if (src == parent) { virReportSystemError(errcode, - _("Cannot access storage file '%s' " - "(as uid:%u, gid:%u)"), + _("Cannot access storage file '%1$s' (as uid:%2$u, gid:%3$u)"), src->path, access_user, access_group); } else { virReportSystemError(errcode, - _("Cannot access backing file '%s' " - "of storage file '%s' (as uid:%u, gid:%u)"), + _("Cannot access backing file '%1$s' of storage file '%2$s' (as uid:%3$u, gid:%4$u)"), src->path, parent->path, access_user, access_group); } } else { if (src == parent) { virReportSystemError(errcode, - _("Cannot access storage file '%s'"), + _("Cannot access storage file '%1$s'"), src->path); } else { virReportSystemError(errcode, - _("Cannot access backing file '%s' " - "of storage file '%s'"), + _("Cannot access backing file '%1$s' of storage file '%2$s'"), src->path, parent->path); } } @@ -1360,7 +1357,7 @@ virStorageSourceGetMetadataRecurse(virStorageSource *src, if (depth > max_depth) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("backing store for %s is self-referential or too deeply nested"), + _("backing store for %1$s is self-referential or too deeply nested"), NULLSTR(src->path)); return -1; } @@ -1411,8 +1408,7 @@ virStorageSourceGetMetadataRecurse(virStorageSource *src, if (rv == -2) { virReportError(VIR_ERR_OPERATION_INVALID, - _("format of backing image '%s' of image '%s' was not specified in the image metadata " - "(See https://libvirt.org/kbase/backing_chains.html for troubleshooting)"), + _("format of backing image '%1$s' of image '%2$s' was not specified in the image metadata (See https://libvirt.org/kbase/backing_chains.html for troubleshooting)"), src->backingStoreRaw, NULLSTR(src->path)); } diff --git a/src/storage_file/storage_source_backingstore.c b/src/storage_file/storage_source_backingstore.c index e48ae725ab..a4ee2a5d78 100644 --- a/src/storage_file/storage_source_backingstore.c +++ b/src/storage_file/storage_source_backingstore.c @@ -46,7 +46,7 @@ virStorageSourceParseBackingURI(virStorageSource *src, if (!(uri = virURIParse(uristr))) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("failed to parse backing file location '%s'"), + _("failed to parse backing file location '%1$s'"), uristr); return -1; } @@ -60,7 +60,7 @@ virStorageSourceParseBackingURI(virStorageSource *src, if (!scheme[0] || (src->protocol = virStorageNetProtocolTypeFromString(scheme[0])) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("invalid backing protocol '%s'"), + _("invalid backing protocol '%1$s'"), NULLSTR(scheme[0])); return -1; } @@ -68,7 +68,7 @@ virStorageSourceParseBackingURI(virStorageSource *src, if (scheme[1] && (src->hosts->transport = virStorageNetHostTransportTypeFromString(scheme[1])) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("invalid protocol transport type '%s'"), + _("invalid protocol transport type '%1$s'"), scheme[1]); return -1; } @@ -114,8 +114,8 @@ virStorageSourceParseBackingURI(virStorageSource *src, if (!(tmp = strchr(src->path, '/')) || tmp == src->path) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("missing volume name or file name in " - "gluster source path '%s'"), src->path); + _("missing volume name or file name in gluster source path '%1$s'"), + src->path); return -1; } @@ -238,7 +238,7 @@ virStorageSourceParseRBDColonString(const char *rbdstr, /* formulate authdef for src->auth */ if (src->auth) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("duplicate 'id' found in '%s'"), src->path); + _("duplicate 'id' found in '%1$s'"), src->path); return -1; } @@ -357,7 +357,7 @@ virStorageSourceParseNBDColonString(const char *nbdstr, malformed: virReportError(VIR_ERR_INTERNAL_ERROR, - _("malformed nbd string '%s'"), nbdstr); + _("malformed nbd string '%1$s'"), nbdstr); return -1; } @@ -371,7 +371,7 @@ virStorageSourceParseBackingColon(virStorageSource *src, if (!(p = strchr(path, ':'))) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("invalid backing protocol string '%s'"), + _("invalid backing protocol string '%1$s'"), path); return -1; } @@ -380,7 +380,7 @@ virStorageSourceParseBackingColon(virStorageSource *src, if ((src->protocol = virStorageNetProtocolTypeFromString(protocol)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("invalid backing protocol '%s'"), + _("invalid backing protocol '%1$s'"), protocol); return -1; } @@ -400,7 +400,7 @@ virStorageSourceParseBackingColon(virStorageSource *src, case VIR_STORAGE_NET_PROTOCOL_LAST: case VIR_STORAGE_NET_PROTOCOL_NONE: virReportError(VIR_ERR_INTERNAL_ERROR, - _("backing store parser is not implemented for protocol %s"), + _("backing store parser is not implemented for protocol %1$s"), protocol); return -1; @@ -415,7 +415,7 @@ virStorageSourceParseBackingColon(virStorageSource *src, case VIR_STORAGE_NET_PROTOCOL_VXHS: case VIR_STORAGE_NET_PROTOCOL_NFS: virReportError(VIR_ERR_INTERNAL_ERROR, - _("malformed backing store path for protocol %s"), + _("malformed backing store path for protocol %1$s"), protocol); return -1; } @@ -465,8 +465,7 @@ virStorageSourceParseBackingJSONUriStr(virStorageSource *src, if (src->protocol != protocol) { virReportError(VIR_ERR_INVALID_ARG, - _("expected protocol '%s' but got '%s' in URI JSON volume " - "definition"), + _("expected protocol '%1$s' but got '%2$s' in URI JSON volume definition"), virStorageNetProtocolTypeToString(protocol), virStorageNetProtocolTypeToString(src->protocol)); return -1; @@ -490,7 +489,7 @@ virStorageSourceParseBackingJSONUriCookies(virStorageSource *src, if (!(cookiestr = virJSONValueObjectGetString(json, "cookie"))) { virReportError(VIR_ERR_INVALID_ARG, - _("wrong format of 'cookie' field in backing store definition '%s'"), + _("wrong format of 'cookie' field in backing store definition '%1$s'"), jsonstr); return -1; } @@ -509,7 +508,7 @@ virStorageSourceParseBackingJSONUriCookies(virStorageSource *src, if (!(cookievalue = strchr(cookiename, '='))) { virReportError(VIR_ERR_INVALID_ARG, - _("malformed http cookie '%s' in backing store definition '%s'"), + _("malformed http cookie '%1$s' in backing store definition '%2$s'"), cookies[i], jsonstr); return -1; } @@ -553,7 +552,7 @@ virStorageSourceParseBackingJSONUri(virStorageSource *src, } else { if (virJSONValueObjectGetBoolean(json, "sslverify", &tmp) < 0) { virReportError(VIR_ERR_INVALID_ARG, - _("malformed 'sslverify' field in backing store definition '%s'"), + _("malformed 'sslverify' field in backing store definition '%1$s'"), jsonstr); return -1; } @@ -572,7 +571,7 @@ virStorageSourceParseBackingJSONUri(virStorageSource *src, if (virJSONValueObjectHasKey(json, "readahead") && virJSONValueObjectGetNumberUlong(json, "readahead", &src->readahead) < 0) { virReportError(VIR_ERR_INVALID_ARG, - _("malformed 'readahead' field in backing store definition '%s'"), + _("malformed 'readahead' field in backing store definition '%1$s'"), jsonstr); return -1; } @@ -580,7 +579,7 @@ virStorageSourceParseBackingJSONUri(virStorageSource *src, if (virJSONValueObjectHasKey(json, "timeout") && virJSONValueObjectGetNumberUlong(json, "timeout", &src->timeout) < 0) { virReportError(VIR_ERR_INVALID_ARG, - _("malformed 'timeout' field in backing store definition '%s'"), + _("malformed 'timeout' field in backing store definition '%1$s'"), jsonstr); return -1; } @@ -666,7 +665,7 @@ virStorageSourceParseBackingJSONSocketAddress(virStorageNetHostDef *host, host->socket = g_strdup(socket); } else { virReportError(VIR_ERR_INTERNAL_ERROR, - _("backing store protocol '%s' is not yet supported"), + _("backing store protocol '%1$s' is not yet supported"), type); return -1; } @@ -1015,7 +1014,7 @@ virStorageSourceParseBackingJSONRaw(virStorageSource *src, /* 'raw' is a format driver so it can have protocol driver children */ if (!(file = virJSONValueObjectGetObject(json, "file"))) { virReportError(VIR_ERR_INVALID_ARG, - _("JSON backing volume definition '%s' lacks 'file' object"), + _("JSON backing volume definition '%1$s' lacks 'file' object"), jsonstr); return -1; } @@ -1181,7 +1180,7 @@ virStorageSourceParseBackingJSONInternal(virStorageSource *src, if (!(drvname = virJSONValueObjectGetString(json, "driver"))) { virReportError(VIR_ERR_INVALID_ARG, - _("JSON backing volume definition '%s' lacks driver name"), + _("JSON backing volume definition '%1$s' lacks driver name"), jsonstr); return -1; } @@ -1192,7 +1191,7 @@ virStorageSourceParseBackingJSONInternal(virStorageSource *src, if (jsonParsers[i].formatdriver && !allowformat) { virReportError(VIR_ERR_INVALID_ARG, - _("JSON backing volume definition '%s' must not have nested format drivers"), + _("JSON backing volume definition '%1$s' must not have nested format drivers"), jsonstr); return -1; } @@ -1201,8 +1200,8 @@ virStorageSourceParseBackingJSONInternal(virStorageSource *src, } virReportError(VIR_ERR_INTERNAL_ERROR, - _("missing parser implementation for JSON backing volume " - "driver '%s'"), drvname); + _("missing parser implementation for JSON backing volume driver '%1$s'"), + drvname); return -1; } -- 2.39.2