int virStorageEncryptionFormat(virBufferPtr buf, virStorageEncryptionPtr enc) { const char *format; size_t i; format = virStorageEncryptionFormatTypeToString(enc->format); if (!format) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("unexpected encryption format")); return -1; } virBufferAsprintf(buf, "<encryption format='%s'>\n", format); virBufferAdjustIndent(buf, 2); for (i = 0; i < enc->nsecrets; i++) { if (virStorageEncryptionSecretFormat(buf, enc->secrets[i]) < 0) return -1; } virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "</encryption>\n"); return 0; }
int virStorageEncryptionFormat(virBufferPtr buf, virStorageEncryptionPtr enc) { const char *format; size_t i; if (!(format = virStorageEncryptionFormatTypeToString(enc->format))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("unexpected encryption format")); return -1; } virBufferAsprintf(buf, "<encryption format='%s'>\n", format); virBufferAdjustIndent(buf, 2); for (i = 0; i < enc->nsecrets; i++) { if (virStorageEncryptionSecretFormat(buf, enc->secrets[i]) < 0) return -1; } if (enc->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS && enc->encinfo.cipher_name) virStorageEncryptionInfoDefFormat(buf, &enc->encinfo); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "</encryption>\n"); return 0; }