mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 21:34:54 +03:00
util: move virStorageFileCheckCompat into conf
It is not used anywhere else. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
780aa25fad
commit
f1007b1eb4
@ -1296,6 +1296,27 @@ virStorageSize(const char *unit,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virStorageCheckCompat(const char *compat)
|
||||
{
|
||||
unsigned int result;
|
||||
g_auto(GStrv) version = NULL;
|
||||
|
||||
if (!compat)
|
||||
return 0;
|
||||
|
||||
version = virStringSplit(compat, ".", 2);
|
||||
if (!version || !version[1] ||
|
||||
virStrToLong_ui(version[0], NULL, 10, &result) < 0 ||
|
||||
virStrToLong_ui(version[1], NULL, 10, &result) < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("forbidden characters in 'compat' attribute"));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static virStorageVolDefPtr
|
||||
virStorageVolDefParseXML(virStoragePoolDefPtr pool,
|
||||
xmlXPathContextPtr ctxt,
|
||||
@ -1424,7 +1445,7 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
|
||||
}
|
||||
|
||||
def->target.compat = virXPathString("string(./target/compat)", ctxt);
|
||||
if (virStorageFileCheckCompat(def->target.compat) < 0)
|
||||
if (virStorageCheckCompat(def->target.compat) < 0)
|
||||
return NULL;
|
||||
|
||||
if (virXPathNode("./target/nocow", ctxt))
|
||||
|
@ -4410,30 +4410,6 @@ virStorageFileGetRelativeBackingPath(virStorageSourcePtr top,
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* virStorageFileCheckCompat
|
||||
*/
|
||||
int
|
||||
virStorageFileCheckCompat(const char *compat)
|
||||
{
|
||||
unsigned int result;
|
||||
g_auto(GStrv) version = NULL;
|
||||
|
||||
if (!compat)
|
||||
return 0;
|
||||
|
||||
version = virStringSplit(compat, ".", 2);
|
||||
if (!version || !version[1] ||
|
||||
virStrToLong_ui(version[0], NULL, 10, &result) < 0 ||
|
||||
virStrToLong_ui(version[1], NULL, 10, &result) < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("forbidden characters in 'compat' attribute"));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virStorageSourceIsRelative:
|
||||
* @src: storage source to check
|
||||
|
@ -513,8 +513,6 @@ int virStorageFileGetRelativeBackingPath(virStorageSourcePtr from,
|
||||
char **relpath)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
|
||||
|
||||
int virStorageFileCheckCompat(const char *compat);
|
||||
|
||||
int virStorageSourceNewFromBackingAbsolute(const char *path,
|
||||
virStorageSourcePtr *src);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user