if (def->serial)
virBufferEscapeString(buf, " <serial>%s</serial>\n",
def->serial);
- if (def->encryption != NULL &&
- virStorageEncryptionFormat(buf, def->encryption, 6) < 0)
- return -1;
+ if (def->encryption) {
+ virBufferAdjustIndent(buf, 6);
+ if (virStorageEncryptionFormat(buf, def->encryption) < 0)
+ return -1;
+ virBufferAdjustIndent(buf, -6);
+ }
if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
return -1;
virBufferAddLit(buf," </permissions>\n");
- if (def->encryption != NULL &&
- virStorageEncryptionFormat(buf, def->encryption, 4) < 0)
- return -1;
+ if (def->encryption) {
+ virBufferAdjustIndent(buf, 4);
+ if (virStorageEncryptionFormat(buf, def->encryption) < 0)
+ return -1;
+ virBufferAdjustIndent(buf, -4);
+ }
virBufferAsprintf(buf, " </%s>\n", type);
/*
* storage_encryption_conf.c: volume encryption information
*
- * Copyright (C) 2009-2010 Red Hat, Inc.
+ * Copyright (C) 2009-2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
static int
virStorageEncryptionSecretFormat(virBufferPtr buf,
- virStorageEncryptionSecretPtr secret,
- int indent)
+ virStorageEncryptionSecretPtr secret)
{
const char *type;
char uuidstr[VIR_UUID_STRING_BUFLEN];
}
virUUIDFormat(secret->uuid, uuidstr);
- virBufferAsprintf(buf, "%*s<secret type='%s' uuid='%s'/>\n",
- indent, "", type, uuidstr);
+ virBufferAsprintf(buf, " <secret type='%s' uuid='%s'/>\n",
+ type, uuidstr);
return 0;
}
int
virStorageEncryptionFormat(virBufferPtr buf,
- virStorageEncryptionPtr enc,
- int indent)
+ virStorageEncryptionPtr enc)
{
const char *format;
size_t i;
"%s", _("unexpected encryption format"));
return -1;
}
- virBufferAsprintf(buf, "%*s<encryption format='%s'>\n",
- indent, "", format);
+ virBufferAsprintf(buf, "<encryption format='%s'>\n", format);
for (i = 0; i < enc->nsecrets; i++) {
- if (virStorageEncryptionSecretFormat(buf, enc->secrets[i],
- indent + 2) < 0)
+ if (virStorageEncryptionSecretFormat(buf, enc->secrets[i]) < 0)
return -1;
}
- virBufferAsprintf(buf, "%*s</encryption>\n", indent, "");
+ virBufferAddLit(buf, "</encryption>\n");
return 0;
}
/*
* storage_encryption_conf.h: volume encryption information
*
- * Copyright (C) 2009-2010 Red Hat, Inc.
+ * Copyright (C) 2009-2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
virStorageEncryptionPtr virStorageEncryptionParseNode(xmlDocPtr xml,
xmlNodePtr root);
int virStorageEncryptionFormat(virBufferPtr buf,
- virStorageEncryptionPtr enc,
- int indent);
+ virStorageEncryptionPtr enc);
/* A helper for VIR_STORAGE_ENCRYPTION_FORMAT_QCOW */
enum {