From nobody Mon Feb 9 14:33:12 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610359733; cv=none; d=zohomail.com; s=zohoarc; b=bA2AkxclwlWfeMjDDnHk0NsSgwNulJY8dcoOJViN+BOh5tG/ET6bGo6YJVDXuMh1gQLdbnooW2uDRK3oYfp2HYNvdvviM8NwCpNhf8h2JQRuUEyNLlmu8Wh2qz0k3M8O21JxUUB5I23rnQ8g8zdmeqrJedaM3rXs4/Wjhe1KtTg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610359733; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=L4trxg1OUj+86RjYVw/uhf8ppMYSLi8K5lJY+a/liy4=; b=kSF2HbaAxl5AK+EK7Jz8xk1oV5YoFIKKhBNNswZx5eLnPx5N2qUZw6zi2Mkz7Suu7qeJ/U2rKDrNtSmyqlnbOTBNUpQ51M0Z4YRXmSCOyF97WB6k+wOFhqFNo1XYm6GROq5eU1UNXLjn3HQdcH0UzHIctZLjzBcl8xQOmVtY8Z0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1610359733071944.9655435639559; Mon, 11 Jan 2021 02:08:53 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-503-dypq_shPOqC6DZyKPhjpoA-1; Mon, 11 Jan 2021 05:08:49 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A5E30CC629; Mon, 11 Jan 2021 10:08:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D522C19D9F; Mon, 11 Jan 2021 10:08:42 +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 148F21809C9F; Mon, 11 Jan 2021 10:08:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10BA8eqT016538 for ; Mon, 11 Jan 2021 05:08:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 03B622166B2B; Mon, 11 Jan 2021 10:08:40 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F0CD92166B2A for ; Mon, 11 Jan 2021 10:08:37 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0684A8007D9 for ; Mon, 11 Jan 2021 10:08:37 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-227-n0W0pxrQPiitZycQKL6HpQ-1; Mon, 11 Jan 2021 05:08:34 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kyu6g-00GBOE-7T for libvir-list@redhat.com; Mon, 11 Jan 2021 13:07:26 +0300 X-MC-Unique: dypq_shPOqC6DZyKPhjpoA-1 X-MC-Unique: n0W0pxrQPiitZycQKL6HpQ-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 17/23] conf: get rid of macros in virDomainDiskDefFormatIotune Date: Mon, 11 Jan 2021 12:50:10 +0300 Message-Id: <1610358616-567804-18-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com 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.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolay Shirokovskiy --- src/conf/domain_conf.c | 42 +++++++++--------------------------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 024d0e3..bbe6ae7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -24225,54 +24225,30 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf, } =20 =20 -#define FORMAT_IOTUNE(val) \ - if (disk->blkdeviotune.val) { \ - virBufferAsprintf(&childBuf, "<" #val ">%llu\n", \ - disk->blkdeviotune.val); \ - } - static void virDomainDiskDefFormatIotune(virBufferPtr buf, virDomainDiskDefPtr disk) { g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); + g_autofree unsigned long long **fields =3D + virDomainBlockIoTuneFields(&disk->blkdeviotune= ); + size_t i; =20 - FORMAT_IOTUNE(total_bytes_sec); - FORMAT_IOTUNE(read_bytes_sec); - FORMAT_IOTUNE(write_bytes_sec); - FORMAT_IOTUNE(total_iops_sec); - FORMAT_IOTUNE(read_iops_sec); - FORMAT_IOTUNE(write_iops_sec); - - FORMAT_IOTUNE(total_bytes_sec_max); - FORMAT_IOTUNE(read_bytes_sec_max); - FORMAT_IOTUNE(write_bytes_sec_max); - FORMAT_IOTUNE(total_iops_sec_max); - FORMAT_IOTUNE(read_iops_sec_max); - FORMAT_IOTUNE(write_iops_sec_max); + for (i =3D 0; i < G_N_ELEMENTS(virDomainBlockIoTuneFieldNames); i++) { + const char *name =3D virDomainBlockIoTuneFieldNames[i]; =20 - if (disk->blkdeviotune.size_iops_sec) { - virBufferAsprintf(&childBuf, "%llu\= n", - disk->blkdeviotune.size_iops_sec); + if (*fields[i]) + virBufferAsprintf(&childBuf, "<%s>%llu\n", + name, *fields[i], name); } =20 - if (disk->blkdeviotune.group_name) { + if (disk->blkdeviotune.group_name) virBufferEscapeString(&childBuf, "%s\n", disk->blkdeviotune.group_name); - } - - FORMAT_IOTUNE(total_bytes_sec_max_length); - FORMAT_IOTUNE(read_bytes_sec_max_length); - FORMAT_IOTUNE(write_bytes_sec_max_length); - FORMAT_IOTUNE(total_iops_sec_max_length); - FORMAT_IOTUNE(read_iops_sec_max_length); - FORMAT_IOTUNE(write_iops_sec_max_length); =20 virXMLFormatElement(buf, "iotune", NULL, &childBuf); } =20 -#undef FORMAT_IOTUNE - =20 static void virDomainDiskDefFormatDriver(virBufferPtr buf, --=20 1.8.3.1