We already have virAsprintf, so picking a similar name helps for seeing a similar purpose. Furthermore, the prefix V before printf generally implies va_arg, even though this variant was ..., and therefore the old name got in the way of adding a new va_arg version. global rename performed with: $ git grep -l virBufferVSprintf \ | xargs -L1 sed -i 's/virBufferVSprintf/virBufferAsprintf/g' --- Completely mechanical. ChangeLog-old | 2 +- HACKING | 2 +- docs/api_extension/0008-support-new-xml.patch | 46 ++-- ...improve-vcpu-support-in-qemu-command-line.patch | 8 +- ...-improve-vcpu-support-in-xen-command-line.patch | 12 +- docs/hacking.html.in | 2 +- docs/news.html.in | 4 +- src/conf/capabilities.c | 48 ++-- src/conf/cpu_conf.c | 24 +- src/conf/domain_conf.c | 294 ++++++++++---------- src/conf/interface_conf.c | 60 ++-- src/conf/network_conf.c | 26 +- src/conf/node_device_conf.c | 62 ++-- src/conf/nwfilter_conf.c | 34 ++-- src/conf/nwfilter_params.c | 2 +- src/conf/secret_conf.c | 4 +- src/conf/storage_conf.c | 70 +++--- src/conf/storage_encryption_conf.c | 6 +- src/cpu/cpu_map.c | 2 +- src/esx/esx_driver.c | 4 +- src/esx/esx_vi.c | 2 +- src/esx/esx_vi_types.c | 6 +- src/libvirt_private.syms | 2 +- src/network/bridge_driver.c | 4 +- src/node_device/node_device_udev.c | 4 +- src/nwfilter/nwfilter_ebiptables_driver.c | 206 +++++++------- src/nwfilter/nwfilter_learnipaddr.c | 4 +- src/openvz/openvz_driver.c | 18 +- src/phyp/phyp_driver.c | 248 ++++++++-------- src/qemu/qemu_command.c | 256 +++++++++--------- src/qemu/qemu_domain.c | 6 +- src/qemu/qemu_monitor.c | 4 +- src/security/virt-aa-helper.c | 12 +- src/uml/uml_conf.c | 10 +- src/util/bitmap.c | 2 +- src/util/buf.c | 12 +- src/util/buf.h | 2 +- src/util/conf.c | 10 +- src/util/logging.c | 8 +- src/util/sexpr.c | 2 +- src/util/sysinfo.c | 12 +- src/vmx/vmx.c | 138 +++++----- src/xen/xend_internal.c | 2 +- src/xen/xm_internal.c | 2 +- src/xenapi/xenapi_utils.c | 2 +- src/xenxs/xen_sxpr.c | 60 ++-- src/xenxs/xen_xm.c | 40 ++-- tests/cputest.c | 6 +- tests/virbuftest.c | 2 +- tools/virsh.c | 64 +++--- 50 files changed, 929 insertions(+), 929 deletions(-) diff --git a/ChangeLog-old b/ChangeLog-old index c3b41e2..af9b914 100644 --- a/ChangeLog-old +++ b/ChangeLog-old @@ -15782,7 +15782,7 @@ Wed May 10 13:17:00 CEST 2006 Karel Zak <kzak@xxxxxxxxxx> * src/xml.c src/xml.h: added virBufferNew() and virBufferStrcat() * tests/xmlrpctest.c: added performace tests for virBufferStrcat() and - virBufferVSprintf() + virBufferAsprintf() * src/xmlrpc.c: used virBufferStrcat() Tue May 9 16:37:22 CEST 2006 Karel Zak <kzak@xxxxxxxxxx> diff --git a/HACKING b/HACKING index 686328c..8ebbec7 100644 --- a/HACKING +++ b/HACKING @@ -545,7 +545,7 @@ Typical usage is as follows: ... virBufferAddLit(&buf, "<domain>\n"); - virBufferVSprintf(&buf, " <memory>%d</memory>\n", memory); + virBufferAsprintf(&buf, " <memory>%d</memory>\n", memory); ... virBufferAddLit(&buf, "</domain>\n"); diff --git a/docs/api_extension/0008-support-new-xml.patch b/docs/api_extension/0008-support-new-xml.patch index 821cfa5..276b339 100644 --- a/docs/api_extension/0008-support-new-xml.patch +++ b/docs/api_extension/0008-support-new-xml.patch @@ -107,7 +107,7 @@ index 78d7a6a..a997e06 100644 allones = 0; - if (allones) { -- virBufferVSprintf(&buf, " <vcpu>%lu</vcpu>\n", def->vcpus); +- virBufferAsprintf(&buf, " <vcpu>%lu</vcpu>\n", def->vcpus); - } else { + virBufferAddLit(&buf, " <vcpu"); + if (!allones) { @@ -115,14 +115,14 @@ index 78d7a6a..a997e06 100644 if ((cpumask = virDomainCpuSetFormat(def->cpumask, def->cpumasklen)) == NULL) goto cleanup; -- virBufferVSprintf(&buf, " <vcpu cpuset='%s'>%lu</vcpu>\n", +- virBufferAsprintf(&buf, " <vcpu cpuset='%s'>%lu</vcpu>\n", - cpumask, def->vcpus); -+ virBufferVSprintf(&buf, " cpuset='%s'", cpumask); ++ virBufferAsprintf(&buf, " cpuset='%s'", cpumask); VIR_FREE(cpumask); } + if (def->vcpus != def->maxvcpus) -+ virBufferVSprintf(&buf, " current='%u'", def->vcpus); -+ virBufferVSprintf(&buf, ">%u</vcpu>\n", def->maxvcpus); ++ virBufferAsprintf(&buf, " current='%u'", def->vcpus); ++ virBufferAsprintf(&buf, ">%u</vcpu>\n", def->maxvcpus); if (def->os.bootloader) { virBufferEscapeString(&buf, " <bootloader>%s</bootloader>\n", @@ -184,8 +184,8 @@ index 7ec8c0e..0a26614 100644 goto cleanup; } -- virBufferVSprintf(&buffer, "numvcpus = \"%d\"\n", (int)def->vcpus); -+ virBufferVSprintf(&buffer, "numvcpus = \"%d\"\n", def->maxvcpus); +- virBufferAsprintf(&buffer, "numvcpus = \"%d\"\n", (int)def->vcpus); ++ virBufferAsprintf(&buffer, "numvcpus = \"%d\"\n", def->maxvcpus); /* def:cpumask -> vmx:sched.cpu.affinity */ if (def->cpumasklen > 0) { @@ -221,8 +221,8 @@ index 44e28dc..2079c51 100644 { int i; virBuffer buf= VIR_BUFFER_INITIALIZER; -- virBufferVSprintf(&buf,"#OpenNebula Template automatically generated by libvirt\nNAME = %s\nCPU = %ld\nMEMORY = %ld\n", -+ virBufferVSprintf(&buf,"#OpenNebula Template automatically generated " +- virBufferAsprintf(&buf,"#OpenNebula Template automatically generated by libvirt\nNAME = %s\nCPU = %ld\nMEMORY = %ld\n", ++ virBufferAsprintf(&buf,"#OpenNebula Template automatically generated " + "by libvirt\nNAME = %s\nCPU = %d\nMEMORY = %ld\n", def->name, - def->vcpus, @@ -311,19 +311,19 @@ index 83c0f83..38c8351 100644 { virBuffer buf = VIR_BUFFER_INITIALIZER; -- virBufferVSprintf(&buf, "%lu", def->vcpus); -+ virBufferVSprintf(&buf, "%u", def->vcpus); +- virBufferAsprintf(&buf, "%lu", def->vcpus); ++ virBufferAsprintf(&buf, "%u", def->vcpus); if ((qemuCmdFlags & QEMUD_CMD_FLAG_SMP_TOPOLOGY)) { /* sockets, cores, and threads are either all zero @@ -3722,11 +3722,18 @@ qemuBuildSmpArgStr(const virDomainDefPtr def, - virBufferVSprintf(&buf, ",threads=%u", def->cpu->threads); + virBufferAsprintf(&buf, ",threads=%u", def->cpu->threads); } else { -- virBufferVSprintf(&buf, ",sockets=%lu", def->vcpus); -+ virBufferVSprintf(&buf, ",sockets=%u", def->maxvcpus); - virBufferVSprintf(&buf, ",cores=%u", 1); - virBufferVSprintf(&buf, ",threads=%u", 1); +- virBufferAsprintf(&buf, ",sockets=%lu", def->vcpus); ++ virBufferAsprintf(&buf, ",sockets=%u", def->maxvcpus); + virBufferAsprintf(&buf, ",cores=%u", 1); + virBufferAsprintf(&buf, ",threads=%u", 1); } } + if (def->vcpus != def->maxvcpus) { @@ -425,20 +425,20 @@ index 5ffc3c8..456b477 100644 */ char * @@ -5666,7 +5667,7 @@ xenDaemonFormatSxpr(virConnectPtr conn, - virBufferVSprintf(&buf, "(name '%s')", def->name); - virBufferVSprintf(&buf, "(memory %lu)(maxmem %lu)", + virBufferAsprintf(&buf, "(name '%s')", def->name); + virBufferAsprintf(&buf, "(memory %lu)(maxmem %lu)", def->mem.cur_balloon/1024, def->mem.max_balloon/1024); -- virBufferVSprintf(&buf, "(vcpus %lu)", def->vcpus); -+ virBufferVSprintf(&buf, "(vcpus %u)", def->maxvcpus); +- virBufferAsprintf(&buf, "(vcpus %lu)", def->vcpus); ++ virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus); if (def->cpumask) { char *ranges = virDomainCpuSetFormat(def->cpumask, def->cpumasklen); @@ -5761,7 +5762,7 @@ xenDaemonFormatSxpr(virConnectPtr conn, else - virBufferVSprintf(&buf, "(kernel '%s')", def->os.loader); + virBufferAsprintf(&buf, "(kernel '%s')", def->os.loader); -- virBufferVSprintf(&buf, "(vcpus %lu)", def->vcpus); -+ virBufferVSprintf(&buf, "(vcpus %u)", def->maxvcpus); +- virBufferAsprintf(&buf, "(vcpus %lu)", def->vcpus); ++ virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus); for (i = 0 ; i < def->os.nBootDevs ; i++) { switch (def->os.bootDevs[i]) { diff --git a/docs/api_extension/0010-improve-vcpu-support-in-qemu-command-line.patch b/docs/api_extension/0010-improve-vcpu-support-in-qemu-command-line.patch index e082991..02320bb 100644 --- a/docs/api_extension/0010-improve-vcpu-support-in-qemu-command-line.patch +++ b/docs/api_extension/0010-improve-vcpu-support-in-qemu-command-line.patch @@ -23,17 +23,17 @@ index 38c8351..ffe184b 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -3714,6 +3714,8 @@ qemuBuildSmpArgStr(const virDomainDefPtr def, - virBufferVSprintf(&buf, "%u", def->vcpus); + virBufferAsprintf(&buf, "%u", def->vcpus); if ((qemuCmdFlags & QEMUD_CMD_FLAG_SMP_TOPOLOGY)) { + if (def->vcpus != def->maxvcpus) -+ virBufferVSprintf(&buf, ",maxcpus=%u", def->maxvcpus); ++ virBufferAsprintf(&buf, ",maxcpus=%u", def->maxvcpus); /* sockets, cores, and threads are either all zero * or all non-zero, thus checking one of them is enough */ if (def->cpu && def->cpu->sockets) { @@ -3726,12 +3728,12 @@ qemuBuildSmpArgStr(const virDomainDefPtr def, - virBufferVSprintf(&buf, ",cores=%u", 1); - virBufferVSprintf(&buf, ",threads=%u", 1); + virBufferAsprintf(&buf, ",cores=%u", 1); + virBufferAsprintf(&buf, ",threads=%u", 1); } - } - if (def->vcpus != def->maxvcpus) { diff --git a/docs/api_extension/0012-improve-vcpu-support-in-xen-command-line.patch b/docs/api_extension/0012-improve-vcpu-support-in-xen-command-line.patch index f8764b3..0a7b2fc 100644 --- a/docs/api_extension/0012-improve-vcpu-support-in-xen-command-line.patch +++ b/docs/api_extension/0012-improve-vcpu-support-in-xen-command-line.patch @@ -88,21 +88,21 @@ index 456b477..dfc6415 100644 } @@ -5668,6 +5675,9 @@ xenDaemonFormatSxpr(virConnectPtr conn, - virBufferVSprintf(&buf, "(memory %lu)(maxmem %lu)", + virBufferAsprintf(&buf, "(memory %lu)(maxmem %lu)", def->mem.cur_balloon/1024, def->mem.max_balloon/1024); - virBufferVSprintf(&buf, "(vcpus %u)", def->maxvcpus); + virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus); + /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is 32. */ + if (def->vcpus < def->maxvcpus) -+ virBufferVSprintf(&buf, "(vcpu_avail %u)", (1U << def->vcpus) - 1); ++ virBufferAsprintf(&buf, "(vcpu_avail %u)", (1U << def->vcpus) - 1); if (def->cpumask) { char *ranges = virDomainCpuSetFormat(def->cpumask, def->cpumasklen); @@ -5763,6 +5773,9 @@ xenDaemonFormatSxpr(virConnectPtr conn, - virBufferVSprintf(&buf, "(kernel '%s')", def->os.loader); + virBufferAsprintf(&buf, "(kernel '%s')", def->os.loader); - virBufferVSprintf(&buf, "(vcpus %u)", def->maxvcpus); + virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus); + if (def->vcpus < def->maxvcpus) -+ virBufferVSprintf(&buf, "(vcpu_avail %u)", ++ virBufferAsprintf(&buf, "(vcpu_avail %u)", + (1U << def->vcpus) - 1); for (i = 0 ; i < def->os.nBootDevs ; i++) { diff --git a/docs/hacking.html.in b/docs/hacking.html.in index dd8eeb8..6888687 100644 --- a/docs/hacking.html.in +++ b/docs/hacking.html.in @@ -654,7 +654,7 @@ ... virBufferAddLit(&buf, "<domain>\n"); - virBufferVSprintf(&buf, " <memory>%d</memory>\n", memory); + virBufferAsprintf(&buf, " <memory>%d</memory>\n", memory); ... virBufferAddLit(&buf, "</domain>\n"); diff --git a/docs/news.html.in b/docs/news.html.in index 25dd467..60fa896 100644 --- a/docs/news.html.in +++ b/docs/news.html.in @@ -870,7 +870,7 @@ and check the <a href="http://libvirt.org/git/?p=libvirt.git;a=log">GIT log</a> </li> <li> Documentation:<br/> updated c# bindings with arnauds latest changes (Justin Clift),<br/> - Fix spelling of virBufferVSprintf (Jiri Denemark),<br/> + Fix spelling of virBufferAsprintf (Jiri Denemark),<br/> Fix broken XML entity for '>' (Philipp Hahn),<br/> removed outdated reference to virt-mem (Justin Clift),<br/> Add doc for missed options of migrate (Osier Yang),<br/> @@ -2578,7 +2578,7 @@ and check the <a href="http://libvirt.org/git/?p=libvirt.git;a=log">GIT log</a> virsh.c: avoid all leaks in OOM path in cmdCPUBaseline (Jiri Denemark),<br/> Fixed reference count in virsh pool-build command (David Allan),<br/> Fix daemon-conf invalid failures (David Allan),<br/> - virBufferVSprintf: do not omit va_end(argptr) call (Jim Meyering),<br/> + virBufferAsprintf: do not omit va_end(argptr) call (Jim Meyering),<br/> xend_internal.c: don't dereference NULL for unexpected input (Jim Meyering),<br/> virsh: be careful to return "FALSE" upon OOM (Jim Meyering),<br/> virBufferStrcat: do not skip va_end (Jim Meyering),<br/> diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index cb9113c..2f243ae 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -666,16 +666,16 @@ virCapabilitiesFormatXML(virCapsPtr caps) virBufferAddLit(&xml, " <host>\n"); if (virUUIDIsValid(caps->host.host_uuid)) { virUUIDFormat(caps->host.host_uuid, host_uuid); - virBufferVSprintf(&xml," <uuid>%s</uuid>\n", host_uuid); + virBufferAsprintf(&xml," <uuid>%s</uuid>\n", host_uuid); } virBufferAddLit(&xml, " <cpu>\n"); - virBufferVSprintf(&xml, " <arch>%s</arch>\n", + virBufferAsprintf(&xml, " <arch>%s</arch>\n", caps->host.arch); if (caps->host.nfeatures) { virBufferAddLit(&xml, " <features>\n"); for (i = 0 ; i < caps->host.nfeatures ; i++) { - virBufferVSprintf(&xml, " <%s/>\n", + virBufferAsprintf(&xml, " <%s/>\n", caps->host.features[i]); } virBufferAddLit(&xml, " </features>\n"); @@ -693,7 +693,7 @@ virCapabilitiesFormatXML(virCapsPtr caps) if (caps->host.nmigrateTrans) { virBufferAddLit(&xml, " <uri_transports>\n"); for (i = 0 ; i < caps->host.nmigrateTrans ; i++) { - virBufferVSprintf(&xml, " <uri_transport>%s</uri_transport>\n", + virBufferAsprintf(&xml, " <uri_transport>%s</uri_transport>\n", caps->host.migrateTrans[i]); } virBufferAddLit(&xml, " </uri_transports>\n"); @@ -703,15 +703,15 @@ virCapabilitiesFormatXML(virCapsPtr caps) if (caps->host.nnumaCell) { virBufferAddLit(&xml, " <topology>\n"); - virBufferVSprintf(&xml, " <cells num='%zu'>\n", + virBufferAsprintf(&xml, " <cells num='%zu'>\n", caps->host.nnumaCell); for (i = 0 ; i < caps->host.nnumaCell ; i++) { - virBufferVSprintf(&xml, " <cell id='%d'>\n", + virBufferAsprintf(&xml, " <cell id='%d'>\n", caps->host.numaCell[i]->num); - virBufferVSprintf(&xml, " <cpus num='%d'>\n", + virBufferAsprintf(&xml, " <cpus num='%d'>\n", caps->host.numaCell[i]->ncpus); for (j = 0 ; j < caps->host.numaCell[i]->ncpus ; j++) - virBufferVSprintf(&xml, " <cpu id='%d'/>\n", + virBufferAsprintf(&xml, " <cpu id='%d'/>\n", caps->host.numaCell[i]->cpus[j]); virBufferAddLit(&xml, " </cpus>\n"); virBufferAddLit(&xml, " </cell>\n"); @@ -722,8 +722,8 @@ virCapabilitiesFormatXML(virCapsPtr caps) if (caps->host.secModel.model) { virBufferAddLit(&xml, " <secmodel>\n"); - virBufferVSprintf(&xml, " <model>%s</model>\n", caps->host.secModel.model); - virBufferVSprintf(&xml, " <doi>%s</doi>\n", caps->host.secModel.doi); + virBufferAsprintf(&xml, " <model>%s</model>\n", caps->host.secModel.model); + virBufferAsprintf(&xml, " <doi>%s</doi>\n", caps->host.secModel.doi); virBufferAddLit(&xml, " </secmodel>\n"); } @@ -732,43 +732,43 @@ virCapabilitiesFormatXML(virCapsPtr caps) for (i = 0 ; i < caps->nguests ; i++) { virBufferAddLit(&xml, " <guest>\n"); - virBufferVSprintf(&xml, " <os_type>%s</os_type>\n", + virBufferAsprintf(&xml, " <os_type>%s</os_type>\n", caps->guests[i]->ostype); - virBufferVSprintf(&xml, " <arch name='%s'>\n", + virBufferAsprintf(&xml, " <arch name='%s'>\n", caps->guests[i]->arch.name); - virBufferVSprintf(&xml, " <wordsize>%d</wordsize>\n", + virBufferAsprintf(&xml, " <wordsize>%d</wordsize>\n", caps->guests[i]->arch.wordsize); if (caps->guests[i]->arch.defaultInfo.emulator) - virBufferVSprintf(&xml, " <emulator>%s</emulator>\n", + virBufferAsprintf(&xml, " <emulator>%s</emulator>\n", caps->guests[i]->arch.defaultInfo.emulator); if (caps->guests[i]->arch.defaultInfo.loader) - virBufferVSprintf(&xml, " <loader>%s</loader>\n", + virBufferAsprintf(&xml, " <loader>%s</loader>\n", caps->guests[i]->arch.defaultInfo.loader); for (j = 0 ; j < caps->guests[i]->arch.defaultInfo.nmachines ; j++) { virCapsGuestMachinePtr machine = caps->guests[i]->arch.defaultInfo.machines[j]; virBufferAddLit(&xml, " <machine"); if (machine->canonical) - virBufferVSprintf(&xml, " canonical='%s'", machine->canonical); - virBufferVSprintf(&xml, ">%s</machine>\n", machine->name); + virBufferAsprintf(&xml, " canonical='%s'", machine->canonical); + virBufferAsprintf(&xml, ">%s</machine>\n", machine->name); } for (j = 0 ; j < caps->guests[i]->arch.ndomains ; j++) { - virBufferVSprintf(&xml, " <domain type='%s'>\n", + virBufferAsprintf(&xml, " <domain type='%s'>\n", caps->guests[i]->arch.domains[j]->type); if (caps->guests[i]->arch.domains[j]->info.emulator) - virBufferVSprintf(&xml, " <emulator>%s</emulator>\n", + virBufferAsprintf(&xml, " <emulator>%s</emulator>\n", caps->guests[i]->arch.domains[j]->info.emulator); if (caps->guests[i]->arch.domains[j]->info.loader) - virBufferVSprintf(&xml, " <loader>%s</loader>\n", + virBufferAsprintf(&xml, " <loader>%s</loader>\n", caps->guests[i]->arch.domains[j]->info.loader); for (k = 0 ; k < caps->guests[i]->arch.domains[j]->info.nmachines ; k++) { virCapsGuestMachinePtr machine = caps->guests[i]->arch.domains[j]->info.machines[k]; virBufferAddLit(&xml, " <machine"); if (machine->canonical) - virBufferVSprintf(&xml, " canonical='%s'", machine->canonical); - virBufferVSprintf(&xml, ">%s</machine>\n", machine->name); + virBufferAsprintf(&xml, " canonical='%s'", machine->canonical); + virBufferAsprintf(&xml, ">%s</machine>\n", machine->name); } virBufferAddLit(&xml, " </domain>\n"); } @@ -784,10 +784,10 @@ virCapabilitiesFormatXML(virCapsPtr caps) STREQ(caps->guests[i]->features[j]->name, "ia64_be") || STREQ(caps->guests[i]->features[j]->name, "cpuselection") || STREQ(caps->guests[i]->features[j]->name, "deviceboot")) { - virBufferVSprintf(&xml, " <%s/>\n", + virBufferAsprintf(&xml, " <%s/>\n", caps->guests[i]->features[j]->name); } else { - virBufferVSprintf(&xml, " <%s default='%s' toggle='%s'/>\n", + virBufferAsprintf(&xml, " <%s default='%s' toggle='%s'/>\n", caps->guests[i]->features[j]->name, caps->guests[i]->features[j]->defaultOn ? "on" : "off", caps->guests[i]->features[j]->toggle ? "yes" : "no"); diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index ad49916..98d598a 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -353,28 +353,28 @@ virCPUDefFormatBuf(virBufferPtr buf, return -1; } - virBufferVSprintf(buf, "%s<cpu match='%s'>\n", indent, match); + virBufferAsprintf(buf, "%s<cpu match='%s'>\n", indent, match); } else - virBufferVSprintf(buf, "%s<cpu>\n", indent); + virBufferAsprintf(buf, "%s<cpu>\n", indent); if (def->arch) - virBufferVSprintf(buf, "%s <arch>%s</arch>\n", indent, def->arch); + virBufferAsprintf(buf, "%s <arch>%s</arch>\n", indent, def->arch); } if (def->model) - virBufferVSprintf(buf, "%s <model>%s</model>\n", indent, def->model); + virBufferAsprintf(buf, "%s <model>%s</model>\n", indent, def->model); if (def->vendor) { - virBufferVSprintf(buf, "%s <vendor>%s</vendor>\n", + virBufferAsprintf(buf, "%s <vendor>%s</vendor>\n", indent, def->vendor); } if (def->sockets && def->cores && def->threads) { - virBufferVSprintf(buf, "%s <topology", indent); - virBufferVSprintf(buf, " sockets='%u'", def->sockets); - virBufferVSprintf(buf, " cores='%u'", def->cores); - virBufferVSprintf(buf, " threads='%u'", def->threads); + virBufferAsprintf(buf, "%s <topology", indent); + virBufferAsprintf(buf, " sockets='%u'", def->sockets); + virBufferAsprintf(buf, " cores='%u'", def->cores); + virBufferAsprintf(buf, " threads='%u'", def->threads); virBufferAddLit(buf, "/>\n"); } @@ -396,17 +396,17 @@ virCPUDefFormatBuf(virBufferPtr buf, _("Unexpected CPU feature policy %d"), feature->policy); return -1; } - virBufferVSprintf(buf, "%s <feature policy='%s' name='%s'/>\n", + virBufferAsprintf(buf, "%s <feature policy='%s' name='%s'/>\n", indent, policy, feature->name); } else { - virBufferVSprintf(buf, "%s <feature name='%s'/>\n", + virBufferAsprintf(buf, "%s <feature name='%s'/>\n", indent, feature->name); } } if (!(flags & VIR_CPU_FORMAT_EMBEDED)) - virBufferVSprintf(buf, "%s</cpu>\n", indent); + virBufferAsprintf(buf, "%s</cpu>\n", indent); return 0; } diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2a681d9..70ea350 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1347,19 +1347,19 @@ virDomainDeviceInfoFormat(virBufferPtr buf, { if (info->alias && !(flags & VIR_DOMAIN_XML_INACTIVE)) { - virBufferVSprintf(buf, " <alias name='%s'/>\n", info->alias); + virBufferAsprintf(buf, " <alias name='%s'/>\n", info->alias); } if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) return 0; /* We'll be in domain/devices/[device type]/ so 3 level indent */ - virBufferVSprintf(buf, " <address type='%s'", + virBufferAsprintf(buf, " <address type='%s'", virDomainDeviceAddressTypeToString(info->type)); switch (info->type) { case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI: - virBufferVSprintf(buf, " domain='0x%.4x' bus='0x%.2x' slot='0x%.2x' function='0x%.1x'", + virBufferAsprintf(buf, " domain='0x%.4x' bus='0x%.2x' slot='0x%.2x' function='0x%.1x'", info->addr.pci.domain, info->addr.pci.bus, info->addr.pci.slot, @@ -1367,21 +1367,21 @@ virDomainDeviceInfoFormat(virBufferPtr buf, break; case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE: - virBufferVSprintf(buf, " controller='%d' bus='%d' unit='%d'", + virBufferAsprintf(buf, " controller='%d' bus='%d' unit='%d'", info->addr.drive.controller, info->addr.drive.bus, info->addr.drive.unit); break; case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL: - virBufferVSprintf(buf, " controller='%d' bus='%d' port='%d'", + virBufferAsprintf(buf, " controller='%d' bus='%d' port='%d'", info->addr.vioserial.controller, info->addr.vioserial.bus, info->addr.vioserial.port); break; case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID: - virBufferVSprintf(buf, " controller='%d' slot='%d'", + virBufferAsprintf(buf, " controller='%d' slot='%d'", info->addr.ccid.controller, info->addr.ccid.slot); break; @@ -4974,7 +4974,7 @@ virVirtualPortProfileFormat(virBufferPtr buf, if (virtPort->virtPortType == VIR_VIRTUALPORT_NONE) return; - virBufferVSprintf(buf, "%s<virtualport type='%s'>\n", + virBufferAsprintf(buf, "%s<virtualport type='%s'>\n", indent, virVirtualPortTypeToString(virtPort->virtPortType)); @@ -4986,7 +4986,7 @@ virVirtualPortProfileFormat(virBufferPtr buf, case VIR_VIRTUALPORT_8021QBG: virUUIDFormat(virtPort->u.virtPort8021Qbg.instanceID, uuidstr); - virBufferVSprintf(buf, + virBufferAsprintf(buf, "%s <parameters managerid='%d' typeid='%d' " "typeidversion='%d' instanceid='%s'/>\n", indent, @@ -4997,14 +4997,14 @@ virVirtualPortProfileFormat(virBufferPtr buf, break; case VIR_VIRTUALPORT_8021QBH: - virBufferVSprintf(buf, + virBufferAsprintf(buf, "%s <parameters profileid='%s'/>\n", indent, virtPort->u.virtPort8021Qbh.profileID); break; } - virBufferVSprintf(buf, "%s</virtualport>\n", indent); + virBufferAsprintf(buf, "%s</virtualport>\n", indent); } int virDomainDiskIndexByName(virDomainDefPtr def, const char *name) @@ -6653,9 +6653,9 @@ virDomainCpuSetFormat(char *cpuset, int maxcpu) else first = 0; if (cur == start + 1) - virBufferVSprintf(&buf, "%d", start); + virBufferAsprintf(&buf, "%d", start); else - virBufferVSprintf(&buf, "%d-%d", start, cur - 1); + virBufferAsprintf(&buf, "%d-%d", start, cur - 1); start = -1; } cur++; @@ -6664,9 +6664,9 @@ virDomainCpuSetFormat(char *cpuset, int maxcpu) if (!first) virBufferAddLit(&buf, ","); if (maxcpu == start + 1) - virBufferVSprintf(&buf, "%d", start); + virBufferAsprintf(&buf, "%d", start); else - virBufferVSprintf(&buf, "%d-%d", start, maxcpu - 1); + virBufferAsprintf(&buf, "%d-%d", start, maxcpu - 1); } if (virBufferError(&buf)) { @@ -6915,7 +6915,7 @@ virDomainLifecycleDefFormat(virBufferPtr buf, return -1; } - virBufferVSprintf(buf, " <%s>%s</%s>\n", name, typeStr, name); + virBufferAsprintf(buf, " <%s>%s</%s>\n", name, typeStr, name); return 0; } @@ -6959,23 +6959,23 @@ virDomainDiskDefFormat(virBufferPtr buf, return -1; } - virBufferVSprintf(buf, + virBufferAsprintf(buf, " <disk type='%s' device='%s'>\n", type, device); if (def->driverName || def->driverType || def->cachemode) { - virBufferVSprintf(buf, " <driver"); + virBufferAsprintf(buf, " <driver"); if (def->driverName) - virBufferVSprintf(buf, " name='%s'", def->driverName); + virBufferAsprintf(buf, " name='%s'", def->driverName); if (def->driverType) - virBufferVSprintf(buf, " type='%s'", def->driverType); + virBufferAsprintf(buf, " type='%s'", def->driverType); if (def->cachemode) - virBufferVSprintf(buf, " cache='%s'", cachemode); + virBufferAsprintf(buf, " cache='%s'", cachemode); if (def->error_policy) - virBufferVSprintf(buf, " error_policy='%s'", error_policy); + virBufferAsprintf(buf, " error_policy='%s'", error_policy); if (def->iomode) - virBufferVSprintf(buf, " io='%s'", iomode); - virBufferVSprintf(buf, "/>\n"); + virBufferAsprintf(buf, " io='%s'", iomode); + virBufferAsprintf(buf, "/>\n"); } if (def->src || def->nhosts > 0) { @@ -6993,24 +6993,24 @@ virDomainDiskDefFormat(virBufferPtr buf, def->src); break; case VIR_DOMAIN_DISK_TYPE_NETWORK: - virBufferVSprintf(buf, " <source protocol='%s'", + virBufferAsprintf(buf, " <source protocol='%s'", virDomainDiskProtocolTypeToString(def->protocol)); if (def->src) { virBufferEscapeString(buf, " name='%s'", def->src); } if (def->nhosts == 0) { - virBufferVSprintf(buf, "/>\n"); + virBufferAsprintf(buf, "/>\n"); } else { int i; - virBufferVSprintf(buf, ">\n"); + virBufferAsprintf(buf, ">\n"); for (i = 0; i < def->nhosts; i++) { virBufferEscapeString(buf, " <host name='%s'", def->hosts[i].name); virBufferEscapeString(buf, " port='%s'/>\n", def->hosts[i].port); } - virBufferVSprintf(buf, " </source>\n"); + virBufferAsprintf(buf, " </source>\n"); } break; default: @@ -7021,11 +7021,11 @@ virDomainDiskDefFormat(virBufferPtr buf, } } - virBufferVSprintf(buf, " <target dev='%s' bus='%s'/>\n", + virBufferAsprintf(buf, " <target dev='%s' bus='%s'/>\n", def->dst, bus); if (def->bootIndex) - virBufferVSprintf(buf, " <boot order='%d'/>\n", def->bootIndex); + virBufferAsprintf(buf, " <boot order='%d'/>\n", def->bootIndex); if (def->readonly) virBufferAddLit(buf, " <readonly/>\n"); if (def->shared) @@ -7069,7 +7069,7 @@ virDomainControllerDefFormat(virBufferPtr buf, } } - virBufferVSprintf(buf, + virBufferAsprintf(buf, " <controller type='%s' index='%d'", type, def->idx); @@ -7080,11 +7080,11 @@ virDomainControllerDefFormat(virBufferPtr buf, switch (def->type) { case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL: if (def->opts.vioserial.ports != -1) { - virBufferVSprintf(buf, " ports='%d'", + virBufferAsprintf(buf, " ports='%d'", def->opts.vioserial.ports); } if (def->opts.vioserial.vectors != -1) { - virBufferVSprintf(buf, " vectors='%d'", + virBufferAsprintf(buf, " vectors='%d'", def->opts.vioserial.vectors); } break; @@ -7126,7 +7126,7 @@ virDomainFSDefFormat(virBufferPtr buf, } - virBufferVSprintf(buf, + virBufferAsprintf(buf, " <filesystem type='%s' accessmode='%s'>\n", type, accessmode); @@ -7153,7 +7153,7 @@ virDomainFSDefFormat(virBufferPtr buf, } } - virBufferVSprintf(buf, " <target dir='%s'/>\n", + virBufferAsprintf(buf, " <target dir='%s'/>\n", def->dst); if (def->readonly) @@ -7181,9 +7181,9 @@ virDomainNetDefFormat(virBufferPtr buf, return -1; } - virBufferVSprintf(buf, " <interface type='%s'>\n", type); + virBufferAsprintf(buf, " <interface type='%s'>\n", type); - virBufferVSprintf(buf, + virBufferAsprintf(buf, " <mac address='%02x:%02x:%02x:%02x:%02x:%02x'/>\n", def->mac[0], def->mac[1], def->mac[2], def->mac[3], def->mac[4], def->mac[5]); @@ -7199,7 +7199,7 @@ virDomainNetDefFormat(virBufferPtr buf, virBufferEscapeString(buf, " <source dev='%s'/>\n", def->data.ethernet.dev); if (def->data.ethernet.ipaddr) - virBufferVSprintf(buf, " <ip address='%s'/>\n", + virBufferAsprintf(buf, " <ip address='%s'/>\n", def->data.ethernet.ipaddr); if (def->data.ethernet.script) virBufferEscapeString(buf, " <script path='%s'/>\n", @@ -7210,7 +7210,7 @@ virDomainNetDefFormat(virBufferPtr buf, virBufferEscapeString(buf, " <source bridge='%s'/>\n", def->data.bridge.brname); if (def->data.bridge.ipaddr) - virBufferVSprintf(buf, " <ip address='%s'/>\n", + virBufferAsprintf(buf, " <ip address='%s'/>\n", def->data.bridge.ipaddr); if (def->data.bridge.script) virBufferEscapeString(buf, " <script path='%s'/>\n", @@ -7221,10 +7221,10 @@ virDomainNetDefFormat(virBufferPtr buf, case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: if (def->data.socket.address) - virBufferVSprintf(buf, " <source address='%s' port='%d'/>\n", + virBufferAsprintf(buf, " <source address='%s' port='%d'/>\n", def->data.socket.address, def->data.socket.port); else - virBufferVSprintf(buf, " <source port='%d'/>\n", + virBufferAsprintf(buf, " <source port='%d'/>\n", def->data.socket.port); break; @@ -7236,7 +7236,7 @@ virDomainNetDefFormat(virBufferPtr buf, case VIR_DOMAIN_NET_TYPE_DIRECT: virBufferEscapeString(buf, " <source dev='%s'", def->data.direct.linkdev); - virBufferVSprintf(buf, " mode='%s'", + virBufferAsprintf(buf, " mode='%s'", virDomainNetdevMacvtapTypeToString(def->data.direct.mode)); virBufferAddLit(buf, "/>\n"); virVirtualPortProfileFormat(buf, &def->data.direct.virtPortProfile, @@ -7258,11 +7258,11 @@ virDomainNetDefFormat(virBufferPtr buf, (def->driver.virtio.name || def->driver.virtio.txmode)) { virBufferAddLit(buf, " <driver"); if (def->driver.virtio.name) { - virBufferVSprintf(buf, " name='%s'", + virBufferAsprintf(buf, " name='%s'", virDomainNetBackendTypeToString(def->driver.virtio.name)); } if (def->driver.virtio.txmode) { - virBufferVSprintf(buf, " txmode='%s'", + virBufferAsprintf(buf, " txmode='%s'", virDomainNetVirtioTxModeTypeToString(def->driver.virtio.txmode)); } virBufferAddLit(buf, "/>\n"); @@ -7276,15 +7276,15 @@ virDomainNetDefFormat(virBufferPtr buf, if (!attrs || strlen(attrs) <= 1) virBufferAddLit(buf, "/>\n"); else - virBufferVSprintf(buf, ">\n%s </filterref>\n", attrs); + virBufferAsprintf(buf, ">\n%s </filterref>\n", attrs); VIR_FREE(attrs); } if (def->bootIndex) - virBufferVSprintf(buf, " <boot order='%d'/>\n", def->bootIndex); + virBufferAsprintf(buf, " <boot order='%d'/>\n", def->bootIndex); if (def->tune.sndbuf_specified) { virBufferAddLit(buf, " <tune>\n"); - virBufferVSprintf(buf, " <sndbuf>%lu</sndbuf>\n", def->tune.sndbuf); + virBufferAsprintf(buf, " <sndbuf>%lu</sndbuf>\n", def->tune.sndbuf); virBufferAddLit(buf, " </tune>\n"); } @@ -7314,7 +7314,7 @@ virDomainChrSourceDefFormat(virBufferPtr buf, } /* Compat with legacy <console tty='/dev/pts/5'/> syntax */ - virBufferVSprintf(buf, " type='%s'", type); + virBufferAsprintf(buf, " type='%s'", type); if (tty_compat) { virBufferEscapeString(buf, " tty='%s'", def->data.file.path); @@ -7344,49 +7344,49 @@ virDomainChrSourceDefFormat(virBufferPtr buf, case VIR_DOMAIN_CHR_TYPE_UDP: if (def->data.udp.bindService && def->data.udp.bindHost) { - virBufferVSprintf(buf, + virBufferAsprintf(buf, " <source mode='bind' host='%s' " "service='%s'/>\n", def->data.udp.bindHost, def->data.udp.bindService); } else if (def->data.udp.bindHost) { - virBufferVSprintf(buf, " <source mode='bind' host='%s'/>\n", + virBufferAsprintf(buf, " <source mode='bind' host='%s'/>\n", def->data.udp.bindHost); } else if (def->data.udp.bindService) { - virBufferVSprintf(buf, " <source mode='bind' service='%s'/>\n", + virBufferAsprintf(buf, " <source mode='bind' service='%s'/>\n", def->data.udp.bindService); } if (def->data.udp.connectService && def->data.udp.connectHost) { - virBufferVSprintf(buf, + virBufferAsprintf(buf, " <source mode='connect' host='%s' " "service='%s'/>\n", def->data.udp.connectHost, def->data.udp.connectService); } else if (def->data.udp.connectHost) { - virBufferVSprintf(buf, " <source mode='connect' host='%s'/>\n", + virBufferAsprintf(buf, " <source mode='connect' host='%s'/>\n", def->data.udp.connectHost); } else if (def->data.udp.connectService) { - virBufferVSprintf(buf, + virBufferAsprintf(buf, " <source mode='connect' service='%s'/>\n", def->data.udp.connectService); } break; case VIR_DOMAIN_CHR_TYPE_TCP: - virBufferVSprintf(buf, + virBufferAsprintf(buf, " <source mode='%s' host='%s' service='%s'/>\n", def->data.tcp.listen ? "bind" : "connect", def->data.tcp.host, def->data.tcp.service); - virBufferVSprintf(buf, " <protocol type='%s'/>\n", + virBufferAsprintf(buf, " <protocol type='%s'/>\n", virDomainChrTcpProtocolTypeToString( def->data.tcp.protocol)); break; case VIR_DOMAIN_CHR_TYPE_UNIX: - virBufferVSprintf(buf, " <source mode='%s'", + virBufferAsprintf(buf, " <source mode='%s'", def->data.nix.listen ? "bind" : "connect"); virBufferEscapeString(buf, " path='%s'/>\n", def->data.nix.path); @@ -7415,7 +7415,7 @@ virDomainChrDefFormat(virBufferPtr buf, return -1; } - virBufferVSprintf(buf, " <%s", elementName); + virBufferAsprintf(buf, " <%s", elementName); tty_compat = (def->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE && def->target.port == 0 && def->source.type == VIR_DOMAIN_CHR_TYPE_PTY && @@ -7432,7 +7432,7 @@ virDomainChrDefFormat(virBufferPtr buf, _("Could not format channel target type")); return -1; } - virBufferVSprintf(buf, " <target type='%s'", targetType); + virBufferAsprintf(buf, " <target type='%s'", targetType); switch (def->targetType) { case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD: { @@ -7447,7 +7447,7 @@ virDomainChrDefFormat(virBufferPtr buf, if (addr == NULL) return -1; - virBufferVSprintf(buf, " address='%s' port='%d'", + virBufferAsprintf(buf, " address='%s' port='%d'", addr, port); VIR_FREE(addr); break; @@ -7466,7 +7466,7 @@ virDomainChrDefFormat(virBufferPtr buf, } case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE: - virBufferVSprintf(buf, + virBufferAsprintf(buf, " <target type='%s' port='%d'/>\n", virDomainChrTargetTypeToString(def->deviceType, def->targetType), @@ -7474,7 +7474,7 @@ virDomainChrDefFormat(virBufferPtr buf, break; default: - virBufferVSprintf(buf, " <target port='%d'/>\n", + virBufferAsprintf(buf, " <target port='%d'/>\n", def->target.port); break; } @@ -7484,7 +7484,7 @@ virDomainChrDefFormat(virBufferPtr buf, return -1; } - virBufferVSprintf(buf, " </%s>\n", + virBufferAsprintf(buf, " </%s>\n", elementName); return ret; @@ -7504,7 +7504,7 @@ virDomainSmartcardDefFormat(virBufferPtr buf, return -1; } - virBufferVSprintf(buf, " <smartcard mode='%s'", mode); + virBufferAsprintf(buf, " <smartcard mode='%s'", mode); switch (def->type) { case VIR_DOMAIN_SMARTCARD_TYPE_HOST: if (!virDomainDeviceInfoIsSet(&def->info)) { @@ -7554,7 +7554,7 @@ virDomainSoundDefFormat(virBufferPtr buf, return -1; } - virBufferVSprintf(buf, " <sound model='%s'", + virBufferAsprintf(buf, " <sound model='%s'", model); if (virDomainDeviceInfoIsSet(&def->info)) { @@ -7583,7 +7583,7 @@ virDomainMemballoonDefFormat(virBufferPtr buf, return -1; } - virBufferVSprintf(buf, " <memballoon model='%s'", + virBufferAsprintf(buf, " <memballoon model='%s'", model); if (virDomainDeviceInfoIsSet(&def->info)) { @@ -7632,7 +7632,7 @@ virDomainWatchdogDefFormat(virBufferPtr buf, return -1; } - virBufferVSprintf(buf, " <watchdog model='%s' action='%s'", + virBufferAsprintf(buf, " <watchdog model='%s' action='%s'", model, action); if (virDomainDeviceInfoIsSet(&def->info)) { @@ -7652,9 +7652,9 @@ static void virDomainVideoAccelDefFormat(virBufferPtr buf, virDomainVideoAccelDefPtr def) { - virBufferVSprintf(buf, " <acceleration accel3d='%s'", + virBufferAsprintf(buf, " <acceleration accel3d='%s'", def->support3d ? "yes" : "no"); - virBufferVSprintf(buf, " accel2d='%s'", + virBufferAsprintf(buf, " accel2d='%s'", def->support2d ? "yes" : "no"); virBufferAddLit(buf, "/>\n"); } @@ -7674,12 +7674,12 @@ virDomainVideoDefFormat(virBufferPtr buf, } virBufferAddLit(buf, " <video>\n"); - virBufferVSprintf(buf, " <model type='%s'", + virBufferAsprintf(buf, " <model type='%s'", model); if (def->vram) - virBufferVSprintf(buf, " vram='%u'", def->vram); + virBufferAsprintf(buf, " vram='%u'", def->vram); if (def->heads) - virBufferVSprintf(buf, " heads='%u'", def->heads); + virBufferAsprintf(buf, " heads='%u'", def->heads); if (def->accel) { virBufferAddLit(buf, ">\n"); virDomainVideoAccelDefFormat(buf, def->accel); @@ -7715,7 +7715,7 @@ virDomainInputDefFormat(virBufferPtr buf, return -1; } - virBufferVSprintf(buf, " <input type='%s' bus='%s'", + virBufferAsprintf(buf, " <input type='%s' bus='%s'", type, bus); if (virDomainDeviceInfoIsSet(&def->info)) { @@ -7742,7 +7742,7 @@ virDomainTimerDefFormat(virBufferPtr buf, _("unexpected timer name %d"), def->name); return -1; } - virBufferVSprintf(buf, " <timer name='%s'", name); + virBufferAsprintf(buf, " <timer name='%s'", name); if (def->present == 0) { virBufferAddLit(buf, " present='no'"); @@ -7759,7 +7759,7 @@ virDomainTimerDefFormat(virBufferPtr buf, def->tickpolicy); return -1; } - virBufferVSprintf(buf, " tickpolicy='%s'", tickpolicy); + virBufferAsprintf(buf, " tickpolicy='%s'", tickpolicy); } if ((def->name == VIR_DOMAIN_TIMER_NAME_PLATFORM) @@ -7773,13 +7773,13 @@ virDomainTimerDefFormat(virBufferPtr buf, def->track); return -1; } - virBufferVSprintf(buf, " track='%s'", track); + virBufferAsprintf(buf, " track='%s'", track); } } if (def->name == VIR_DOMAIN_TIMER_NAME_TSC) { if (def->frequency > 0) { - virBufferVSprintf(buf, " frequency='%lu'", def->frequency); + virBufferAsprintf(buf, " frequency='%lu'", def->frequency); } if (def->mode != -1) { @@ -7791,7 +7791,7 @@ virDomainTimerDefFormat(virBufferPtr buf, def->mode); return -1; } - virBufferVSprintf(buf, " mode='%s'", mode); + virBufferAsprintf(buf, " mode='%s'", mode); } } @@ -7802,13 +7802,13 @@ virDomainTimerDefFormat(virBufferPtr buf, } else { virBufferAddLit(buf, ">\n <catchup "); if (def->catchup.threshold > 0) { - virBufferVSprintf(buf, " threshold='%lu'", def->catchup.threshold); + virBufferAsprintf(buf, " threshold='%lu'", def->catchup.threshold); } if (def->catchup.slew > 0) { - virBufferVSprintf(buf, " slew='%lu'", def->catchup.slew); + virBufferAsprintf(buf, " slew='%lu'", def->catchup.slew); } if (def->catchup.limit > 0) { - virBufferVSprintf(buf, " limit='%lu'", def->catchup.limit); + virBufferAsprintf(buf, " limit='%lu'", def->catchup.limit); } virBufferAddLit(buf, "/>\n </timer>\n"); } @@ -7833,7 +7833,7 @@ virDomainGraphicsAuthDefFormatAttr(virBufferPtr buf, struct tm tmbuf, *tm; tm = gmtime_r(&def->validTo, &tmbuf); strftime(strbuf, sizeof(strbuf), "%Y-%m-%dT%H:%M:%S", tm); - virBufferVSprintf(buf, " passwdValidTo='%s'", strbuf); + virBufferAsprintf(buf, " passwdValidTo='%s'", strbuf); } } @@ -7852,27 +7852,27 @@ virDomainGraphicsDefFormat(virBufferPtr buf, return -1; } - virBufferVSprintf(buf, " <graphics type='%s'", type); + virBufferAsprintf(buf, " <graphics type='%s'", type); switch (def->type) { case VIR_DOMAIN_GRAPHICS_TYPE_VNC: if (def->data.vnc.socket) { if (def->data.vnc.socket) - virBufferVSprintf(buf, " socket='%s'", + virBufferAsprintf(buf, " socket='%s'", def->data.vnc.socket); } else { if (def->data.vnc.port && (!def->data.vnc.autoport || !(flags & VIR_DOMAIN_XML_INACTIVE))) - virBufferVSprintf(buf, " port='%d'", + virBufferAsprintf(buf, " port='%d'", def->data.vnc.port); else if (def->data.vnc.autoport) virBufferAddLit(buf, " port='-1'"); - virBufferVSprintf(buf, " autoport='%s'", + virBufferAsprintf(buf, " autoport='%s'", def->data.vnc.autoport ? "yes" : "no"); if (def->data.vnc.listenAddr) - virBufferVSprintf(buf, " listen='%s'", + virBufferAsprintf(buf, " listen='%s'", def->data.vnc.listenAddr); } @@ -7898,22 +7898,22 @@ virDomainGraphicsDefFormat(virBufferPtr buf, case VIR_DOMAIN_GRAPHICS_TYPE_RDP: if (def->data.rdp.port) - virBufferVSprintf(buf, " port='%d'", + virBufferAsprintf(buf, " port='%d'", def->data.rdp.port); else if (def->data.rdp.autoport) virBufferAddLit(buf, " port='0'"); if (def->data.rdp.autoport) - virBufferVSprintf(buf, " autoport='yes'"); + virBufferAsprintf(buf, " autoport='yes'"); if (def->data.rdp.replaceUser) - virBufferVSprintf(buf, " replaceUser='yes'"); + virBufferAsprintf(buf, " replaceUser='yes'"); if (def->data.rdp.multiUser) - virBufferVSprintf(buf, " multiUser='yes'"); + virBufferAsprintf(buf, " multiUser='yes'"); if (def->data.rdp.listenAddr) - virBufferVSprintf(buf, " listen='%s'", def->data.rdp.listenAddr); + virBufferAsprintf(buf, " listen='%s'", def->data.rdp.listenAddr); break; @@ -7929,18 +7929,18 @@ virDomainGraphicsDefFormat(virBufferPtr buf, case VIR_DOMAIN_GRAPHICS_TYPE_SPICE: if (def->data.spice.port) - virBufferVSprintf(buf, " port='%d'", + virBufferAsprintf(buf, " port='%d'", def->data.spice.port); if (def->data.spice.tlsPort) - virBufferVSprintf(buf, " tlsPort='%d'", + virBufferAsprintf(buf, " tlsPort='%d'", def->data.spice.tlsPort); - virBufferVSprintf(buf, " autoport='%s'", + virBufferAsprintf(buf, " autoport='%s'", def->data.spice.autoport ? "yes" : "no"); if (def->data.spice.listenAddr) - virBufferVSprintf(buf, " listen='%s'", + virBufferAsprintf(buf, " listen='%s'", def->data.spice.listenAddr); if (def->data.spice.keymap) @@ -7963,21 +7963,21 @@ virDomainGraphicsDefFormat(virBufferPtr buf, children = 1; } - virBufferVSprintf(buf, " <channel name='%s' mode='%s'/>\n", + virBufferAsprintf(buf, " <channel name='%s' mode='%s'/>\n", virDomainGraphicsSpiceChannelNameTypeToString(i), virDomainGraphicsSpiceChannelModeTypeToString(mode)); } if (def->data.spice.image) - virBufferVSprintf(buf, " <image compression='%s'/>\n", + virBufferAsprintf(buf, " <image compression='%s'/>\n", virDomainGraphicsSpiceImageCompressionTypeToString(def->data.spice.image)); if (def->data.spice.jpeg) - virBufferVSprintf(buf, " <jpeg compression='%s'/>\n", + virBufferAsprintf(buf, " <jpeg compression='%s'/>\n", virDomainGraphicsSpiceJpegCompressionTypeToString(def->data.spice.jpeg)); if (def->data.spice.zlib) - virBufferVSprintf(buf, " <zlib compression='%s'/>\n", + virBufferAsprintf(buf, " <zlib compression='%s'/>\n", virDomainGraphicsSpiceZlibCompressionTypeToString(def->data.spice.zlib)); if (def->data.spice.playback) - virBufferVSprintf(buf, " <playback compression='%s'/>\n", + virBufferAsprintf(buf, " <playback compression='%s'/>\n", virDomainGraphicsSpicePlaybackCompressionTypeToString(def->data.spice.playback)); } @@ -8013,24 +8013,24 @@ virDomainHostdevDefFormat(virBufferPtr buf, return -1; } - virBufferVSprintf(buf, " <hostdev mode='%s' type='%s' managed='%s'>\n", + virBufferAsprintf(buf, " <hostdev mode='%s' type='%s' managed='%s'>\n", mode, type, def->managed ? "yes" : "no"); virBufferAddLit(buf, " <source>\n"); if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) { if (def->source.subsys.u.usb.vendor) { - virBufferVSprintf(buf, " <vendor id='0x%.4x'/>\n", + virBufferAsprintf(buf, " <vendor id='0x%.4x'/>\n", def->source.subsys.u.usb.vendor); - virBufferVSprintf(buf, " <product id='0x%.4x'/>\n", + virBufferAsprintf(buf, " <product id='0x%.4x'/>\n", def->source.subsys.u.usb.product); } if (def->source.subsys.u.usb.bus || def->source.subsys.u.usb.device) - virBufferVSprintf(buf, " <address bus='%d' device='%d'/>\n", + virBufferAsprintf(buf, " <address bus='%d' device='%d'/>\n", def->source.subsys.u.usb.bus, def->source.subsys.u.usb.device); } else if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) { - virBufferVSprintf(buf, " <address domain='0x%.4x' bus='0x%.2x' slot='0x%.2x' function='0x%.1x'/>\n", + virBufferAsprintf(buf, " <address domain='0x%.4x' bus='0x%.2x' slot='0x%.2x' function='0x%.1x'/>\n", def->source.subsys.u.pci.domain, def->source.subsys.u.pci.bus, def->source.subsys.u.pci.slot, @@ -8040,7 +8040,7 @@ virDomainHostdevDefFormat(virBufferPtr buf, virBufferAddLit(buf, " </source>\n"); if (def->bootIndex) - virBufferVSprintf(buf, " <boot order='%d'/>\n", def->bootIndex); + virBufferAsprintf(buf, " <boot order='%d'/>\n", def->bootIndex); if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) return -1; @@ -8069,58 +8069,58 @@ char *virDomainDefFormat(virDomainDefPtr def, if (def->id == -1) flags |= VIR_DOMAIN_XML_INACTIVE; - virBufferVSprintf(&buf, "<domain type='%s'", type); + virBufferAsprintf(&buf, "<domain type='%s'", type); if (!(flags & VIR_DOMAIN_XML_INACTIVE)) - virBufferVSprintf(&buf, " id='%d'", def->id); + virBufferAsprintf(&buf, " id='%d'", def->id); if (def->namespaceData && def->ns.href) - virBufferVSprintf(&buf, " %s", (def->ns.href)()); + virBufferAsprintf(&buf, " %s", (def->ns.href)()); virBufferAddLit(&buf, ">\n"); virBufferEscapeString(&buf, " <name>%s</name>\n", def->name); uuid = def->uuid; virUUIDFormat(uuid, uuidstr); - virBufferVSprintf(&buf, " <uuid>%s</uuid>\n", uuidstr); + virBufferAsprintf(&buf, " <uuid>%s</uuid>\n", uuidstr); if (def->description) virBufferEscapeString(&buf, " <description>%s</description>\n", def->description); - virBufferVSprintf(&buf, " <memory>%lu</memory>\n", def->mem.max_balloon); - virBufferVSprintf(&buf, " <currentMemory>%lu</currentMemory>\n", + virBufferAsprintf(&buf, " <memory>%lu</memory>\n", def->mem.max_balloon); + virBufferAsprintf(&buf, " <currentMemory>%lu</currentMemory>\n", def->mem.cur_balloon); /* add blkiotune only if there are any */ if (def->blkio.weight) { - virBufferVSprintf(&buf, " <blkiotune>\n"); - virBufferVSprintf(&buf, " <weight>%u</weight>\n", + virBufferAsprintf(&buf, " <blkiotune>\n"); + virBufferAsprintf(&buf, " <weight>%u</weight>\n", def->blkio.weight); - virBufferVSprintf(&buf, " </blkiotune>\n"); + virBufferAsprintf(&buf, " </blkiotune>\n"); } /* add memtune only if there are any */ if (def->mem.hard_limit || def->mem.soft_limit || def->mem.min_guarantee || def->mem.swap_hard_limit) - virBufferVSprintf(&buf, " <memtune>\n"); + virBufferAsprintf(&buf, " <memtune>\n"); if (def->mem.hard_limit) { - virBufferVSprintf(&buf, " <hard_limit>%lu</hard_limit>\n", + virBufferAsprintf(&buf, " <hard_limit>%lu</hard_limit>\n", def->mem.hard_limit); } if (def->mem.soft_limit) { - virBufferVSprintf(&buf, " <soft_limit>%lu</soft_limit>\n", + virBufferAsprintf(&buf, " <soft_limit>%lu</soft_limit>\n", def->mem.soft_limit); } if (def->mem.min_guarantee) { - virBufferVSprintf(&buf, " <min_guarantee>%lu</min_guarantee>\n", + virBufferAsprintf(&buf, " <min_guarantee>%lu</min_guarantee>\n", def->mem.min_guarantee); } if (def->mem.swap_hard_limit) { - virBufferVSprintf(&buf, " <swap_hard_limit>%lu</swap_hard_limit>\n", + virBufferAsprintf(&buf, " <swap_hard_limit>%lu</swap_hard_limit>\n", def->mem.swap_hard_limit); } if (def->mem.hard_limit || def->mem.soft_limit || def->mem.min_guarantee || def->mem.swap_hard_limit) - virBufferVSprintf(&buf, " </memtune>\n"); + virBufferAsprintf(&buf, " </memtune>\n"); if (def->mem.hugepage_backed) { virBufferAddLit(&buf, " <memoryBacking>\n"); @@ -8138,23 +8138,23 @@ char *virDomainDefFormat(virDomainDefPtr def, if ((cpumask = virDomainCpuSetFormat(def->cpumask, def->cpumasklen)) == NULL) goto cleanup; - virBufferVSprintf(&buf, " cpuset='%s'", cpumask); + virBufferAsprintf(&buf, " cpuset='%s'", cpumask); VIR_FREE(cpumask); } if (def->vcpus != def->maxvcpus) - virBufferVSprintf(&buf, " current='%u'", def->vcpus); - virBufferVSprintf(&buf, ">%u</vcpu>\n", def->maxvcpus); + virBufferAsprintf(&buf, " current='%u'", def->vcpus); + virBufferAsprintf(&buf, ">%u</vcpu>\n", def->maxvcpus); if (def->cputune.shares || def->cputune.vcpupin) virBufferAddLit(&buf, " <cputune>\n"); if (def->cputune.shares) - virBufferVSprintf(&buf, " <shares>%lu</shares>\n", + virBufferAsprintf(&buf, " <shares>%lu</shares>\n", def->cputune.shares); if (def->cputune.vcpupin) { int i; for (i = 0; i < def->cputune.nvcpupin; i++) { - virBufferVSprintf(&buf, " <vcpupin vcpu='%u' ", + virBufferAsprintf(&buf, " <vcpupin vcpu='%u' ", def->cputune.vcpupin[i]->vcpuid); char *cpumask = NULL; @@ -8167,7 +8167,7 @@ char *virDomainDefFormat(virDomainDefPtr def, goto cleanup; } - virBufferVSprintf(&buf, "cpuset='%s'/>\n", cpumask); + virBufferAsprintf(&buf, "cpuset='%s'/>\n", cpumask); VIR_FREE(cpumask); } } @@ -8189,9 +8189,9 @@ char *virDomainDefFormat(virDomainDefPtr def, virBufferAddLit(&buf, " <type"); if (def->os.arch) - virBufferVSprintf(&buf, " arch='%s'", def->os.arch); + virBufferAsprintf(&buf, " arch='%s'", def->os.arch); if (def->os.machine) - virBufferVSprintf(&buf, " machine='%s'", def->os.machine); + virBufferAsprintf(&buf, " machine='%s'", def->os.machine); /* * HACK: For xen driver we previously used bogus 'linux' as the * os type for paravirt, whereas capabilities declare it to @@ -8199,9 +8199,9 @@ char *virDomainDefFormat(virDomainDefPtr def, */ if (def->virtType == VIR_DOMAIN_VIRT_XEN && STREQ(def->os.type, "xen")) - virBufferVSprintf(&buf, ">%s</type>\n", "linux"); + virBufferAsprintf(&buf, ">%s</type>\n", "linux"); else - virBufferVSprintf(&buf, ">%s</type>\n", def->os.type); + virBufferAsprintf(&buf, ">%s</type>\n", def->os.type); if (def->os.init) virBufferEscapeString(&buf, " <init>%s</init>\n", @@ -8232,14 +8232,14 @@ char *virDomainDefFormat(virDomainDefPtr def, def->os.bootDevs[n]); goto cleanup; } - virBufferVSprintf(&buf, " <boot dev='%s'/>\n", boottype); + virBufferAsprintf(&buf, " <boot dev='%s'/>\n", boottype); } if (def->os.bootmenu != VIR_DOMAIN_BOOT_MENU_DEFAULT) { const char *enabled = (def->os.bootmenu == VIR_DOMAIN_BOOT_MENU_ENABLED ? "yes" : "no"); - virBufferVSprintf(&buf, " <bootmenu enable='%s'/>\n", enabled); + virBufferAsprintf(&buf, " <bootmenu enable='%s'/>\n", enabled); } } @@ -8252,7 +8252,7 @@ char *virDomainDefFormat(virDomainDefPtr def, _("unexpected smbios mode %d"), def->os.smbios_mode); goto cleanup; } - virBufferVSprintf(&buf, " <smbios mode='%s'/>\n", mode); + virBufferAsprintf(&buf, " <smbios mode='%s'/>\n", mode); } virBufferAddLit(&buf, " </os>\n"); @@ -8268,7 +8268,7 @@ char *virDomainDefFormat(virDomainDefPtr def, _("unexpected feature %d"), i); goto cleanup; } - virBufferVSprintf(&buf, " <%s/>\n", name); + virBufferAsprintf(&buf, " <%s/>\n", name); } } virBufferAddLit(&buf, " </features>\n"); @@ -8277,11 +8277,11 @@ char *virDomainDefFormat(virDomainDefPtr def, if (virCPUDefFormatBuf(&buf, def->cpu, " ", 0) < 0) goto cleanup; - virBufferVSprintf(&buf, " <clock offset='%s'", + virBufferAsprintf(&buf, " <clock offset='%s'", virDomainClockOffsetTypeToString(def->clock.offset)); switch (def->clock.offset) { case VIR_DOMAIN_CLOCK_OFFSET_VARIABLE: - virBufferVSprintf(&buf, " adjustment='%lld'", def->clock.data.adjustment); + virBufferAsprintf(&buf, " adjustment='%lld'", def->clock.data.adjustment); break; case VIR_DOMAIN_CLOCK_OFFSET_TIMEZONE: virBufferEscapeString(&buf, " timezone='%s'", def->clock.data.timezone); @@ -8413,10 +8413,10 @@ char *virDomainDefFormat(virDomainDefPtr def, if (!def->seclabel.label || (def->seclabel.type == VIR_DOMAIN_SECLABEL_DYNAMIC && (flags & VIR_DOMAIN_XML_INACTIVE))) { - virBufferVSprintf(&buf, " <seclabel type='%s' model='%s'/>\n", + virBufferAsprintf(&buf, " <seclabel type='%s' model='%s'/>\n", sectype, def->seclabel.model); } else { - virBufferVSprintf(&buf, " <seclabel type='%s' model='%s'>\n", + virBufferAsprintf(&buf, " <seclabel type='%s' model='%s'>\n", sectype, def->seclabel.model); virBufferEscapeString(&buf, " <label>%s</label>\n", def->seclabel.label); @@ -8455,7 +8455,7 @@ static char *virDomainObjFormat(virCapsPtr caps, char *config_xml = NULL; virBuffer buf = VIR_BUFFER_INITIALIZER; - virBufferVSprintf(&buf, "<domstatus state='%s' pid='%d'>\n", + virBufferAsprintf(&buf, "<domstatus state='%s' pid='%d'>\n", virDomainStateTypeToString(obj->state), obj->pid); @@ -9127,24 +9127,24 @@ char *virDomainSnapshotDefFormat(char *domain_uuid, virBuffer buf = VIR_BUFFER_INITIALIZER; virBufferAddLit(&buf, "<domainsnapshot>\n"); - virBufferVSprintf(&buf, " <name>%s</name>\n", def->name); + virBufferAsprintf(&buf, " <name>%s</name>\n", def->name); if (def->description) - virBufferVSprintf(&buf, " <description>%s</description>\n", + virBufferAsprintf(&buf, " <description>%s</description>\n", def->description); - virBufferVSprintf(&buf, " <state>%s</state>\n", + virBufferAsprintf(&buf, " <state>%s</state>\n", virDomainStateTypeToString(def->state)); if (def->parent) { virBufferAddLit(&buf, " <parent>\n"); - virBufferVSprintf(&buf, " <name>%s</name>\n", def->parent); + virBufferAsprintf(&buf, " <name>%s</name>\n", def->parent); virBufferAddLit(&buf, " </parent>\n"); } - virBufferVSprintf(&buf, " <creationTime>%ld</creationTime>\n", + virBufferAsprintf(&buf, " <creationTime>%ld</creationTime>\n", def->creationTime); virBufferAddLit(&buf, " <domain>\n"); - virBufferVSprintf(&buf, " <uuid>%s</uuid>\n", domain_uuid); + virBufferAsprintf(&buf, " <uuid>%s</uuid>\n", domain_uuid); virBufferAddLit(&buf, " </domain>\n"); if (internal) - virBufferVSprintf(&buf, " <active>%ld</active>\n", def->active); + virBufferAsprintf(&buf, " <active>%ld</active>\n", def->active); virBufferAddLit(&buf, "</domainsnapshot>\n"); if (virBufferError(&buf)) { diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c index 2fa2fa0..2c051ea 100644 --- a/src/conf/interface_conf.c +++ b/src/conf/interface_conf.c @@ -881,13 +881,13 @@ virInterfaceBridgeDefFormat(virBufferPtr buf, int i; int ret = 0; - virBufferVSprintf(buf, "%*s <bridge", level*2, ""); + virBufferAsprintf(buf, "%*s <bridge", level*2, ""); if (def->data.bridge.stp == 1) virBufferAddLit(buf, " stp='on'"); else if (def->data.bridge.stp == 0) virBufferAddLit(buf, " stp='off'"); if (def->data.bridge.delay != NULL) - virBufferVSprintf(buf, " delay='%s'", def->data.bridge.delay); + virBufferAsprintf(buf, " delay='%s'", def->data.bridge.delay); virBufferAddLit(buf, ">\n"); for (i = 0;i < def->data.bridge.nbItf;i++) { @@ -896,7 +896,7 @@ virInterfaceBridgeDefFormat(virBufferPtr buf, ret = -1; } - virBufferVSprintf(buf, "%*s </bridge>\n", level*2, ""); + virBufferAsprintf(buf, "%*s </bridge>\n", level*2, ""); return(ret); } @@ -906,7 +906,7 @@ virInterfaceBondDefFormat(virBufferPtr buf, int i; int ret = 0; - virBufferVSprintf(buf, "%*s <bond", level*2, ""); + virBufferAsprintf(buf, "%*s <bond", level*2, ""); if (def->data.bond.mode == VIR_INTERFACE_BOND_BALRR) virBufferAddLit(buf, " mode='balance-rr'"); else if (def->data.bond.mode == VIR_INTERFACE_BOND_ABACKUP) @@ -924,12 +924,12 @@ virInterfaceBondDefFormat(virBufferPtr buf, virBufferAddLit(buf, ">\n"); if (def->data.bond.monit == VIR_INTERFACE_BOND_MONIT_MII) { - virBufferVSprintf(buf, "%*s <miimon freq='%d'", + virBufferAsprintf(buf, "%*s <miimon freq='%d'", level*2, "", def->data.bond.frequency); if (def->data.bond.downdelay > 0) - virBufferVSprintf(buf, " downdelay='%d'", def->data.bond.downdelay); + virBufferAsprintf(buf, " downdelay='%d'", def->data.bond.downdelay); if (def->data.bond.updelay > 0) - virBufferVSprintf(buf, " updelay='%d'", def->data.bond.updelay); + virBufferAsprintf(buf, " updelay='%d'", def->data.bond.updelay); if (def->data.bond.carrier == VIR_INTERFACE_BOND_MII_IOCTL) virBufferAddLit(buf, " carrier='ioctl'"); else if (def->data.bond.carrier == VIR_INTERFACE_BOND_MII_NETIF) @@ -941,7 +941,7 @@ virInterfaceBondDefFormat(virBufferPtr buf, "%s", _("bond arp monitoring has no target")); return(-1); } - virBufferVSprintf(buf, "%*s <arpmon interval='%d' target='%s'", + virBufferAsprintf(buf, "%*s <arpmon interval='%d' target='%s'", level*2, "", def->data.bond.interval, def->data.bond.target); if (def->data.bond.validate == VIR_INTERFACE_BOND_ARP_ACTIVE) @@ -957,7 +957,7 @@ virInterfaceBondDefFormat(virBufferPtr buf, ret = -1; } - virBufferVSprintf(buf, "%*s </bond>\n", level*2, ""); + virBufferAsprintf(buf, "%*s </bond>\n", level*2, ""); return(ret); } @@ -970,13 +970,13 @@ virInterfaceVlanDefFormat(virBufferPtr buf, return(-1); } - virBufferVSprintf(buf, "%*s <vlan tag='%s'", + virBufferAsprintf(buf, "%*s <vlan tag='%s'", level*2, "", def->data.vlan.tag); if (def->data.vlan.devname != NULL) { virBufferAddLit(buf, ">\n"); - virBufferVSprintf(buf, "%*s <interface name='%s'/>\n", + virBufferAsprintf(buf, "%*s <interface name='%s'/>\n", level*2, "", def->data.vlan.devname); - virBufferVSprintf(buf, "%*s </vlan>\n", level*2, ""); + virBufferAsprintf(buf, "%*s </vlan>\n", level*2, ""); } else virBufferAddLit(buf, "/>\n"); return(0); @@ -989,42 +989,42 @@ virInterfaceProtocolDefFormat(virBufferPtr buf, const virInterfaceDefPtr def, for (pp = 0; pp < def->nprotos; pp++) { - virBufferVSprintf(buf, "%*s <protocol family='%s'>\n", + virBufferAsprintf(buf, "%*s <protocol family='%s'>\n", level*2, "", def->protos[pp]->family); if (def->protos[pp]->autoconf) { - virBufferVSprintf(buf, "%*s <autoconf/>\n", level*2, ""); + virBufferAsprintf(buf, "%*s <autoconf/>\n", level*2, ""); } if (def->protos[pp]->dhcp) { if (def->protos[pp]->peerdns == 0) - virBufferVSprintf(buf, "%*s <dhcp peerdns='no'/>\n", + virBufferAsprintf(buf, "%*s <dhcp peerdns='no'/>\n", level*2, ""); else if (def->protos[pp]->peerdns == 1) - virBufferVSprintf(buf, "%*s <dhcp peerdns='yes'/>\n", + virBufferAsprintf(buf, "%*s <dhcp peerdns='yes'/>\n", level*2, ""); else - virBufferVSprintf(buf, "%*s <dhcp/>\n", level*2, ""); + virBufferAsprintf(buf, "%*s <dhcp/>\n", level*2, ""); } for (ii = 0; ii < def->protos[pp]->nips; ii++) { if (def->protos[pp]->ips[ii]->address != NULL) { - virBufferVSprintf(buf, "%*s <ip address='%s'", level*2, "", + virBufferAsprintf(buf, "%*s <ip address='%s'", level*2, "", def->protos[pp]->ips[ii]->address); if (def->protos[pp]->ips[ii]->prefix != 0) { - virBufferVSprintf(buf, " prefix='%d'", + virBufferAsprintf(buf, " prefix='%d'", def->protos[pp]->ips[ii]->prefix); } virBufferAddLit(buf, "/>\n"); } } if (def->protos[pp]->gateway != NULL) { - virBufferVSprintf(buf, "%*s <route gateway='%s'/>\n", + virBufferAsprintf(buf, "%*s <route gateway='%s'/>\n", level*2, "", def->protos[pp]->gateway); } - virBufferVSprintf(buf, "%*s </protocol>\n", level*2, ""); + virBufferAsprintf(buf, "%*s </protocol>\n", level*2, ""); } return(0); } @@ -1051,7 +1051,7 @@ virInterfaceStartmodeDefFormat(virBufferPtr buf, "%s", _("virInterfaceDefFormat unknown startmode")); return -1; } - virBufferVSprintf(buf, "%*s <start mode='%s'/>\n", level*2, "", mode); + virBufferAsprintf(buf, "%*s <start mode='%s'/>\n", level*2, "", mode); return(0); } @@ -1078,7 +1078,7 @@ virInterfaceDefDevFormat(virBufferPtr buf, goto cleanup; } - virBufferVSprintf(buf, "%*s<interface type='%s' ", level*2, "", type); + virBufferAsprintf(buf, "%*s<interface type='%s' ", level*2, "", type); if (def->name != NULL) virBufferEscapeString(buf, "name='%s'", def->name); virBufferAddLit(buf, ">\n"); @@ -1087,17 +1087,17 @@ virInterfaceDefDevFormat(virBufferPtr buf, case VIR_INTERFACE_TYPE_ETHERNET: virInterfaceStartmodeDefFormat(buf, def->startmode, level); if (def->mac != NULL) - virBufferVSprintf(buf, "%*s <mac address='%s'/>\n", + virBufferAsprintf(buf, "%*s <mac address='%s'/>\n", level*2, "", def->mac); if (def->mtu != 0) - virBufferVSprintf(buf, "%*s <mtu size='%d'/>\n", + virBufferAsprintf(buf, "%*s <mtu size='%d'/>\n", level*2, "", def->mtu); virInterfaceProtocolDefFormat(buf, def, level); break; case VIR_INTERFACE_TYPE_BRIDGE: virInterfaceStartmodeDefFormat(buf, def->startmode, level); if (def->mtu != 0) - virBufferVSprintf(buf, "%*s <mtu size='%d'/>\n", + virBufferAsprintf(buf, "%*s <mtu size='%d'/>\n", level*2, "", def->mtu); virInterfaceProtocolDefFormat(buf, def, level); virInterfaceBridgeDefFormat(buf, def, level); @@ -1105,7 +1105,7 @@ virInterfaceDefDevFormat(virBufferPtr buf, case VIR_INTERFACE_TYPE_BOND: virInterfaceStartmodeDefFormat(buf, def->startmode, level); if (def->mtu != 0) - virBufferVSprintf(buf, "%*s <mtu size='%d'/>\n", + virBufferAsprintf(buf, "%*s <mtu size='%d'/>\n", level*2, "", def->mtu); virInterfaceProtocolDefFormat(buf, def, level); virInterfaceBondDefFormat(buf, def, level); @@ -1113,17 +1113,17 @@ virInterfaceDefDevFormat(virBufferPtr buf, case VIR_INTERFACE_TYPE_VLAN: virInterfaceStartmodeDefFormat(buf, def->startmode, level); if (def->mac != NULL) - virBufferVSprintf(buf, "%*s <mac address='%s'/>\n", + virBufferAsprintf(buf, "%*s <mac address='%s'/>\n", level*2, "", def->mac); if (def->mtu != 0) - virBufferVSprintf(buf, "%*s <mtu size='%d'/>\n", + virBufferAsprintf(buf, "%*s <mtu size='%d'/>\n", level*2, "", def->mtu); virInterfaceProtocolDefFormat(buf, def, level); virInterfaceVlanDefFormat(buf, def, level); break; } - virBufferVSprintf(buf, "%*s</interface>\n", level*2, ""); + virBufferAsprintf(buf, "%*s</interface>\n", level*2, ""); if (virBufferError(buf)) goto no_memory; diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 5738757..08f7b77 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -756,24 +756,24 @@ virNetworkIpDefFormat(virBufferPtr buf, virBufferAddLit(buf, " <ip"); if (def->family) { - virBufferVSprintf(buf, " family='%s'", def->family); + virBufferAsprintf(buf, " family='%s'", def->family); } if (VIR_SOCKET_HAS_ADDR(&def->address)) { char *addr = virSocketFormatAddr(&def->address); if (!addr) goto error; - virBufferVSprintf(buf, " address='%s'", addr); + virBufferAsprintf(buf, " address='%s'", addr); VIR_FREE(addr); } if (VIR_SOCKET_HAS_ADDR(&def->netmask)) { char *addr = virSocketFormatAddr(&def->netmask); if (!addr) goto error; - virBufferVSprintf(buf, " netmask='%s'", addr); + virBufferAsprintf(buf, " netmask='%s'", addr); VIR_FREE(addr); } if (def->prefix > 0) { - virBufferVSprintf(buf," prefix='%u'", def->prefix); + virBufferAsprintf(buf," prefix='%u'", def->prefix); } virBufferAddLit(buf, ">\n"); @@ -793,7 +793,7 @@ virNetworkIpDefFormat(virBufferPtr buf, VIR_FREE(saddr); goto error; } - virBufferVSprintf(buf, " <range start='%s' end='%s' />\n", + virBufferAsprintf(buf, " <range start='%s' end='%s' />\n", saddr, eaddr); VIR_FREE(saddr); VIR_FREE(eaddr); @@ -801,14 +801,14 @@ virNetworkIpDefFormat(virBufferPtr buf, for (ii = 0 ; ii < def->nhosts ; ii++) { virBufferAddLit(buf, " <host "); if (def->hosts[ii].mac) - virBufferVSprintf(buf, "mac='%s' ", def->hosts[ii].mac); + virBufferAsprintf(buf, "mac='%s' ", def->hosts[ii].mac); if (def->hosts[ii].name) - virBufferVSprintf(buf, "name='%s' ", def->hosts[ii].name); + virBufferAsprintf(buf, "name='%s' ", def->hosts[ii].name); if (VIR_SOCKET_HAS_ADDR(&def->hosts[ii].ip)) { char *ipaddr = virSocketFormatAddr(&def->hosts[ii].ip); if (!ipaddr) goto error; - virBufferVSprintf(buf, "ip='%s' ", ipaddr); + virBufferAsprintf(buf, "ip='%s' ", ipaddr); VIR_FREE(ipaddr); } virBufferAddLit(buf, "/>\n"); @@ -848,7 +848,7 @@ char *virNetworkDefFormat(const virNetworkDefPtr def) uuid = def->uuid; virUUIDFormat(uuid, uuidstr); - virBufferVSprintf(&buf, " <uuid>%s</uuid>\n", uuidstr); + virBufferAsprintf(&buf, " <uuid>%s</uuid>\n", uuidstr); if (def->forwardType != VIR_NETWORK_FORWARD_NONE) { const char *mode = virNetworkForwardTypeToString(def->forwardType); @@ -859,24 +859,24 @@ char *virNetworkDefFormat(const virNetworkDefPtr def) } else { virBufferAddLit(&buf, " <forward"); } - virBufferVSprintf(&buf, " mode='%s'/>\n", mode); + virBufferAsprintf(&buf, " mode='%s'/>\n", mode); } } virBufferAddLit(&buf, " <bridge"); if (def->bridge) virBufferEscapeString(&buf, " name='%s'", def->bridge); - virBufferVSprintf(&buf, " stp='%s' delay='%ld' />\n", + virBufferAsprintf(&buf, " stp='%s' delay='%ld' />\n", def->stp ? "on" : "off", def->delay); if (def->mac_specified) { char macaddr[VIR_MAC_STRING_BUFLEN]; virFormatMacAddr(def->mac, macaddr); - virBufferVSprintf(&buf, " <mac address='%s'/>\n", macaddr); + virBufferAsprintf(&buf, " <mac address='%s'/>\n", macaddr); } if (def->domain) - virBufferVSprintf(&buf, " <domain name='%s'/>\n", def->domain); + virBufferAsprintf(&buf, " <domain name='%s'/>\n", def->domain); for (ii = 0; ii < def->nips; ii++) { if (virNetworkIpDefFormat(&buf, &def->ips[ii]) < 0) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 0b080ce..e9b8978 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -260,7 +260,7 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr def) char uuidstr[VIR_UUID_STRING_BUFLEN]; union _virNodeDevCapData *data = &caps->data; - virBufferVSprintf(&buf, " <capability type='%s'>\n", + virBufferAsprintf(&buf, " <capability type='%s'>\n", virNodeDevCapTypeToString(caps->type)); switch (caps->type) { case VIR_NODE_DEV_CAP_SYSTEM: @@ -278,7 +278,7 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr def) virBufferEscapeString(&buf, " <serial>%s</serial>\n", data->system.hardware.serial); virUUIDFormat(data->system.hardware.uuid, uuidstr); - virBufferVSprintf(&buf, " <uuid>%s</uuid>\n", uuidstr); + virBufferAsprintf(&buf, " <uuid>%s</uuid>\n", uuidstr); virBufferAddLit(&buf, " </hardware>\n"); virBufferAddLit(&buf, " <firmware>\n"); if (data->system.firmware.vendor_name) @@ -294,21 +294,21 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr def) virBufferAddLit(&buf, " </firmware>\n"); break; case VIR_NODE_DEV_CAP_PCI_DEV: - virBufferVSprintf(&buf, " <domain>%d</domain>\n", + virBufferAsprintf(&buf, " <domain>%d</domain>\n", data->pci_dev.domain); - virBufferVSprintf(&buf, " <bus>%d</bus>\n", data->pci_dev.bus); - virBufferVSprintf(&buf, " <slot>%d</slot>\n", + virBufferAsprintf(&buf, " <bus>%d</bus>\n", data->pci_dev.bus); + virBufferAsprintf(&buf, " <slot>%d</slot>\n", data->pci_dev.slot); - virBufferVSprintf(&buf, " <function>%d</function>\n", + virBufferAsprintf(&buf, " <function>%d</function>\n", data->pci_dev.function); - virBufferVSprintf(&buf, " <product id='0x%04x'", + virBufferAsprintf(&buf, " <product id='0x%04x'", data->pci_dev.product); if (data->pci_dev.product_name) virBufferEscapeString(&buf, ">%s</product>\n", data->pci_dev.product_name); else virBufferAddLit(&buf, " />\n"); - virBufferVSprintf(&buf, " <vendor id='0x%04x'", + virBufferAsprintf(&buf, " <vendor id='0x%04x'", data->pci_dev.vendor); if (data->pci_dev.vendor_name) virBufferEscapeString(&buf, ">%s</vendor>\n", @@ -317,7 +317,7 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr def) virBufferAddLit(&buf, " />\n"); if (data->pci_dev.flags & VIR_NODE_DEV_CAP_FLAG_PCI_PHYSICAL_FUNCTION) { virBufferAddLit(&buf, " <capability type='phys_function'>\n"); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " <address domain='0x%.4x' bus='0x%.2x' " "slot='0x%.2x' function='0x%.1x'/>\n", data->pci_dev.physical_function->domain, @@ -329,7 +329,7 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr def) if (data->pci_dev.flags & VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION) { virBufferAddLit(&buf, " <capability type='virt_functions'>\n"); for (i = 0 ; i < data->pci_dev.num_virtual_functions ; i++) { - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " <address domain='0x%.4x' bus='0x%.2x' " "slot='0x%.2x' function='0x%.1x'/>\n", data->pci_dev.virtual_functions[i]->domain, @@ -341,17 +341,17 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr def) } break; case VIR_NODE_DEV_CAP_USB_DEV: - virBufferVSprintf(&buf, " <bus>%d</bus>\n", data->usb_dev.bus); - virBufferVSprintf(&buf, " <device>%d</device>\n", + virBufferAsprintf(&buf, " <bus>%d</bus>\n", data->usb_dev.bus); + virBufferAsprintf(&buf, " <device>%d</device>\n", data->usb_dev.device); - virBufferVSprintf(&buf, " <product id='0x%04x'", + virBufferAsprintf(&buf, " <product id='0x%04x'", data->usb_dev.product); if (data->usb_dev.product_name) virBufferEscapeString(&buf, ">%s</product>\n", data->usb_dev.product_name); else virBufferAddLit(&buf, " />\n"); - virBufferVSprintf(&buf, " <vendor id='0x%04x'", + virBufferAsprintf(&buf, " <vendor id='0x%04x'", data->usb_dev.vendor); if (data->usb_dev.vendor_name) virBufferEscapeString(&buf, ">%s</vendor>\n", @@ -360,13 +360,13 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr def) virBufferAddLit(&buf, " />\n"); break; case VIR_NODE_DEV_CAP_USB_INTERFACE: - virBufferVSprintf(&buf, " <number>%d</number>\n", + virBufferAsprintf(&buf, " <number>%d</number>\n", data->usb_if.number); - virBufferVSprintf(&buf, " <class>%d</class>\n", + virBufferAsprintf(&buf, " <class>%d</class>\n", data->usb_if._class); - virBufferVSprintf(&buf, " <subclass>%d</subclass>\n", + virBufferAsprintf(&buf, " <subclass>%d</subclass>\n", data->usb_if.subclass); - virBufferVSprintf(&buf, " <protocol>%d</protocol>\n", + virBufferAsprintf(&buf, " <protocol>%d</protocol>\n", data->usb_if.protocol); if (data->usb_if.description) virBufferEscapeString(&buf, @@ -387,7 +387,7 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr def) } break; case VIR_NODE_DEV_CAP_SCSI_HOST: - virBufferVSprintf(&buf, " <host>%d</host>\n", + virBufferAsprintf(&buf, " <host>%d</host>\n", data->scsi_host.host); if (data->scsi_host.flags & VIR_NODE_DEV_CAP_FLAG_HBA_FC_HOST) { virBufferAddLit(&buf, " <capability type='fc_host'>\n"); @@ -409,11 +409,11 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr def) break; case VIR_NODE_DEV_CAP_SCSI: - virBufferVSprintf(&buf, " <host>%d</host>\n", data->scsi.host); - virBufferVSprintf(&buf, " <bus>%d</bus>\n", data->scsi.bus); - virBufferVSprintf(&buf, " <target>%d</target>\n", + virBufferAsprintf(&buf, " <host>%d</host>\n", data->scsi.host); + virBufferAsprintf(&buf, " <bus>%d</bus>\n", data->scsi.bus); + virBufferAsprintf(&buf, " <target>%d</target>\n", data->scsi.target); - virBufferVSprintf(&buf, " <lun>%d</lun>\n", data->scsi.lun); + virBufferAsprintf(&buf, " <lun>%d</lun>\n", data->scsi.lun); if (data->scsi.type) virBufferEscapeString(&buf, " <type>%s</type>\n", data->scsi.type); @@ -434,16 +434,16 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr def) virBufferEscapeString(&buf, " <vendor>%s</vendor>\n", data->storage.vendor); if (data->storage.serial) - virBufferVSprintf(&buf, " <serial>%s</serial>\n", + virBufferAsprintf(&buf, " <serial>%s</serial>\n", data->storage.serial); if (data->storage.flags & VIR_NODE_DEV_CAP_STORAGE_REMOVABLE) { int avl = data->storage.flags & VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE; virBufferAddLit(&buf, " <capability type='removable'>\n"); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " <media_available>%d" "</media_available>\n", avl ? 1 : 0); - virBufferVSprintf(&buf, " <media_size>%llu</media_size>\n", + virBufferAsprintf(&buf, " <media_size>%llu</media_size>\n", data->storage.removable_media_size); if (data->storage.media_label) virBufferEscapeString(&buf, @@ -451,23 +451,23 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr def) data->storage.media_label); if (data->storage.logical_block_size > 0) - virBufferVSprintf(&buf, " <logical_block_size>%llu" + virBufferAsprintf(&buf, " <logical_block_size>%llu" "</logical_block_size>\n", data->storage.logical_block_size); if (data->storage.num_blocks > 0) - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " <num_blocks>%llu</num_blocks>\n", data->storage.num_blocks); virBufferAddLit(&buf, " </capability>\n"); } else { - virBufferVSprintf(&buf, " <size>%llu</size>\n", + virBufferAsprintf(&buf, " <size>%llu</size>\n", data->storage.size); if (data->storage.logical_block_size > 0) - virBufferVSprintf(&buf, " <logical_block_size>%llu" + virBufferAsprintf(&buf, " <logical_block_size>%llu" "</logical_block_size>\n", data->storage.logical_block_size); if (data->storage.num_blocks > 0) - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " <num_blocks>%llu</num_blocks>\n", data->storage.num_blocks); } diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c index 615c0f1..5ba2972 100644 --- a/src/conf/nwfilter_conf.c +++ b/src/conf/nwfilter_conf.c @@ -493,7 +493,7 @@ macProtocolIDFormatter(virBufferPtr buf, } else { if (nwf->p.ethHdrFilter.dataProtocolID.datatype == DATATYPE_UINT16) asHex = false; - virBufferVSprintf(buf, asHex ? "0x%x" : "%d", + virBufferAsprintf(buf, asHex ? "0x%x" : "%d", nwf->p.ethHdrFilter.dataProtocolID.u.u16); } return 1; @@ -594,7 +594,7 @@ arpOpcodeFormatter(virBufferPtr buf, &str)) { virBufferAdd(buf, str, -1); } else { - virBufferVSprintf(buf, "%d", nwf->p.arpHdrFilter.dataOpcode.u.u16); + virBufferAsprintf(buf, "%d", nwf->p.arpHdrFilter.dataOpcode.u.u16); } return 1; } @@ -658,7 +658,7 @@ formatIPProtocolID(virBufferPtr buf, } else { if (nwf->p.ipHdrFilter.ipHdr.dataProtocolID.datatype == DATATYPE_UINT8) asHex = false; - virBufferVSprintf(buf, asHex ? "0x%x" : "%d", + virBufferAsprintf(buf, asHex ? "0x%x" : "%d", nwf->p.ipHdrFilter.ipHdr.dataProtocolID.u.u8); } return 1; @@ -2725,7 +2725,7 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf, enum virNWFilterEntryItemFlags flags = item->flags; if ((flags & NWFILTER_ENTRY_ITEM_FLAG_EXISTS)) { if (!typeShown) { - virBufferVSprintf(buf, " <%s", type); + virBufferAsprintf(buf, " <%s", type); typeShown = 1; neverShown = 0; } @@ -2750,7 +2750,7 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf, matchShown = MATCH_YES; } - virBufferVSprintf(buf, " %s='", + virBufferAsprintf(buf, " %s='", att[i].name); if (att[i].formatter) { if (!att[i].formatter(buf, def, item)) { @@ -2761,7 +2761,7 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf, goto err_exit; } } else if ((flags & NWFILTER_ENTRY_ITEM_FLAG_HAS_VAR)) { - virBufferVSprintf(buf, "$%s", item->var); + virBufferAsprintf(buf, "$%s", item->var); } else { asHex = false; @@ -2773,14 +2773,14 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf, case DATATYPE_IPV6MASK: /* display all masks in CIDR format */ case DATATYPE_UINT8: - virBufferVSprintf(buf, asHex ? "0x%x" : "%d", + virBufferAsprintf(buf, asHex ? "0x%x" : "%d", item->u.u8); break; case DATATYPE_UINT16_HEX: asHex = true; case DATATYPE_UINT16: - virBufferVSprintf(buf, asHex ? "0x%x" : "%d", + virBufferAsprintf(buf, asHex ? "0x%x" : "%d", item->u.u16); break; @@ -2793,7 +2793,7 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf, case DATATYPE_MACMASK: case DATATYPE_MACADDR: for (j = 0; j < 6; j++) - virBufferVSprintf(buf, "%02x%s", + virBufferAsprintf(buf, "%02x%s", item->u.macaddr.addr[j], (j < 5) ? ":" : ""); break; @@ -2804,7 +2804,7 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf, case DATATYPE_STRING: default: - virBufferVSprintf(buf, + virBufferAsprintf(buf, "UNSUPPORTED DATATYPE 0x%02x\n", att[i].datatype); } @@ -2817,7 +2817,7 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf, virBufferAddLit(buf, "/>\n"); if (neverShown) - virBufferVSprintf(buf, + virBufferAsprintf(buf, " <%s/>\n", type); err_exit: @@ -2833,7 +2833,7 @@ virNWFilterRuleDefFormat(virNWFilterRuleDefPtr def) virBuffer buf2 = VIR_BUFFER_INITIALIZER; char *data; - virBufferVSprintf(&buf, " <rule action='%s' direction='%s' priority='%d'", + virBufferAsprintf(&buf, " <rule action='%s' direction='%s' priority='%d'", virNWFilterRuleActionTypeToString(def->action), virNWFilterRuleDirectionTypeToString(def->tt), def->priority); @@ -2860,7 +2860,7 @@ virNWFilterRuleDefFormat(virNWFilterRuleDefPtr def) if (data) { virBufferAddLit(&buf, ">\n"); - virBufferVSprintf(&buf, "%s </rule>\n", data); + virBufferAsprintf(&buf, "%s </rule>\n", data); VIR_FREE(data); } else virBufferAddLit(&buf, "/>\n"); @@ -2885,7 +2885,7 @@ virNWFilterIncludeDefFormat(virNWFilterIncludeDefPtr inc) char *attrs; virBuffer buf = VIR_BUFFER_INITIALIZER; - virBufferVSprintf(&buf," <filterref filter='%s'", + virBufferAsprintf(&buf," <filterref filter='%s'", inc->filterref); attrs = virNWFilterFormatParamAttributes(inc->params, " "); @@ -2893,7 +2893,7 @@ virNWFilterIncludeDefFormat(virNWFilterIncludeDefPtr inc) if (!attrs || strlen(attrs) <= 1) virBufferAddLit(&buf, "/>\n"); else - virBufferVSprintf(&buf, ">\n%s </filterref>\n", attrs); + virBufferAsprintf(&buf, ">\n%s </filterref>\n", attrs); if (virBufferError(&buf)) { virReportOOMError(); @@ -2922,13 +2922,13 @@ virNWFilterDefFormat(virNWFilterDefPtr def) int i; char *xml; - virBufferVSprintf(&buf, "<filter name='%s' chain='%s'", + virBufferAsprintf(&buf, "<filter name='%s' chain='%s'", def->name, virNWFilterChainSuffixTypeToString(def->chainsuffix)); virBufferAddLit(&buf, ">\n"); virUUIDFormat(def->uuid, uuid); - virBufferVSprintf(&buf," <uuid>%s</uuid>\n", uuid); + virBufferAsprintf(&buf," <uuid>%s</uuid>\n", uuid); for (i = 0; i < def->nentries; i++) { xml = virNWFilterEntryFormat(def->filterEntries[i]); diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c index 211ff55..ee10b21 100644 --- a/src/conf/nwfilter_params.c +++ b/src/conf/nwfilter_params.c @@ -269,7 +269,7 @@ _formatParameterAttrs(void *payload, const void *name, void *data) { struct formatterParam *fp = (struct formatterParam *)data; - virBufferVSprintf(fp->buf, "%s<parameter name='%s' value='%s'/>\n", + virBufferAsprintf(fp->buf, "%s<parameter name='%s' value='%s'/>\n", fp->indent, (const char *)name, (char *)payload); diff --git a/src/conf/secret_conf.c b/src/conf/secret_conf.c index fc4ae82..105afbe 100644 --- a/src/conf/secret_conf.c +++ b/src/conf/secret_conf.c @@ -228,7 +228,7 @@ virSecretDefFormatUsage(virBufferPtr buf, def->usage_type); return -1; } - virBufferVSprintf(buf, " <usage type='%s'>\n", type); + virBufferAsprintf(buf, " <usage type='%s'>\n", type); switch (def->usage_type) { case VIR_SECRET_USAGE_TYPE_NONE: break; @@ -257,7 +257,7 @@ virSecretDefFormat(const virSecretDefPtr def) unsigned char *uuid; char uuidstr[VIR_UUID_STRING_BUFLEN]; - virBufferVSprintf(&buf, "<secret ephemeral='%s' private='%s'>\n", + virBufferAsprintf(&buf, "<secret ephemeral='%s' private='%s'>\n", def->ephemeral ? "yes" : "no", def->private ? "yes" : "no"); diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 116898d..aeb1596 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -804,9 +804,9 @@ virStoragePoolSourceFormat(virBufferPtr buf, virBufferAddLit(buf," <source>\n"); if ((options->flags & VIR_STORAGE_POOL_SOURCE_HOST) && src->host.name) { - virBufferVSprintf(buf, " <host name='%s'", src->host.name); + virBufferAsprintf(buf, " <host name='%s'", src->host.name); if (src->host.port) - virBufferVSprintf(buf, " port='%d'", src->host.port); + virBufferAsprintf(buf, " port='%d'", src->host.port); virBufferAddLit(buf, "/>\n"); } @@ -814,29 +814,29 @@ virStoragePoolSourceFormat(virBufferPtr buf, src->ndevice) { for (i = 0 ; i < src->ndevice ; i++) { if (src->devices[i].nfreeExtent) { - virBufferVSprintf(buf," <device path='%s'>\n", + virBufferAsprintf(buf," <device path='%s'>\n", src->devices[i].path); for (j = 0 ; j < src->devices[i].nfreeExtent ; j++) { - virBufferVSprintf(buf, " <freeExtent start='%llu' end='%llu'/>\n", + virBufferAsprintf(buf, " <freeExtent start='%llu' end='%llu'/>\n", src->devices[i].freeExtents[j].start, src->devices[i].freeExtents[j].end); } virBufferAddLit(buf," </device>\n"); } else - virBufferVSprintf(buf, " <device path='%s'/>\n", + virBufferAsprintf(buf, " <device path='%s'/>\n", src->devices[i].path); } } if ((options->flags & VIR_STORAGE_POOL_SOURCE_DIR) && src->dir) - virBufferVSprintf(buf," <dir path='%s'/>\n", src->dir); + virBufferAsprintf(buf," <dir path='%s'/>\n", src->dir); if ((options->flags & VIR_STORAGE_POOL_SOURCE_ADAPTER) && src->adapter) - virBufferVSprintf(buf," <adapter name='%s'/>\n", src->adapter); + virBufferAsprintf(buf," <adapter name='%s'/>\n", src->adapter); if ((options->flags & VIR_STORAGE_POOL_SOURCE_NAME) && src->name) - virBufferVSprintf(buf," <name>%s</name>\n", src->name); + virBufferAsprintf(buf," <name>%s</name>\n", src->name); if ((options->flags & VIR_STORAGE_POOL_SOURCE_INITIATOR_IQN) && src->initiator.iqn) { @@ -853,12 +853,12 @@ virStoragePoolSourceFormat(virBufferPtr buf, src->format); return -1; } - virBufferVSprintf(buf," <format type='%s'/>\n", format); + virBufferAsprintf(buf," <format type='%s'/>\n", format); } if (src->authType == VIR_STORAGE_POOL_AUTH_CHAP) - virBufferVSprintf(buf," <auth type='chap' login='%s' passwd='%s'/>\n", + virBufferAsprintf(buf," <auth type='chap' login='%s' passwd='%s'/>\n", src->auth.chap.login, src->auth.chap.passwd); @@ -893,17 +893,17 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def) { "%s", _("unexpected pool type")); goto cleanup; } - virBufferVSprintf(&buf, "<pool type='%s'>\n", type); - virBufferVSprintf(&buf," <name>%s</name>\n", def->name); + virBufferAsprintf(&buf, "<pool type='%s'>\n", type); + virBufferAsprintf(&buf," <name>%s</name>\n", def->name); virUUIDFormat(def->uuid, uuid); - virBufferVSprintf(&buf," <uuid>%s</uuid>\n", uuid); + virBufferAsprintf(&buf," <uuid>%s</uuid>\n", uuid); - virBufferVSprintf(&buf," <capacity>%llu</capacity>\n", + virBufferAsprintf(&buf," <capacity>%llu</capacity>\n", def->capacity); - virBufferVSprintf(&buf," <allocation>%llu</allocation>\n", + virBufferAsprintf(&buf," <allocation>%llu</allocation>\n", def->allocation); - virBufferVSprintf(&buf," <available>%llu</available>\n", + virBufferAsprintf(&buf," <available>%llu</available>\n", def->available); if (virStoragePoolSourceFormat(&buf, options, &def->source) < 0) @@ -912,18 +912,18 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def) { virBufferAddLit(&buf," <target>\n"); if (def->target.path) - virBufferVSprintf(&buf," <path>%s</path>\n", def->target.path); + virBufferAsprintf(&buf," <path>%s</path>\n", def->target.path); virBufferAddLit(&buf," <permissions>\n"); - virBufferVSprintf(&buf," <mode>0%o</mode>\n", + virBufferAsprintf(&buf," <mode>0%o</mode>\n", def->target.perms.mode); - virBufferVSprintf(&buf," <owner>%d</owner>\n", + virBufferAsprintf(&buf," <owner>%d</owner>\n", def->target.perms.uid); - virBufferVSprintf(&buf," <group>%d</group>\n", + virBufferAsprintf(&buf," <group>%d</group>\n", def->target.perms.gid); if (def->target.perms.label) - virBufferVSprintf(&buf," <label>%s</label>\n", + virBufferAsprintf(&buf," <label>%s</label>\n", def->target.perms.label); virBufferAddLit(&buf," </permissions>\n"); @@ -1182,10 +1182,10 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options, virBufferPtr buf, virStorageVolTargetPtr def, const char *type) { - virBufferVSprintf(buf, " <%s>\n", type); + virBufferAsprintf(buf, " <%s>\n", type); if (def->path) - virBufferVSprintf(buf," <path>%s</path>\n", def->path); + virBufferAsprintf(buf," <path>%s</path>\n", def->path); if (options->formatToString) { const char *format = (options->formatToString)(def->format); @@ -1195,20 +1195,20 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options, def->format); return -1; } - virBufferVSprintf(buf," <format type='%s'/>\n", format); + virBufferAsprintf(buf," <format type='%s'/>\n", format); } virBufferAddLit(buf," <permissions>\n"); - virBufferVSprintf(buf," <mode>0%o</mode>\n", + virBufferAsprintf(buf," <mode>0%o</mode>\n", def->perms.mode); - virBufferVSprintf(buf," <owner>%d</owner>\n", + virBufferAsprintf(buf," <owner>%d</owner>\n", def->perms.uid); - virBufferVSprintf(buf," <group>%d</group>\n", + virBufferAsprintf(buf," <group>%d</group>\n", def->perms.gid); if (def->perms.label) - virBufferVSprintf(buf," <label>%s</label>\n", + virBufferAsprintf(buf," <label>%s</label>\n", def->perms.label); virBufferAddLit(buf," </permissions>\n"); @@ -1217,7 +1217,7 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options, virStorageEncryptionFormat(buf, def->encryption, 4) < 0) return -1; - virBufferVSprintf(buf, " </%s>\n", type); + virBufferAsprintf(buf, " </%s>\n", type); return 0; } @@ -1233,8 +1233,8 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool, return NULL; virBufferAddLit(&buf, "<volume>\n"); - virBufferVSprintf(&buf," <name>%s</name>\n", def->name); - virBufferVSprintf(&buf," <key>%s</key>\n", def->key); + virBufferAsprintf(&buf," <name>%s</name>\n", def->name); + virBufferAsprintf(&buf," <key>%s</key>\n", def->key); virBufferAddLit(&buf, " <source>\n"); if (def->source.nextent) { @@ -1246,11 +1246,11 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool, if (thispath != NULL) virBufferAddLit(&buf, " </device>\n"); - virBufferVSprintf(&buf, " <device path='%s'>\n", + virBufferAsprintf(&buf, " <device path='%s'>\n", def->source.extents[i].path); } - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " <extent start='%llu' end='%llu'/>\n", def->source.extents[i].start, def->source.extents[i].end); @@ -1261,9 +1261,9 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool, } virBufferAddLit(&buf, " </source>\n"); - virBufferVSprintf(&buf," <capacity>%llu</capacity>\n", + virBufferAsprintf(&buf," <capacity>%llu</capacity>\n", def->capacity); - virBufferVSprintf(&buf," <allocation>%llu</allocation>\n", + virBufferAsprintf(&buf," <allocation>%llu</allocation>\n", def->allocation); if (virStorageVolTargetDefFormat(options, &buf, diff --git a/src/conf/storage_encryption_conf.c b/src/conf/storage_encryption_conf.c index 20e822c..9ec3dad 100644 --- a/src/conf/storage_encryption_conf.c +++ b/src/conf/storage_encryption_conf.c @@ -227,7 +227,7 @@ virStorageEncryptionSecretFormat(virBufferPtr buf, } virUUIDFormat(secret->uuid, uuidstr); - virBufferVSprintf(buf, "%*s<secret type='%s' uuid='%s'/>\n", + virBufferAsprintf(buf, "%*s<secret type='%s' uuid='%s'/>\n", indent, "", type, uuidstr); return 0; } @@ -246,7 +246,7 @@ virStorageEncryptionFormat(virBufferPtr buf, "%s", _("unexpected encryption format")); return -1; } - virBufferVSprintf(buf, "%*s<encryption format='%s'>\n", + virBufferAsprintf(buf, "%*s<encryption format='%s'>\n", indent, "", format); for (i = 0; i < enc->nsecrets; i++) { @@ -255,7 +255,7 @@ virStorageEncryptionFormat(virBufferPtr buf, return -1; } - virBufferVSprintf(buf, "%*s</encryption>\n", indent, ""); + virBufferAsprintf(buf, "%*s</encryption>\n", indent, ""); return 0; } diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c index 86bc670..b8a6374 100644 --- a/src/cpu/cpu_map.c +++ b/src/cpu/cpu_map.c @@ -107,7 +107,7 @@ int cpuMapLoad(const char *arch, if ((ctxt = xmlXPathNewContext(xml)) == NULL) goto no_memory; - virBufferVSprintf(&buf, "./arch[@name='%s']", arch); + virBufferAsprintf(&buf, "./arch[@name='%s']", arch); if (virBufferError(&buf)) goto no_memory; diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 1f8f90b..9c6a514 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2624,7 +2624,7 @@ esxDomainDumpXML(virDomainPtr domain, int flags) goto cleanup; } - virBufferVSprintf(&buffer, "%s://%s:%d/folder/", priv->parsedUri->transport, + virBufferAsprintf(&buffer, "%s://%s:%d/folder/", priv->parsedUri->transport, domain->conn->uri->server, domain->conn->uri->port); virBufferURIEncodeString(&buffer, directoryAndFileName); virBufferAddLit(&buffer, "?dcPath="); @@ -3075,7 +3075,7 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml) goto cleanup; } - virBufferVSprintf(&buffer, "%s://%s:%d/folder/", priv->parsedUri->transport, + virBufferAsprintf(&buffer, "%s://%s:%d/folder/", priv->parsedUri->transport, conn->uri->server, conn->uri->port); if (directoryName != NULL) { diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 756ff68..2bb1794 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -3551,7 +3551,7 @@ esxVI_HandleVirtualMachineQuestion for (elementDescription = questionInfo->choice->choiceInfo; elementDescription != NULL; elementDescription = elementDescription->_next) { - virBufferVSprintf(&buffer, "'%s'", elementDescription->label); + virBufferAsprintf(&buffer, "'%s'", elementDescription->label); if (elementDescription->_next != NULL) { virBufferAddLit(&buffer, ", "); diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c index ecaecc4..9bfec8f 100644 --- a/src/esx/esx_vi_types.c +++ b/src/esx/esx_vi_types.c @@ -1280,7 +1280,7 @@ ESX_VI__TEMPLATE__DEEP_COPY(Int, /* esxVI_Int_Serialize */ ESX_VI__TEMPLATE__SERIALIZE(Int, { - virBufferVSprintf(output, "%d", (int)item->value); + virBufferAsprintf(output, "%d", (int)item->value); }) /* esxVI_Int_SerializeList */ @@ -1318,7 +1318,7 @@ ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(Long) /* esxVI_Long_Serialize */ ESX_VI__TEMPLATE__SERIALIZE(Long, { - virBufferVSprintf(output, "%lld", (long long int)item->value); + virBufferAsprintf(output, "%lld", (long long int)item->value); }) /* esxVI_Long_SerializeList */ @@ -1614,7 +1614,7 @@ esxVI_ManagedObjectReference_Serialize virBufferAddLit(output, "<"); virBufferAdd(output, element, -1); - virBufferVSprintf(output, + virBufferAsprintf(output, " xmlns=\"urn:vim25\" " "xsi:type=\"ManagedObjectReference\" type=\"%s\">", managedObjectReference->type); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 1b22be6..fc8edb4 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -30,7 +30,7 @@ virBufferFreeAndReset; virBufferStrcat; virBufferURIEncodeString; virBufferUse; -virBufferVSprintf; +virBufferAsprintf; # caps.h diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index ed78710..12050b3 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -742,7 +742,7 @@ networkStartRadvd(virNetworkObjPtr network) } /* create radvd config file appropriate for this network */ - virBufferVSprintf(&configbuf, "interface %s\n" + virBufferAsprintf(&configbuf, "interface %s\n" "{\n" " AdvSendAdvert on;\n" " AdvManagedFlag off;\n" @@ -764,7 +764,7 @@ networkStartRadvd(virNetworkObjPtr network) } if (!(netaddr = virSocketFormatAddr(&ipdef->address))) goto cleanup; - virBufferVSprintf(&configbuf, + virBufferAsprintf(&configbuf, " prefix %s/%d\n" " {\n" " AdvOnLink on;\n" diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 2139ef3..eec3fc9 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -323,12 +323,12 @@ static int udevGenerateDeviceName(struct udev_device *device, int ret = 0, i = 0; virBuffer buf = VIR_BUFFER_INITIALIZER; - virBufferVSprintf(&buf, "%s_%s", + virBufferAsprintf(&buf, "%s_%s", udev_device_get_subsystem(device), udev_device_get_sysname(device)); if (s != NULL) { - virBufferVSprintf(&buf, "_%s", s); + virBufferAsprintf(&buf, "_%s", s); } if (virBufferError(&buf)) { diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c index 39bd4a5..14ce019 100644 --- a/src/nwfilter/nwfilter_ebiptables_driver.c +++ b/src/nwfilter/nwfilter_ebiptables_driver.c @@ -361,7 +361,7 @@ ebtablesHandleEthHdr(virBufferPtr buf, ðHdr->dataSrcMACAddr)) goto err_exit; - virBufferVSprintf(buf, + virBufferAsprintf(buf, " %s %s %s", reverse ? "-d" : "-s", ENTRY_GET_NEG_SIGN(ðHdr->dataSrcMACAddr), @@ -373,7 +373,7 @@ ebtablesHandleEthHdr(virBufferPtr buf, ðHdr->dataSrcMACMask)) goto err_exit; - virBufferVSprintf(buf, + virBufferAsprintf(buf, "/%s", macaddr); } @@ -385,7 +385,7 @@ ebtablesHandleEthHdr(virBufferPtr buf, ðHdr->dataDstMACAddr)) goto err_exit; - virBufferVSprintf(buf, + virBufferAsprintf(buf, " %s %s %s", reverse ? "-s" : "-d", ENTRY_GET_NEG_SIGN(ðHdr->dataDstMACAddr), @@ -397,7 +397,7 @@ ebtablesHandleEthHdr(virBufferPtr buf, ðHdr->dataDstMACMask)) goto err_exit; - virBufferVSprintf(buf, + virBufferAsprintf(buf, "/%s", macaddr); } @@ -421,7 +421,7 @@ static int iptablesLinkIPTablesBaseChain(const char *iptables_cmd, unsigned int pos, int stopOnError) { - virBufferVSprintf(buf, + virBufferAsprintf(buf, "res=$(%s -L %s -n --line-number | " "%s \" %s \")\n" "if [ $? -ne 0 ]; then\n" @@ -459,7 +459,7 @@ static int iptablesLinkIPTablesBaseChain(const char *iptables_cmd, static int iptablesCreateBaseChains(const char *iptables_cmd, virBufferPtr buf) { - virBufferVSprintf(buf,"%s -N " VIRT_IN_CHAIN CMD_SEPARATOR + virBufferAsprintf(buf,"%s -N " VIRT_IN_CHAIN CMD_SEPARATOR "%s -N " VIRT_OUT_CHAIN CMD_SEPARATOR "%s -N " VIRT_IN_POST_CHAIN CMD_SEPARATOR "%s -N " HOST_IN_CHAIN CMD_SEPARATOR, @@ -496,7 +496,7 @@ iptablesCreateTmpRootChain(const char *iptables_cmd, PRINT_IPT_ROOT_CHAIN(chain, chainPrefix, ifname); - virBufferVSprintf(buf, + virBufferAsprintf(buf, CMD_DEF("%s -N %s") CMD_SEPARATOR CMD_EXEC "%s", @@ -541,7 +541,7 @@ _iptablesRemoveRootChain(const char *iptables_cmd, PRINT_IPT_ROOT_CHAIN(chain, chainPrefix, ifname); - virBufferVSprintf(buf, + virBufferAsprintf(buf, "%s -F %s" CMD_SEPARATOR "%s -X %s" CMD_SEPARATOR, iptables_cmd, chain, @@ -618,7 +618,7 @@ iptablesLinkTmpRootChain(const char *iptables_cmd, PRINT_IPT_ROOT_CHAIN(chain, chainPrefix, ifname); - virBufferVSprintf(buf, + virBufferAsprintf(buf, CMD_DEF("%s -A %s " "%s %s -g %s") CMD_SEPARATOR CMD_EXEC @@ -652,7 +652,7 @@ iptablesSetupVirtInPost(const char *iptables_cmd, const char *ifname) { const char *match = MATCH_PHYSDEV_IN; - virBufferVSprintf(buf, + virBufferAsprintf(buf, "res=$(%s -n -L " VIRT_IN_POST_CHAIN " | grep \"\\%s %s\")\n" "if [ \"${res}\" = \"\" ]; then " @@ -677,7 +677,7 @@ iptablesClearVirtInPost(const char *iptables_cmd, const char *ifname) { const char *match = MATCH_PHYSDEV_IN; - virBufferVSprintf(buf, + virBufferAsprintf(buf, "%s -D " VIRT_IN_POST_CHAIN " %s %s -j ACCEPT" CMD_SEPARATOR, iptables_cmd, @@ -708,7 +708,7 @@ _iptablesUnlinkRootChain(const char *iptables_cmd, PRINT_IPT_ROOT_CHAIN(chain, chainPrefix, ifname); - virBufferVSprintf(buf, + virBufferAsprintf(buf, "%s -D %s " "%s %s -g %s" CMD_SEPARATOR, iptables_cmd, @@ -790,7 +790,7 @@ iptablesRenameTmpRootChain(const char *iptables_cmd, PRINT_IPT_ROOT_CHAIN(tmpchain, tmpChainPrefix, ifname); PRINT_IPT_ROOT_CHAIN( chain, chainPrefix, ifname); - virBufferVSprintf(buf, + virBufferAsprintf(buf, "%s -E %s %s" CMD_SEPARATOR, iptables_cmd, tmpchain, @@ -819,8 +819,8 @@ iptablesInstCommand(virBufferPtr buf, char position[10] = { 0 }; if (pos >= 0) snprintf(position, sizeof(position), "%d", pos); - virBufferVSprintf(buf, templ, cmd, position); - virBufferVSprintf(buf, CMD_SEPARATOR "%s", + virBufferAsprintf(buf, templ, cmd, position); + virBufferAsprintf(buf, CMD_SEPARATOR "%s", CMD_STOPONERR(stopOnError)); } @@ -846,7 +846,7 @@ iptablesHandleSrcMacAddr(virBufferPtr buf, srcMacAddr)) goto err_exit; - virBufferVSprintf(buf, + virBufferAsprintf(buf, " -m mac %s --mac-source %s", ENTRY_GET_NEG_SIGN(srcMacAddr), macaddr); @@ -890,7 +890,7 @@ iptablesHandleIpHdr(virBufferPtr buf, &ipHdr->dataSrcIPAddr)) goto err_exit; - virBufferVSprintf(buf, + virBufferAsprintf(buf, " %s %s %s", ENTRY_GET_NEG_SIGN(&ipHdr->dataSrcIPAddr), src, @@ -903,7 +903,7 @@ iptablesHandleIpHdr(virBufferPtr buf, &ipHdr->dataSrcIPMask)) goto err_exit; - virBufferVSprintf(buf, + virBufferAsprintf(buf, "/%s", number); } @@ -914,7 +914,7 @@ iptablesHandleIpHdr(virBufferPtr buf, &ipHdr->dataSrcIPFrom)) goto err_exit; - virBufferVSprintf(buf, + virBufferAsprintf(buf, " -m iprange %s %s %s", ENTRY_GET_NEG_SIGN(&ipHdr->dataSrcIPFrom), srcrange, @@ -927,7 +927,7 @@ iptablesHandleIpHdr(virBufferPtr buf, &ipHdr->dataSrcIPTo)) goto err_exit; - virBufferVSprintf(buf, + virBufferAsprintf(buf, "-%s", ipaddr); } @@ -940,7 +940,7 @@ iptablesHandleIpHdr(virBufferPtr buf, &ipHdr->dataDstIPAddr)) goto err_exit; - virBufferVSprintf(buf, + virBufferAsprintf(buf, " %s %s %s", ENTRY_GET_NEG_SIGN(&ipHdr->dataDstIPAddr), dst, @@ -953,7 +953,7 @@ iptablesHandleIpHdr(virBufferPtr buf, &ipHdr->dataDstIPMask)) goto err_exit; - virBufferVSprintf(buf, + virBufferAsprintf(buf, "/%s", number); @@ -965,7 +965,7 @@ iptablesHandleIpHdr(virBufferPtr buf, &ipHdr->dataDstIPFrom)) goto err_exit; - virBufferVSprintf(buf, + virBufferAsprintf(buf, " -m iprange %s %s %s", ENTRY_GET_NEG_SIGN(&ipHdr->dataDstIPFrom), dstrange, @@ -978,7 +978,7 @@ iptablesHandleIpHdr(virBufferPtr buf, &ipHdr->dataDstIPTo)) goto err_exit; - virBufferVSprintf(buf, + virBufferAsprintf(buf, "-%s", ipaddr); } @@ -991,7 +991,7 @@ iptablesHandleIpHdr(virBufferPtr buf, &ipHdr->dataDSCP)) goto err_exit; - virBufferVSprintf(buf, + virBufferAsprintf(buf, " -m dscp %s --dscp %s", ENTRY_GET_NEG_SIGN(&ipHdr->dataDSCP), number); @@ -1009,7 +1009,7 @@ iptablesHandleIpHdr(virBufferPtr buf, /* place connlimit after potential -m state --state ... since this is the most useful order */ - virBufferVSprintf(afterStateMatch, + virBufferAsprintf(afterStateMatch, " -m connlimit %s --connlimit-above %s", ENTRY_GET_NEG_SIGN(&ipHdr->dataConnlimitAbove), number); @@ -1056,7 +1056,7 @@ iptablesHandlePortData(virBufferPtr buf, &portData->dataSrcPortStart)) goto err_exit; - virBufferVSprintf(buf, + virBufferAsprintf(buf, " %s %s %s", ENTRY_GET_NEG_SIGN(&portData->dataSrcPortStart), sport, @@ -1068,7 +1068,7 @@ iptablesHandlePortData(virBufferPtr buf, &portData->dataSrcPortEnd)) goto err_exit; - virBufferVSprintf(buf, + virBufferAsprintf(buf, ":%s", portstr); } @@ -1080,7 +1080,7 @@ iptablesHandlePortData(virBufferPtr buf, &portData->dataDstPortStart)) goto err_exit; - virBufferVSprintf(buf, + virBufferAsprintf(buf, " %s %s %s", ENTRY_GET_NEG_SIGN(&portData->dataDstPortStart), dport, @@ -1092,7 +1092,7 @@ iptablesHandlePortData(virBufferPtr buf, &portData->dataDstPortEnd)) goto err_exit; - virBufferVSprintf(buf, + virBufferAsprintf(buf, ":%s", portstr); } @@ -1111,7 +1111,7 @@ iptablesEnforceDirection(int directionIn, virBufferPtr buf) { if (rule->tt != VIR_NWFILTER_RULE_DIRECTION_INOUT) - virBufferVSprintf(buf, " -m conntrack --ctdir %s", + virBufferAsprintf(buf, " -m conntrack --ctdir %s", (directionIn) ? "Original" : "Reply"); } @@ -1179,7 +1179,7 @@ _iptablesCreateRuleInstance(int directionIn, switch (rule->prtclType) { case VIR_NWFILTER_RULE_PROTOCOL_TCP: case VIR_NWFILTER_RULE_PROTOCOL_TCPoIPV6: - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF_PRE "%s -%%c %s %%s", iptables_cmd, chain); @@ -1205,7 +1205,7 @@ _iptablesCreateRuleInstance(int directionIn, goto err_exit; if (HAS_ENTRY_ITEM(&rule->p.tcpHdrFilter.dataTCPFlags)) { - virBufferVSprintf(&buf, " %s --tcp-flags ", + virBufferAsprintf(&buf, " %s --tcp-flags ", ENTRY_GET_NEG_SIGN(&rule->p.tcpHdrFilter.dataTCPFlags)); virNWFilterPrintTCPFlags(&buf, rule->p.tcpHdrFilter.dataTCPFlags.u.tcpFlags.mask, @@ -1225,7 +1225,7 @@ _iptablesCreateRuleInstance(int directionIn, &rule->p.tcpHdrFilter.dataTCPOption)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " %s --tcp-option %s", ENTRY_GET_NEG_SIGN(&rule->p.tcpHdrFilter.dataTCPOption), number); @@ -1235,7 +1235,7 @@ _iptablesCreateRuleInstance(int directionIn, case VIR_NWFILTER_RULE_PROTOCOL_UDP: case VIR_NWFILTER_RULE_PROTOCOL_UDPoIPV6: - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF_PRE "%s -%%c %s %%s", iptables_cmd, chain); @@ -1269,7 +1269,7 @@ _iptablesCreateRuleInstance(int directionIn, case VIR_NWFILTER_RULE_PROTOCOL_UDPLITE: case VIR_NWFILTER_RULE_PROTOCOL_UDPLITEoIPV6: - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF_PRE "%s -%%c %s %%s", iptables_cmd, chain); @@ -1298,7 +1298,7 @@ _iptablesCreateRuleInstance(int directionIn, case VIR_NWFILTER_RULE_PROTOCOL_ESP: case VIR_NWFILTER_RULE_PROTOCOL_ESPoIPV6: - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF_PRE "%s -%%c %s %%s", iptables_cmd, chain); @@ -1327,7 +1327,7 @@ _iptablesCreateRuleInstance(int directionIn, case VIR_NWFILTER_RULE_PROTOCOL_AH: case VIR_NWFILTER_RULE_PROTOCOL_AHoIPV6: - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF_PRE "%s -%%c %s %%s", iptables_cmd, chain); @@ -1356,7 +1356,7 @@ _iptablesCreateRuleInstance(int directionIn, case VIR_NWFILTER_RULE_PROTOCOL_SCTP: case VIR_NWFILTER_RULE_PROTOCOL_SCTPoIPV6: - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF_PRE "%s -%%c %s %%s", iptables_cmd, chain); @@ -1390,7 +1390,7 @@ _iptablesCreateRuleInstance(int directionIn, case VIR_NWFILTER_RULE_PROTOCOL_ICMP: case VIR_NWFILTER_RULE_PROTOCOL_ICMPV6: - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF_PRE "%s -%%c %s %%s", iptables_cmd, chain); @@ -1436,7 +1436,7 @@ _iptablesCreateRuleInstance(int directionIn, &rule->p.icmpHdrFilter.dataICMPType)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " %s %s %s", ENTRY_GET_NEG_SIGN(&rule->p.icmpHdrFilter.dataICMPType), parm, @@ -1448,7 +1448,7 @@ _iptablesCreateRuleInstance(int directionIn, &rule->p.icmpHdrFilter.dataICMPCode)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, "/%s", number); } @@ -1456,7 +1456,7 @@ _iptablesCreateRuleInstance(int directionIn, break; case VIR_NWFILTER_RULE_PROTOCOL_IGMP: - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF_PRE "%s -%%c %s %%s", iptables_cmd, chain); @@ -1485,7 +1485,7 @@ _iptablesCreateRuleInstance(int directionIn, case VIR_NWFILTER_RULE_PROTOCOL_ALL: case VIR_NWFILTER_RULE_PROTOCOL_ALLoIPV6: - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF_PRE "%s -%%c %s %%s", iptables_cmd, chain); @@ -1531,7 +1531,7 @@ _iptablesCreateRuleInstance(int directionIn, } if (match && !skipMatch) - virBufferVSprintf(&buf, " %s", match); + virBufferAsprintf(&buf, " %s", match); if (defMatch && match != NULL && !skipMatch && !hasICMPType) iptablesEnforceDirection(directionIn, @@ -1554,7 +1554,7 @@ _iptablesCreateRuleInstance(int directionIn, VIR_FREE(s); } - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -j %s" CMD_DEF_POST CMD_SEPARATOR CMD_EXEC, target); @@ -1908,7 +1908,7 @@ ebtablesCreateRuleInstance(char chainPrefix, switch (rule->prtclType) { case VIR_NWFILTER_RULE_PROTOCOL_MAC: - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF_PRE "%s -t %s -%%c %s %%s", ebtables_cmd_path, EBTABLES_DEFAULT_TABLE, chain); @@ -1924,7 +1924,7 @@ ebtablesCreateRuleInstance(char chainPrefix, number, sizeof(number), &rule->p.ethHdrFilter.dataProtocolID)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -p %s %s", ENTRY_GET_NEG_SIGN(&rule->p.ethHdrFilter.dataProtocolID), number); @@ -1934,7 +1934,7 @@ ebtablesCreateRuleInstance(char chainPrefix, case VIR_NWFILTER_RULE_PROTOCOL_ARP: case VIR_NWFILTER_RULE_PROTOCOL_RARP: - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF_PRE "%s -t %s -%%c %s %%s", ebtables_cmd_path, EBTABLES_DEFAULT_TABLE, chain); @@ -1944,7 +1944,7 @@ ebtablesCreateRuleInstance(char chainPrefix, reverse)) goto err_exit; - virBufferVSprintf(&buf, " -p 0x%x", + virBufferAsprintf(&buf, " -p 0x%x", (rule->prtclType == VIR_NWFILTER_RULE_PROTOCOL_ARP) ? l3_protocols[L3_PROTO_ARP_IDX].attr : l3_protocols[L3_PROTO_RARP_IDX].attr); @@ -1954,7 +1954,7 @@ ebtablesCreateRuleInstance(char chainPrefix, number, sizeof(number), &rule->p.arpHdrFilter.dataHWType)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " --arp-htype %s %s", ENTRY_GET_NEG_SIGN(&rule->p.arpHdrFilter.dataHWType), number); @@ -1965,7 +1965,7 @@ ebtablesCreateRuleInstance(char chainPrefix, number, sizeof(number), &rule->p.arpHdrFilter.dataOpcode)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " --arp-opcode %s %s", ENTRY_GET_NEG_SIGN(&rule->p.arpHdrFilter.dataOpcode), number); @@ -1976,7 +1976,7 @@ ebtablesCreateRuleInstance(char chainPrefix, number, sizeof(number), &rule->p.arpHdrFilter.dataProtocolType)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " --arp-ptype %s %s", ENTRY_GET_NEG_SIGN(&rule->p.arpHdrFilter.dataProtocolType), number); @@ -1988,7 +1988,7 @@ ebtablesCreateRuleInstance(char chainPrefix, &rule->p.arpHdrFilter.dataARPSrcIPAddr)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " %s %s %s", reverse ? "--arp-ip-dst" : "--arp-ip-src", ENTRY_GET_NEG_SIGN(&rule->p.arpHdrFilter.dataARPSrcIPAddr), @@ -2001,7 +2001,7 @@ ebtablesCreateRuleInstance(char chainPrefix, &rule->p.arpHdrFilter.dataARPDstIPAddr)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " %s %s %s", reverse ? "--arp-ip-src" : "--arp-ip-dst", ENTRY_GET_NEG_SIGN(&rule->p.arpHdrFilter.dataARPDstIPAddr), @@ -2014,7 +2014,7 @@ ebtablesCreateRuleInstance(char chainPrefix, &rule->p.arpHdrFilter.dataARPSrcMACAddr)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " %s %s %s", reverse ? "--arp-mac-dst" : "--arp-mac-src", ENTRY_GET_NEG_SIGN(&rule->p.arpHdrFilter.dataARPSrcMACAddr), @@ -2027,7 +2027,7 @@ ebtablesCreateRuleInstance(char chainPrefix, &rule->p.arpHdrFilter.dataARPDstMACAddr)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " %s %s %s", reverse ? "--arp-mac-src" : "--arp-mac-dst", ENTRY_GET_NEG_SIGN(&rule->p.arpHdrFilter.dataARPDstMACAddr), @@ -2036,7 +2036,7 @@ ebtablesCreateRuleInstance(char chainPrefix, break; case VIR_NWFILTER_RULE_PROTOCOL_IP: - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF_PRE "%s -t %s -%%c %s %%s", ebtables_cmd_path, EBTABLES_DEFAULT_TABLE, chain); @@ -2055,7 +2055,7 @@ ebtablesCreateRuleInstance(char chainPrefix, &rule->p.ipHdrFilter.ipHdr.dataSrcIPAddr)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " %s %s %s", reverse ? "--ip-destination" : "--ip-source", ENTRY_GET_NEG_SIGN(&rule->p.ipHdrFilter.ipHdr.dataSrcIPAddr), @@ -2066,7 +2066,7 @@ ebtablesCreateRuleInstance(char chainPrefix, number, sizeof(number), &rule->p.ipHdrFilter.ipHdr.dataSrcIPMask)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, "/%s", number); } @@ -2079,7 +2079,7 @@ ebtablesCreateRuleInstance(char chainPrefix, &rule->p.ipHdrFilter.ipHdr.dataDstIPAddr)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " %s %s %s", reverse ? "--ip-source" : "--ip-destination", ENTRY_GET_NEG_SIGN(&rule->p.ipHdrFilter.ipHdr.dataDstIPAddr), @@ -2090,7 +2090,7 @@ ebtablesCreateRuleInstance(char chainPrefix, number, sizeof(number), &rule->p.ipHdrFilter.ipHdr.dataDstIPMask)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, "/%s", number); } @@ -2102,7 +2102,7 @@ ebtablesCreateRuleInstance(char chainPrefix, &rule->p.ipHdrFilter.ipHdr.dataProtocolID)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " --ip-protocol %s %s", ENTRY_GET_NEG_SIGN(&rule->p.ipHdrFilter.ipHdr.dataProtocolID), number); @@ -2115,7 +2115,7 @@ ebtablesCreateRuleInstance(char chainPrefix, &rule->p.ipHdrFilter.portData.dataSrcPortStart)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " %s %s %s", reverse ? "--ip-destination-port" : "--ip-source-port", ENTRY_GET_NEG_SIGN(&rule->p.ipHdrFilter.portData.dataSrcPortStart), @@ -2127,7 +2127,7 @@ ebtablesCreateRuleInstance(char chainPrefix, &rule->p.ipHdrFilter.portData.dataSrcPortEnd)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, ":%s", number); } @@ -2140,7 +2140,7 @@ ebtablesCreateRuleInstance(char chainPrefix, &rule->p.ipHdrFilter.portData.dataDstPortStart)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " %s %s %s", reverse ? "--ip-source-port" : "--ip-destination-port", ENTRY_GET_NEG_SIGN(&rule->p.ipHdrFilter.portData.dataDstPortStart), @@ -2152,7 +2152,7 @@ ebtablesCreateRuleInstance(char chainPrefix, &rule->p.ipHdrFilter.portData.dataDstPortEnd)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, ":%s", number); } @@ -2164,7 +2164,7 @@ ebtablesCreateRuleInstance(char chainPrefix, &rule->p.ipHdrFilter.ipHdr.dataDSCP)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " --ip-tos %s %s", ENTRY_GET_NEG_SIGN(&rule->p.ipHdrFilter.ipHdr.dataDSCP), number); @@ -2172,7 +2172,7 @@ ebtablesCreateRuleInstance(char chainPrefix, break; case VIR_NWFILTER_RULE_PROTOCOL_IPV6: - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF_PRE "%s -t %s -%%c %s %%s", ebtables_cmd_path, EBTABLES_DEFAULT_TABLE, chain); @@ -2191,7 +2191,7 @@ ebtablesCreateRuleInstance(char chainPrefix, &rule->p.ipv6HdrFilter.ipHdr.dataSrcIPAddr)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " %s %s %s", reverse ? "--ip6-destination" : "--ip6-source", ENTRY_GET_NEG_SIGN(&rule->p.ipv6HdrFilter.ipHdr.dataSrcIPAddr), @@ -2202,7 +2202,7 @@ ebtablesCreateRuleInstance(char chainPrefix, number, sizeof(number), &rule->p.ipv6HdrFilter.ipHdr.dataSrcIPMask)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, "/%s", number); } @@ -2215,7 +2215,7 @@ ebtablesCreateRuleInstance(char chainPrefix, &rule->p.ipv6HdrFilter.ipHdr.dataDstIPAddr)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " %s %s %s", reverse ? "--ip6-source" : "--ip6-destination", ENTRY_GET_NEG_SIGN(&rule->p.ipv6HdrFilter.ipHdr.dataDstIPAddr), @@ -2226,7 +2226,7 @@ ebtablesCreateRuleInstance(char chainPrefix, number, sizeof(number), &rule->p.ipv6HdrFilter.ipHdr.dataDstIPMask)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, "/%s", number); } @@ -2238,7 +2238,7 @@ ebtablesCreateRuleInstance(char chainPrefix, &rule->p.ipv6HdrFilter.ipHdr.dataProtocolID)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " --ip6-protocol %s %s", ENTRY_GET_NEG_SIGN(&rule->p.ipv6HdrFilter.ipHdr.dataProtocolID), number); @@ -2251,7 +2251,7 @@ ebtablesCreateRuleInstance(char chainPrefix, &rule->p.ipv6HdrFilter.portData.dataSrcPortStart)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " %s %s %s", reverse ? "--ip6-destination-port" : "--ip6-source-port", ENTRY_GET_NEG_SIGN(&rule->p.ipv6HdrFilter.portData.dataSrcPortStart), @@ -2263,7 +2263,7 @@ ebtablesCreateRuleInstance(char chainPrefix, &rule->p.ipv6HdrFilter.portData.dataSrcPortEnd)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, ":%s", number); } @@ -2276,7 +2276,7 @@ ebtablesCreateRuleInstance(char chainPrefix, &rule->p.ipv6HdrFilter.portData.dataDstPortStart)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " %s %s %s", reverse ? "--ip6-source-port" : "--ip6-destination-port", ENTRY_GET_NEG_SIGN(&rule->p.ipv6HdrFilter.portData.dataDstPortStart), @@ -2288,7 +2288,7 @@ ebtablesCreateRuleInstance(char chainPrefix, &rule->p.ipv6HdrFilter.portData.dataDstPortEnd)) goto err_exit; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, ":%s", number); } @@ -2296,7 +2296,7 @@ ebtablesCreateRuleInstance(char chainPrefix, break; case VIR_NWFILTER_RULE_PROTOCOL_NONE: - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF_PRE "%s -t %s -%%c %s %%s", ebtables_cmd_path, EBTABLES_DEFAULT_TABLE, chain); break; @@ -2315,7 +2315,7 @@ ebtablesCreateRuleInstance(char chainPrefix, target = virNWFilterJumpTargetTypeToString(rule->action); } - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -j %s" CMD_DEF_POST CMD_SEPARATOR CMD_EXEC, target); @@ -2631,7 +2631,7 @@ ebtablesCreateTmpRootChain(virBufferPtr buf, PRINT_ROOT_CHAIN(chain, chainPrefix, ifname); - virBufferVSprintf(buf, + virBufferAsprintf(buf, CMD_DEF("%s -t %s -N %s") CMD_SEPARATOR CMD_EXEC "%s", @@ -2654,7 +2654,7 @@ ebtablesLinkTmpRootChain(virBufferPtr buf, PRINT_ROOT_CHAIN(chain, chainPrefix, ifname); - virBufferVSprintf(buf, + virBufferAsprintf(buf, CMD_DEF("%s -t %s -A %s -%c %s -j %s") CMD_SEPARATOR CMD_EXEC "%s", @@ -2685,7 +2685,7 @@ _ebtablesRemoveRootChain(virBufferPtr buf, PRINT_ROOT_CHAIN(chain, chainPrefix, ifname); - virBufferVSprintf(buf, + virBufferAsprintf(buf, "%s -t %s -F %s" CMD_SEPARATOR "%s -t %s -X %s" CMD_SEPARATOR, ebtables_cmd_path, EBTABLES_DEFAULT_TABLE, chain, @@ -2730,7 +2730,7 @@ _ebtablesUnlinkRootChain(virBufferPtr buf, PRINT_ROOT_CHAIN(chain, chainPrefix, ifname); - virBufferVSprintf(buf, + virBufferAsprintf(buf, "%s -t %s -D %s -%c %s -j %s" CMD_SEPARATOR, ebtables_cmd_path, EBTABLES_DEFAULT_TABLE, (incoming) ? EBTABLES_CHAIN_INCOMING @@ -2771,7 +2771,7 @@ ebtablesCreateTmpSubChain(virBufferPtr buf, PRINT_ROOT_CHAIN(rootchain, chainPrefix, ifname); PRINT_CHAIN(chain, chainPrefix, ifname, l3_protocols[protoidx].val); - virBufferVSprintf(buf, + virBufferAsprintf(buf, CMD_DEF("%s -t %s -N %s") CMD_SEPARATOR CMD_EXEC "%s" @@ -2813,7 +2813,7 @@ _ebtablesRemoveSubChain(virBufferPtr buf, PRINT_ROOT_CHAIN(rootchain, chainPrefix, ifname); PRINT_CHAIN(chain, chainPrefix, ifname, l3_protocols[protoidx].val); - virBufferVSprintf(buf, + virBufferAsprintf(buf, "%s -t %s -D %s -p 0x%x -j %s" CMD_SEPARATOR "%s -t %s -F %s" CMD_SEPARATOR "%s -t %s -X %s" CMD_SEPARATOR, @@ -2900,7 +2900,7 @@ ebtablesRenameTmpSubChain(virBufferPtr buf, PRINT_ROOT_CHAIN( chain, chainPrefix, ifname); } - virBufferVSprintf(buf, + virBufferAsprintf(buf, "%s -t %s -E %s %s" CMD_SEPARATOR, ebtables_cmd_path, EBTABLES_DEFAULT_TABLE, tmpchain, chain); return 0; @@ -2939,8 +2939,8 @@ ebiptablesInstCommand(virBufferPtr buf, char position[10] = { 0 }; if (pos >= 0) snprintf(position, sizeof(position), "%d", pos); - virBufferVSprintf(buf, templ, cmd, position); - virBufferVSprintf(buf, CMD_SEPARATOR "%s", + virBufferAsprintf(buf, templ, cmd, position); + virBufferAsprintf(buf, CMD_SEPARATOR "%s", CMD_STOPONERR(stopOnError)); } @@ -2995,7 +2995,7 @@ ebtablesApplyBasicRules(const char *ifname, ebtablesCreateTmpRootChain(&buf, 1, ifname, 1); PRINT_ROOT_CHAIN(chain, chainPrefix, ifname); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF("%s -t %s -A %s -s ! %s -j DROP") CMD_SEPARATOR CMD_EXEC "%s", @@ -3004,7 +3004,7 @@ ebtablesApplyBasicRules(const char *ifname, chain, macaddr_str, CMD_STOPONERR(1)); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF("%s -t %s -A %s -p IPv4 -j ACCEPT") CMD_SEPARATOR CMD_EXEC "%s", @@ -3012,7 +3012,7 @@ ebtablesApplyBasicRules(const char *ifname, ebtables_cmd_path, EBTABLES_DEFAULT_TABLE, chain, CMD_STOPONERR(1)); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF("%s -t %s -A %s -p ARP -j ACCEPT") CMD_SEPARATOR CMD_EXEC "%s", @@ -3020,7 +3020,7 @@ ebtablesApplyBasicRules(const char *ifname, ebtables_cmd_path, EBTABLES_DEFAULT_TABLE, chain, CMD_STOPONERR(1)); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF("%s -t %s -A %s -j DROP") CMD_SEPARATOR CMD_EXEC "%s", @@ -3081,7 +3081,7 @@ ebtablesApplyDHCPOnlyRules(const char *ifname, } if (dhcpserver) { - virBufferVSprintf(&buf, " --ip-src %s", dhcpserver); + virBufferAsprintf(&buf, " --ip-src %s", dhcpserver); if (virBufferError(&buf)) return 1; srcIPParam = virBufferContentAndReset(&buf); @@ -3097,7 +3097,7 @@ ebtablesApplyDHCPOnlyRules(const char *ifname, PRINT_ROOT_CHAIN(chain_in , CHAINPREFIX_HOST_IN_TEMP , ifname); PRINT_ROOT_CHAIN(chain_out, CHAINPREFIX_HOST_OUT_TEMP, ifname); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF("%s -t %s -A %s" " -s %s -d Broadcast " " -p ipv4 --ip-protocol udp" @@ -3111,7 +3111,7 @@ ebtablesApplyDHCPOnlyRules(const char *ifname, macaddr_str, CMD_STOPONERR(1)); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF("%s -t %s -A %s -j DROP") CMD_SEPARATOR CMD_EXEC "%s", @@ -3119,7 +3119,7 @@ ebtablesApplyDHCPOnlyRules(const char *ifname, ebtables_cmd_path, EBTABLES_DEFAULT_TABLE, chain_in, CMD_STOPONERR(1)); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF("%s -t %s -A %s" " -d %s" " -p ipv4 --ip-protocol udp" @@ -3134,7 +3134,7 @@ ebtablesApplyDHCPOnlyRules(const char *ifname, srcIPParam != NULL ? srcIPParam : "", CMD_STOPONERR(1)); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF("%s -t %s -A %s -j DROP") CMD_SEPARATOR CMD_EXEC "%s", @@ -3199,7 +3199,7 @@ ebtablesApplyDropAllRules(const char *ifname) PRINT_ROOT_CHAIN(chain_in , CHAINPREFIX_HOST_IN_TEMP , ifname); PRINT_ROOT_CHAIN(chain_out, CHAINPREFIX_HOST_OUT_TEMP, ifname); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF("%s -t %s -A %s -j DROP") CMD_SEPARATOR CMD_EXEC "%s", @@ -3207,7 +3207,7 @@ ebtablesApplyDropAllRules(const char *ifname) ebtables_cmd_path, EBTABLES_DEFAULT_TABLE, chain_in, CMD_STOPONERR(1)); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF("%s -t %s -A %s -j DROP") CMD_SEPARATOR CMD_EXEC "%s", @@ -3717,7 +3717,7 @@ ebiptablesDriverInit(bool privileged) ebtables_cmd_path = virFindFileInPath("ebtables"); if (ebtables_cmd_path) { /* basic probing */ - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF("%s -t %s -L") CMD_SEPARATOR CMD_EXEC "%s", @@ -3730,7 +3730,7 @@ ebiptablesDriverInit(bool privileged) iptables_cmd_path = virFindFileInPath("iptables"); if (iptables_cmd_path) { - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF("%s -n -L FORWARD") CMD_SEPARATOR CMD_EXEC "%s", @@ -3743,7 +3743,7 @@ ebiptablesDriverInit(bool privileged) ip6tables_cmd_path = virFindFileInPath("ip6tables"); if (ip6tables_cmd_path) { - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, CMD_DEF("%s -n -L FORWARD") CMD_SEPARATOR CMD_EXEC "%s", diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c index 96d2a55..ce845ac 100644 --- a/src/nwfilter/nwfilter_learnipaddr.c +++ b/src/nwfilter/nwfilter_learnipaddr.c @@ -454,7 +454,7 @@ learnIPAddressThread(void *arg) req->status = EINVAL; goto done; } - virBufferVSprintf(&buf, " ether dst %s" + virBufferAsprintf(&buf, " ether dst %s" " and src port 67 and dst port 68", macaddr); break; @@ -464,7 +464,7 @@ learnIPAddressThread(void *arg) req->status = EINVAL; goto done; } - virBufferVSprintf(&buf, "ether host %s", macaddr); + virBufferAsprintf(&buf, "ether host %s", macaddr); } if (virBufferError(&buf)) { diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 4af28e9..0bd007a 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -744,19 +744,19 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid, } virBufferAdd(&buf, net->data.ethernet.dev, -1); /* Guest dev */ - virBufferVSprintf(&buf, ",%s", macaddr); /* Guest dev mac */ - virBufferVSprintf(&buf, ",%s", net->ifname); /* Host dev */ - virBufferVSprintf(&buf, ",%s", host_macaddr); /* Host dev mac */ + virBufferAsprintf(&buf, ",%s", macaddr); /* Guest dev mac */ + virBufferAsprintf(&buf, ",%s", net->ifname); /* Host dev */ + virBufferAsprintf(&buf, ",%s", host_macaddr); /* Host dev mac */ if (net->type == VIR_DOMAIN_NET_TYPE_BRIDGE) { if (driver->version >= VZCTL_BRIDGE_MIN_VERSION) { - virBufferVSprintf(&buf, ",%s", net->data.bridge.brname); /* Host bridge */ + virBufferAsprintf(&buf, ",%s", net->data.bridge.brname); /* Host bridge */ } else { - virBufferVSprintf(configBuf, "ifname=%s", net->data.ethernet.dev); - virBufferVSprintf(configBuf, ",mac=%s", macaddr); /* Guest dev mac */ - virBufferVSprintf(configBuf, ",host_ifname=%s", net->ifname); /* Host dev */ - virBufferVSprintf(configBuf, ",host_mac=%s", host_macaddr); /* Host dev mac */ - virBufferVSprintf(configBuf, ",bridge=%s", net->data.bridge.brname); /* Host bridge */ + virBufferAsprintf(configBuf, "ifname=%s", net->data.ethernet.dev); + virBufferAsprintf(configBuf, ",mac=%s", macaddr); /* Guest dev mac */ + virBufferAsprintf(configBuf, ",host_ifname=%s", net->ifname); /* Host dev */ + virBufferAsprintf(configBuf, ",host_mac=%s", host_macaddr); /* Host dev mac */ + virBufferAsprintf(configBuf, ",bridge=%s", net->data.bridge.brname); /* Host bridge */ } } diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index ebd4a8a..30d4adf 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -284,7 +284,7 @@ phypGetVIOSPartitionID(virConnectPtr conn) virBufferAddLit(&buf, "lssyscfg"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -m %s", managed_system); virBufferAddLit(&buf, " -r lpar -F lpar_id,lpar_env" "|sed -n '/vioserver/ {\n s/,.*$//\n p\n}'"); phypExecInt(session, &buf, conn, &id); @@ -368,8 +368,8 @@ phypNumDomainsGeneric(virConnectPtr conn, unsigned int type) virBufferAddLit(&buf, "lssyscfg -r lpar"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, " -F lpar_id,state %s |grep -c '^[0-9][0-9]*'", + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -F lpar_id,state %s |grep -c '^[0-9][0-9]*'", state); phypExecInt(session, &buf, conn, &ndom); return ndom; @@ -405,8 +405,8 @@ phypListDomainsGeneric(virConnectPtr conn, int *ids, int nids, virBufferAddLit(&buf, "lssyscfg -r lpar"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, " -F lpar_id,state %s | sed -e 's/,.*$//'", + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -F lpar_id,state %s | sed -e 's/,.*$//'", state); ret = phypExecBuffer(session, &buf, &exit_status, conn, false); @@ -1300,8 +1300,8 @@ phypGetLparID(LIBSSH2_SESSION * session, const char *managed_system, virBufferAddLit(&buf, "lssyscfg -r lpar"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, " --filter lpar_names=%s -F lpar_id", name); + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " --filter lpar_names=%s -F lpar_id", name); phypExecInt(session, &buf, conn, &lpar_id); return lpar_id; } @@ -1319,8 +1319,8 @@ phypGetLparNAME(LIBSSH2_SESSION * session, const char *managed_system, virBufferAddLit(&buf, "lssyscfg -r lpar"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, " --filter lpar_ids=%d -F name", lpar_id); + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " --filter lpar_ids=%d -F name", lpar_id); ret = phypExecBuffer(session, &buf, &exit_status, conn, true); if (exit_status < 0) @@ -1374,8 +1374,8 @@ phypGetLparMem(virConnectPtr conn, const char *managed_system, int lpar_id, virBufferAddLit(&buf, "lshwres"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -r mem --level lpar -F %s --filter lpar_ids=%d", type ? "curr_mem" : "curr_max_mem", lpar_id); phypExecInt(session, &buf, conn, &memory); @@ -1395,8 +1395,8 @@ phypGetLparCPUGeneric(virConnectPtr conn, const char *managed_system, virBufferAddLit(&buf, "lshwres"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -r proc --level lpar -F %s --filter lpar_ids=%d", type ? "curr_max_procs" : "curr_procs", lpar_id); phypExecInt(session, &buf, conn, &vcpus); @@ -1443,8 +1443,8 @@ phypGetRemoteSlot(virConnectPtr conn, const char *managed_system, virBufferAddLit(&buf, "lshwres"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, " -r virtualio --rsubtype scsi -F " + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -r virtualio --rsubtype scsi -F " "remote_slot_num --filter lpar_names=%s", lpar_name); phypExecInt(session, &buf, conn, &remote_slot); return remote_slot; @@ -1474,8 +1474,8 @@ phypGetBackingDevice(virConnectPtr conn, const char *managed_system, virBufferAddLit(&buf, "lshwres"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, " -r virtualio --rsubtype scsi -F " + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -r virtualio --rsubtype scsi -F " "backing_devices --filter slots=%d", remote_slot); ret = phypExecBuffer(session, &buf, &exit_status, conn, false); @@ -1534,8 +1534,8 @@ phypGetLparProfile(virConnectPtr conn, int lpar_id) virBufferAddLit(&buf, "lssyscfg"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -r prof --filter lpar_ids=%d -F name|head -n 1", lpar_id); ret = phypExecBuffer(session, &buf, &exit_status, conn, true); @@ -1566,9 +1566,9 @@ phypGetVIOSNextSlotNumber(virConnectPtr conn) virBufferAddLit(&buf, "lssyscfg"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, " -r prof --filter " + virBufferAsprintf(&buf, " -r prof --filter " "profile_names=%s -F virtual_eth_adapters," "virtual_opti_pool_id,virtual_scsi_adapters," "virtual_serial_adapters|sed -e 's/\"//g' -e " @@ -1618,8 +1618,8 @@ phypCreateServerSCSIAdapter(virConnectPtr conn) * */ virBufferAddLit(&buf, "lssyscfg"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, " -r prof --filter lpar_ids=%d,profile_names=%s" + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -r prof --filter lpar_ids=%d,profile_names=%s" " -F virtual_scsi_adapters|sed -e s/\\\"//g", vios_id, profile); ret = phypExecBuffer(session, &buf, &exit_status, conn, false); @@ -1632,8 +1632,8 @@ phypCreateServerSCSIAdapter(virConnectPtr conn) * */ virBufferAddLit(&buf, "chsyscfg"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, " -r prof -i 'name=%s,lpar_id=%d," + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -r prof -i 'name=%s,lpar_id=%d," "\"virtual_scsi_adapters=%s,%d/server/any/any/1\"'", vios_name, vios_id, ret, slot); VIR_FREE(ret); @@ -1647,8 +1647,8 @@ phypCreateServerSCSIAdapter(virConnectPtr conn) * */ virBufferAddLit(&buf, "chhwres -r virtualio --rsubtype scsi"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -p %s -o a -s %d -d 0 -a \"adapter_type=server\"", vios_name, slot); VIR_FREE(ret); @@ -1681,15 +1681,15 @@ phypGetVIOSFreeSCSIAdapter(virConnectPtr conn) virBuffer buf = VIR_BUFFER_INITIALIZER; if (system_type == HMC) - virBufferVSprintf(&buf, "viosvrcmd -m %s --id %d -c '", + virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '", managed_system, vios_id); - virBufferVSprintf(&buf, "lsmap -all -field svsa backing -fmt , "); + virBufferAsprintf(&buf, "lsmap -all -field svsa backing -fmt , "); if (system_type == HMC) virBufferAddChar(&buf, '\''); - virBufferVSprintf(&buf, "|sed '/,[^.*]/d; s/,//g; q'"); + virBufferAsprintf(&buf, "|sed '/,[^.*]/d; s/,//g; q'"); ret = phypExecBuffer(session, &buf, &exit_status, conn, true); if (exit_status < 0) @@ -1763,10 +1763,10 @@ phypAttachDevice(virDomainPtr domain, const char *xml) } if (system_type == HMC) - virBufferVSprintf(&buf, "viosvrcmd -m %s --id %d -c '", + virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '", managed_system, vios_id); - virBufferVSprintf(&buf, "mkvdev -vdev %s -vadapter %s", + virBufferAsprintf(&buf, "mkvdev -vdev %s -vadapter %s", dev->data.disk->src, scsi_adapter); if (system_type == HMC) @@ -1785,8 +1785,8 @@ phypAttachDevice(virDomainPtr domain, const char *xml) * */ virBufferAddLit(&buf, "lshwres -r virtualio --rsubtype scsi"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " slot_num,backing_device|grep %s|cut -d, -f1", dev->data.disk->src); if (phypExecInt(session, &buf, conn, &slot) < 0) @@ -1797,8 +1797,8 @@ phypAttachDevice(virDomainPtr domain, const char *xml) * */ virBufferAddLit(&buf, "lssyscfg"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -r prof --filter lpar_ids=%d,profile_names=%s" " -F virtual_scsi_adapters|sed -e 's/\"//g'", vios_id, profile); @@ -1813,8 +1813,8 @@ phypAttachDevice(virDomainPtr domain, const char *xml) * */ virBufferAddLit(&buf, "chsyscfg"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -r prof -i 'name=%s,lpar_id=%d," "\"virtual_scsi_adapters=%s,%d/client/%d/%s/0\"'", domain_name, domain->id, ret, slot, @@ -1827,8 +1827,8 @@ phypAttachDevice(virDomainPtr domain, const char *xml) * */ virBufferAddLit(&buf, "chhwres -r virtualio --rsubtype scsi"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -p %s -o a -s %d -d 0 -a \"adapter_type=server\"", domain_name, slot); VIR_FREE(ret); @@ -1869,15 +1869,15 @@ phypVolumeGetKey(virConnectPtr conn, const char *name) virBuffer buf = VIR_BUFFER_INITIALIZER; if (system_type == HMC) - virBufferVSprintf(&buf, "viosvrcmd -m %s --id %d -c '", + virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '", managed_system, vios_id); - virBufferVSprintf(&buf, "lslv %s -field lvid", name); + virBufferAsprintf(&buf, "lslv %s -field lvid", name); if (system_type == HMC) virBufferAddChar(&buf, '\''); - virBufferVSprintf(&buf, "|sed -e 's/^LV IDENTIFIER://' -e 's/ //g'"); + virBufferAsprintf(&buf, "|sed -e 's/^LV IDENTIFIER://' -e 's/ //g'"); ret = phypExecBuffer(session, &buf, &exit_status, conn, true); if (exit_status < 0) @@ -1899,15 +1899,15 @@ phypGetStoragePoolDevice(virConnectPtr conn, char *name) virBuffer buf = VIR_BUFFER_INITIALIZER; if (system_type == HMC) - virBufferVSprintf(&buf, "viosvrcmd -m %s --id %d -c '", + virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '", managed_system, vios_id); - virBufferVSprintf(&buf, "lssp -detail -sp %s -field name", name); + virBufferAsprintf(&buf, "lssp -detail -sp %s -field name", name); if (system_type == HMC) virBufferAddChar(&buf, '\''); - virBufferVSprintf(&buf, "|sed '1d; s/ //g'"); + virBufferAsprintf(&buf, "|sed '1d; s/ //g'"); ret = phypExecBuffer(session, &buf, &exit_status, conn, true); if (exit_status < 0) @@ -1928,15 +1928,15 @@ phypGetStoragePoolSize(virConnectPtr conn, char *name) virBuffer buf = VIR_BUFFER_INITIALIZER; if (system_type == HMC) - virBufferVSprintf(&buf, "viosvrcmd -m %s --id %d -c '", + virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '", managed_system, vios_id); - virBufferVSprintf(&buf, "lssp -detail -sp %s -field size", name); + virBufferAsprintf(&buf, "lssp -detail -sp %s -field size", name); if (system_type == HMC) virBufferAddChar(&buf, '\''); - virBufferVSprintf(&buf, "|sed '1d; s/ //g'"); + virBufferAsprintf(&buf, "|sed '1d; s/ //g'"); phypExecInt(session, &buf, conn, &sp_size); return sp_size; } @@ -1957,10 +1957,10 @@ phypBuildVolume(virConnectPtr conn, const char *lvname, const char *spname, char *key = NULL; if (system_type == HMC) - virBufferVSprintf(&buf, "viosvrcmd -m %s --id %d -c '", + virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '", managed_system, vios_id); - virBufferVSprintf(&buf, "mklv -lv %s %s %d", lvname, spname, capacity); + virBufferAsprintf(&buf, "mklv -lv %s %s %d", lvname, spname, capacity); if (system_type == HMC) virBufferAddChar(&buf, '\''); @@ -2109,15 +2109,15 @@ phypVolumeGetPhysicalVolumeByStoragePool(virStorageVolPtr vol, char *sp) virBuffer buf = VIR_BUFFER_INITIALIZER; if (system_type == HMC) - virBufferVSprintf(&buf, "viosvrcmd -m %s --id %d -c '", + virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '", managed_system, vios_id); - virBufferVSprintf(&buf, "lssp -detail -sp %s -field pvname", sp); + virBufferAsprintf(&buf, "lssp -detail -sp %s -field pvname", sp); if (system_type == HMC) virBufferAddChar(&buf, '\''); - virBufferVSprintf(&buf, "|sed 1d"); + virBufferAsprintf(&buf, "|sed 1d"); ret = phypExecBuffer(session, &buf, &exit_status, conn, true); if (exit_status < 0) @@ -2141,15 +2141,15 @@ phypVolumeLookupByPath(virConnectPtr conn, const char *volname) virStorageVolPtr vol = NULL; if (system_type == HMC) - virBufferVSprintf(&buf, "viosvrcmd -m %s --id %d -c '", + virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '", managed_system, vios_id); - virBufferVSprintf(&buf, "lslv %s -field vgname", volname); + virBufferAsprintf(&buf, "lslv %s -field vgname", volname); if (system_type == HMC) virBufferAddChar(&buf, '\''); - virBufferVSprintf(&buf, "|sed -e 's/^VOLUME GROUP://g' -e 's/ //g'"); + virBufferAsprintf(&buf, "|sed -e 's/^VOLUME GROUP://g' -e 's/ //g'"); ret = phypExecBuffer(session, &buf, &exit_status, conn, true); if (exit_status < 0 || ret == NULL) @@ -2185,15 +2185,15 @@ phypGetStoragePoolUUID(virConnectPtr conn, unsigned char *uuid, virBuffer buf = VIR_BUFFER_INITIALIZER; if (system_type == HMC) - virBufferVSprintf(&buf, "viosvrcmd -m %s --id %d -c '", + virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '", managed_system, vios_id); - virBufferVSprintf(&buf, "lsdev -dev %s -attr vgserial_id", name); + virBufferAsprintf(&buf, "lsdev -dev %s -attr vgserial_id", name); if (system_type == HMC) virBufferAddChar(&buf, '\''); - virBufferVSprintf(&buf, "|sed '1,2d'"); + virBufferAsprintf(&buf, "|sed '1,2d'"); ret = phypExecBuffer(session, &buf, &exit_status, conn, false); if (exit_status < 0 || ret == NULL) @@ -2319,15 +2319,15 @@ phypVolumeGetPath(virStorageVolPtr vol) char *pv; if (system_type == HMC) - virBufferVSprintf(&buf, "viosvrcmd -m %s --id %d -c '", + virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '", managed_system, vios_id); - virBufferVSprintf(&buf, "lslv %s -field vgname", vol->name); + virBufferAsprintf(&buf, "lslv %s -field vgname", vol->name); if (system_type == HMC) virBufferAddChar(&buf, '\''); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, "|sed -e 's/^VOLUME GROUP://g' -e 's/ //g'"); ret = phypExecBuffer(session, &buf, &exit_status, conn, true); @@ -2372,15 +2372,15 @@ phypStoragePoolListVolumes(virStoragePoolPtr pool, char **const volumes, virBuffer buf = VIR_BUFFER_INITIALIZER; if (system_type == HMC) - virBufferVSprintf(&buf, "viosvrcmd -m %s --id %d -c '", + virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '", managed_system, vios_id); - virBufferVSprintf(&buf, "lsvg -lv %s -field lvname", pool->name); + virBufferAsprintf(&buf, "lsvg -lv %s -field lvname", pool->name); if (system_type == HMC) virBufferAddChar(&buf, '\''); - virBufferVSprintf(&buf, "|sed '1,2d'"); + virBufferAsprintf(&buf, "|sed '1,2d'"); ret = phypExecBuffer(session, &buf, &exit_status, conn, false); /* I need to parse the textual return in order to get the volumes */ @@ -2432,12 +2432,12 @@ phypStoragePoolNumOfVolumes(virStoragePoolPtr pool) virBuffer buf = VIR_BUFFER_INITIALIZER; if (system_type == HMC) - virBufferVSprintf(&buf, "viosvrcmd -m %s --id %d -c '", + virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '", managed_system, vios_id); - virBufferVSprintf(&buf, "lsvg -lv %s -field lvname", pool->name); + virBufferAsprintf(&buf, "lsvg -lv %s -field lvname", pool->name); if (system_type == HMC) virBufferAddChar(&buf, '\''); - virBufferVSprintf(&buf, "|grep -c '^.*$'"); + virBufferAsprintf(&buf, "|grep -c '^.*$'"); if (phypExecInt(session, &buf, conn, &nvolumes) < 0) return -1; @@ -2461,10 +2461,10 @@ phypDestroyStoragePool(virStoragePoolPtr pool) virBuffer buf = VIR_BUFFER_INITIALIZER; if (system_type == HMC) - virBufferVSprintf(&buf, "viosvrcmd -m %s --id %d -c '", + virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '", managed_system, vios_id); - virBufferVSprintf(&buf, "rmsp %s", pool->name); + virBufferAsprintf(&buf, "rmsp %s", pool->name); if (system_type == HMC) virBufferAddChar(&buf, '\''); @@ -2499,10 +2499,10 @@ phypBuildStoragePool(virConnectPtr conn, virStoragePoolDefPtr def) virBuffer buf = VIR_BUFFER_INITIALIZER; if (system_type == HMC) - virBufferVSprintf(&buf, "viosvrcmd -m %s --id %d -c '", + virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '", managed_system, vios_id); - virBufferVSprintf(&buf, "mksp -f %schild %s", def->name, + virBufferAsprintf(&buf, "mksp -f %schild %s", def->name, source.adapter); if (system_type == HMC) @@ -2536,15 +2536,15 @@ phypNumOfStoragePools(virConnectPtr conn) virBuffer buf = VIR_BUFFER_INITIALIZER; if (system_type == HMC) - virBufferVSprintf(&buf, "viosvrcmd -m %s --id %d -c '", + virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '", managed_system, vios_id); - virBufferVSprintf(&buf, "lsvg"); + virBufferAsprintf(&buf, "lsvg"); if (system_type == HMC) virBufferAddChar(&buf, '\''); - virBufferVSprintf(&buf, "|grep -c '^.*$'"); + virBufferAsprintf(&buf, "|grep -c '^.*$'"); phypExecInt(session, &buf, conn, &nsp); return nsp; } @@ -2568,10 +2568,10 @@ phypListStoragePools(virConnectPtr conn, char **const pools, int npools) virBuffer buf = VIR_BUFFER_INITIALIZER; if (system_type == HMC) - virBufferVSprintf(&buf, "viosvrcmd -m %s --id %d -c '", + virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '", managed_system, vios_id); - virBufferVSprintf(&buf, "lsvg"); + virBufferAsprintf(&buf, "lsvg"); if (system_type == HMC) virBufferAddChar(&buf, '\''); @@ -2776,9 +2776,9 @@ phypInterfaceDestroy(virInterfacePtr iface, virBufferAddLit(&buf, "lshwres "); if (system_type == HMC) - virBufferVSprintf(&buf, "-m %s ", managed_system); + virBufferAsprintf(&buf, "-m %s ", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -r virtualio --rsubtype eth --level lpar " " -F mac_addr,slot_num|" " sed -n '/%s/ s/^.*,//p'", iface->mac); @@ -2788,9 +2788,9 @@ phypInterfaceDestroy(virInterfacePtr iface, /* Getting the remote slot number */ virBufferAddLit(&buf, "lshwres "); if (system_type == HMC) - virBufferVSprintf(&buf, "-m %s ", managed_system); + virBufferAsprintf(&buf, "-m %s ", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -r virtualio --rsubtype eth --level lpar " " -F mac_addr,lpar_id|" " sed -n '/%s/ s/^.*,//p'", iface->mac); @@ -2800,9 +2800,9 @@ phypInterfaceDestroy(virInterfacePtr iface, /* excluding interface */ virBufferAddLit(&buf, "chhwres "); if (system_type == HMC) - virBufferVSprintf(&buf, "-m %s ", managed_system); + virBufferAsprintf(&buf, "-m %s ", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -r virtualio --rsubtype eth" " --id %d -o r -s %d", lpar_id, slot_num); VIR_FREE(ret); @@ -2844,9 +2844,9 @@ phypInterfaceDefineXML(virConnectPtr conn, const char *xml, /* Now need to get the next free slot number */ virBufferAddLit(&buf, "lshwres "); if (system_type == HMC) - virBufferVSprintf(&buf, "-m %s ", managed_system); + virBufferAsprintf(&buf, "-m %s ", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -r virtualio --rsubtype slot --level slot" " -Fslot_num --filter lpar_names=%s" " |sort|tail -n 1", def->name); @@ -2859,9 +2859,9 @@ phypInterfaceDefineXML(virConnectPtr conn, const char *xml, /* Now adding the new network interface */ virBufferAddLit(&buf, "chhwres "); if (system_type == HMC) - virBufferVSprintf(&buf, "-m %s ", managed_system); + virBufferAsprintf(&buf, "-m %s ", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -r virtualio --rsubtype eth" " -p %s -o a -s %d -a port_vlan_id=1," "ieee_virtual_eth=0", def->name, slot); @@ -2879,9 +2879,9 @@ phypInterfaceDefineXML(virConnectPtr conn, const char *xml, /* Getting the new interface name */ virBufferAddLit(&buf, "lshwres "); if (system_type == HMC) - virBufferVSprintf(&buf, "-m %s ", managed_system); + virBufferAsprintf(&buf, "-m %s ", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -r virtualio --rsubtype slot --level slot" " |sed '/lpar_name=%s/!d; /slot_num=%d/!d; " "s/^.*drc_name=//'", def->name, slot); @@ -2892,9 +2892,9 @@ phypInterfaceDefineXML(virConnectPtr conn, const char *xml, /* roll back and excluding interface if error*/ virBufferAddLit(&buf, "chhwres "); if (system_type == HMC) - virBufferVSprintf(&buf, "-m %s ", managed_system); + virBufferAsprintf(&buf, "-m %s ", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -r virtualio --rsubtype eth" " -p %s -o r -s %d", def->name, slot); VIR_FREE(ret); @@ -2907,9 +2907,9 @@ phypInterfaceDefineXML(virConnectPtr conn, const char *xml, /* Getting the new interface mac addr */ virBufferAddLit(&buf, "lshwres "); if (system_type == HMC) - virBufferVSprintf(&buf, "-m %s ", managed_system); + virBufferAsprintf(&buf, "-m %s ", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, "-r virtualio --rsubtype eth --level lpar " " |sed '/lpar_name=%s/!d; /slot_num=%d/!d; " "s/^.*mac_addr=//'", def->name, slot); @@ -2948,9 +2948,9 @@ phypInterfaceLookupByName(virConnectPtr conn, const char *name) /*Getting the slot number for the interface */ virBufferAddLit(&buf, "lshwres "); if (system_type == HMC) - virBufferVSprintf(&buf, "-m %s ", managed_system); + virBufferAsprintf(&buf, "-m %s ", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -r virtualio --rsubtype slot --level slot " " -F drc_name,slot_num |" " sed -n '/%s/ s/^.*,//p'", name); @@ -2960,9 +2960,9 @@ phypInterfaceLookupByName(virConnectPtr conn, const char *name) /*Getting the lpar_id for the interface */ virBufferAddLit(&buf, "lshwres "); if (system_type == HMC) - virBufferVSprintf(&buf, "-m %s ", managed_system); + virBufferAsprintf(&buf, "-m %s ", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -r virtualio --rsubtype slot --level slot " " -F drc_name,lpar_id |" " sed -n '/%s/ s/^.*,//p'", name); @@ -2972,9 +2972,9 @@ phypInterfaceLookupByName(virConnectPtr conn, const char *name) /*Getting the interface mac */ virBufferAddLit(&buf, "lshwres "); if (system_type == HMC) - virBufferVSprintf(&buf, "-m %s ", managed_system); + virBufferAsprintf(&buf, "-m %s ", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -r virtualio --rsubtype eth --level lpar " " -F lpar_id,slot_num,mac_addr|" " sed -n '/%d,%d/ s/^.*,//p'", lpar_id, slot); @@ -3005,9 +3005,9 @@ phypInterfaceIsActive(virInterfacePtr iface) virBufferAddLit(&buf, "lshwres "); if (system_type == HMC) - virBufferVSprintf(&buf, "-m %s ", managed_system); + virBufferAsprintf(&buf, "-m %s ", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -r virtualio --rsubtype eth --level lpar " " -F mac_addr,state |" " sed -n '/%s/ s/^.*,//p'", iface->mac); @@ -3035,8 +3035,8 @@ phypListInterfaces(virConnectPtr conn, char **const names, int nnames) virBufferAddLit(&buf, "lshwres"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, " -r virtualio --rsubtype slot --level slot|" + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -r virtualio --rsubtype slot --level slot|" " sed '/eth/!d; /lpar_id=%d/d; s/^.*drc_name=//g'", vios_id); ret = phypExecBuffer(session, &buf, &exit_status, conn, false); @@ -3087,9 +3087,9 @@ phypNumOfInterfaces(virConnectPtr conn) virBufferAddLit(&buf, "lshwres "); if (system_type == HMC) - virBufferVSprintf(&buf, "-m %s ", managed_system); + virBufferAsprintf(&buf, "-m %s ", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, "-r virtualio --rsubtype eth --level lpar|" "grep -v lpar_id=%d|grep -c lpar_name", vios_id); phypExecInt(session, &buf, conn, &nnets); @@ -3111,8 +3111,8 @@ phypGetLparState(virConnectPtr conn, unsigned int lpar_id) virBufferAddLit(&buf, "lssyscfg -r lpar"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, " -F state --filter lpar_ids=%d", lpar_id); + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -F state --filter lpar_ids=%d", lpar_id); ret = phypExecBuffer(session, &buf, &exit_status, conn, true); if (exit_status < 0 || ret == NULL) @@ -3148,8 +3148,8 @@ phypDiskType(virConnectPtr conn, char *backing_device) virBufferAddLit(&buf, "viosvrcmd"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, " -p %d -c \"lssp -field name type " + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -p %d -c \"lssp -field name type " "-fmt , -all|sed -n '/%s/ {\n s/^.*,//\n p\n}'\"", vios_id, backing_device); ret = phypExecBuffer(session, &buf, &exit_status, conn, true); @@ -3204,8 +3204,8 @@ phypListDefinedDomains(virConnectPtr conn, char **const names, int nnames) virBufferAddLit(&buf, "lssyscfg -r lpar"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, " -F name,state" + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -F name,state" "|sed -n '/Not Activated/ {\n s/,.*$//\n p\n}'"); ret = phypExecBuffer(session, &buf, &exit_status, conn, false); @@ -3367,8 +3367,8 @@ phypDomainResume(virDomainPtr dom) virBufferAddLit(&buf, "chsysstate"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, " -r lpar -o on --id %d -f %s", + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -r lpar -o on --id %d -f %s", dom->id, dom->name); ret = phypExecBuffer(session, &buf, &exit_status, dom->conn, false); @@ -3399,8 +3399,8 @@ phypDomainReboot(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED) virBufferAddLit(&buf, "chsysstate"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -r lpar -o shutdown --id %d --immed --restart", dom->id); ret = phypExecBuffer(session, &buf, &exit_status, dom->conn, false); @@ -3432,8 +3432,8 @@ phypDomainShutdown(virDomainPtr dom) virBufferAddLit(&buf, "chsysstate"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, " -r lpar -o shutdown --id %d", dom->id); + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -r lpar -o shutdown --id %d", dom->id); ret = phypExecBuffer(session, &buf, &exit_status, dom->conn, false); if (exit_status < 0) @@ -3485,8 +3485,8 @@ phypDomainDestroy(virDomainPtr dom) virBufferAddLit(&buf, "rmsyscfg"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, " -r lpar --id %d", dom->id); + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -r lpar --id %d", dom->id); ret = phypExecBuffer(session, &buf, &exit_status, dom->conn, false); if (exit_status < 0) @@ -3546,8 +3546,8 @@ phypBuildLpar(virConnectPtr conn, virDomainDefPtr def) virBufferAddLit(&buf, "mksyscfg"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, " -r lpar -p %s -i min_mem=%d,desired_mem=%d," + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " -r lpar -p %s -i min_mem=%d,desired_mem=%d," "max_mem=%d,desired_procs=%d,virtual_scsi_adapters=%s", def->name, (int) def->mem.cur_balloon, (int) def->mem.cur_balloon, (int) def->mem.max_balloon, @@ -3679,8 +3679,8 @@ phypDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, virBufferAddLit(&buf, "chhwres -r proc"); if (system_type == HMC) - virBufferVSprintf(&buf, " -m %s", managed_system); - virBufferVSprintf(&buf, " --id %d -o %c --procunits %d 2>&1 |sed " + virBufferAsprintf(&buf, " -m %s", managed_system); + virBufferAsprintf(&buf, " --id %d -o %c --procunits %d 2>&1 |sed " "-e 's/^.*\\([0-9][0-9]*.[0-9][0-9]*\\).*$/\\1/'", dom->id, operation, amount); ret = phypExecBuffer(session, &buf, &exit_status, dom->conn, false); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 2205ed1..22b2634 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1162,9 +1162,9 @@ qemuBuildDeviceAddressStr(virBufferPtr buf, * to pciNN.0 where NN is the domain number */ if (qemuCapsGet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS)) - virBufferVSprintf(buf, ",bus=pci.0,addr=0x%x", info->addr.pci.slot); + virBufferAsprintf(buf, ",bus=pci.0,addr=0x%x", info->addr.pci.slot); else - virBufferVSprintf(buf, ",bus=pci,addr=0x%x", info->addr.pci.slot); + virBufferAsprintf(buf, ",bus=pci,addr=0x%x", info->addr.pci.slot); } return 0; } @@ -1289,9 +1289,9 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, goto error; } if (disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) - virBufferVSprintf(&opt, "file=fat:floppy:%s,", disk->src); + virBufferAsprintf(&opt, "file=fat:floppy:%s,", disk->src); else - virBufferVSprintf(&opt, "file=fat:%s,", disk->src); + virBufferAsprintf(&opt, "file=fat:%s,", disk->src); } else if (disk->type == VIR_DOMAIN_DISK_TYPE_NETWORK) { switch (disk->protocol) { case VIR_DOMAIN_DISK_PROTOCOL_NBD: @@ -1300,46 +1300,46 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, _("NBD accepts only one host")); goto error; } - virBufferVSprintf(&opt, "file=nbd:%s:%s,", + virBufferAsprintf(&opt, "file=nbd:%s:%s,", disk->hosts->name, disk->hosts->port); break; case VIR_DOMAIN_DISK_PROTOCOL_RBD: /* TODO: set monitor hostnames */ - virBufferVSprintf(&opt, "file=rbd:%s,", disk->src); + virBufferAsprintf(&opt, "file=rbd:%s,", disk->src); break; case VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG: if (disk->nhosts == 0) - virBufferVSprintf(&opt, "file=sheepdog:%s,", disk->src); + virBufferAsprintf(&opt, "file=sheepdog:%s,", disk->src); else /* only one host is supported now */ - virBufferVSprintf(&opt, "file=sheepdog:%s:%s:%s,", + virBufferAsprintf(&opt, "file=sheepdog:%s:%s:%s,", disk->hosts->name, disk->hosts->port, disk->src); break; } } else { - virBufferVSprintf(&opt, "file=%s,", disk->src); + virBufferAsprintf(&opt, "file=%s,", disk->src); } } if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) virBufferAddLit(&opt, "if=none"); else - virBufferVSprintf(&opt, "if=%s", bus); + virBufferAsprintf(&opt, "if=%s", bus); if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) virBufferAddLit(&opt, ",media=cdrom"); if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - virBufferVSprintf(&opt, ",id=%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias); + virBufferAsprintf(&opt, ",id=%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias); } else { if (busid == -1 && unitid == -1) { if (idx != -1) - virBufferVSprintf(&opt, ",index=%d", idx); + virBufferAsprintf(&opt, ",index=%d", idx); } else { if (busid != -1) - virBufferVSprintf(&opt, ",bus=%d", busid); + virBufferAsprintf(&opt, ",bus=%d", busid); if (unitid != -1) - virBufferVSprintf(&opt, ",unit=%d", unitid); + virBufferAsprintf(&opt, ",unit=%d", unitid); } } if (bootable && @@ -1352,12 +1352,12 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, if (disk->driverType && *disk->driverType != '\0' && disk->type != VIR_DOMAIN_DISK_TYPE_DIR && qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_FORMAT)) - virBufferVSprintf(&opt, ",format=%s", disk->driverType); + virBufferAsprintf(&opt, ",format=%s", disk->driverType); if (disk->serial && qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_SERIAL)) { if (qemuSafeSerialParamValue(disk->serial) < 0) goto error; - virBufferVSprintf(&opt, ",serial=%s", disk->serial); + virBufferAsprintf(&opt, ",serial=%s", disk->serial); } if (disk->cachemode) { @@ -1366,14 +1366,14 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, qemuDiskCacheV2TypeToString(disk->cachemode) : qemuDiskCacheV1TypeToString(disk->cachemode); - virBufferVSprintf(&opt, ",cache=%s", mode); + virBufferAsprintf(&opt, ",cache=%s", mode); } else if (disk->shared && !disk->readonly) { virBufferAddLit(&opt, ",cache=off"); } if (qemuCapsGet(qemuCaps, QEMU_CAPS_MONITOR_JSON)) { if (disk->error_policy) { - virBufferVSprintf(&opt, ",werror=%s,rerror=%s", + virBufferAsprintf(&opt, ",werror=%s,rerror=%s", virDomainDiskErrorPolicyTypeToString(disk->error_policy), virDomainDiskErrorPolicyTypeToString(disk->error_policy)); } @@ -1381,7 +1381,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, if (disk->iomode) { if (qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_AIO)) { - virBufferVSprintf(&opt, ",aio=%s", + virBufferAsprintf(&opt, ",aio=%s", virDomainDiskIoTypeToString(disk->iomode)); } else { qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -1421,13 +1421,13 @@ qemuBuildDriveDevStr(virDomainDiskDefPtr disk, switch (disk->bus) { case VIR_DOMAIN_DISK_BUS_IDE: virBufferAddLit(&opt, "ide-drive"); - virBufferVSprintf(&opt, ",bus=ide.%d,unit=%d", + virBufferAsprintf(&opt, ",bus=ide.%d,unit=%d", disk->info.addr.drive.bus, disk->info.addr.drive.unit); break; case VIR_DOMAIN_DISK_BUS_SCSI: virBufferAddLit(&opt, "scsi-disk"); - virBufferVSprintf(&opt, ",bus=scsi%d.%d,scsi-id=%d", + virBufferAsprintf(&opt, ",bus=scsi%d.%d,scsi-id=%d", disk->info.addr.drive.controller, disk->info.addr.drive.bus, disk->info.addr.drive.unit); @@ -1444,10 +1444,10 @@ qemuBuildDriveDevStr(virDomainDiskDefPtr disk, _("unsupported disk bus '%s' with device setup"), bus); goto error; } - virBufferVSprintf(&opt, ",drive=%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias); - virBufferVSprintf(&opt, ",id=%s", disk->info.alias); + virBufferAsprintf(&opt, ",drive=%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias); + virBufferAsprintf(&opt, ",id=%s", disk->info.alias); if (disk->bootIndex && qemuCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX)) - virBufferVSprintf(&opt, ",bootindex=%d", disk->bootIndex); + virBufferAsprintf(&opt, ",bootindex=%d", disk->bootIndex); if (virBufferError(&opt)) { virReportOOMError(); @@ -1481,8 +1481,8 @@ char *qemuBuildFSStr(virDomainFSDefPtr fs, } else if(fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_SQUASH) { virBufferAddLit(&opt, ",security_model=none"); } - virBufferVSprintf(&opt, ",id=%s%s", QEMU_FSDEV_HOST_PREFIX, fs->info.alias); - virBufferVSprintf(&opt, ",path=%s", fs->src); + virBufferAsprintf(&opt, ",id=%s%s", QEMU_FSDEV_HOST_PREFIX, fs->info.alias); + virBufferAsprintf(&opt, ",path=%s", fs->src); if (virBufferError(&opt)) { virReportOOMError(); @@ -1510,9 +1510,9 @@ qemuBuildFSDevStr(virDomainFSDefPtr fs, } virBufferAddLit(&opt, "virtio-9p-pci"); - virBufferVSprintf(&opt, ",id=%s", fs->info.alias); - virBufferVSprintf(&opt, ",fsdev=%s%s", QEMU_FSDEV_HOST_PREFIX, fs->info.alias); - virBufferVSprintf(&opt, ",mount_tag=%s", fs->dst); + virBufferAsprintf(&opt, ",id=%s", fs->info.alias); + virBufferAsprintf(&opt, ",fsdev=%s%s", QEMU_FSDEV_HOST_PREFIX, fs->info.alias); + virBufferAsprintf(&opt, ",mount_tag=%s", fs->dst); qemuBuildDeviceAddressStr(&opt, &fs->info, qemuCaps); if (virBufferError(&opt)) { @@ -1537,7 +1537,7 @@ qemuBuildControllerDevStr(virDomainControllerDefPtr def, switch (def->type) { case VIR_DOMAIN_CONTROLLER_TYPE_SCSI: virBufferAddLit(&buf, "lsi"); - virBufferVSprintf(&buf, ",id=scsi%d", def->idx); + virBufferAsprintf(&buf, ",id=scsi%d", def->idx); break; case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL: @@ -1546,20 +1546,20 @@ qemuBuildControllerDevStr(virDomainControllerDefPtr def, } else { virBufferAddLit(&buf, "virtio-serial"); } - virBufferVSprintf(&buf, ",id=" QEMU_VIRTIO_SERIAL_PREFIX "%d", + virBufferAsprintf(&buf, ",id=" QEMU_VIRTIO_SERIAL_PREFIX "%d", def->idx); if (def->opts.vioserial.ports != -1) { - virBufferVSprintf(&buf, ",max_ports=%d", + virBufferAsprintf(&buf, ",max_ports=%d", def->opts.vioserial.ports); } if (def->opts.vioserial.vectors != -1) { - virBufferVSprintf(&buf, ",vectors=%d", + virBufferAsprintf(&buf, ",vectors=%d", def->opts.vioserial.vectors); } break; case VIR_DOMAIN_CONTROLLER_TYPE_CCID: - virBufferVSprintf(&buf, "usb-ccid,id=ccid%d", def->idx); + virBufferAsprintf(&buf, "usb-ccid,id=ccid%d", def->idx); break; /* We always get an IDE controller, whether we want it or not. */ @@ -1657,18 +1657,18 @@ qemuBuildNicDevStr(virDomainNetDefPtr net, } } if (vlan == -1) - virBufferVSprintf(&buf, ",netdev=host%s", net->info.alias); + virBufferAsprintf(&buf, ",netdev=host%s", net->info.alias); else - virBufferVSprintf(&buf, ",vlan=%d", vlan); - virBufferVSprintf(&buf, ",id=%s", net->info.alias); - virBufferVSprintf(&buf, ",mac=%02x:%02x:%02x:%02x:%02x:%02x", + virBufferAsprintf(&buf, ",vlan=%d", vlan); + virBufferAsprintf(&buf, ",id=%s", net->info.alias); + virBufferAsprintf(&buf, ",mac=%02x:%02x:%02x:%02x:%02x:%02x", net->mac[0], net->mac[1], net->mac[2], net->mac[3], net->mac[4], net->mac[5]); if (qemuBuildDeviceAddressStr(&buf, &net->info, qemuCaps) < 0) goto error; if (net->bootIndex && qemuCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX)) - virBufferVSprintf(&buf, ",bootindex=%d", net->bootIndex); + virBufferAsprintf(&buf, ",bootindex=%d", net->bootIndex); if (virBufferError(&buf)) { virReportOOMError(); @@ -1698,7 +1698,7 @@ qemuBuildHostNetStr(virDomainNetDefPtr net, case VIR_DOMAIN_NET_TYPE_BRIDGE: case VIR_DOMAIN_NET_TYPE_DIRECT: virBufferAddLit(&buf, "tap"); - virBufferVSprintf(&buf, "%cfd=%s", type_sep, tapfd); + virBufferAsprintf(&buf, "%cfd=%s", type_sep, tapfd); type_sep = ','; is_tap = true; break; @@ -1706,11 +1706,11 @@ qemuBuildHostNetStr(virDomainNetDefPtr net, case VIR_DOMAIN_NET_TYPE_ETHERNET: virBufferAddLit(&buf, "tap"); if (net->ifname) { - virBufferVSprintf(&buf, "%cifname=%s", type_sep, net->ifname); + virBufferAsprintf(&buf, "%cifname=%s", type_sep, net->ifname); type_sep = ','; } if (net->data.ethernet.script) { - virBufferVSprintf(&buf, "%cscript=%s", type_sep, + virBufferAsprintf(&buf, "%cscript=%s", type_sep, net->data.ethernet.script); type_sep = ','; } @@ -1723,19 +1723,19 @@ qemuBuildHostNetStr(virDomainNetDefPtr net, virBufferAddLit(&buf, "socket"); switch (net->type) { case VIR_DOMAIN_NET_TYPE_CLIENT: - virBufferVSprintf(&buf, "%cconnect=%s:%d", + virBufferAsprintf(&buf, "%cconnect=%s:%d", type_sep, net->data.socket.address, net->data.socket.port); break; case VIR_DOMAIN_NET_TYPE_SERVER: - virBufferVSprintf(&buf, "%clisten=%s:%d", + virBufferAsprintf(&buf, "%clisten=%s:%d", type_sep, net->data.socket.address, net->data.socket.port); break; case VIR_DOMAIN_NET_TYPE_MCAST: - virBufferVSprintf(&buf, "%cmcast=%s:%d", + virBufferAsprintf(&buf, "%cmcast=%s:%d", type_sep, net->data.socket.address, net->data.socket.port); @@ -1759,20 +1759,20 @@ qemuBuildHostNetStr(virDomainNetDefPtr net, } if (vlan >= 0) { - virBufferVSprintf(&buf, "%cvlan=%d", type_sep, vlan); + virBufferAsprintf(&buf, "%cvlan=%d", type_sep, vlan); if (net->info.alias) - virBufferVSprintf(&buf, ",name=host%s", + virBufferAsprintf(&buf, ",name=host%s", net->info.alias); } else { - virBufferVSprintf(&buf, "%cid=host%s", + virBufferAsprintf(&buf, "%cid=host%s", type_sep, net->info.alias); } if (is_tap) { if (vhostfd && *vhostfd) - virBufferVSprintf(&buf, ",vhost=on,vhostfd=%s", vhostfd); + virBufferAsprintf(&buf, ",vhost=on,vhostfd=%s", vhostfd); if (net->tune.sndbuf_specified) - virBufferVSprintf(&buf, ",sndbuf=%lu", net->tune.sndbuf); + virBufferAsprintf(&buf, ",sndbuf=%lu", net->tune.sndbuf); } if (virBufferError(&buf)) { @@ -1798,7 +1798,7 @@ qemuBuildWatchdogDevStr(virDomainWatchdogDefPtr dev, goto error; } - virBufferVSprintf(&buf, "%s,id=%s", model, dev->info.alias); + virBufferAsprintf(&buf, "%s,id=%s", model, dev->info.alias); if (qemuBuildDeviceAddressStr(&buf, &dev->info, qemuCaps) < 0) goto error; @@ -1822,7 +1822,7 @@ qemuBuildMemballoonDevStr(virDomainMemballoonDefPtr dev, virBuffer buf = VIR_BUFFER_INITIALIZER; virBufferAddLit(&buf, "virtio-balloon-pci"); - virBufferVSprintf(&buf, ",id=%s", dev->info.alias); + virBufferAsprintf(&buf, ",id=%s", dev->info.alias); if (qemuBuildDeviceAddressStr(&buf, &dev->info, qemuCaps) < 0) goto error; @@ -1844,7 +1844,7 @@ qemuBuildUSBInputDevStr(virDomainInputDefPtr dev) { virBuffer buf = VIR_BUFFER_INITIALIZER; - virBufferVSprintf(&buf, "%s,id=%s", + virBufferAsprintf(&buf, "%s,id=%s", dev->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ? "usb-mouse" : "usb-tablet", dev->info.alias); @@ -1882,7 +1882,7 @@ qemuBuildSoundDevStr(virDomainSoundDefPtr sound, else if (STREQ(model, "ich6")) model = "intel-hda"; - virBufferVSprintf(&buf, "%s,id=%s", model, sound->info.alias); + virBufferAsprintf(&buf, "%s,id=%s", model, sound->info.alias); if (qemuBuildDeviceAddressStr(&buf, &sound->info, qemuCaps) < 0) goto error; @@ -1905,7 +1905,7 @@ qemuBuildSoundCodecStr(virDomainSoundDefPtr sound, virBuffer buf = VIR_BUFFER_INITIALIZER; int cad = 0; - virBufferVSprintf(&buf, "%s,id=%s-codec%d,bus=%s.0,cad=%d", + virBufferAsprintf(&buf, "%s,id=%s-codec%d,bus=%s.0,cad=%d", codec, sound->info.alias, cad, sound->info.alias, cad); if (virBufferError(&buf)) { @@ -1933,7 +1933,7 @@ qemuBuildVideoDevStr(virDomainVideoDefPtr video, goto error; } - virBufferVSprintf(&buf, "%s,id=%s", model, video->info.alias); + virBufferAsprintf(&buf, "%s,id=%s", model, video->info.alias); if (video->type == VIR_DOMAIN_VIDEO_TYPE_QXL) { if (video->vram > (UINT_MAX / 1024)) { @@ -1944,7 +1944,7 @@ qemuBuildVideoDevStr(virDomainVideoDefPtr video, } /* QEMU accepts bytes for vram_size. */ - virBufferVSprintf(&buf, ",vram_size=%u", video->vram * 1024); + virBufferAsprintf(&buf, ",vram_size=%u", video->vram * 1024); } if (qemuBuildDeviceAddressStr(&buf, &video->info, qemuCaps) < 0) @@ -1995,15 +1995,15 @@ qemuBuildPCIHostdevDevStr(virDomainHostdevDefPtr dev, const char *configfd, virBuffer buf = VIR_BUFFER_INITIALIZER; virBufferAddLit(&buf, "pci-assign"); - virBufferVSprintf(&buf, ",host=%.2x:%.2x.%.1x", + virBufferAsprintf(&buf, ",host=%.2x:%.2x.%.1x", dev->source.subsys.u.pci.bus, dev->source.subsys.u.pci.slot, dev->source.subsys.u.pci.function); - virBufferVSprintf(&buf, ",id=%s", dev->info.alias); + virBufferAsprintf(&buf, ",id=%s", dev->info.alias); if (configfd && *configfd) - virBufferVSprintf(&buf, ",configfd=%s", configfd); + virBufferAsprintf(&buf, ",configfd=%s", configfd); if (dev->bootIndex) - virBufferVSprintf(&buf, ",bootindex=%d", dev->bootIndex); + virBufferAsprintf(&buf, ",bootindex=%d", dev->bootIndex); if (qemuBuildDeviceAddressStr(&buf, &dev->info, qemuCaps) < 0) goto error; @@ -2090,38 +2090,38 @@ qemuBuildChrChardevStr(virDomainChrSourceDefPtr dev, const char *alias, switch(dev->type) { case VIR_DOMAIN_CHR_TYPE_NULL: - virBufferVSprintf(&buf, "null,id=char%s", alias); + virBufferAsprintf(&buf, "null,id=char%s", alias); break; case VIR_DOMAIN_CHR_TYPE_VC: - virBufferVSprintf(&buf, "vc,id=char%s", alias); + virBufferAsprintf(&buf, "vc,id=char%s", alias); break; case VIR_DOMAIN_CHR_TYPE_PTY: - virBufferVSprintf(&buf, "pty,id=char%s", alias); + virBufferAsprintf(&buf, "pty,id=char%s", alias); break; case VIR_DOMAIN_CHR_TYPE_DEV: - virBufferVSprintf(&buf, "tty,id=char%s,path=%s", alias, + virBufferAsprintf(&buf, "tty,id=char%s,path=%s", alias, dev->data.file.path); break; case VIR_DOMAIN_CHR_TYPE_FILE: - virBufferVSprintf(&buf, "file,id=char%s,path=%s", alias, + virBufferAsprintf(&buf, "file,id=char%s,path=%s", alias, dev->data.file.path); break; case VIR_DOMAIN_CHR_TYPE_PIPE: - virBufferVSprintf(&buf, "pipe,id=char%s,path=%s", alias, + virBufferAsprintf(&buf, "pipe,id=char%s,path=%s", alias, dev->data.file.path); break; case VIR_DOMAIN_CHR_TYPE_STDIO: - virBufferVSprintf(&buf, "stdio,id=char%s", alias); + virBufferAsprintf(&buf, "stdio,id=char%s", alias); break; case VIR_DOMAIN_CHR_TYPE_UDP: - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, "udp,id=char%s,host=%s,port=%s,localaddr=%s," "localport=%s", alias, @@ -2133,7 +2133,7 @@ qemuBuildChrChardevStr(virDomainChrSourceDefPtr dev, const char *alias, case VIR_DOMAIN_CHR_TYPE_TCP: telnet = dev->data.tcp.protocol == VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET; - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, "socket,id=char%s,host=%s,port=%s%s%s", alias, dev->data.tcp.host, @@ -2143,7 +2143,7 @@ qemuBuildChrChardevStr(virDomainChrSourceDefPtr dev, const char *alias, break; case VIR_DOMAIN_CHR_TYPE_UNIX: - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, "socket,id=char%s,path=%s%s", alias, dev->data.nix.path, @@ -2156,7 +2156,7 @@ qemuBuildChrChardevStr(virDomainChrSourceDefPtr dev, const char *alias, _("spicevmc not supported in this QEMU binary")); goto error; } - virBufferVSprintf(&buf, "spicevmc,id=char%s,name=%s", alias, + virBufferAsprintf(&buf, "spicevmc,id=char%s,name=%s", alias, virDomainChrSpicevmcTypeToString(dev->data.spicevmc)); break; @@ -2206,11 +2206,11 @@ qemuBuildChrArgStr(virDomainChrSourceDefPtr dev, const char *prefix) break; case VIR_DOMAIN_CHR_TYPE_FILE: - virBufferVSprintf(&buf, "file:%s", dev->data.file.path); + virBufferAsprintf(&buf, "file:%s", dev->data.file.path); break; case VIR_DOMAIN_CHR_TYPE_PIPE: - virBufferVSprintf(&buf, "pipe:%s", dev->data.file.path); + virBufferAsprintf(&buf, "pipe:%s", dev->data.file.path); break; case VIR_DOMAIN_CHR_TYPE_STDIO: @@ -2218,7 +2218,7 @@ qemuBuildChrArgStr(virDomainChrSourceDefPtr dev, const char *prefix) break; case VIR_DOMAIN_CHR_TYPE_UDP: - virBufferVSprintf(&buf, "udp:%s:%s@%s:%s", + virBufferAsprintf(&buf, "udp:%s:%s@%s:%s", dev->data.udp.connectHost, dev->data.udp.connectService, dev->data.udp.bindHost, @@ -2227,12 +2227,12 @@ qemuBuildChrArgStr(virDomainChrSourceDefPtr dev, const char *prefix) case VIR_DOMAIN_CHR_TYPE_TCP: if (dev->data.tcp.protocol == VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET) { - virBufferVSprintf(&buf, "telnet:%s:%s%s", + virBufferAsprintf(&buf, "telnet:%s:%s%s", dev->data.tcp.host, dev->data.tcp.service, dev->data.tcp.listen ? ",server,nowait" : ""); } else { - virBufferVSprintf(&buf, "tcp:%s:%s%s", + virBufferAsprintf(&buf, "tcp:%s:%s%s", dev->data.tcp.host, dev->data.tcp.service, dev->data.tcp.listen ? ",server,nowait" : ""); @@ -2240,7 +2240,7 @@ qemuBuildChrArgStr(virDomainChrSourceDefPtr dev, const char *prefix) break; case VIR_DOMAIN_CHR_TYPE_UNIX: - virBufferVSprintf(&buf, "unix:%s%s", + virBufferAsprintf(&buf, "unix:%s%s", dev->data.nix.path, dev->data.nix.listen ? ",server,nowait" : ""); break; @@ -2282,11 +2282,11 @@ qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev, goto error; } - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, ",bus=" QEMU_VIRTIO_SERIAL_PREFIX "%d.%d", dev->info.addr.vioserial.controller, dev->info.addr.vioserial.bus); - virBufferVSprintf(&buf, + virBufferAsprintf(&buf, ",nr=%d", dev->info.addr.vioserial.port); } @@ -2301,12 +2301,12 @@ qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev, } if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC) && dev->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC) { - virBufferVSprintf(&buf, ",id=%s", dev->info.alias); + virBufferAsprintf(&buf, ",id=%s", dev->info.alias); } else { - virBufferVSprintf(&buf, ",chardev=char%s,id=%s", + virBufferAsprintf(&buf, ",chardev=char%s,id=%s", dev->info.alias, dev->info.alias); if (dev->target.name) { - virBufferVSprintf(&buf, ",name=%s", dev->target.name); + virBufferAsprintf(&buf, ",name=%s", dev->target.name); } } if (virBufferError(&buf)) { @@ -2333,16 +2333,16 @@ static char *qemuBuildSmbiosBiosStr(virSysinfoDefPtr def) /* 0:Vendor */ if (def->bios_vendor) - virBufferVSprintf(&buf, ",vendor=%s", def->bios_vendor); + virBufferAsprintf(&buf, ",vendor=%s", def->bios_vendor); /* 0:BIOS Version */ if (def->bios_version) - virBufferVSprintf(&buf, ",version=%s", def->bios_version); + virBufferAsprintf(&buf, ",version=%s", def->bios_version); /* 0:BIOS Release Date */ if (def->bios_date) - virBufferVSprintf(&buf, ",date=%s", def->bios_date); + virBufferAsprintf(&buf, ",date=%s", def->bios_date); /* 0:System BIOS Major Release and 0:System BIOS Minor Release */ if (def->bios_release) - virBufferVSprintf(&buf, ",release=%s", def->bios_release); + virBufferAsprintf(&buf, ",release=%s", def->bios_release); if (virBufferError(&buf)) { virReportOOMError(); @@ -2370,26 +2370,26 @@ static char *qemuBuildSmbiosSystemStr(virSysinfoDefPtr def, bool skip_uuid) /* 1:Manufacturer */ if (def->system_manufacturer) - virBufferVSprintf(&buf, ",manufacturer=%s", + virBufferAsprintf(&buf, ",manufacturer=%s", def->system_manufacturer); /* 1:Product Name */ if (def->system_product) - virBufferVSprintf(&buf, ",product=%s", def->system_product); + virBufferAsprintf(&buf, ",product=%s", def->system_product); /* 1:Version */ if (def->system_version) - virBufferVSprintf(&buf, ",version=%s", def->system_version); + virBufferAsprintf(&buf, ",version=%s", def->system_version); /* 1:Serial Number */ if (def->system_serial) - virBufferVSprintf(&buf, ",serial=%s", def->system_serial); + virBufferAsprintf(&buf, ",serial=%s", def->system_serial); /* 1:UUID */ if (def->system_uuid && !skip_uuid) - virBufferVSprintf(&buf, ",uuid=%s", def->system_uuid); + virBufferAsprintf(&buf, ",uuid=%s", def->system_uuid); /* 1:SKU Number */ if (def->system_sku) - virBufferVSprintf(&buf, ",sku=%s", def->system_sku); + virBufferAsprintf(&buf, ",sku=%s", def->system_sku); /* 1:Family */ if (def->system_family) - virBufferVSprintf(&buf, ",family=%s", def->system_family); + virBufferAsprintf(&buf, ",family=%s", def->system_family); if (virBufferError(&buf)) { virReportOOMError(); @@ -2425,7 +2425,7 @@ qemuBuildClockArgStr(virDomainClockDefPtr def) now += def->data.adjustment; gmtime_r(&now, &nowbits); - virBufferVSprintf(&buf, "base=%d-%02d-%02dT%02d:%02d:%02d", + virBufferAsprintf(&buf, "base=%d-%02d-%02dT%02d:%02d:%02d", nowbits.tm_year + 1900, nowbits.tm_mon + 1, nowbits.tm_mday, @@ -2574,7 +2574,7 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver, else sign = '+'; - virBufferVSprintf(&buf, ",%c%s", sign, guest->features[i].name); + virBufferAsprintf(&buf, ",%c%s", sign, guest->features[i].name); } } else { @@ -2628,22 +2628,22 @@ qemuBuildSmpArgStr(const virDomainDefPtr def, { virBuffer buf = VIR_BUFFER_INITIALIZER; - virBufferVSprintf(&buf, "%u", def->vcpus); + virBufferAsprintf(&buf, "%u", def->vcpus); if (qemuCapsGet(qemuCaps, QEMU_CAPS_SMP_TOPOLOGY)) { if (def->vcpus != def->maxvcpus) - virBufferVSprintf(&buf, ",maxcpus=%u", def->maxvcpus); + virBufferAsprintf(&buf, ",maxcpus=%u", def->maxvcpus); /* sockets, cores, and threads are either all zero * or all non-zero, thus checking one of them is enough */ if (def->cpu && def->cpu->sockets) { - virBufferVSprintf(&buf, ",sockets=%u", def->cpu->sockets); - virBufferVSprintf(&buf, ",cores=%u", def->cpu->cores); - virBufferVSprintf(&buf, ",threads=%u", def->cpu->threads); + virBufferAsprintf(&buf, ",sockets=%u", def->cpu->sockets); + virBufferAsprintf(&buf, ",cores=%u", def->cpu->cores); + virBufferAsprintf(&buf, ",threads=%u", def->cpu->threads); } else { - virBufferVSprintf(&buf, ",sockets=%u", def->maxvcpus); - virBufferVSprintf(&buf, ",cores=%u", 1); - virBufferVSprintf(&buf, ",threads=%u", 1); + virBufferAsprintf(&buf, ",sockets=%u", def->maxvcpus); + virBufferAsprintf(&buf, ",cores=%u", 1); + virBufferAsprintf(&buf, ",threads=%u", 1); } } else if (def->vcpus != def->maxvcpus) { virBufferFreeAndReset(&buf); @@ -3118,9 +3118,9 @@ qemuBuildCommandLine(virConnectPtr conn, if (qemuCapsGet(qemuCaps, QEMU_CAPS_BOOT_MENU) && def->os.bootmenu != VIR_DOMAIN_BOOT_MENU_DEFAULT) { if (def->os.bootmenu == VIR_DOMAIN_BOOT_MENU_ENABLED) - virBufferVSprintf(&boot_buf, "order=%s,menu=on", boot); + virBufferAsprintf(&boot_buf, "order=%s,menu=on", boot); else if (def->os.bootmenu == VIR_DOMAIN_BOOT_MENU_DISABLED) - virBufferVSprintf(&boot_buf, "order=%s,menu=off", boot); + virBufferAsprintf(&boot_buf, "order=%s,menu=off", boot); } else { virBufferAdd(&boot_buf, boot, -1); } @@ -3281,7 +3281,7 @@ qemuBuildCommandLine(virConnectPtr conn, } virDomainDiskHostDefPtr host = &disk->hosts[j]; if (host->port) { - virBufferVSprintf(&rbd_hosts, "%s:%s", + virBufferAsprintf(&rbd_hosts, "%s:%s", host->name, host->port); } else { @@ -3403,7 +3403,7 @@ qemuBuildCommandLine(virConnectPtr conn, } virDomainDiskHostDefPtr host = &disk->hosts[j]; if (host->port) { - virBufferVSprintf(&rbd_hosts, "%s:%s", + virBufferAsprintf(&rbd_hosts, "%s:%s", host->name, host->port); } else { @@ -3621,7 +3621,7 @@ qemuBuildCommandLine(virConnectPtr conn, smartcard->data.cert.file[j]); goto error; } - virBufferVSprintf(&opt, ",cert%d=%s", j + 1, + virBufferAsprintf(&opt, ",cert%d=%s", j + 1, smartcard->data.cert.file[j]); } if (smartcard->data.cert.database) { @@ -3636,7 +3636,7 @@ qemuBuildCommandLine(virConnectPtr conn, } else { database = VIR_DOMAIN_SMARTCARD_DEFAULT_DATABASE; } - virBufferVSprintf(&opt, ",database=%s", database); + virBufferAsprintf(&opt, ",database=%s", database); break; case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH: @@ -3658,7 +3658,7 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, devstr); VIR_FREE(devstr); - virBufferVSprintf(&opt, "ccid-card-passthru,chardev=char%s", + virBufferAsprintf(&opt, "ccid-card-passthru,chardev=char%s", smartcard->info.alias); break; @@ -3670,7 +3670,7 @@ qemuBuildCommandLine(virConnectPtr conn, goto error; } virCommandAddArg(cmd, "-device"); - virBufferVSprintf(&opt, ",id=%s,bus=ccid0.0", smartcard->info.alias); + virBufferAsprintf(&opt, ",id=%s,bus=ccid0.0", smartcard->info.alias); virCommandAddArgBuffer(cmd, &opt); } @@ -3889,7 +3889,7 @@ qemuBuildCommandLine(virConnectPtr conn, goto no_memory; } - virBufferVSprintf(&opt, "unix:%s", + virBufferAsprintf(&opt, "unix:%s", def->graphics[0]->data.vnc.socket); } else if (qemuCapsGet(qemuCaps, QEMU_CAPS_VNC_COLON)) { @@ -3898,11 +3898,11 @@ qemuBuildCommandLine(virConnectPtr conn, else if (driver->vncListen) virBufferAdd(&opt, driver->vncListen, -1); - virBufferVSprintf(&opt, ":%d", + virBufferAsprintf(&opt, ":%d", def->graphics[0]->data.vnc.port - 5900); } else { - virBufferVSprintf(&opt, "%d", + virBufferAsprintf(&opt, "%d", def->graphics[0]->data.vnc.port - 5900); } @@ -3914,10 +3914,10 @@ qemuBuildCommandLine(virConnectPtr conn, if (driver->vncTLS) { virBufferAddLit(&opt, ",tls"); if (driver->vncTLSx509verify) { - virBufferVSprintf(&opt, ",x509verify=%s", + virBufferAsprintf(&opt, ",x509verify=%s", driver->vncTLSx509certdir); } else { - virBufferVSprintf(&opt, ",x509=%s", + virBufferAsprintf(&opt, ",x509=%s", driver->vncTLSx509certdir); } } @@ -3991,15 +3991,15 @@ qemuBuildCommandLine(virConnectPtr conn, goto error; } - virBufferVSprintf(&opt, "port=%u", def->graphics[0]->data.spice.port); + virBufferAsprintf(&opt, "port=%u", def->graphics[0]->data.spice.port); if (driver->spiceTLS && def->graphics[0]->data.spice.tlsPort != -1) - virBufferVSprintf(&opt, ",tls-port=%u", def->graphics[0]->data.spice.tlsPort); + virBufferAsprintf(&opt, ",tls-port=%u", def->graphics[0]->data.spice.tlsPort); if (def->graphics[0]->data.spice.listenAddr) - virBufferVSprintf(&opt, ",addr=%s", def->graphics[0]->data.spice.listenAddr); + virBufferAsprintf(&opt, ",addr=%s", def->graphics[0]->data.spice.listenAddr); else if (driver->spiceListen) - virBufferVSprintf(&opt, ",addr=%s", driver->spiceListen); + virBufferAsprintf(&opt, ",addr=%s", driver->spiceListen); /* In the password case we set it via monitor command, to avoid * making it visible on CLI, so there's no use of password=XXX @@ -4009,33 +4009,33 @@ qemuBuildCommandLine(virConnectPtr conn, virBufferAddLit(&opt, ",disable-ticketing"); if (driver->spiceTLS) - virBufferVSprintf(&opt, ",x509-dir=%s", + virBufferAsprintf(&opt, ",x509-dir=%s", driver->spiceTLSx509certdir); for (i = 0 ; i < VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST ; i++) { int mode = def->graphics[0]->data.spice.channels[i]; switch (mode) { case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE: - virBufferVSprintf(&opt, ",tls-channel=%s", + virBufferAsprintf(&opt, ",tls-channel=%s", virDomainGraphicsSpiceChannelNameTypeToString(i)); break; case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE: - virBufferVSprintf(&opt, ",plaintext-channel=%s", + virBufferAsprintf(&opt, ",plaintext-channel=%s", virDomainGraphicsSpiceChannelNameTypeToString(i)); break; } } if (def->graphics[0]->data.spice.image) - virBufferVSprintf(&opt, ",image-compression=%s", + virBufferAsprintf(&opt, ",image-compression=%s", virDomainGraphicsSpiceImageCompressionTypeToString(def->graphics[0]->data.spice.image)); if (def->graphics[0]->data.spice.jpeg) - virBufferVSprintf(&opt, ",jpeg-wan-compression=%s", + virBufferAsprintf(&opt, ",jpeg-wan-compression=%s", virDomainGraphicsSpiceJpegCompressionTypeToString(def->graphics[0]->data.spice.jpeg)); if (def->graphics[0]->data.spice.zlib) - virBufferVSprintf(&opt, ",zlib-glz-wan-compression=%s", + virBufferAsprintf(&opt, ",zlib-glz-wan-compression=%s", virDomainGraphicsSpiceZlibCompressionTypeToString(def->graphics[0]->data.spice.zlib)); if (def->graphics[0]->data.spice.playback) - virBufferVSprintf(&opt, ",playback-compression=%s", + virBufferAsprintf(&opt, ",playback-compression=%s", virDomainGraphicsSpicePlaybackCompressionTypeToString(def->graphics[0]->data.spice.playback)); virCommandAddArg(cmd, "-spice"); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index a947b4e..3be9078 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -146,7 +146,7 @@ static int qemuDomainObjPrivateXMLFormat(virBufferPtr buf, void *data) virBufferEscapeString(buf, " <monitor path='%s'", monitorpath); if (priv->monJSON) virBufferAddLit(buf, " json='1'"); - virBufferVSprintf(buf, " type='%s'/>\n", + virBufferAsprintf(buf, " type='%s'/>\n", virDomainChrTypeToString(priv->monConfig->type)); } @@ -155,7 +155,7 @@ static int qemuDomainObjPrivateXMLFormat(virBufferPtr buf, void *data) int i; virBufferAddLit(buf, " <vcpus>\n"); for (i = 0 ; i < priv->nvcpupids ; i++) { - virBufferVSprintf(buf, " <vcpu pid='%d'/>\n", priv->vcpupids[i]); + virBufferAsprintf(buf, " <vcpu pid='%d'/>\n", priv->vcpupids[i]); } virBufferAddLit(buf, " </vcpus>\n"); } @@ -395,7 +395,7 @@ qemuDomainDefNamespaceFormatXML(virBufferPtr buf, virBufferEscapeString(buf, " <qemu:arg value='%s'/>\n", cmd->args[i]); for (i = 0; i < cmd->num_env; i++) { - virBufferVSprintf(buf, " <qemu:env name='%s'", cmd->env_name[i]); + virBufferAsprintf(buf, " <qemu:env name='%s'", cmd->env_name[i]); if (cmd->env_value[i]) virBufferEscapeString(buf, " value='%s'", cmd->env_value[i]); virBufferAddLit(buf, "/>\n"); diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 2d28f8d..f89038e 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -184,9 +184,9 @@ static char * qemuMonitorEscapeNonPrintable(const char *text) if (c_isprint(text[i]) || text[i] == '\n' || (text[i] == '\r' && text[i+1] == '\n')) - virBufferVSprintf(&buf,"%c", text[i]); + virBufferAsprintf(&buf,"%c", text[i]); else - virBufferVSprintf(&buf, "0x%02x", text[i]); + virBufferAsprintf(&buf, "0x%02x", text[i]); } return virBufferContentAndReset(&buf); } diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index 08ff53c..a4e8549 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -827,10 +827,10 @@ vah_add_file(virBufferPtr buf, const char *path, const char *perms) goto clean; } - virBufferVSprintf(buf, " \"%s\" %s,\n", tmp, perms); + virBufferAsprintf(buf, " \"%s\" %s,\n", tmp, perms); if (readonly) { - virBufferVSprintf(buf, " # don't audit writes to readonly files\n"); - virBufferVSprintf(buf, " deny \"%s\" w,\n", tmp); + virBufferAsprintf(buf, " # don't audit writes to readonly files\n"); + virBufferAsprintf(buf, " deny \"%s\" w,\n", tmp); } clean: @@ -1197,11 +1197,11 @@ main(int argc, char **argv) if (vah_add_file(&buf, ctl->newfile, "rw") != 0) goto clean; } else { - virBufferVSprintf(&buf, " \"%s/log/libvirt/**/%s.log\" w,\n", + virBufferAsprintf(&buf, " \"%s/log/libvirt/**/%s.log\" w,\n", LOCALSTATEDIR, ctl->def->name); - virBufferVSprintf(&buf, " \"%s/lib/libvirt/**/%s.monitor\" rw,\n", + virBufferAsprintf(&buf, " \"%s/lib/libvirt/**/%s.monitor\" rw,\n", LOCALSTATEDIR, ctl->def->name); - virBufferVSprintf(&buf, " \"%s/run/libvirt/**/%s.pid\" rwk,\n", + virBufferAsprintf(&buf, " \"%s/run/libvirt/**/%s.pid\" rwk,\n", LOCALSTATEDIR, ctl->def->name); if (ctl->files) virBufferAdd(&buf, ctl->files, -1); diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c index 7c8fb16..84b74f3 100644 --- a/src/uml/uml_conf.c +++ b/src/uml/uml_conf.c @@ -197,7 +197,7 @@ umlBuildCommandLineNet(virConnectPtr conn, /* General format: ethNN=type,options */ - virBufferVSprintf(&buf, "eth%d=", idx); + virBufferAsprintf(&buf, "eth%d=", idx); switch (def->type) { case VIR_DOMAIN_NET_TYPE_USER: @@ -258,7 +258,7 @@ umlBuildCommandLineNet(virConnectPtr conn, } /* ethNNN=tuntap,tapname,macaddr,gateway */ - virBufferVSprintf(&buf, "tuntap,%s", def->ifname); + virBufferAsprintf(&buf, "tuntap,%s", def->ifname); break; } @@ -267,7 +267,7 @@ umlBuildCommandLineNet(virConnectPtr conn, goto error; /* ethNNN=tuntap,tapname,macaddr,gateway */ - virBufferVSprintf(&buf, "tuntap,%s", def->ifname); + virBufferAsprintf(&buf, "tuntap,%s", def->ifname); break; case VIR_DOMAIN_NET_TYPE_INTERNAL: @@ -284,12 +284,12 @@ umlBuildCommandLineNet(virConnectPtr conn, break; } - virBufferVSprintf(&buf, ",%02x:%02x:%02x:%02x:%02x:%02x", + virBufferAsprintf(&buf, ",%02x:%02x:%02x:%02x:%02x:%02x", def->mac[0], def->mac[1], def->mac[2], def->mac[3], def->mac[4], def->mac[5]); if (def->type == VIR_DOMAIN_NET_TYPE_MCAST) { - virBufferVSprintf(&buf, ",%s,%d", + virBufferAsprintf(&buf, ",%s,%d", def->data.socket.address, def->data.socket.port); } diff --git a/src/util/bitmap.c b/src/util/bitmap.c index 2edb2db..8c326c4 100644 --- a/src/util/bitmap.c +++ b/src/util/bitmap.c @@ -168,7 +168,7 @@ char *virBitmapString(virBitmapPtr bitmap) VIR_BITMAP_BITS_PER_UNIT; while (sz--) { - virBufferVSprintf(&buf, "%0*lx", + virBufferAsprintf(&buf, "%0*lx", VIR_BITMAP_BITS_PER_UNIT / 4, bitmap->map[sz]); } diff --git a/src/util/buf.c b/src/util/buf.c index a3cc063..7814e8e 100644 --- a/src/util/buf.c +++ b/src/util/buf.c @@ -213,7 +213,7 @@ virBufferUse(const virBufferPtr buf) } /** - * virBufferVSprintf: + * virBufferAsprintf: * @buf: the buffer to dump * @format: the format * @...: the variable list of arguments @@ -221,7 +221,7 @@ virBufferUse(const virBufferPtr buf) * Do a formatted print to an XML buffer. */ void -virBufferVSprintf(const virBufferPtr buf, const char *format, ...) +virBufferAsprintf(const virBufferPtr buf, const char *format, ...) { int size, count, grow_size; va_list argptr; @@ -294,7 +294,7 @@ virBufferEscapeString(const virBufferPtr buf, const char *format, const char *st len = strlen(str); if (strcspn(str, "<>&'\"") == len) { - virBufferVSprintf(buf, format, str); + virBufferAsprintf(buf, format, str); return; } @@ -350,7 +350,7 @@ virBufferEscapeString(const virBufferPtr buf, const char *format, const char *st } *out = 0; - virBufferVSprintf(buf, format, escaped); + virBufferAsprintf(buf, format, escaped); VIR_FREE(escaped); } @@ -381,7 +381,7 @@ virBufferEscapeSexpr(const virBufferPtr buf, len = strlen(str); if (strcspn(str, "\\'") == len) { - virBufferVSprintf(buf, format, str); + virBufferAsprintf(buf, format, str); return; } @@ -405,7 +405,7 @@ virBufferEscapeSexpr(const virBufferPtr buf, } *out = 0; - virBufferVSprintf(buf, format, escaped); + virBufferAsprintf(buf, format, escaped); VIR_FREE(escaped); } diff --git a/src/util/buf.h b/src/util/buf.h index 54f4de5..00f2043 100644 --- a/src/util/buf.h +++ b/src/util/buf.h @@ -40,7 +40,7 @@ int virBufferError(const virBufferPtr buf); unsigned int virBufferUse(const virBufferPtr buf); void virBufferAdd(const virBufferPtr buf, const char *str, int len); void virBufferAddChar(const virBufferPtr buf, char c); -void virBufferVSprintf(const virBufferPtr buf, const char *format, ...) +void virBufferAsprintf(const virBufferPtr buf, const char *format, ...) ATTRIBUTE_FMT_PRINTF(2, 3); void virBufferStrcat(const virBufferPtr buf, ...) ATTRIBUTE_SENTINEL; diff --git a/src/util/conf.c b/src/util/conf.c index 4b8afb8..377f9cd 100644 --- a/src/util/conf.c +++ b/src/util/conf.c @@ -260,17 +260,17 @@ virConfSaveValue(virBufferPtr buf, virConfValuePtr val) case VIR_CONF_NONE: return(-1); case VIR_CONF_LONG: - virBufferVSprintf(buf, "%ld", val->l); + virBufferAsprintf(buf, "%ld", val->l); break; case VIR_CONF_STRING: if (strchr(val->str, '\n') != NULL) { - virBufferVSprintf(buf, "\"\"\"%s\"\"\"", val->str); + virBufferAsprintf(buf, "\"\"\"%s\"\"\"", val->str); } else if (strchr(val->str, '"') == NULL) { - virBufferVSprintf(buf, "\"%s\"", val->str); + virBufferAsprintf(buf, "\"%s\"", val->str); } else if (strchr(val->str, '\'') == NULL) { - virBufferVSprintf(buf, "'%s'", val->str); + virBufferAsprintf(buf, "'%s'", val->str); } else { - virBufferVSprintf(buf, "\"\"\"%s\"\"\"", val->str); + virBufferAsprintf(buf, "\"\"\"%s\"\"\"", val->str); } break; case VIR_CONF_LIST: { diff --git a/src/util/logging.c b/src/util/logging.c index bb3ba13..90d5a99 100644 --- a/src/util/logging.c +++ b/src/util/logging.c @@ -1089,7 +1089,7 @@ char *virLogGetFilters(void) { virLogLock(); for (i = 0; i < virLogNbFilters; i++) { - virBufferVSprintf(&filterbuf, "%d:%s ", virLogFilters[i].priority, + virBufferAsprintf(&filterbuf, "%d:%s ", virLogFilters[i].priority, virLogFilters[i].match); } virLogUnlock(); @@ -1117,17 +1117,17 @@ char *virLogGetOutputs(void) { for (i = 0; i < virLogNbOutputs; i++) { int dest = virLogOutputs[i].dest; if (i) - virBufferVSprintf(&outputbuf, " "); + virBufferAsprintf(&outputbuf, " "); switch (dest) { case VIR_LOG_TO_SYSLOG: case VIR_LOG_TO_FILE: - virBufferVSprintf(&outputbuf, "%d:%s:%s", + virBufferAsprintf(&outputbuf, "%d:%s:%s", virLogOutputs[i].priority, virLogOutputString(dest), virLogOutputs[i].name); break; default: - virBufferVSprintf(&outputbuf, "%d:%s", + virBufferAsprintf(&outputbuf, "%d:%s", virLogOutputs[i].priority, virLogOutputString(dest)); } diff --git a/src/util/sexpr.c b/src/util/sexpr.c index d6668f8..d8d4c2d 100644 --- a/src/util/sexpr.c +++ b/src/util/sexpr.c @@ -232,7 +232,7 @@ sexpr2string(const struct sexpr *sexpr, virBufferPtr buffer) if (strchr(sexpr->u.value, ' ') || strchr(sexpr->u.value, ')') || strchr(sexpr->u.value, '(')) - virBufferVSprintf(buffer, "'%s'", sexpr->u.value); + virBufferAsprintf(buffer, "'%s'", sexpr->u.value); else virBufferAdd(buffer, sexpr->u.value, -1); diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c index a865d25..d929073 100644 --- a/src/util/sysinfo.c +++ b/src/util/sysinfo.c @@ -241,10 +241,10 @@ virSysinfoFormat(virSysinfoDefPtr def, const char *prefix) return NULL; } - virBufferVSprintf(&buf, "%s<sysinfo type='%s'>\n", prefix, type); + virBufferAsprintf(&buf, "%s<sysinfo type='%s'>\n", prefix, type); if ((def->bios_vendor != NULL) || (def->bios_version != NULL) || (def->bios_date != NULL) || (def->bios_release != NULL)) { - virBufferVSprintf(&buf, "%s <bios>\n", prefix); + virBufferAsprintf(&buf, "%s <bios>\n", prefix); if (def->bios_vendor != NULL) { virBufferAdd(&buf, prefix, len); virBufferEscapeString(&buf, @@ -269,13 +269,13 @@ virSysinfoFormat(virSysinfoDefPtr def, const char *prefix) " <entry name='release'>%s</entry>\n", def->bios_release); } - virBufferVSprintf(&buf, "%s </bios>\n", prefix); + virBufferAsprintf(&buf, "%s </bios>\n", prefix); } if ((def->system_manufacturer != NULL) || (def->system_product != NULL) || (def->system_version != NULL) || (def->system_serial != NULL) || (def->system_uuid != NULL) || (def->system_sku != NULL) || (def->system_family != NULL)) { - virBufferVSprintf(&buf, "%s <system>\n", prefix); + virBufferAsprintf(&buf, "%s <system>\n", prefix); if (def->system_manufacturer != NULL) { virBufferAdd(&buf, prefix, len); virBufferEscapeString(&buf, @@ -318,10 +318,10 @@ virSysinfoFormat(virSysinfoDefPtr def, const char *prefix) " <entry name='family'>%s</entry>\n", def->system_family); } - virBufferVSprintf(&buf, "%s </system>\n", prefix); + virBufferAsprintf(&buf, "%s </system>\n", prefix); } - virBufferVSprintf(&buf, "%s</sysinfo>\n", prefix); + virBufferAsprintf(&buf, "%s</sysinfo>\n", prefix); return virBufferContentAndReset(&buf); } diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index aee2d80..7758314 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -2892,7 +2892,7 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, virBufferAddLit(&buffer, "config.version = \"8\"\n"); /* vmx:virtualHW.version */ - virBufferVSprintf(&buffer, "virtualHW.version = \"%d\"\n", + virBufferAsprintf(&buffer, "virtualHW.version = \"%d\"\n", virtualHW_version); /* def:os.arch -> vmx:guestOS */ @@ -2924,7 +2924,7 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, if (memcmp(def->uuid, zero, VIR_UUID_BUFLEN) == 0) { virBufferAddLit(&buffer, "uuid.action = \"create\"\n"); } else { - virBufferVSprintf(&buffer, "uuid.bios = \"%02x %02x %02x %02x %02x %02x " + virBufferAsprintf(&buffer, "uuid.bios = \"%02x %02x %02x %02x %02x %02x " "%02x %02x-%02x %02x %02x %02x %02x %02x %02x %02x\"\n", def->uuid[0], def->uuid[1], def->uuid[2], def->uuid[3], def->uuid[4], def->uuid[5], def->uuid[6], def->uuid[7], @@ -2946,32 +2946,32 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, goto cleanup; } - virBufferVSprintf(&buffer, "displayName = \"%s\"\n", displayName); + virBufferAsprintf(&buffer, "displayName = \"%s\"\n", displayName); /* def:description -> vmx:annotation */ if (def->description != NULL) { annotation = virVMXEscapeHexPipe(def->description); - virBufferVSprintf(&buffer, "annotation = \"%s\"\n", annotation); + virBufferAsprintf(&buffer, "annotation = \"%s\"\n", annotation); } /* def:mem.max_balloon -> vmx:memsize */ /* max-memory must be a multiple of 4096 kilobyte */ max_balloon = VIR_DIV_UP(def->mem.max_balloon, 4096) * 4096; - virBufferVSprintf(&buffer, "memsize = \"%lu\"\n", + virBufferAsprintf(&buffer, "memsize = \"%lu\"\n", max_balloon / 1024); /* Scale from kilobytes to megabytes */ /* def:mem.cur_balloon -> vmx:sched.mem.max */ if (def->mem.cur_balloon < max_balloon) { - virBufferVSprintf(&buffer, "sched.mem.max = \"%lu\"\n", + virBufferAsprintf(&buffer, "sched.mem.max = \"%lu\"\n", VIR_DIV_UP(def->mem.cur_balloon, 1024)); /* Scale from kilobytes to megabytes */ } /* def:mem.min_guarantee -> vmx:sched.mem.minsize */ if (def->mem.min_guarantee > 0) { - virBufferVSprintf(&buffer, "sched.mem.minsize = \"%lu\"\n", + virBufferAsprintf(&buffer, "sched.mem.minsize = \"%lu\"\n", VIR_DIV_UP(def->mem.min_guarantee, 1024)); /* Scale from kilobytes to megabytes */ } @@ -2991,7 +2991,7 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, goto cleanup; } - virBufferVSprintf(&buffer, "numvcpus = \"%d\"\n", def->maxvcpus); + virBufferAsprintf(&buffer, "numvcpus = \"%d\"\n", def->maxvcpus); /* def:cpumask -> vmx:sched.cpu.affinity */ if (def->cpumasklen > 0) { @@ -3015,7 +3015,7 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, for (i = 0; i < def->cpumasklen; ++i) { if (def->cpumask[i]) { - virBufferVSprintf(&buffer, "%d", i); + virBufferAsprintf(&buffer, "%d", i); if (sched_cpu_affinity_length > 1) { virBufferAddChar(&buffer, ','); @@ -3038,7 +3038,7 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, } else if (def->cputune.shares == def->vcpus * 2000) { virBufferAddLit(&buffer, "sched.cpu.shares = \"high\"\n"); } else { - virBufferVSprintf(&buffer, "sched.cpu.shares = \"%lu\"\n", + virBufferAsprintf(&buffer, "sched.cpu.shares = \"%lu\"\n", def->cputune.shares); } } @@ -3076,10 +3076,10 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, for (i = 0; i < 4; ++i) { if (scsi_present[i]) { - virBufferVSprintf(&buffer, "scsi%d.present = \"true\"\n", i); + virBufferAsprintf(&buffer, "scsi%d.present = \"true\"\n", i); if (scsi_virtualDev[i] != -1) { - virBufferVSprintf(&buffer, "scsi%d.virtualDev = \"%s\"\n", i, + virBufferAsprintf(&buffer, "scsi%d.virtualDev = \"%s\"\n", i, virVMXSCSIControllerModelTypeToString (scsi_virtualDev[i])); } @@ -3121,7 +3121,7 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, for (i = 0; i < 2; ++i) { /* floppy[0..1].present defaults to true, disable it explicitly */ if (! floppy_present[i]) { - virBufferVSprintf(&buffer, "floppy%d.present = \"false\"\n", i); + virBufferAsprintf(&buffer, "floppy%d.present = \"false\"\n", i); } } @@ -3201,7 +3201,7 @@ virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer) return -1; } - virBufferVSprintf(buffer, "RemoteDisplay.vnc.enabled = \"true\"\n"); + virBufferAsprintf(buffer, "RemoteDisplay.vnc.enabled = \"true\"\n"); if (def->data.vnc.autoport) { VIR_WARN0("VNC autoport is enabled, but the automatically assigned " @@ -3212,22 +3212,22 @@ virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer) def->data.vnc.port); } - virBufferVSprintf(buffer, "RemoteDisplay.vnc.port = \"%d\"\n", + virBufferAsprintf(buffer, "RemoteDisplay.vnc.port = \"%d\"\n", def->data.vnc.port); } if (def->data.vnc.listenAddr != NULL) { - virBufferVSprintf(buffer, "RemoteDisplay.vnc.ip = \"%s\"\n", + virBufferAsprintf(buffer, "RemoteDisplay.vnc.ip = \"%s\"\n", def->data.vnc.listenAddr); } if (def->data.vnc.keymap != NULL) { - virBufferVSprintf(buffer, "RemoteDisplay.vnc.keymap = \"%s\"\n", + virBufferAsprintf(buffer, "RemoteDisplay.vnc.keymap = \"%s\"\n", def->data.vnc.keymap); } if (def->data.vnc.auth.passwd != NULL) { - virBufferVSprintf(buffer, "RemoteDisplay.vnc.password = \"%s\"\n", + virBufferAsprintf(buffer, "RemoteDisplay.vnc.password = \"%s\"\n", def->data.vnc.auth.passwd); } @@ -3284,9 +3284,9 @@ virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def, return -1; } - virBufferVSprintf(buffer, "%s%d:%d.present = \"true\"\n", + virBufferAsprintf(buffer, "%s%d:%d.present = \"true\"\n", entryPrefix, controllerOrBus, unit); - virBufferVSprintf(buffer, "%s%d:%d.deviceType = \"%s-hardDisk\"\n", + virBufferAsprintf(buffer, "%s%d:%d.deviceType = \"%s-hardDisk\"\n", entryPrefix, controllerOrBus, unit, deviceTypePrefix); if (def->src != NULL) { @@ -3303,7 +3303,7 @@ virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def, return -1; } - virBufferVSprintf(buffer, "%s%d:%d.fileName = \"%s\"\n", + virBufferAsprintf(buffer, "%s%d:%d.fileName = \"%s\"\n", entryPrefix, controllerOrBus, unit, fileName); VIR_FREE(fileName); @@ -3311,7 +3311,7 @@ virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def, if (def->bus == VIR_DOMAIN_DISK_BUS_SCSI) { if (def->cachemode == VIR_DOMAIN_DISK_CACHE_WRITETHRU) { - virBufferVSprintf(buffer, "%s%d:%d.writeThrough = \"true\"\n", + virBufferAsprintf(buffer, "%s%d:%d.writeThrough = \"true\"\n", entryPrefix, controllerOrBus, unit); } else if (def->cachemode != VIR_DOMAIN_DISK_CACHE_DEFAULT) { VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, @@ -3364,11 +3364,11 @@ virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def, return -1; } - virBufferVSprintf(buffer, "%s%d:%d.present = \"true\"\n", + virBufferAsprintf(buffer, "%s%d:%d.present = \"true\"\n", entryPrefix, controllerOrBus, unit); if (def->type == VIR_DOMAIN_DISK_TYPE_FILE) { - virBufferVSprintf(buffer, "%s%d:%d.deviceType = \"cdrom-image\"\n", + virBufferAsprintf(buffer, "%s%d:%d.deviceType = \"cdrom-image\"\n", entryPrefix, controllerOrBus, unit); if (def->src != NULL) { @@ -3385,17 +3385,17 @@ virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def, return -1; } - virBufferVSprintf(buffer, "%s%d:%d.fileName = \"%s\"\n", + virBufferAsprintf(buffer, "%s%d:%d.fileName = \"%s\"\n", entryPrefix, controllerOrBus, unit, fileName); VIR_FREE(fileName); } } else if (def->type == VIR_DOMAIN_DISK_TYPE_BLOCK) { - virBufferVSprintf(buffer, "%s%d:%d.deviceType = \"atapi-cdrom\"\n", + virBufferAsprintf(buffer, "%s%d:%d.deviceType = \"atapi-cdrom\"\n", entryPrefix, controllerOrBus, unit); if (def->src != NULL) { - virBufferVSprintf(buffer, "%s%d:%d.fileName = \"%s\"\n", + virBufferAsprintf(buffer, "%s%d:%d.fileName = \"%s\"\n", entryPrefix, controllerOrBus, unit, def->src); } } else { @@ -3431,10 +3431,10 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def, floppy_present[unit] = true; - virBufferVSprintf(buffer, "floppy%d.present = \"true\"\n", unit); + virBufferAsprintf(buffer, "floppy%d.present = \"true\"\n", unit); if (def->type == VIR_DOMAIN_DISK_TYPE_FILE) { - virBufferVSprintf(buffer, "floppy%d.fileType = \"file\"\n", unit); + virBufferAsprintf(buffer, "floppy%d.fileType = \"file\"\n", unit); if (def->src != NULL) { if (! virFileHasSuffix(def->src, ".flp")) { @@ -3450,16 +3450,16 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def, return -1; } - virBufferVSprintf(buffer, "floppy%d.fileName = \"%s\"\n", + virBufferAsprintf(buffer, "floppy%d.fileName = \"%s\"\n", unit, fileName); VIR_FREE(fileName); } } else if (def->type == VIR_DOMAIN_DISK_TYPE_BLOCK) { - virBufferVSprintf(buffer, "floppy%d.fileType = \"device\"\n", unit); + virBufferAsprintf(buffer, "floppy%d.fileType = \"device\"\n", unit); if (def->src != NULL) { - virBufferVSprintf(buffer, "floppy%d.fileName = \"%s\"\n", + virBufferAsprintf(buffer, "floppy%d.fileName = \"%s\"\n", unit, def->src); } } else { @@ -3491,7 +3491,7 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int controller, return -1; } - virBufferVSprintf(buffer, "ethernet%d.present = \"true\"\n", controller); + virBufferAsprintf(buffer, "ethernet%d.present = \"true\"\n", controller); /* def:model -> vmx:virtualDev, vmx:features */ if (def->model != NULL) { @@ -3508,12 +3508,12 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int controller, } if (STRCASEEQ(def->model, "vmxnet2")) { - virBufferVSprintf(buffer, "ethernet%d.virtualDev = \"vmxnet\"\n", + virBufferAsprintf(buffer, "ethernet%d.virtualDev = \"vmxnet\"\n", controller); - virBufferVSprintf(buffer, "ethernet%d.features = \"15\"\n", + virBufferAsprintf(buffer, "ethernet%d.features = \"15\"\n", controller); } else { - virBufferVSprintf(buffer, "ethernet%d.virtualDev = \"%s\"\n", + virBufferAsprintf(buffer, "ethernet%d.virtualDev = \"%s\"\n", controller, def->model); } } @@ -3521,16 +3521,16 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int controller, /* def:type, def:ifname -> vmx:connectionType */ switch (def->type) { case VIR_DOMAIN_NET_TYPE_BRIDGE: - virBufferVSprintf(buffer, "ethernet%d.networkName = \"%s\"\n", + virBufferAsprintf(buffer, "ethernet%d.networkName = \"%s\"\n", controller, def->data.bridge.brname); if (def->ifname != NULL) { - virBufferVSprintf(buffer, "ethernet%d.connectionType = \"custom\"\n", + virBufferAsprintf(buffer, "ethernet%d.connectionType = \"custom\"\n", controller); - virBufferVSprintf(buffer, "ethernet%d.vnet = \"%s\"\n", + virBufferAsprintf(buffer, "ethernet%d.vnet = \"%s\"\n", controller, def->ifname); } else { - virBufferVSprintf(buffer, "ethernet%d.connectionType = \"bridged\"\n", + virBufferAsprintf(buffer, "ethernet%d.connectionType = \"bridged\"\n", controller); } @@ -3549,28 +3549,28 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int controller, suffix = (def->mac[3] << 16) | (def->mac[4] << 8) | def->mac[5]; if (prefix == 0x000c29) { - virBufferVSprintf(buffer, "ethernet%d.addressType = \"generated\"\n", + virBufferAsprintf(buffer, "ethernet%d.addressType = \"generated\"\n", controller); - virBufferVSprintf(buffer, "ethernet%d.generatedAddress = \"%s\"\n", + virBufferAsprintf(buffer, "ethernet%d.generatedAddress = \"%s\"\n", controller, mac_string); - virBufferVSprintf(buffer, "ethernet%d.generatedAddressOffset = \"0\"\n", + virBufferAsprintf(buffer, "ethernet%d.generatedAddressOffset = \"0\"\n", controller); } else if (prefix == 0x005056 && suffix <= 0x3fffff) { - virBufferVSprintf(buffer, "ethernet%d.addressType = \"static\"\n", + virBufferAsprintf(buffer, "ethernet%d.addressType = \"static\"\n", controller); - virBufferVSprintf(buffer, "ethernet%d.address = \"%s\"\n", + virBufferAsprintf(buffer, "ethernet%d.address = \"%s\"\n", controller, mac_string); } else if (prefix == 0x005056 && suffix >= 0x800000 && suffix <= 0xbfffff) { - virBufferVSprintf(buffer, "ethernet%d.addressType = \"vpx\"\n", + virBufferAsprintf(buffer, "ethernet%d.addressType = \"vpx\"\n", controller); - virBufferVSprintf(buffer, "ethernet%d.generatedAddress = \"%s\"\n", + virBufferAsprintf(buffer, "ethernet%d.generatedAddress = \"%s\"\n", controller, mac_string); } else { - virBufferVSprintf(buffer, "ethernet%d.addressType = \"static\"\n", + virBufferAsprintf(buffer, "ethernet%d.addressType = \"static\"\n", controller); - virBufferVSprintf(buffer, "ethernet%d.address = \"%s\"\n", + virBufferAsprintf(buffer, "ethernet%d.address = \"%s\"\n", controller, mac_string); - virBufferVSprintf(buffer, "ethernet%d.checkMACAddress = \"false\"\n", + virBufferAsprintf(buffer, "ethernet%d.checkMACAddress = \"false\"\n", controller); } @@ -3593,19 +3593,19 @@ virVMXFormatSerial(virVMXContext *ctx, virDomainChrDefPtr def, return -1; } - virBufferVSprintf(buffer, "serial%d.present = \"true\"\n", def->target.port); + virBufferAsprintf(buffer, "serial%d.present = \"true\"\n", def->target.port); /* def:type -> vmx:fileType and def:data.file.path -> vmx:fileName */ switch (def->source.type) { case VIR_DOMAIN_CHR_TYPE_DEV: - virBufferVSprintf(buffer, "serial%d.fileType = \"device\"\n", + virBufferAsprintf(buffer, "serial%d.fileType = \"device\"\n", def->target.port); - virBufferVSprintf(buffer, "serial%d.fileName = \"%s\"\n", + virBufferAsprintf(buffer, "serial%d.fileName = \"%s\"\n", def->target.port, def->source.data.file.path); break; case VIR_DOMAIN_CHR_TYPE_FILE: - virBufferVSprintf(buffer, "serial%d.fileType = \"file\"\n", + virBufferAsprintf(buffer, "serial%d.fileType = \"file\"\n", def->target.port); fileName = ctx->formatFileName(def->source.data.file.path, ctx->opaque); @@ -3614,22 +3614,22 @@ virVMXFormatSerial(virVMXContext *ctx, virDomainChrDefPtr def, return -1; } - virBufferVSprintf(buffer, "serial%d.fileName = \"%s\"\n", + virBufferAsprintf(buffer, "serial%d.fileName = \"%s\"\n", def->target.port, fileName); VIR_FREE(fileName); break; case VIR_DOMAIN_CHR_TYPE_PIPE: - virBufferVSprintf(buffer, "serial%d.fileType = \"pipe\"\n", + virBufferAsprintf(buffer, "serial%d.fileType = \"pipe\"\n", def->target.port); /* FIXME: Based on VI Client GUI default */ - virBufferVSprintf(buffer, "serial%d.pipe.endPoint = \"client\"\n", + virBufferAsprintf(buffer, "serial%d.pipe.endPoint = \"client\"\n", def->target.port); /* FIXME: Based on VI Client GUI default */ - virBufferVSprintf(buffer, "serial%d.tryNoRxLoss = \"false\"\n", + virBufferAsprintf(buffer, "serial%d.tryNoRxLoss = \"false\"\n", def->target.port); - virBufferVSprintf(buffer, "serial%d.fileName = \"%s\"\n", + virBufferAsprintf(buffer, "serial%d.fileName = \"%s\"\n", def->target.port, def->source.data.file.path); break; @@ -3659,12 +3659,12 @@ virVMXFormatSerial(virVMXContext *ctx, virDomainChrDefPtr def, return -1; } - virBufferVSprintf(buffer, "serial%d.fileType = \"network\"\n", + virBufferAsprintf(buffer, "serial%d.fileType = \"network\"\n", def->target.port); - virBufferVSprintf(buffer, "serial%d.fileName = \"%s://%s:%s\"\n", + virBufferAsprintf(buffer, "serial%d.fileName = \"%s://%s:%s\"\n", def->target.port, protocol, def->source.data.tcp.host, def->source.data.tcp.service); - virBufferVSprintf(buffer, "serial%d.network.endPoint = \"%s\"\n", + virBufferAsprintf(buffer, "serial%d.network.endPoint = \"%s\"\n", def->target.port, def->source.data.tcp.listen ? "server" : "client"); break; @@ -3678,7 +3678,7 @@ virVMXFormatSerial(virVMXContext *ctx, virDomainChrDefPtr def, /* vmx:yieldOnMsrRead */ /* FIXME: Based on VI Client GUI default */ - virBufferVSprintf(buffer, "serial%d.yieldOnMsrRead = \"true\"\n", + virBufferAsprintf(buffer, "serial%d.yieldOnMsrRead = \"true\"\n", def->target.port); return 0; @@ -3699,20 +3699,20 @@ virVMXFormatParallel(virVMXContext *ctx, virDomainChrDefPtr def, return -1; } - virBufferVSprintf(buffer, "parallel%d.present = \"true\"\n", + virBufferAsprintf(buffer, "parallel%d.present = \"true\"\n", def->target.port); /* def:type -> vmx:fileType and def:data.file.path -> vmx:fileName */ switch (def->source.type) { case VIR_DOMAIN_CHR_TYPE_DEV: - virBufferVSprintf(buffer, "parallel%d.fileType = \"device\"\n", + virBufferAsprintf(buffer, "parallel%d.fileType = \"device\"\n", def->target.port); - virBufferVSprintf(buffer, "parallel%d.fileName = \"%s\"\n", + virBufferAsprintf(buffer, "parallel%d.fileName = \"%s\"\n", def->target.port, def->source.data.file.path); break; case VIR_DOMAIN_CHR_TYPE_FILE: - virBufferVSprintf(buffer, "parallel%d.fileType = \"file\"\n", + virBufferAsprintf(buffer, "parallel%d.fileType = \"file\"\n", def->target.port); fileName = ctx->formatFileName(def->source.data.file.path, ctx->opaque); @@ -3721,7 +3721,7 @@ virVMXFormatParallel(virVMXContext *ctx, virDomainChrDefPtr def, return -1; } - virBufferVSprintf(buffer, "parallel%d.fileName = \"%s\"\n", + virBufferAsprintf(buffer, "parallel%d.fileName = \"%s\"\n", def->target.port, fileName); VIR_FREE(fileName); @@ -3763,7 +3763,7 @@ virVMXFormatSVGA(virDomainVideoDefPtr def, virBufferPtr buffer) return -1; } - virBufferVSprintf(buffer, "svga.vramSize = \"%lld\"\n", + virBufferAsprintf(buffer, "svga.vramSize = \"%lld\"\n", vram * 1024); /* kilobyte to byte */ return 0; diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index b608a43..a4420d8 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -487,7 +487,7 @@ xend_op_ext(virConnectPtr xend, const char *path, const char *key, va_list ap) while (k) { v = va_arg(ap, const char *); - virBufferVSprintf(&buf, "%s=%s", k, v); + virBufferAsprintf(&buf, "%s=%s", k, v); k = va_arg(ap, const char *); if (k) diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c index f9f52b5..07a0c0f 100644 --- a/src/xen/xm_internal.c +++ b/src/xen/xm_internal.c @@ -857,7 +857,7 @@ int xenXMDomainPinVcpu(virDomainPtr domain, virBufferAddLit (&mapbuf, ","); comma = 1; - virBufferVSprintf (&mapbuf, "%d", n); + virBufferAsprintf (&mapbuf, "%d", n); } if (virBufferError(&mapbuf)) { diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c index ae20bf7..9362cf1 100644 --- a/src/xenapi/xenapi_utils.c +++ b/src/xenapi/xenapi_utils.c @@ -292,7 +292,7 @@ mapDomainPinVcpu(unsigned char *cpumap, int maplen) for (i = 0; i < maplen; i++) { for (j = 0; j < 8; j++) { if (cpumap[i] & (1 << j)) { - virBufferVSprintf(&buf, "%d,", (8*i)+j); + virBufferAsprintf(&buf, "%d,", (8*i)+j); } } } diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c index a2fdc71..8690286 100644 --- a/src/xenxs/xen_sxpr.c +++ b/src/xenxs/xen_sxpr.c @@ -1432,24 +1432,24 @@ xenFormatSxprGraphicsNew(virDomainGraphicsDefPtr def, if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) { virBufferAddLit(buf, "(type sdl)"); if (def->data.sdl.display) - virBufferVSprintf(buf, "(display '%s')", def->data.sdl.display); + virBufferAsprintf(buf, "(display '%s')", def->data.sdl.display); if (def->data.sdl.xauth) - virBufferVSprintf(buf, "(xauthority '%s')", def->data.sdl.xauth); + virBufferAsprintf(buf, "(xauthority '%s')", def->data.sdl.xauth); } else if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) { virBufferAddLit(buf, "(type vnc)"); if (def->data.vnc.autoport) { virBufferAddLit(buf, "(vncunused 1)"); } else { virBufferAddLit(buf, "(vncunused 0)"); - virBufferVSprintf(buf, "(vncdisplay %d)", def->data.vnc.port-5900); + virBufferAsprintf(buf, "(vncdisplay %d)", def->data.vnc.port-5900); } if (def->data.vnc.listenAddr) - virBufferVSprintf(buf, "(vnclisten '%s')", def->data.vnc.listenAddr); + virBufferAsprintf(buf, "(vnclisten '%s')", def->data.vnc.listenAddr); if (def->data.vnc.auth.passwd) - virBufferVSprintf(buf, "(vncpasswd '%s')", def->data.vnc.auth.passwd); + virBufferAsprintf(buf, "(vncpasswd '%s')", def->data.vnc.auth.passwd); if (def->data.vnc.keymap) - virBufferVSprintf(buf, "(keymap '%s')", def->data.vnc.keymap); + virBufferAsprintf(buf, "(keymap '%s')", def->data.vnc.keymap); } virBufferAddLit(buf, "))"); @@ -1474,9 +1474,9 @@ xenFormatSxprGraphicsOld(virDomainGraphicsDefPtr def, if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) { virBufferAddLit(buf, "(sdl 1)"); if (def->data.sdl.display) - virBufferVSprintf(buf, "(display '%s')", def->data.sdl.display); + virBufferAsprintf(buf, "(display '%s')", def->data.sdl.display); if (def->data.sdl.xauth) - virBufferVSprintf(buf, "(xauthority '%s')", def->data.sdl.xauth); + virBufferAsprintf(buf, "(xauthority '%s')", def->data.sdl.xauth); } else if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) { virBufferAddLit(buf, "(vnc 1)"); if (xendConfigVersion >= 2) { @@ -1484,15 +1484,15 @@ xenFormatSxprGraphicsOld(virDomainGraphicsDefPtr def, virBufferAddLit(buf, "(vncunused 1)"); } else { virBufferAddLit(buf, "(vncunused 0)"); - virBufferVSprintf(buf, "(vncdisplay %d)", def->data.vnc.port-5900); + virBufferAsprintf(buf, "(vncdisplay %d)", def->data.vnc.port-5900); } if (def->data.vnc.listenAddr) - virBufferVSprintf(buf, "(vnclisten '%s')", def->data.vnc.listenAddr); + virBufferAsprintf(buf, "(vnclisten '%s')", def->data.vnc.listenAddr); if (def->data.vnc.auth.passwd) - virBufferVSprintf(buf, "(vncpasswd '%s')", def->data.vnc.auth.passwd); + virBufferAsprintf(buf, "(vncpasswd '%s')", def->data.vnc.auth.passwd); if (def->data.vnc.keymap) - virBufferVSprintf(buf, "(keymap '%s')", def->data.vnc.keymap); + virBufferAsprintf(buf, "(keymap '%s')", def->data.vnc.keymap); } } @@ -1522,7 +1522,7 @@ xenFormatSxprChr(virDomainChrDefPtr def, case VIR_DOMAIN_CHR_TYPE_FILE: case VIR_DOMAIN_CHR_TYPE_PIPE: - virBufferVSprintf(buf, "%s:", type); + virBufferAsprintf(buf, "%s:", type); virBufferEscapeSexpr(buf, "%s", def->source.data.file.path); break; @@ -1531,7 +1531,7 @@ xenFormatSxprChr(virDomainChrDefPtr def, break; case VIR_DOMAIN_CHR_TYPE_TCP: - virBufferVSprintf(buf, "%s:%s:%s%s", + virBufferAsprintf(buf, "%s:%s:%s%s", (def->source.data.tcp.protocol == VIR_DOMAIN_CHR_TCP_PROTOCOL_RAW ? "tcp" : "telnet"), @@ -1544,7 +1544,7 @@ xenFormatSxprChr(virDomainChrDefPtr def, break; case VIR_DOMAIN_CHR_TYPE_UDP: - virBufferVSprintf(buf, "%s:%s:%s@%s:%s", type, + virBufferAsprintf(buf, "%s:%s:%s@%s:%s", type, (def->source.data.udp.connectHost ? def->source.data.udp.connectHost : ""), (def->source.data.udp.connectService ? @@ -1556,7 +1556,7 @@ xenFormatSxprChr(virDomainChrDefPtr def, break; case VIR_DOMAIN_CHR_TYPE_UNIX: - virBufferVSprintf(buf, "%s:", type); + virBufferAsprintf(buf, "%s:", type); virBufferEscapeSexpr(buf, "%s", def->source.data.nix.path); if (def->source.data.nix.listen) virBufferAddLit(buf, ",server,nowait"); @@ -1639,7 +1639,7 @@ xenFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED, } else { /* But newer does not */ virBufferEscapeSexpr(buf, "(dev '%s:", def->dst); - virBufferVSprintf(buf, "%s')", + virBufferAsprintf(buf, "%s')", def->device == VIR_DOMAIN_DISK_DEVICE_CDROM ? "cdrom" : "disk"); } @@ -1730,7 +1730,7 @@ xenFormatSxprNet(virConnectPtr conn, virBufferAddLit(buf, "(vif "); - virBufferVSprintf(buf, + virBufferAsprintf(buf, "(mac '%02x:%02x:%02x:%02x:%02x:%02x')", def->mac[0], def->mac[1], def->mac[2], def->mac[3], def->mac[4], def->mac[5]); @@ -1827,7 +1827,7 @@ static void xenFormatSxprPCI(virDomainHostdevDefPtr def, virBufferPtr buf) { - virBufferVSprintf(buf, "(dev (domain 0x%04x)(bus 0x%02x)(slot 0x%02x)(func 0x%x))", + virBufferAsprintf(buf, "(dev (domain 0x%04x)(bus 0x%02x)(slot 0x%02x)(func 0x%x))", def->source.subsys.u.pci.domain, def->source.subsys.u.pci.bus, def->source.subsys.u.pci.slot, @@ -1945,7 +1945,7 @@ xenFormatSxprInput(virDomainInputDefPtr input, return -1; } - virBufferVSprintf(buf, "(usbdevice %s)", + virBufferAsprintf(buf, "(usbdevice %s)", input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ? "mouse" : "tablet"); @@ -1983,14 +1983,14 @@ xenFormatSxpr(virConnectPtr conn, virBufferAddLit(&buf, "(vm "); virBufferEscapeSexpr(&buf, "(name '%s')", def->name); - virBufferVSprintf(&buf, "(memory %lu)(maxmem %lu)", + virBufferAsprintf(&buf, "(memory %lu)(maxmem %lu)", VIR_DIV_UP(def->mem.cur_balloon, 1024), VIR_DIV_UP(def->mem.max_balloon, 1024)); - virBufferVSprintf(&buf, "(vcpus %u)", def->maxvcpus); + virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus); /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is either 32, or 64 on a platform where long is big enough. */ if (def->vcpus < def->maxvcpus) - virBufferVSprintf(&buf, "(vcpu_avail %lu)", (1UL << def->vcpus) - 1); + virBufferAsprintf(&buf, "(vcpu_avail %lu)", (1UL << def->vcpus) - 1); if (def->cpumask) { char *ranges = virDomainCpuSetFormat(def->cpumask, def->cpumasklen); @@ -2001,7 +2001,7 @@ xenFormatSxpr(virConnectPtr conn, } virUUIDFormat(def->uuid, uuidstr); - virBufferVSprintf(&buf, "(uuid '%s')", uuidstr); + virBufferAsprintf(&buf, "(uuid '%s')", uuidstr); if (def->description) virBufferEscapeSexpr(&buf, "(description '%s')", def->description); @@ -2021,21 +2021,21 @@ xenFormatSxpr(virConnectPtr conn, _("unexpected lifecycle value %d"), def->onPoweroff); goto error; } - virBufferVSprintf(&buf, "(on_poweroff '%s')", tmp); + virBufferAsprintf(&buf, "(on_poweroff '%s')", tmp); if (!(tmp = virDomainLifecycleTypeToString(def->onReboot))) { XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, _("unexpected lifecycle value %d"), def->onReboot); goto error; } - virBufferVSprintf(&buf, "(on_reboot '%s')", tmp); + virBufferAsprintf(&buf, "(on_reboot '%s')", tmp); if (!(tmp = virDomainLifecycleCrashTypeToString(def->onCrash))) { XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, _("unexpected lifecycle value %d"), def->onCrash); goto error; } - virBufferVSprintf(&buf, "(on_crash '%s')", tmp); + virBufferAsprintf(&buf, "(on_crash '%s')", tmp); /* Set localtime here for current XenD (both PV & HVM) */ if (def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME) { @@ -2085,9 +2085,9 @@ xenFormatSxpr(virConnectPtr conn, else virBufferEscapeSexpr(&buf, "(kernel '%s')", def->os.loader); - virBufferVSprintf(&buf, "(vcpus %u)", def->maxvcpus); + virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus); if (def->vcpus < def->maxvcpus) - virBufferVSprintf(&buf, "(vcpu_avail %lu)", + virBufferAsprintf(&buf, "(vcpu_avail %lu)", (1UL << def->vcpus) - 1); for (i = 0 ; i < def->os.nBootDevs ; i++) { @@ -2113,7 +2113,7 @@ xenFormatSxpr(virConnectPtr conn, } else { bootorder[def->os.nBootDevs] = '\0'; } - virBufferVSprintf(&buf, "(boot %s)", bootorder); + virBufferAsprintf(&buf, "(boot %s)", bootorder); /* some disk devices are defined here */ for (i = 0 ; i < def->ndisks ; i++) { diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c index 63ba153..7f67ae2 100644 --- a/src/xenxs/xen_xm.c +++ b/src/xenxs/xen_xm.c @@ -1096,9 +1096,9 @@ static int xenFormatXMDisk(virConfValuePtr list, if(disk->src) { if (disk->driverName) { - virBufferVSprintf(&buf, "%s:", disk->driverName); + virBufferAsprintf(&buf, "%s:", disk->driverName); if (STREQ(disk->driverName, "tap")) - virBufferVSprintf(&buf, "%s:", disk->driverType ? disk->driverType : "aio"); + virBufferAsprintf(&buf, "%s:", disk->driverType ? disk->driverType : "aio"); } else { switch (disk->type) { case VIR_DOMAIN_DISK_TYPE_FILE: @@ -1209,24 +1209,24 @@ static int xenFormatXMNet(virConnectPtr conn, virBuffer buf = VIR_BUFFER_INITIALIZER; virConfValuePtr val, tmp; - virBufferVSprintf(&buf, "mac=%02x:%02x:%02x:%02x:%02x:%02x", + virBufferAsprintf(&buf, "mac=%02x:%02x:%02x:%02x:%02x:%02x", net->mac[0], net->mac[1], net->mac[2], net->mac[3], net->mac[4], net->mac[5]); switch (net->type) { case VIR_DOMAIN_NET_TYPE_BRIDGE: - virBufferVSprintf(&buf, ",bridge=%s", net->data.bridge.brname); + virBufferAsprintf(&buf, ",bridge=%s", net->data.bridge.brname); if (net->data.bridge.ipaddr) - virBufferVSprintf(&buf, ",ip=%s", net->data.bridge.ipaddr); - virBufferVSprintf(&buf, ",script=%s", DEFAULT_VIF_SCRIPT); + virBufferAsprintf(&buf, ",ip=%s", net->data.bridge.ipaddr); + virBufferAsprintf(&buf, ",script=%s", DEFAULT_VIF_SCRIPT); break; case VIR_DOMAIN_NET_TYPE_ETHERNET: if (net->data.ethernet.script) - virBufferVSprintf(&buf, ",script=%s", net->data.ethernet.script); + virBufferAsprintf(&buf, ",script=%s", net->data.ethernet.script); if (net->data.ethernet.ipaddr) - virBufferVSprintf(&buf, ",ip=%s", net->data.ethernet.ipaddr); + virBufferAsprintf(&buf, ",ip=%s", net->data.ethernet.ipaddr); break; case VIR_DOMAIN_NET_TYPE_NETWORK: @@ -1247,8 +1247,8 @@ static int xenFormatXMNet(virConnectPtr conn, return -1; } - virBufferVSprintf(&buf, ",bridge=%s", bridge); - virBufferVSprintf(&buf, ",script=%s", DEFAULT_VIF_SCRIPT); + virBufferAsprintf(&buf, ",bridge=%s", bridge); + virBufferAsprintf(&buf, ",script=%s", DEFAULT_VIF_SCRIPT); } break; @@ -1261,7 +1261,7 @@ static int xenFormatXMNet(virConnectPtr conn, if (!hvm) { if (net->model != NULL) - virBufferVSprintf(&buf, ",model=%s", net->model); + virBufferAsprintf(&buf, ",model=%s", net->model); } else if (net->model == NULL) { /* @@ -1275,12 +1275,12 @@ static int xenFormatXMNet(virConnectPtr conn, virBufferAddLit(&buf, ",type=netfront"); } else { - virBufferVSprintf(&buf, ",model=%s", net->model); + virBufferAsprintf(&buf, ",model=%s", net->model); virBufferAddLit(&buf, ",type=ioemu"); } if (net->ifname) - virBufferVSprintf(&buf, ",vifname=%s", + virBufferAsprintf(&buf, ",vifname=%s", net->ifname); if (virBufferError(&buf)) { @@ -1641,26 +1641,26 @@ virConfPtr xenFormatXM(virConnectPtr conn, if (def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) { virBufferAddLit(&buf, "type=sdl"); if (def->graphics[0]->data.sdl.display) - virBufferVSprintf(&buf, ",display=%s", + virBufferAsprintf(&buf, ",display=%s", def->graphics[0]->data.sdl.display); if (def->graphics[0]->data.sdl.xauth) - virBufferVSprintf(&buf, ",xauthority=%s", + virBufferAsprintf(&buf, ",xauthority=%s", def->graphics[0]->data.sdl.xauth); } else { virBufferAddLit(&buf, "type=vnc"); - virBufferVSprintf(&buf, ",vncunused=%d", + virBufferAsprintf(&buf, ",vncunused=%d", def->graphics[0]->data.vnc.autoport ? 1 : 0); if (!def->graphics[0]->data.vnc.autoport) - virBufferVSprintf(&buf, ",vncdisplay=%d", + virBufferAsprintf(&buf, ",vncdisplay=%d", def->graphics[0]->data.vnc.port - 5900); if (def->graphics[0]->data.vnc.listenAddr) - virBufferVSprintf(&buf, ",vnclisten=%s", + virBufferAsprintf(&buf, ",vnclisten=%s", def->graphics[0]->data.vnc.listenAddr); if (def->graphics[0]->data.vnc.auth.passwd) - virBufferVSprintf(&buf, ",vncpasswd=%s", + virBufferAsprintf(&buf, ",vncpasswd=%s", def->graphics[0]->data.vnc.auth.passwd); if (def->graphics[0]->data.vnc.keymap) - virBufferVSprintf(&buf, ",keymap=%s", + virBufferAsprintf(&buf, ",keymap=%s", def->graphics[0]->data.vnc.keymap); } if (virBufferError(&buf)) { diff --git a/tests/cputest.c b/tests/cputest.c index a8d28dc..b6ec104 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -299,11 +299,11 @@ cpuTestGuestData(const void *arg) goto cleanup; } - virBufferVSprintf(&buf, "%s+%s", data->host, data->name); + virBufferAsprintf(&buf, "%s+%s", data->host, data->name); if (data->nmodels) - virBufferVSprintf(&buf, ",%s", data->modelsName); + virBufferAsprintf(&buf, ",%s", data->modelsName); if (data->preferred) - virBufferVSprintf(&buf, ",%s", data->preferred); + virBufferAsprintf(&buf, ",%s", data->preferred); virBufferAddLit(&buf, "-result"); if (virBufferError(&buf)) { diff --git a/tests/virbuftest.c b/tests/virbuftest.c index 0094a16..01db313 100644 --- a/tests/virbuftest.c +++ b/tests/virbuftest.c @@ -48,7 +48,7 @@ static int testBufInfiniteLoop(const void *data ATTRIBUTE_UNUSED) if (info->doEscape) virBufferEscapeString(buf, "%s", addstr); else - virBufferVSprintf(buf, "%s", addstr); + virBufferAsprintf(buf, "%s", addstr); ret = 0; out: diff --git a/tools/virsh.c b/tools/virsh.c index 3d4ed2f..b249829 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -5566,27 +5566,27 @@ static int buildPoolXML(const vshCmd *cmd, const char **retname, char **xml) { goto cleanup; } - virBufferVSprintf(&buf, "<pool type='%s'>\n", type); - virBufferVSprintf(&buf, " <name>%s</name>\n", name); + virBufferAsprintf(&buf, "<pool type='%s'>\n", type); + virBufferAsprintf(&buf, " <name>%s</name>\n", name); if (srcHost || srcPath || srcDev) { virBufferAddLit(&buf, " <source>\n"); if (srcHost) - virBufferVSprintf(&buf, " <host name='%s'/>\n", srcHost); + virBufferAsprintf(&buf, " <host name='%s'/>\n", srcHost); if (srcPath) - virBufferVSprintf(&buf, " <dir path='%s'/>\n", srcPath); + virBufferAsprintf(&buf, " <dir path='%s'/>\n", srcPath); if (srcDev) - virBufferVSprintf(&buf, " <device path='%s'/>\n", srcDev); + virBufferAsprintf(&buf, " <device path='%s'/>\n", srcDev); if (srcFormat) - virBufferVSprintf(&buf, " <format type='%s'/>\n", srcFormat); + virBufferAsprintf(&buf, " <format type='%s'/>\n", srcFormat); if (srcName) - virBufferVSprintf(&buf, " <name>%s</name>\n", srcName); + virBufferAsprintf(&buf, " <name>%s</name>\n", srcName); virBufferAddLit(&buf, " </source>\n"); } if (target) { virBufferAddLit(&buf, " <target>\n"); - virBufferVSprintf(&buf, " <path>%s</path>\n", target); + virBufferAsprintf(&buf, " <path>%s</path>\n", target); virBufferAddLit(&buf, " </target>\n"); } virBufferAddLit(&buf, "</pool>\n"); @@ -6387,13 +6387,13 @@ cmdPoolDiscoverSourcesAs(vshControl * ctl, const vshCmd * cmd ATTRIBUTE_UNUSED) return false; } virBufferAddLit(&buf, "<source>\n"); - virBufferVSprintf(&buf, " <host name='%s'", host); + virBufferAsprintf(&buf, " <host name='%s'", host); if (port) - virBufferVSprintf(&buf, " port='%s'", port); + virBufferAsprintf(&buf, " port='%s'", port); virBufferAddLit(&buf, "/>\n"); if (initiator) { virBufferAddLit(&buf, " <initiator>\n"); - virBufferVSprintf(&buf, " <iqn name='%s'/>\n", initiator); + virBufferAsprintf(&buf, " <iqn name='%s'/>\n", initiator); virBufferAddLit(&buf, " </initiator>\n"); } virBufferAddLit(&buf, "</source>\n"); @@ -6721,14 +6721,14 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd) virBufferAddLit(&buf, "<volume>\n"); - virBufferVSprintf(&buf, " <name>%s</name>\n", name); - virBufferVSprintf(&buf, " <capacity>%llu</capacity>\n", capacity); + virBufferAsprintf(&buf, " <name>%s</name>\n", name); + virBufferAsprintf(&buf, " <capacity>%llu</capacity>\n", capacity); if (allocationStr) - virBufferVSprintf(&buf, " <allocation>%llu</allocation>\n", allocation); + virBufferAsprintf(&buf, " <allocation>%llu</allocation>\n", allocation); if (format) { virBufferAddLit(&buf, " <target>\n"); - virBufferVSprintf(&buf, " <format type='%s'/>\n",format); + virBufferAsprintf(&buf, " <format type='%s'/>\n",format); virBufferAddLit(&buf, " </target>\n"); } @@ -6776,9 +6776,9 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd) /* Create XML for the backing store */ virBufferAddLit(&buf, " <backingStore>\n"); - virBufferVSprintf(&buf, " <path>%s</path>\n",snapshotStrVolPath); + virBufferAsprintf(&buf, " <path>%s</path>\n",snapshotStrVolPath); if (snapshotStrFormat) - virBufferVSprintf(&buf, " <format type='%s'/>\n",snapshotStrFormat); + virBufferAsprintf(&buf, " <format type='%s'/>\n",snapshotStrFormat); virBufferAddLit(&buf, " </backingStore>\n"); /* Cleanup snapshot allocations */ @@ -9149,21 +9149,21 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd) } /* Make XML of interface */ - virBufferVSprintf(&buf, "<interface type='%s'>\n", type); + virBufferAsprintf(&buf, "<interface type='%s'>\n", type); if (typ == 1) - virBufferVSprintf(&buf, " <source network='%s'/>\n", source); + virBufferAsprintf(&buf, " <source network='%s'/>\n", source); else if (typ == 2) - virBufferVSprintf(&buf, " <source bridge='%s'/>\n", source); + virBufferAsprintf(&buf, " <source bridge='%s'/>\n", source); if (target != NULL) - virBufferVSprintf(&buf, " <target dev='%s'/>\n", target); + virBufferAsprintf(&buf, " <target dev='%s'/>\n", target); if (mac != NULL) - virBufferVSprintf(&buf, " <mac address='%s'/>\n", mac); + virBufferAsprintf(&buf, " <mac address='%s'/>\n", mac); if (script != NULL) - virBufferVSprintf(&buf, " <script path='%s'/>\n", script); + virBufferAsprintf(&buf, " <script path='%s'/>\n", script); if (model != NULL) - virBufferVSprintf(&buf, " <model type='%s'/>\n", model); + virBufferAsprintf(&buf, " <model type='%s'/>\n", model); virBufferAddLit(&buf, "</interface>\n"); @@ -9418,29 +9418,29 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd) } /* Make XML of disk */ - virBufferVSprintf(&buf, "<disk type='%s'", + virBufferAsprintf(&buf, "<disk type='%s'", (isFile) ? "file" : "block"); if (type) - virBufferVSprintf(&buf, " device='%s'", type); + virBufferAsprintf(&buf, " device='%s'", type); virBufferAddLit(&buf, ">\n"); if (driver || subdriver) - virBufferVSprintf(&buf, " <driver"); + virBufferAsprintf(&buf, " <driver"); if (driver) - virBufferVSprintf(&buf, " name='%s'", driver); + virBufferAsprintf(&buf, " name='%s'", driver); if (subdriver) - virBufferVSprintf(&buf, " type='%s'", subdriver); + virBufferAsprintf(&buf, " type='%s'", subdriver); if (driver || subdriver) virBufferAddLit(&buf, "/>\n"); - virBufferVSprintf(&buf, " <source %s='%s'/>\n", + virBufferAsprintf(&buf, " <source %s='%s'/>\n", (isFile) ? "file" : "dev", source); - virBufferVSprintf(&buf, " <target dev='%s'/>\n", target); + virBufferAsprintf(&buf, " <target dev='%s'/>\n", target); if (mode) - virBufferVSprintf(&buf, " <%s/>\n", mode); + virBufferAsprintf(&buf, " <%s/>\n", mode); virBufferAddLit(&buf, "</disk>\n"); -- 1.7.4.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list