From nobody Tue Feb 10 00:58:04 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 ARC-Seal: i=1; a=rsa-sha256; t=1562569817; cv=none; d=zoho.com; s=zohoarc; b=RvLTbSVUg0jSXHKtdUGDR7re9U0ZprzgyIRhZrPULkoqdhk/Nbc5qUurEKIlPJTu5cFMkrfaewG37hffgEb8Gorjb0pjHKF6gy9hQ2gZhtn2UAur7bXOfTBGwW8Yh025esQmO0MHAVMa5svzfz6n7fFCgM1xapo2jsYf+fqpDuo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562569817; h=Content-Type:Content-Transfer-Encoding:Cc: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=pgf1kq+f4N6LriHp4Hu1haKitZkfjrTbanX4l1BjIcY=; b=XYQ4CtK5kcbXyCxVtSV9EE+WY90X6tzQsAyUzIS/lUx52yzHEUz+hmbxfTY2VBpF5lwSUHYDmcTW5AhSyOJ85LIlFmupOvk2DO0HwCmrEnE+zD4qS0qgdYC6FY8FDknJzh48eyR2c5emFIE+iES9yD8xA1KrvWxZvccaj6ItwBo= 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 156256981735644.69679482810534; Mon, 8 Jul 2019 00:10:17 -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 B586F30BD1B3; Mon, 8 Jul 2019 07:10:15 +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 849FA51966; Mon, 8 Jul 2019 07:10:15 +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 28BA4206D7; Mon, 8 Jul 2019 07:10:15 +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 x687AD8j006880 for ; Mon, 8 Jul 2019 03:10:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id B53C32B9EF; Mon, 8 Jul 2019 07:10:13 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA4FD2C152; Mon, 8 Jul 2019 07:10:05 +0000 (UTC) From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Date: Mon, 8 Jul 2019 11:07:36 +0400 Message-Id: <20190708070747.1962-13-marcandre.lureau@redhat.com> In-Reply-To: <20190708070747.1962-1-marcandre.lureau@redhat.com> References: <20190708070747.1962-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [libvirt] [PATCH 12/23] domain-conf: add network def private data 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.49]); Mon, 08 Jul 2019 07:10:16 +0000 (UTC) From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- src/conf/domain_conf.c | 21 ++++++++++++++++++++- src/conf/domain_conf.h | 6 ++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3323c9a5b1..9e868b5337 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2451,6 +2451,7 @@ virDomainNetDefFree(virDomainNetDefPtr def) if (!def) return; virDomainNetDefClear(def); + virObjectUnref(def->privateData); VIR_FREE(def); } =20 @@ -11434,7 +11435,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop= t, VIR_AUTOFREE(char *) trustGuestRxFilters =3D NULL; VIR_AUTOFREE(char *) vhost_path =3D NULL; =20 - if (VIR_ALLOC(def) < 0) + if (!(def =3D virDomainNetDefNew(xmlopt))) return NULL; =20 ctxt->node =3D node; @@ -14312,6 +14313,24 @@ virDomainGraphicsDefNew(virDomainXMLOptionPtr xmlo= pt) } =20 =20 +virDomainNetDefPtr +virDomainNetDefNew(virDomainXMLOptionPtr xmlopt) +{ + virDomainNetDefPtr def =3D NULL; + + if (VIR_ALLOC(def) < 0) + return NULL; + + if (xmlopt && xmlopt->privateData.networkNew && + !(def->privateData =3D xmlopt->privateData.networkNew())) { + VIR_FREE(def); + def =3D NULL; + } + + return def; +} + + /* Parse the XML definition for a graphics device */ static virDomainGraphicsDefPtr virDomainGraphicsDefParseXML(virDomainXMLOptionPtr xmlopt, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index c1b5fc1337..ebe9ac183e 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1019,6 +1019,7 @@ struct _virDomainNetDef { unsigned int mtu; virNetDevCoalescePtr coalesce; virDomainVirtioOptionsPtr virtio; + virObjectPtr privateData; }; =20 typedef enum { @@ -2708,6 +2709,7 @@ struct _virDomainXMLPrivateDataCallbacks { virDomainXMLPrivateDataNewFunc chrSourceNew; virDomainXMLPrivateDataNewFunc vsockNew; virDomainXMLPrivateDataNewFunc graphicsNew; + virDomainXMLPrivateDataNewFunc networkNew; virDomainXMLPrivateDataFormatFunc format; virDomainXMLPrivateDataParseFunc parse; /* following function shall return a pointer which will be used as the @@ -2891,6 +2893,10 @@ virDomainChrDefPtr virDomainChrDefNew(virDomainXMLOp= tionPtr xmlopt); =20 virDomainGraphicsDefPtr virDomainGraphicsDefNew(virDomainXMLOptionPtr xmlopt); + +virDomainNetDefPtr +virDomainNetDefNew(virDomainXMLOptionPtr xmlopt); + virDomainDefPtr virDomainDefNew(void); =20 void virDomainObjAssignDef(virDomainObjPtr domain, --=20 2.22.0.214.g8dca754b1e -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list