From nobody Sun Feb 8 15:30:54 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1607961447; cv=none; d=zohomail.com; s=zohoarc; b=kUJOwivBvYWADO5ViAQETfvfHFkrDq0jwXOBNhT/zSvVeb+R/W6UyeNYPxHzKotFDKY972lqIfFc3UhzrN1Tn/dTV3VbW3gTZVxucylWPaBc7PRn2P9LD+oLCLjC3xhzqUrwOIZKcAUuupxfTClNVKF2JisRMqO+gWk0tjOHy9Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607961447; 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; bh=ZaQOb9OO9PEu3hgMp6tA+hw9tWVbdch+17yliwUVmuE=; b=hVWCNuv+v/NK6CEfeZ+RoKdzrPd5z2aJ+W5E5eIUtYyxz+w+I1nz2xo1XziLyRZMAsgT02pa4JNSPitScU8PIt9uhegZ35WivJZRnvT4/VZAHv3jKLX2QbWqhtfTSpOcH45gJM4rl61k/2zc7v+nN9MCFIWwUtRAbvLhUcOzI9g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) 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 1607961447172906.461783179588; Mon, 14 Dec 2020 07:57:27 -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-520-LlIVLbUxMcmMbQn24FcoDw-1; Mon, 14 Dec 2020 10:56:25 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 87D74107ACFE; Mon, 14 Dec 2020 15:56:19 +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 32551E700; Mon, 14 Dec 2020 15:56:19 +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 E95D950040; Mon, 14 Dec 2020 15:56:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BEFtqb1028593 for ; Mon, 14 Dec 2020 10:55:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 29F6F17B77; Mon, 14 Dec 2020 15:55:52 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.194.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B81F5D6D5 for ; Mon, 14 Dec 2020 15:55:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607961444; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ZaQOb9OO9PEu3hgMp6tA+hw9tWVbdch+17yliwUVmuE=; b=UksZZIgBQiJOI9LtMz8shlaSq4NWS276HYtf7dM8pQBlNDFMPl8qNmgNpSRz85hZsmSjo+ hiM6j0x5OPVsf5MlyygSy5Y8mt4uDvoHKuOVH6blUIomLLqEHZLB0UuQcu6yyQMIvcrn+s G2weoQVl951oNY2gnH2VTGvCsZi1JVM= X-MC-Unique: LlIVLbUxMcmMbQn24FcoDw-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 10/17] virstoragefile: move virStorageIsRelative into virfile Date: Mon, 14 Dec 2020 16:55:30 +0100 Message-Id: <1a5a60eb1bdfb0b42fbdb8b8befb71840e106140.1607960951.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- src/libvirt_private.syms | 2 +- src/qemu/qemu_block.c | 2 +- src/qemu/qemu_snapshot.c | 2 +- src/util/virfile.c | 13 +++++++++++++ src/util/virfile.h | 2 ++ src/util/virstoragefile.c | 15 +-------------- src/util/virstoragefile.h | 2 -- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 0b560dfe45..1bbf567847 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2094,6 +2094,7 @@ virFileIsFile; virFileIsLink; virFileIsMountPoint; virFileIsRegular; +virFileIsRelative; virFileIsSharedFS; virFileIsSharedFSType; virFileLength; @@ -3157,7 +3158,6 @@ virStorageFileSupportsBackingChainTraversal; virStorageFileSupportsCreate; virStorageFileSupportsSecurityDriver; virStorageFileUnlink; -virStorageIsRelative; virStorageNetHostDefClear; virStorageNetHostDefCopy; virStorageNetHostDefFree; diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 4640e339c0..0743db4d2c 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -3357,7 +3357,7 @@ qemuBlockUpdateRelativeBacking(virDomainObjPtr vm, if (rc < 0) return rc; =20 - if (backingStoreStr && virStorageIsRelative(backingStoreStr)) + if (backingStoreStr && virFileIsRelative(backingStoreStr)) n->backingStore->relPath =3D g_steal_pointer(&backingStoreStr); } =20 diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 15494c3415..6f64111ca8 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1075,7 +1075,7 @@ qemuSnapshotDiskPrepareOne(virDomainObjPtr vm, if (virStorageFileGetBackingStoreStr(dd->src, &backingStor= eStr) < 0) return -1; if (backingStoreStr !=3D NULL) { - if (virStorageIsRelative(backingStoreStr)) + if (virFileIsRelative(backingStoreStr)) dd->relPath =3D g_steal_pointer(&backingStoreStr); } } diff --git a/src/util/virfile.c b/src/util/virfile.c index 7a7468b202..c3f0e7cabc 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -2016,6 +2016,19 @@ virFileIsFile(const char *backing) } =20 =20 +bool +virFileIsRelative(const char *path) +{ + if (path[0] =3D=3D '/') + return false; + + if (!virFileIsFile(path)) + return false; + + return true; +} + + #if defined WITH_MNTENT_H && defined WITH_GETMNTENT_R static int virFileGetMountSubtreeImpl(const char *mtabpath, diff --git a/src/util/virfile.h b/src/util/virfile.h index dfd3188ff2..06d9cffd88 100644 --- a/src/util/virfile.h +++ b/src/util/virfile.h @@ -228,6 +228,8 @@ int virFileIsMountPoint(const char *file) ATTRIBUTE_NON= NULL(1); int virFileIsCDROM(const char *path) ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT; bool virFileIsFile(const char *path); +bool virFileIsRelative(const char *path); + =20 int virFileGetMountSubtree(const char *mtabpath, const char *prefix, diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index f37802260b..6ced28762a 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -757,19 +757,6 @@ virStorageFileMatchesVersion(int versionOffset, } =20 =20 -bool -virStorageIsRelative(const char *backing) -{ - if (backing[0] =3D=3D '/') - return false; - - if (!virFileIsFile(backing)) - return false; - - return true; -} - - static int virStorageFileProbeFormatFromBuf(const char *path, char *buf, @@ -3846,7 +3833,7 @@ virStorageSourceNewFromChild(virStorageSourcePtr pare= nt, =20 *child =3D NULL; =20 - if (virStorageIsRelative(parentRaw)) { + if (virFileIsRelative(parentRaw)) { if (!(def =3D virStorageSourceNewFromBackingRelative(parent, paren= tRaw))) return -1; } else { diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 2a44a535a1..d39486ad59 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -420,8 +420,6 @@ virStorageSourcePtr virStorageFileChainLookup(virStorag= eSourcePtr chain, virStorageSourcePtr *parent) ATTRIBUTE_NONNULL(1); =20 -bool virStorageIsRelative(const char *backing); - int virStorageFileGetSCSIKey(const char *path, char **key, bool ignoreError); --=20 2.28.0