From nobody Thu Apr 25 04:36:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1555340127; cv=none; d=zoho.com; s=zohoarc; b=bcddvTgWqWdS3Bivl6Cyj8eIrcVlmASwGDRecEvYr6KG6KYCqE0G8d48s5r4lRPIGY4DIwa+XkhFY94JyK+rpX2yqKv06vsMcbcqz72iUTHw9oPb4IJPWEth6Ae4ffW+YnWRU+qF9qpYCFazm/7a9AWJ5vvJJ6yiYPwNekG/NN8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555340127; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=m7hiLxU+0+J0o/fZ4qGwWJYd07YRBOBZnuW93SknyCM=; b=JV+jf0HQMvPVQSaeLhXNFylVJI6EnhfWTiCkYr/TQjsZ+SB15mm5/GcI9oNCOmxPnDbsIE2lpbaspGKuF3lEh2FGurpiNCAASjxRnCKFHtSPPWXlwOsC3iUWvFfTcqOfRJl0yl067vmqKO1fIw+/Zz0ZgqT9mLNqZVd/3Pi3TY8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1555340127123961.2563775228123; Mon, 15 Apr 2019 07:55:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9094C3091783; Mon, 15 Apr 2019 14:55:24 +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 6931F60C43; Mon, 15 Apr 2019 14:55:24 +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 304EF181AC47; Mon, 15 Apr 2019 14:55:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3FEtMUN021780 for ; Mon, 15 Apr 2019 10:55:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8CE54196A2; Mon, 15 Apr 2019 14:55:21 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C80353B22 for ; Mon, 15 Apr 2019 14:55:20 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Mon, 15 Apr 2019 16:55:17 +0200 Message-Id: <4fd5d628c1555e5e512ff7b269cb1a411d9b8bae.1555340099.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] conf: pass the element/attribute names to virSchedulerFormat 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 15 Apr 2019 14:55:25 +0000 (UTC) Instead of constructing them dynamically from a base name, pass the two different static strings. While adjusting the callers, also expect a negative return value. Signed-off-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b969a9f6e5..93d32c9df1 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -27189,26 +27189,27 @@ virDomainPerfDefFormat(virBufferPtr buf, virDomai= nPerfDefPtr perf) } =20 =20 -static void +static int virDomainSchedulerFormat(virBufferPtr buf, - const char *name, + const char *elementName, + const char *idAttributeName, virDomainThreadSchedParamPtr sched, size_t id) { switch (sched->policy) { case VIR_PROC_POLICY_BATCH: case VIR_PROC_POLICY_IDLE: - virBufferAsprintf(buf, "<%ssched " - "%ss=3D'%zu' scheduler=3D'%s'/>\n", - name, name, id, + virBufferAsprintf(buf, "<%s " + "%s=3D'%zu' scheduler=3D'%s'/>\n", + elementName, idAttributeName, id, virProcessSchedPolicyTypeToString(sched->pol= icy)); break; =20 case VIR_PROC_POLICY_RR: case VIR_PROC_POLICY_FIFO: - virBufferAsprintf(buf, "<%ssched " - "%ss=3D'%zu' scheduler=3D'%s' priority=3D'%d= '/>\n", - name, name, id, + virBufferAsprintf(buf, "<%s " + "%s=3D'%zu' scheduler=3D'%s' priority=3D'%d'= />\n", + elementName, idAttributeName, id, virProcessSchedPolicyTypeToString(sched->pol= icy), sched->priority); break; @@ -27218,6 +27219,7 @@ virDomainSchedulerFormat(virBufferPtr buf, break; } =20 + return 0; } =20 =20 @@ -27476,14 +27478,16 @@ virDomainCputuneDefFormat(virBufferPtr buf, } =20 for (i =3D 0; i < def->maxvcpus; i++) { - virDomainSchedulerFormat(&childrenBuf, "vcpu", - &def->vcpus[i]->sched, i); + if (virDomainSchedulerFormat(&childrenBuf, "vcpusched", "vcpus", + &def->vcpus[i]->sched, i) < 0) + goto cleanup; } =20 for (i =3D 0; i < def->niothreadids; i++) { - virDomainSchedulerFormat(&childrenBuf, "iothread", - &def->iothreadids[i]->sched, - def->iothreadids[i]->iothread_id); + if (virDomainSchedulerFormat(&childrenBuf, "iothreadsched", "iothr= eads", + &def->iothreadids[i]->sched, + def->iothreadids[i]->iothread_id) < 0) + goto cleanup; } =20 for (i =3D 0; i < def->nresctrls; i++) --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 04:36:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1555340131; cv=none; d=zoho.com; s=zohoarc; b=kvfZyaCk6GG4H8+vMG8Djmycc/Evue9tvhITYekH00YbPjQ/ZJAks0/g9HHPRlOlu3cpCnrNDhKJMhoncvW2tHVviR7Kju+JWFQZHhWkxhsrvwnBaiN4GClcmjtwScLUxyr6RPYZlHyMIc+RR3rp47BDxwa3MFSG3HsOvGJYWJ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555340131; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=VWoe0enM59/A+US8PX7ca8lOUZ/yG0sffhNYr+IYaeY=; b=cmpP1y1H8oIOv810ra/1WYbbytVPc3AMdVZWwmybnqnSJR2ZL9QGFjIo2hlxrkdxNIWsibbx5tGrJW6/GeeT70LbZnDCzDGi1QUADZQNcQycmVjcBB5waxiD71YsxrXKEGpNtGHd2o74NJOJP5kgAbECLrGBtPVIGBIkil0aXws= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1555340131161648.1236576862444; Mon, 15 Apr 2019 07:55:31 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 20479308C388; Mon, 15 Apr 2019 14:55:29 +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 8C1C117B5C; Mon, 15 Apr 2019 14:55:28 +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 451773FA48; Mon, 15 Apr 2019 14:55:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3FEtM0j021787 for ; Mon, 15 Apr 2019 10:55:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8B6175C2F5; Mon, 15 Apr 2019 14:55:22 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D4EC05CC03 for ; Mon, 15 Apr 2019 14:55:21 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Mon, 15 Apr 2019 16:55:18 +0200 Message-Id: <9f7299f1bd81b3642848112a155481f03480bd13.1555340099.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] conf: switch virDomainSchedulerFormat to use virXMLFormatElement 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 15 Apr 2019 14:55:29 +0000 (UTC) Signed-off-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 93d32c9df1..1f44237b11 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -27196,30 +27196,30 @@ virDomainSchedulerFormat(virBufferPtr buf, virDomainThreadSchedParamPtr sched, size_t id) { + VIR_AUTOCLEAN(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; + switch (sched->policy) { case VIR_PROC_POLICY_BATCH: case VIR_PROC_POLICY_IDLE: - virBufferAsprintf(buf, "<%s " - "%s=3D'%zu' scheduler=3D'%s'/>\n", - elementName, idAttributeName, id, + virBufferAsprintf(&attrBuf, " %s=3D'%zu'", idAttributeName, id= ); + virBufferAsprintf(&attrBuf, " scheduler=3D'%s'", virProcessSchedPolicyTypeToString(sched->pol= icy)); break; =20 case VIR_PROC_POLICY_RR: case VIR_PROC_POLICY_FIFO: - virBufferAsprintf(buf, "<%s " - "%s=3D'%zu' scheduler=3D'%s' priority=3D'%d'= />\n", - elementName, idAttributeName, id, - virProcessSchedPolicyTypeToString(sched->pol= icy), - sched->priority); + virBufferAsprintf(&attrBuf, " %s=3D'%zu'", idAttributeName, id= ); + virBufferAsprintf(&attrBuf, " scheduler=3D'%s'", + virProcessSchedPolicyTypeToString(sched->pol= icy)); + virBufferAsprintf(&attrBuf, " priority=3D'%d'", sched->priorit= y); break; =20 case VIR_PROC_POLICY_NONE: case VIR_PROC_POLICY_LAST: - break; + return 0; } =20 - return 0; + return virXMLFormatElement(buf, elementName, &attrBuf, NULL); } =20 =20 --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list