From patchwork Tue Feb 19 20:09:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 158732 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4081020jaa; Tue, 19 Feb 2019 12:10:59 -0800 (PST) X-Google-Smtp-Source: AHgI3IYhBL45ekDJe3UFUlrb6iZg3UwVGI6ts2USWYdbozLjKdV7WC6XO2O/r/fCRJCDwMgXFag8 X-Received: by 2002:a37:6fc2:: with SMTP id k185mr11739599qkc.175.1550607059863; Tue, 19 Feb 2019 12:10:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550607059; cv=none; d=google.com; s=arc-20160816; b=nnJ9jDxw6WbHEzU7+EqEoFGpbF7SF/x4nM+8gMu0MxPfYUibqwHTrgmhUGXDTi3Y8v 9lPt6fSiU9kPrvxAcbDQ6i5aBP2sOdXwrH7SBMpCPoYD+Bx7beC8GF+OtCQD1rDUisj/ IaqY9rWLUonrxsI3QVunuDkWCGCQKnDfmeyVdP6FWcbNx7YRW9HjzhjzHTjVu8xlaxQn 9UyBdmFHadcOQDggaalbkUKixmKvRQWSUBWCXnIYUjGgHxP0UvgSbilXhqmPx5H9Ltt3 R8F9G7H+9Pdvze09gNzJOHl0F4US4pzwSaylEORN+TZSBMIF9S6CjDF9DMJRDQgtBZhd s0FQ== 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=z17zJQwbvmBPiZzhsGByoToFlphS0LyZTg3LUbZ5Scg=; b=iuPjKytgMHSAlyHH6qgKRU12eyli+2IU7WxoNcaqcGNcvPproD24t/6O+bMOEKW3Ek HQ1FnnZi6Pha0ERlP8nVOGXGs18QCnz3z069k4WnDija+pQBZ47BggZfeugJ71eEqmzz mde6emXPqLbYKqNmDwr+4mUNkDllDPgscaBaNcHBmIj3zF4gI4Nu8D7UrbYTz2kF1O3A ratap7JTpW3Cpuv4fo2ZCiicKdNRWswLPoBu0UjDaw1cywJWOm2IElniSKRxRme1YHXT P/ku+Q3wK/5DWKAIiGIa90Ntz8B4ZGFeUu56vm3jALMGJWp7K86NFzs+qidRbhT4DWrY 8JHA== 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 c11si1219398qvc.55.2019.02.19.12.10.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Feb 2019 12:10:59 -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-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 534DC201FB; Tue, 19 Feb 2019 20:10:58 +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 38CCE60141; Tue, 19 Feb 2019 20:10:58 +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 D6E314EE89; Tue, 19 Feb 2019 20:10:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1JKAjqP000471 for ; Tue, 19 Feb 2019 15:10:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id DB0F560141; Tue, 19 Feb 2019 20:10:45 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.bos.redhat.com (dhcp-17-6.bos.redhat.com [10.18.17.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id 83BF26013C; Tue, 19 Feb 2019 20:10:45 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 19 Feb 2019 15:09:33 -0500 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/10] 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 19 Feb 2019 20:10:58 +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 6352eda343..4539281ff5 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, \ @@ -593,8 +599,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); @@ -614,11 +619,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);