conf: eliminate hardcoded indentation in all remaining xml

These last files had such a small change count I just put them into a
single patch.
This commit is contained in:
Laine Stump 2014-03-06 16:58:56 +02:00
parent 0224039c42
commit 68d63c6b6f
5 changed files with 30 additions and 19 deletions

View File

@ -1,7 +1,7 @@
/* /*
* cpu_conf.c: CPU XML handling * cpu_conf.c: CPU XML handling
* *
* Copyright (C) 2009-2013 Red Hat, Inc. * Copyright (C) 2009-2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -541,12 +541,11 @@ virCPUDefFormatBufFull(virBufferPtr buf,
} }
} }
virBufferAddLit(buf, ">\n"); virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
if (def->arch) if (def->arch)
virBufferAsprintf(buf, "<arch>%s</arch>\n", virBufferAsprintf(buf, "<arch>%s</arch>\n",
virArchToString(def->arch)); virArchToString(def->arch));
virBufferAdjustIndent(buf, 2);
if (virCPUDefFormatBuf(buf, def, flags) < 0) if (virCPUDefFormatBuf(buf, def, flags) < 0)
return -1; return -1;
virBufferAdjustIndent(buf, -2); virBufferAdjustIndent(buf, -2);
@ -645,12 +644,14 @@ virCPUDefFormatBuf(virBufferPtr buf,
if (def->ncells) { if (def->ncells) {
virBufferAddLit(buf, "<numa>\n"); virBufferAddLit(buf, "<numa>\n");
virBufferAdjustIndent(buf, 2);
for (i = 0; i < def->ncells; i++) { for (i = 0; i < def->ncells; i++) {
virBufferAddLit(buf, "<cell"); virBufferAddLit(buf, "<cell");
virBufferAsprintf(buf, " cpus='%s'", def->cells[i].cpustr); virBufferAsprintf(buf, " cpus='%s'", def->cells[i].cpustr);
virBufferAsprintf(buf, " memory='%d'", def->cells[i].mem); virBufferAsprintf(buf, " memory='%d'", def->cells[i].mem);
virBufferAddLit(buf, "/>\n"); virBufferAddLit(buf, "/>\n");
} }
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</numa>\n"); virBufferAddLit(buf, "</numa>\n");
} }
return 0; return 0;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2009-2011 Red Hat, Inc. * Copyright (C) 2009-2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -257,9 +257,11 @@ virNetDevBandwidthFormat(virNetDevBandwidthPtr def, virBufferPtr buf)
} }
virBufferAddLit(buf, "<bandwidth>\n"); virBufferAddLit(buf, "<bandwidth>\n");
virBufferAdjustIndent(buf, 2);
if (virNetDevBandwidthRateFormat(def->in, buf, "inbound") < 0 || if (virNetDevBandwidthRateFormat(def->in, buf, "inbound") < 0 ||
virNetDevBandwidthRateFormat(def->out, buf, "outbound") < 0) virNetDevBandwidthRateFormat(def->out, buf, "outbound") < 0)
goto cleanup; goto cleanup;
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</bandwidth>\n"); virBufferAddLit(buf, "</bandwidth>\n");
ret = 0; ret = 0;

View File

@ -154,6 +154,7 @@ virNetDevVlanFormat(const virNetDevVlan *def, virBufferPtr buf)
} }
virBufferAsprintf(buf, "<vlan%s>\n", def->trunk ? " trunk='yes'" : ""); virBufferAsprintf(buf, "<vlan%s>\n", def->trunk ? " trunk='yes'" : "");
virBufferAdjustIndent(buf, 2);
for (i = 0; i < def->nTags; i++) { for (i = 0; i < def->nTags; i++) {
if (def->nativeMode != VIR_NATIVE_VLAN_MODE_DEFAULT && if (def->nativeMode != VIR_NATIVE_VLAN_MODE_DEFAULT &&
def->nativeTag == def->tag[i]) { def->nativeTag == def->tag[i]) {
@ -169,6 +170,7 @@ virNetDevVlanFormat(const virNetDevVlan *def, virBufferPtr buf)
virBufferAsprintf(buf, "<tag id='%u'/>\n", def->tag[i]); virBufferAsprintf(buf, "<tag id='%u'/>\n", def->tag[i]);
} }
} }
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</vlan>\n"); virBufferAddLit(buf, "</vlan>\n");
return 0; return 0;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2009-2012 Red Hat, Inc. * Copyright (C) 2009-2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -232,6 +232,7 @@ virNetDevVPortProfileFormat(virNetDevVPortProfilePtr virtPort,
virNetDevVPortTypeToString(type)); virNetDevVPortTypeToString(type));
} }
} }
virBufferAdjustIndent(buf, 2);
virBufferAddLit(buf, "<parameters"); virBufferAddLit(buf, "<parameters");
if (virtPort->managerID_specified && if (virtPort->managerID_specified &&
@ -274,6 +275,7 @@ virNetDevVPortProfileFormat(virNetDevVPortProfilePtr virtPort,
} }
virBufferAddLit(buf, "/>\n"); virBufferAddLit(buf, "/>\n");
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</virtualport>\n"); virBufferAddLit(buf, "</virtualport>\n");
return 0; return 0;
} }

View File

@ -1,7 +1,7 @@
/* /*
* secret_conf.c: internal <secret> XML handling * secret_conf.c: internal <secret> XML handling
* *
* Copyright (C) 2009, 2011, 2013 Red Hat, Inc. * Copyright (C) 2009, 2011, 2013, 2014 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -255,6 +255,7 @@ virSecretDefFormatUsage(virBufferPtr buf,
return -1; return -1;
} }
virBufferAsprintf(buf, "<usage type='%s'>\n", type); virBufferAsprintf(buf, "<usage type='%s'>\n", type);
virBufferAdjustIndent(buf, 2);
switch (def->usage_type) { switch (def->usage_type) {
case VIR_SECRET_USAGE_TYPE_NONE: case VIR_SECRET_USAGE_TYPE_NONE:
break; break;
@ -285,6 +286,7 @@ virSecretDefFormatUsage(virBufferPtr buf,
def->usage_type); def->usage_type);
return -1; return -1;
} }
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</usage>\n"); virBufferAddLit(buf, "</usage>\n");
return 0; return 0;
@ -303,6 +305,7 @@ virSecretDefFormat(const virSecretDef *def)
uuid = def->uuid; uuid = def->uuid;
virUUIDFormat(uuid, uuidstr); virUUIDFormat(uuid, uuidstr);
virBufferAdjustIndent(&buf, 2);
virBufferEscapeString(&buf, "<uuid>%s</uuid>\n", uuidstr); virBufferEscapeString(&buf, "<uuid>%s</uuid>\n", uuidstr);
if (def->description != NULL) if (def->description != NULL)
virBufferEscapeString(&buf, "<description>%s</description>\n", virBufferEscapeString(&buf, "<description>%s</description>\n",
@ -310,6 +313,7 @@ virSecretDefFormat(const virSecretDef *def)
if (def->usage_type != VIR_SECRET_USAGE_TYPE_NONE && if (def->usage_type != VIR_SECRET_USAGE_TYPE_NONE &&
virSecretDefFormatUsage(&buf, def) < 0) virSecretDefFormatUsage(&buf, def) < 0)
goto error; goto error;
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</secret>\n"); virBufferAddLit(&buf, "</secret>\n");
if (virBufferError(&buf)) if (virBufferError(&buf))