From patchwork Wed Mar 6 23:36:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 159771 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp6773894jad; Wed, 6 Mar 2019 15:37:38 -0800 (PST) X-Google-Smtp-Source: APXvYqxrynTISLR3hTnxK3+7DbH2Z/LmQnKW02zEfOotLmB5YVsrOxZ32oZqLHlynIJelNElPG6W X-Received: by 2002:ae9:dec2:: with SMTP id s185mr7486373qkf.107.1551915458641; Wed, 06 Mar 2019 15:37:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551915458; cv=none; d=google.com; s=arc-20160816; b=ZUx6gdxVX16vPxLPofWX83vxeTM+Jbi22A0JC2/ifNEvAGfifuFf2Qkzm8bA9Afwaf 7x0sakNGyTvr52iqkXJiRE3WgoDlYi+6/clgaolE0OO6krn9C8IqlZ+D+EptuvjQFYa2 wL2JK89PmCTUA0W13ZLBDDUu1LWr4vKBZzWpROmw8OJ7ql67ZgZIaN8pZQgRkHnTCgG6 dSr8cAEPIMDdmp+LU7+1DGsD/xLxl1K7YLO+lHajA3TOYMdGeHQ+DVKmDnNbtsFGvZAv 9mer9D+OvbOxj+GzhKtigG5VnXA2m7wwp7VB6MR16Q0kGnkl6vFlb1FIf86IlL5eN+Pq jRCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=R217ng3wkRHiwD92rqZf+tNzZlDhw5pBuZCpwntjdCI=; b=s+T2fwIe76j1YRRdAriZ/9r0LpKMyibDAVEI3jNWm2V7PyNIIXnrl4ItFBAK9/TuGW 5FZOT3i13v2W7qkpC7b2PvijUfc3ZY9cPp1Ej9CLgD+OeEed84dBnBngJgd4zkG/dBjp VXng3fjNofWCsdNWhJLaNMFDOxuydarutvhGrPY/o1Iv2keBXsduKB6CAYIkKan4AtIS fX+zndXRhJXn91bxnDdXGaJZTY5y2YrMsurHOSDJMHjAhpcQK9Xk6Vk4pEUXdMn0k23W iKyn4S3cL8lGqA97USnIbvsK59s70jd3on1dQ5OXCsjyYq5cafegGHntdOLh531Smfyb ofgQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id o70si1887401qkl.238.2019.03.06.15.37.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Mar 2019 15:37:38 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0A4EF81E05; Wed, 6 Mar 2019 23:37:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D93E91891B; Wed, 6 Mar 2019 23:37:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 94EFD3FB12; Wed, 6 Mar 2019 23:37:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x26NbHrM005181 for ; Wed, 6 Mar 2019 18:37:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id B0CB91001DFB; Wed, 6 Mar 2019 23:37:17 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-121-104.rdu2.redhat.com [10.10.121.104]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AADF1001DE2; Wed, 6 Mar 2019 23:37:17 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 6 Mar 2019 18:36:53 -0500 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 04/16] conf: domcaps: Add single line formatting macro X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 06 Mar 2019 23:37:37 +0000 (UTC) Similar to the macros we have for formatting enums, add a macro to simplify formatting the pattern: Signed-off-by: Cole Robinson --- src/conf/domain_capabilities.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index a6104920ab..5a26329176 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -384,6 +384,12 @@ virDomainCapsStringValuesFormat(virBufferPtr buf, virBufferAddLit(buf, "\n"); \ } while (0) +#define FORMAT_SINGLE(name, supported) \ + do { \ + virBufferAsprintf(&buf, "<%s supported='%s'/>\n", name, \ + supported ? "yes" : "no"); \ + } while (0) + #define ENUM_PROCESS(master, capsEnum, valToStr) \ do { \ virDomainCapsEnumFormat(buf, &master->capsEnum, \ @@ -594,8 +600,7 @@ virDomainCapsFormat(virDomainCapsPtr const caps) if (caps->maxvcpus) virBufferAsprintf(&buf, "\n", caps->maxvcpus); - virBufferAsprintf(&buf, "\n", - caps->iothreads ? "yes" : "no"); + FORMAT_SINGLE("iothreads", caps->iothreads); virDomainCapsOSFormat(&buf, &caps->os); virDomainCapsCPUFormat(&buf, &caps->cpu); @@ -615,11 +620,8 @@ virDomainCapsFormat(virDomainCapsPtr const caps) virBufferAdjustIndent(&buf, 2); virDomainCapsFeatureGICFormat(&buf, &caps->gic); - virBufferAsprintf(&buf, "\n", - caps->vmcoreinfo ? "yes" : "no"); - - virBufferAsprintf(&buf, "\n", - caps->genid ? "yes" : "no"); + FORMAT_SINGLE("vmcoreinfo", caps->vmcoreinfo); + FORMAT_SINGLE("genid", caps->genid); virDomainCapsFeatureSEVFormat(&buf, caps->sev); virBufferAdjustIndent(&buf, -2);