Introduce virStorageSourceSlice which will store the 'offset' and 'size'
of a virStorageSource and declare it as 'sliceStorage' and 'sliceFormat'
attributes of a virStorageSource.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/util/virstoragefile.c | 18 ++++++++++++++++++
src/util/virstoragefile.h | 12 ++++++++++++
2 files changed, 30 insertions(+)
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 7ffb2cdcf4..30d5a2fe67 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2248,6 +2248,18 @@ virStorageSourcePoolDefCopy(const virStorageSourcePoolDef *src)
}
+static virStorageSourceSlicePtr
+virStorageSourceSliceCopy(const virStorageSourceSlice *src)
+{
+ virStorageSourceSlicePtr ret = g_new0(virStorageSourceSlice, 1);
+
+ ret->offset = src->offset;
+ ret->size = src->size;
+
+ return ret;
+}
+
+
/**
* virStorageSourcePtr:
*
@@ -2302,6 +2314,9 @@ virStorageSourceCopy(const virStorageSource *src,
def->tlsAlias = g_strdup(src->tlsAlias);
def->tlsCertdir = g_strdup(src->tlsCertdir);
+ def->sliceFormat = virStorageSourceSliceCopy(src->sliceFormat);
+ def->sliceStorage = virStorageSourceSliceCopy(src->sliceStorage);
+
if (src->nhosts) {
if (!(def->hosts = virStorageNetHostDefCopy(src->nhosts, src->hosts)))
return NULL;
@@ -2581,6 +2596,9 @@ virStorageSourceClear(virStorageSourcePtr def)
VIR_FREE(def->timestamps);
VIR_FREE(def->externalDataStoreRaw);
+ VIR_FREE(def->sliceFormat);
+ VIR_FREE(def->sliceStorage);
+
virObjectUnref(def->externalDataStore);
def->externalDataStore = NULL;
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 39e50a989d..a6b474ec51 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -242,6 +242,15 @@ struct _virStorageSourceNVMeDef {
/* Don't forget to update virStorageSourceNVMeDefCopy */
};
+
+typedef struct _virStorageSourceSlice virStorageSourceSlice;
+typedef virStorageSourceSlice *virStorageSourceSlicePtr;
+struct _virStorageSourceSlice {
+ unsigned long long offset;
+ unsigned long long size;
+};
+
+
typedef struct _virStorageDriverData virStorageDriverData;
typedef virStorageDriverData *virStorageDriverDataPtr;
@@ -286,6 +295,9 @@ struct _virStorageSource {
bool nocow;
bool sparse;
+ virStorageSourceSlicePtr sliceFormat;
+ virStorageSourceSlicePtr sliceStorage;
+
virStoragePermsPtr perms;
virStorageTimestampsPtr timestamps;
unsigned long long capacity; /* in bytes, 0 if unknown */
--
2.24.1