From nobody Tue Feb 10 11:56:43 2026 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1536824930717921.3009622491163; Thu, 13 Sep 2018 00:48:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 31C7F3082B56; Thu, 13 Sep 2018 07:48:48 +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 B00405D6AA; Thu, 13 Sep 2018 07:48: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 9618218005DF; Thu, 13 Sep 2018 07:48:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8D7mOAl027153 for ; Thu, 13 Sep 2018 03:48:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1529A9A311; Thu, 13 Sep 2018 07:48:24 +0000 (UTC) Received: from dahmer.redhat.com (ovpn-204-17.brq.redhat.com [10.40.204.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E1D69A324; Thu, 13 Sep 2018 07:48:23 +0000 (UTC) From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Thu, 13 Sep 2018 09:48:11 +0200 Message-Id: <20180913074814.9697-2-fidencio@redhat.com> In-Reply-To: <20180913074814.9697-1-fidencio@redhat.com> References: <20180913074814.9697-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [libvirt PATCH v3 1/4] domain_conf: split out virBlkioDevice and virDomainBlkiotune definitions 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 13 Sep 2018 07:48:48 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Let's move those to their own newly created files (src/util/virblkio.{c,h}) as this will help us to easily start sharing the cgroup code that's duplicated between QEMU and LXC. Signed-off-by: Fabiano Fid=C3=AAncio --- src/conf/domain_conf.c | 11 +-------- src/conf/domain_conf.h | 27 ++------------------- src/libvirt_private.syms | 5 +++- src/util/Makefile.inc.am | 2 ++ src/util/virblkio.c | 37 ++++++++++++++++++++++++++++ src/util/virblkio.h | 52 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 98 insertions(+), 36 deletions(-) create mode 100644 src/util/virblkio.c create mode 100644 src/util/virblkio.h diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 409a2291ff..3384a36d76 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -59,6 +59,7 @@ #include "virnetdevmacvlan.h" #include "virhostdev.h" #include "virmdev.h" +#include "virblkio.h" =20 #define VIR_FROM_THIS VIR_FROM_DOMAIN =20 @@ -1205,16 +1206,6 @@ virDomainXMLOptionGetSaveCookie(virDomainXMLOptionPt= r xmlopt) } =20 =20 -void -virBlkioDeviceArrayClear(virBlkioDevicePtr devices, - int ndevices) -{ - size_t i; - - for (i =3D 0; i < ndevices; i++) - VIR_FREE(devices[i].path); -} - /** * virDomainBlkioDeviceParseXML * diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e30a4b2fe7..e9e6b6d6c4 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -57,6 +57,7 @@ # include "virtypedparam.h" # include "virsavecookie.h" # include "virresctrl.h" +# include "virblkio.h" =20 /* forward declarations of all device types, required by * virDomainDeviceDef @@ -2084,17 +2085,6 @@ struct _virDomainClockDef { }; =20 =20 -typedef struct _virBlkioDevice virBlkioDevice; -typedef virBlkioDevice *virBlkioDevicePtr; -struct _virBlkioDevice { - char *path; - unsigned int weight; - unsigned int riops; - unsigned int wiops; - unsigned long long rbps; - unsigned long long wbps; -}; - typedef enum { VIR_DOMAIN_RNG_MODEL_VIRTIO, =20 @@ -2184,9 +2174,6 @@ struct _virDomainPanicDef { }; =20 =20 -void virBlkioDeviceArrayClear(virBlkioDevicePtr deviceWeights, - int ndevices); - typedef struct _virDomainResourceDef virDomainResourceDef; typedef virDomainResourceDef *virDomainResourceDefPtr; struct _virDomainResourceDef { @@ -2260,16 +2247,6 @@ struct _virDomainVcpuDef { virObjectPtr privateData; }; =20 -typedef struct _virDomainBlkiotune virDomainBlkiotune; -typedef virDomainBlkiotune *virDomainBlkiotunePtr; - -struct _virDomainBlkiotune { - unsigned int weight; - - size_t ndevices; - virBlkioDevicePtr devices; -}; - typedef struct _virDomainMemtune virDomainMemtune; typedef virDomainMemtune *virDomainMemtunePtr; =20 @@ -2402,7 +2379,7 @@ struct _virDomainDef { char *title; char *description; =20 - virDomainBlkiotune blkio; + virBlkioTune blkio; virDomainMemtune mem; =20 virDomainVcpuDefPtr *vcpus; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a0d229a79f..bf1536ea57 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -190,7 +190,6 @@ virSEVCapabilitiesFree; =20 =20 # conf/domain_conf.h -virBlkioDeviceArrayClear; virDiskNameParse; virDiskNameToBusDeviceIndex; virDiskNameToIndex; @@ -1471,6 +1470,10 @@ virBitmapToDataBuf; virBitmapToString; =20 =20 +# util/virblkio.h +virBlkioDeviceArrayClear; + + # util/virbuffer.h virBufferAdd; virBufferAddBuffer; diff --git a/src/util/Makefile.inc.am b/src/util/Makefile.inc.am index a22265606c..13f415b23c 100644 --- a/src/util/Makefile.inc.am +++ b/src/util/Makefile.inc.am @@ -17,6 +17,8 @@ UTIL_SOURCES =3D \ util/virauthconfig.h \ util/virbitmap.c \ util/virbitmap.h \ + util/virblkio.c \ + util/virblkio.h \ util/virbuffer.c \ util/virbuffer.h \ util/virperf.c \ diff --git a/src/util/virblkio.c b/src/util/virblkio.c new file mode 100644 index 0000000000..9711077ee8 --- /dev/null +++ b/src/util/virblkio.c @@ -0,0 +1,37 @@ +/* + * virblkio.c: Block IO helpers + * + * Copyright (C) 2018 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + * + * Authors: + * Fabiano Fid=C3=AAncio + */ + +#include + +#include "viralloc.h" +#include "virblkio.h" + +void +virBlkioDeviceArrayClear(virBlkioDevicePtr devices, + int ndevices) +{ + size_t i; + + for (i =3D 0; i < ndevices; i++) + VIR_FREE(devices[i].path); +} diff --git a/src/util/virblkio.h b/src/util/virblkio.h new file mode 100644 index 0000000000..aa9788636d --- /dev/null +++ b/src/util/virblkio.h @@ -0,0 +1,52 @@ +/* + * virblkio.h: Block IO definitions and helpers + * + * Copyright (C) 2018 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + * + * Author: Fabiano Fid=C3=AAncio + */ + +#ifndef __VIR_BLKIO_H__ +# define __VIR_BLKIO_H__ + +# include "virutil.h" + +typedef struct _virBlkioDevice virBlkioDevice; +typedef virBlkioDevice *virBlkioDevicePtr; +struct _virBlkioDevice { + char *path; + unsigned int weight; + unsigned int riops; + unsigned int wiops; + unsigned long long rbps; + unsigned long long wbps; +}; + + +typedef struct _virBlkioTune virBlkioTune; +typedef virBlkioTune *virBlkioTunePtr; +struct _virBlkioTune { + unsigned int weight; + + size_t ndevices; + virBlkioDevicePtr devices; +}; + +void virBlkioDeviceArrayClear(virBlkioDevicePtr deviceWeights, + int ndevices); + +#endif /* __VIR_BLKIO_H__ */ --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list