From nobody Mon Feb 9 14:34:50 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=1565280070; cv=none; d=zoho.com; s=zohoarc; b=dUJ0Ox8x9IVKs/Q4BnbuLtUywx7dMLup12XaHguRPN+6jl+ecFuB5xsMY9EPWSq6NgJhXHqOcpyoPUX9BkdL3zI2v2cFWA8Q5FGCH614K4QTTx90BJic4O5ZZWEa2FlpDOy4ap+r2zYgBh9uh2isns7mqjJu6t4mfQ6k5mwCqrU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565280070; 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=2gjvtOSyogxIPf73wP4J/DvF7/zLOVfU/F8R9694n1A=; b=AOOZY/OfqNtT42iOOMGKSoste2GwRGIP9n+CnnMfRjaUzOymieIK3wN4Nlw3opGUZzyG81w9TaJJMhyg+9K/Ha+NP8iYHy9lTSxgF5HZtk0t6puGW4sF8xP2Rn1B254mY7d6l2szQXNms6/1E1ot0vp4dHuGA02zUrfKj8nLVOo= 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 1565280070796866.001623169421; Thu, 8 Aug 2019 09:01:10 -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 C72FC99C42; Thu, 8 Aug 2019 16:01:08 +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 8E1A661F27; Thu, 8 Aug 2019 16:01:08 +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 0CAD324F37; Thu, 8 Aug 2019 16:01:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x78G0oih005393 for ; Thu, 8 Aug 2019 12:00:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 70354F6E6; Thu, 8 Aug 2019 16:00:50 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE70A16BE2 for ; Thu, 8 Aug 2019 16:00:49 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 8 Aug 2019 18:00:35 +0200 Message-Id: <0f899ac954e3b037b3507b214ed46e01f3a34044.1565279921.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/12] util: storage: Allow checking whether virStorageFileCreate is supported 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-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.38]); Thu, 08 Aug 2019 16:01:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Add virStorageFileSupportsCreate which allows silent check whether virStorageFileCreate is implemented. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/libvirt_private.syms | 1 + src/util/virstoragefile.c | 20 ++++++++++++++++++++ src/util/virstoragefile.h | 1 + 3 files changed, 22 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index cae8febf8d..b86868e954 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2995,6 +2995,7 @@ virStorageFileReportBrokenChain; virStorageFileResize; virStorageFileStat; virStorageFileSupportsAccess; +virStorageFileSupportsCreate; virStorageFileSupportsSecurityDriver; virStorageFileUnlink; virStorageIsFile; diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 5882d470de..ba56f452e9 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -4505,6 +4505,26 @@ virStorageFileSupportsAccess(const virStorageSource = *src) } +/** + * virStorageFileSupportsCreate: + * @src: a storage file structure + * + * Check if the storage driver supports creating storage described by @src + * via virStorageFileCreate. + */ +int +virStorageFileSupportsCreate(const virStorageSource *src) +{ + virStorageFileBackendPtr backend; + int rv; + + if ((rv =3D virStorageFileGetBackendForSupportCheck(src, &backend)) < = 1) + return rv; + + return backend->storageFileCreate ? 1 : 0; +} + + void virStorageFileDeinit(virStorageSourcePtr src) { diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 38ba901858..2882bacf3e 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -532,6 +532,7 @@ int virStorageFileChown(const virStorageSource *src, ui= d_t uid, gid_t gid); int virStorageFileSupportsSecurityDriver(const virStorageSource *src); int virStorageFileSupportsAccess(const virStorageSource *src); +int virStorageFileSupportsCreate(const virStorageSource *src); int virStorageFileGetMetadata(virStorageSourcePtr src, uid_t uid, gid_t gid, --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list