]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: Add feature check for storage file backend supporting access check
authorPeter Krempa <pkrempa@redhat.com>
Mon, 16 Oct 2017 11:42:21 +0000 (13:42 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 3 Nov 2017 08:15:41 +0000 (09:15 +0100)
When the user provides backing chain, we don't need the full support for
traversing the backing chain. This patch adds a feature check for the
virStorageSourceAccess API.

src/storage/storage_source.c
src/storage/storage_source.h

index e3c5c3285af01bc060f177ac05284257a5aaaac1..cced5308c76178eff96348f62362c48d6a9bf998 100644 (file)
@@ -95,6 +95,26 @@ virStorageFileSupportsSecurityDriver(const virStorageSource *src)
 }
 
 
+/**
+ * virStorageFileSupportsAccess:
+ *
+ * @src: a storage file structure
+ *
+ * Check if a storage file supports checking if the storage source is accessible
+ * for the given vm.
+ */
+bool
+virStorageFileSupportsAccess(const virStorageSource *src)
+{
+    virStorageFileBackendPtr backend;
+
+    if (!(backend = virStorageFileGetBackendForSupportCheck(src)))
+        return false;
+
+    return !!backend->storageFileAccess;
+}
+
+
 void
 virStorageFileDeinit(virStorageSourcePtr src)
 {
index 6462baf6aeac55d2759e4ed5d7db9ed8a2ff93b9..320ea3cab7af558270092388e174b57b79fed1c2 100644 (file)
@@ -41,6 +41,7 @@ int virStorageFileAccess(virStorageSourcePtr src, int mode);
 int virStorageFileChown(const virStorageSource *src, uid_t uid, gid_t gid);
 
 bool virStorageFileSupportsSecurityDriver(const virStorageSource *src);
+bool virStorageFileSupportsAccess(const virStorageSource *src);
 
 int virStorageFileGetMetadata(virStorageSourcePtr src,
                               uid_t uid, gid_t gid,