From nobody Mon Dec 15 01:55:12 2025 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1513243902350881.5512283509198; Thu, 14 Dec 2017 01:31:42 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F40EA6016A; Thu, 14 Dec 2017 09:31:40 +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 C490418174; Thu, 14 Dec 2017 09:31:40 +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 3BE744A469; Thu, 14 Dec 2017 09:31:40 +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 vBE9VRNd016780 for ; Thu, 14 Dec 2017 04:31:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7823A7EE9E; Thu, 14 Dec 2017 09:31:27 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id A36C17EE9B; Thu, 14 Dec 2017 09:31:26 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 14 Dec 2017 10:30:50 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, Peter Krempa Subject: [libvirt] [PATCH 2/3] util: storage: Add helpers to parse and format relPath into privateData 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: , MIME-Version: 1.0 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 14 Dec 2017 09:31:41 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This will be the first private piece of data that will need to be stored in the XML for some drivers. Add helpers which will do it. --- src/libvirt_private.syms | 2 ++ src/util/virstoragefile.c | 20 ++++++++++++++++++++ src/util/virstoragefile.h | 8 ++++++++ 3 files changed, 30 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index b4b72c0734..d5c3b9abb5 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2734,6 +2734,8 @@ virStorageSourceParseRBDColonString; virStorageSourcePoolDefFree; virStorageSourcePoolModeTypeFromString; virStorageSourcePoolModeTypeToString; +virStorageSourcePrivateDataFormatRelPath; +virStorageSourcePrivateDataParseRelPath; virStorageSourceUpdateBackingSizes; virStorageSourceUpdateCapacity; virStorageSourceUpdatePhysicalSize; diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 6594715e5e..5780180a94 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -4086,3 +4086,23 @@ virStorageSourceNetworkAssignDefaultPorts(virStorage= SourcePtr src) src->hosts[i].port =3D virStorageSourceNetworkDefaultPort(src-= >protocol); } } + + +int +virStorageSourcePrivateDataParseRelPath(xmlXPathContextPtr ctxt, + virStorageSourcePtr src) +{ + src->relPath =3D virXPathString("string(./relPath)", ctxt); + return 0; +} + + +int +virStorageSourcePrivateDataFormatRelPath(virStorageSourcePtr src, + virBufferPtr buf) +{ + if (src->relPath) + virBufferEscapeString(buf, "%s\n", src->relPath= ); + + return 0; +} diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 24382a0a6b..ecd806c93f 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -441,4 +441,12 @@ bool virStorageSourceHasBacking(const virStorageSource *src); +int +virStorageSourcePrivateDataParseRelPath(xmlXPathContextPtr ctxt, + virStorageSourcePtr src); +int +virStorageSourcePrivateDataFormatRelPath(virStorageSourcePtr src, + virBufferPtr buf); + + #endif /* __VIR_STORAGE_FILE_H__ */ --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list