From nobody Mon Feb 9 17:22:46 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=1610359435; cv=none; d=zohomail.com; s=zohoarc; b=NXdCnlJbgfcAD1UGxzWYCAOEn1uIyXspwIRWXW2X0hzJMgqu0l4fi7mRPChhjCFWpTRtipXU/Q8TCv0m9JvpGEFO7oTMvJZZfcnZZ9wuvinBZPKKihB6QuEOkmoECTxaELKFznbsh88a3sku/q98kuYL84i/MpXjJ0tgEet8p6c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610359435; 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=3+X04AflSEs0J9giG+NlnYv19vHupQEfhe092dzua8Q=; b=dgMO2ztxEkFG0ffXVxdjj8+j9jbfcWyoCqJ+9t/IfjoaA5OI0ZVPK5eLXTCgwQoIZlrhTyprLWuVE8fjQeOtqcUZqxBrfS6emqUbuSNygkEtJyXFZCnJ9Cz+XgPm8eix/8wWWNYiC53FC4iyB9Uqs5dAZUTMtGaUbR5EwOpU79Q= 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 1610359435663317.40078855555726; Mon, 11 Jan 2021 02:03:55 -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-225-_Qb30rgFPbmXFIvBgbVdAw-1; Mon, 11 Jan 2021 05:03:52 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7B58A8030C0; Mon, 11 Jan 2021 10:03:46 +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 582061349A; Mon, 11 Jan 2021 10:03:46 +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 E0565180954D; Mon, 11 Jan 2021 10:03:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10BA3itF016013 for ; Mon, 11 Jan 2021 05:03:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id 511632026D11; Mon, 11 Jan 2021 10:03:44 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C8062026D5D for ; Mon, 11 Jan 2021 10:03:41 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 D5441858EEC for ; Mon, 11 Jan 2021 10:03:41 +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-535-Iq3yeFNRP4CJOUS9ESkdvg-1; Mon, 11 Jan 2021 05:03:37 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kyu1s-00GBOE-HO for libvir-list@redhat.com; Mon, 11 Jan 2021 13:02:28 +0300 X-MC-Unique: _Qb30rgFPbmXFIvBgbVdAw-1 X-MC-Unique: Iq3yeFNRP4CJOUS9ESkdvg-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 12/23] qemu: prepare for removing qemuBlockIoTuneSetFlags Date: Mon, 11 Jan 2021 12:50:05 +0300 Message-Id: <1610358616-567804-13-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.4 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.79 on 10.5.11.11 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" We need extra variable in macros thus let's add do {} while (0) wrapping. Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_driver.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 02b28f0..15ccf90 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15889,11 +15889,13 @@ qemuDomainSetBlockIoTuneDefaults(virDomainBlockIo= TuneInfoPtr newinfo, qemuBlockIoTuneSetFlags set_fields) { #define SET_IOTUNE_DEFAULTS(BOOL, FIELD) \ - if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL)) { \ - newinfo->total_##FIELD =3D oldinfo->total_##FIELD; \ - newinfo->read_##FIELD =3D oldinfo->read_##FIELD; \ - newinfo->write_##FIELD =3D oldinfo->write_##FIELD; \ - } + do { \ + if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL)) { \ + newinfo->total_##FIELD =3D oldinfo->total_##FIELD; \ + newinfo->read_##FIELD =3D oldinfo->read_##FIELD; \ + newinfo->write_##FIELD =3D oldinfo->write_##FIELD; \ + } \ + } while (0) =20 SET_IOTUNE_DEFAULTS(BYTES, bytes_sec); SET_IOTUNE_DEFAULTS(BYTES_MAX, bytes_sec_max); @@ -15935,13 +15937,15 @@ qemuDomainSetBlockIoTuneDefaults(virDomainBlockIo= TuneInfoPtr newinfo, * our newinfo is clearing, then set max_length based on whether we * have a value in the family set/defined. */ #define SET_MAX_LENGTH(BOOL, FIELD) \ - if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL)) \ - newinfo->FIELD##_max_length =3D oldinfo->FIELD##_max_length; \ - else if ((set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL) && \ - oldinfo->FIELD##_max_length && \ - !newinfo->FIELD##_max_length) \ - newinfo->FIELD##_max_length =3D (newinfo->FIELD || \ - newinfo->FIELD##_max) ? 1 : 0; + do { \ + if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL)) \ + newinfo->FIELD##_max_length =3D oldinfo->FIELD##_max_length; \ + else if ((set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL) && \ + oldinfo->FIELD##_max_length && \ + !newinfo->FIELD##_max_length) \ + newinfo->FIELD##_max_length =3D (newinfo->FIELD || \ + newinfo->FIELD##_max) ? 1 : 0; \ + } while (0) =20 SET_MAX_LENGTH(BYTES_MAX_LENGTH, total_bytes_sec); SET_MAX_LENGTH(BYTES_MAX_LENGTH, read_bytes_sec); --=20 1.8.3.1