mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-04-26 15:14:42 +00:00
virStorageEncryptionInfoParseCipher: Use virXMLProp*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
88cc6a1f9f
commit
ad1d37876d
@ -176,27 +176,15 @@ static int
|
|||||||
virStorageEncryptionInfoParseCipher(xmlNodePtr info_node,
|
virStorageEncryptionInfoParseCipher(xmlNodePtr info_node,
|
||||||
virStorageEncryptionInfoDef *info)
|
virStorageEncryptionInfoDef *info)
|
||||||
{
|
{
|
||||||
g_autofree char *size_str = NULL;
|
|
||||||
|
|
||||||
if (!(info->cipher_name = virXMLPropString(info_node, "name"))) {
|
if (!(info->cipher_name = virXMLPropString(info_node, "name"))) {
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("cipher info missing 'name' attribute"));
|
_("cipher info missing 'name' attribute"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((size_str = virXMLPropString(info_node, "size")) &&
|
if (virXMLPropUInt(info_node, "size", 10, VIR_XML_PROP_REQUIRED,
|
||||||
virStrToLong_uip(size_str, NULL, 10, &info->cipher_size) < 0) {
|
&info->cipher_size) < 0)
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
|
||||||
_("cannot parse cipher size: '%s'"),
|
|
||||||
size_str);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
if (!size_str) {
|
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
|
||||||
_("cipher info missing 'size' attribute"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
info->cipher_mode = virXMLPropString(info_node, "mode");
|
info->cipher_mode = virXMLPropString(info_node, "mode");
|
||||||
info->cipher_hash = virXMLPropString(info_node, "hash");
|
info->cipher_hash = virXMLPropString(info_node, "hash");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user