A fairly smooth transition. And now that domain disks and storage volumes share a common struct, it opens the doors for a future patch to expose more details in the XML for both objects. * src/conf/storage_conf.h (_virStorageVolTarget): Delete. (_virStorageVolDef): Use common type. * src/conf/storage_conf.c (virStorageVolDefFree) (virStorageVolTargetDefFormat): Update clients. * src/storage/storage_backend.h: Likewise. * src/storage/storage_backend.c (virStorageBackendDetectBlockVolFormatFD) (virStorageBackendUpdateVolTargetInfo) (virStorageBackendUpdateVolTargetInfoFD): Likewise. * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget): Likewise. Signed-off-by: Eric Blake <eblake@xxxxxxxxxx> --- src/conf/storage_conf.c | 20 +++----------------- src/conf/storage_conf.h | 22 ++-------------------- src/storage/storage_backend.c | 6 +++--- src/storage/storage_backend.h | 4 ++-- src/storage/storage_backend_fs.c | 2 +- 5 files changed, 11 insertions(+), 43 deletions(-) diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index e4986e6..a96f4d6 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -329,22 +329,8 @@ virStorageVolDefFree(virStorageVolDefPtr def) } VIR_FREE(def->source.extents); - VIR_FREE(def->target.compat); - virBitmapFree(def->target.features); - VIR_FREE(def->target.path); - if (def->target.perms) { - VIR_FREE(def->target.perms->label); - VIR_FREE(def->target.perms); - } - VIR_FREE(def->target.timestamps); - virStorageEncryptionFree(def->target.encryption); - VIR_FREE(def->backingStore.path); - if (def->backingStore.perms) { - VIR_FREE(def->backingStore.perms->label); - VIR_FREE(def->backingStore.perms); - } - VIR_FREE(def->backingStore.timestamps); - virStorageEncryptionFree(def->backingStore.encryption); + virStorageSourceClear(&def->target); + virStorageSourceClear(&def->backingStore); VIR_FREE(def); } @@ -1528,7 +1514,7 @@ virStorageVolTimestampFormat(virBufferPtr buf, const char *name, static int virStorageVolTargetDefFormat(virStorageVolOptionsPtr options, virBufferPtr buf, - virStorageVolTargetPtr def, + virStorageSourcePtr def, const char *type) { virBufferAsprintf(buf, "<%s>\n", type); diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h index 507f08b..66b5a3b 100644 --- a/src/conf/storage_conf.h +++ b/src/conf/storage_conf.h @@ -56,24 +56,6 @@ struct _virStorageVolSource { }; -/* - * How the volume appears on the host - */ -typedef struct _virStorageVolTarget virStorageVolTarget; -typedef virStorageVolTarget *virStorageVolTargetPtr; -struct _virStorageVolTarget { - char *path; - int format; /* enum virStorageFileFormat */ - virStoragePermsPtr perms; - virStorageTimestampsPtr timestamps; - - /* The next three are currently only used in vol->target, - * not in vol->backingStore. */ - virStorageEncryptionPtr encryption; - virBitmapPtr features; - char *compat; -}; - typedef struct _virStorageVolDef virStorageVolDef; typedef virStorageVolDef *virStorageVolDefPtr; struct _virStorageVolDef { @@ -87,8 +69,8 @@ struct _virStorageVolDef { unsigned long long capacity; /* bytes */ virStorageVolSource source; - virStorageVolTarget target; - virStorageVolTarget backingStore; + virStorageSource target; + virStorageSource backingStore; }; typedef struct _virStorageVolDefList virStorageVolDefList; diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index c21504d..9abaccd 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -1236,7 +1236,7 @@ static struct diskType const disk_types[] = { static int -virStorageBackendDetectBlockVolFormatFD(virStorageVolTargetPtr target, +virStorageBackendDetectBlockVolFormatFD(virStorageSourcePtr target, int fd) { size_t i; @@ -1384,7 +1384,7 @@ virStorageBackendVolOpen(const char *path, struct stat *sb, } int -virStorageBackendUpdateVolTargetInfo(virStorageVolTargetPtr target, +virStorageBackendUpdateVolTargetInfo(virStorageSourcePtr target, unsigned long long *allocation, unsigned long long *capacity, bool withBlockVolFormat, @@ -1451,7 +1451,7 @@ virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol, * Returns 0 for success, -1 on a legitimate error condition. */ int -virStorageBackendUpdateVolTargetInfoFD(virStorageVolTargetPtr target, +virStorageBackendUpdateVolTargetInfoFD(virStorageSourcePtr target, int fd, struct stat *sb, unsigned long long *allocation, diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h index c0d1668..8442c13 100644 --- a/src/storage/storage_backend.h +++ b/src/storage/storage_backend.h @@ -141,12 +141,12 @@ int virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol, bool withCapacity, bool withBlockVolFormat, unsigned int openflags); -int virStorageBackendUpdateVolTargetInfo(virStorageVolTargetPtr target, +int virStorageBackendUpdateVolTargetInfo(virStorageSourcePtr target, unsigned long long *allocation, unsigned long long *capacity, bool withBlockVolFormat, unsigned int openflags); -int virStorageBackendUpdateVolTargetInfoFD(virStorageVolTargetPtr target, +int virStorageBackendUpdateVolTargetInfoFD(virStorageSourcePtr target, int fd, struct stat *sb, unsigned long long *allocation, diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index b361804..113593b 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -62,7 +62,7 @@ VIR_LOG_INIT("storage.storage_backend_fs"); ~VIR_STORAGE_VOL_OPEN_ERROR) static int ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) -virStorageBackendProbeTarget(virStorageVolTargetPtr target, +virStorageBackendProbeTarget(virStorageSourcePtr target, char **backingStore, int *backingStoreFormat, unsigned long long *allocation, -- 1.9.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list