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 (virStorageBackendUpdateVolTargetInfo) (virStorageBackendUpdateVolTargetInfoFD) (virStorageBackendDetectBlockVolFormatFD): Likewise. * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget): Likewise. * src/storage/storage_backend_scsi.c (virStorageBackendSCSIUpdateVolTargetInfo): Likewise. * src/storage/storage_backend_mpath.c (virStorageBackendMpathUpdateVolTargetInfo): Likewise. Signed-off-by: Eric Blake <eblake@xxxxxxxxxx> --- src/conf/storage_conf.c | 20 +++----------------- src/conf/storage_conf.h | 23 ++--------------------- src/storage/storage_backend.c | 6 +++--- src/storage/storage_backend.h | 6 +++--- src/storage/storage_backend_fs.c | 2 +- src/storage/storage_backend_mpath.c | 4 ++-- src/storage/storage_backend_scsi.c | 2 +- 7 files changed, 15 insertions(+), 48 deletions(-) diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 49b790d..fe98b18 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 eb09443..d16d679 100644 --- a/src/conf/storage_conf.h +++ b/src/conf/storage_conf.h @@ -53,25 +53,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; - int partType; /* enum virStorageVolTypeDisk, only used by disk - * backend for partition type */ - /* 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 { @@ -85,8 +66,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 00066da..6204f18 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -1317,7 +1317,7 @@ int virStorageBackendVolOpen(const char *path) } int -virStorageBackendUpdateVolTargetInfo(virStorageVolTargetPtr target, +virStorageBackendUpdateVolTargetInfo(virStorageSourcePtr target, unsigned long long *allocation, unsigned long long *capacity, unsigned int openflags) @@ -1381,7 +1381,7 @@ int 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, @@ -1502,7 +1502,7 @@ static struct diskType const disk_types[] = { int -virStorageBackendDetectBlockVolFormatFD(virStorageVolTargetPtr target, +virStorageBackendDetectBlockVolFormatFD(virStorageSourcePtr target, int fd) { size_t i; diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h index 2034a22..3ff3e5c 100644 --- a/src/storage/storage_backend.h +++ b/src/storage/storage_backend.h @@ -142,16 +142,16 @@ int virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol, int virStorageBackendUpdateVolInfoFlags(virStorageVolDefPtr vol, int withCapacity, unsigned int openflags); -int virStorageBackendUpdateVolTargetInfo(virStorageVolTargetPtr target, +int virStorageBackendUpdateVolTargetInfo(virStorageSourcePtr target, unsigned long long *allocation, unsigned long long *capacity, unsigned int openflags); -int virStorageBackendUpdateVolTargetInfoFD(virStorageVolTargetPtr target, +int virStorageBackendUpdateVolTargetInfoFD(virStorageSourcePtr target, int fd, struct stat *sb, unsigned long long *allocation, unsigned long long *capacity); -int virStorageBackendDetectBlockVolFormatFD(virStorageVolTargetPtr target, +int virStorageBackendDetectBlockVolFormatFD(virStorageSourcePtr target, int fd); char *virStorageBackendStablePath(virStoragePoolObjPtr pool, diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index fd03ca4..3fef6bd 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, diff --git a/src/storage/storage_backend_mpath.c b/src/storage/storage_backend_mpath.c index 82e3e20..6ee278b 100644 --- a/src/storage/storage_backend_mpath.c +++ b/src/storage/storage_backend_mpath.c @@ -1,7 +1,7 @@ /* * storage_backend_mpath.c: storage backend for multipath handling * - * Copyright (C) 2009-2011, 2013 Red Hat, Inc. + * Copyright (C) 2009-2014 Red Hat, Inc. * Copyright (C) 2009-2008 Dave Allan * * This library is free software; you can redistribute it and/or @@ -42,7 +42,7 @@ VIR_LOG_INIT("storage.storage_backend_mpath"); static int -virStorageBackendMpathUpdateVolTargetInfo(virStorageVolTargetPtr target, +virStorageBackendMpathUpdateVolTargetInfo(virStorageSourcePtr target, unsigned long long *allocation, unsigned long long *capacity) { diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c index a318f29..f7693a0 100644 --- a/src/storage/storage_backend_scsi.c +++ b/src/storage/storage_backend_scsi.c @@ -103,7 +103,7 @@ getDeviceType(uint32_t host, } static int -virStorageBackendSCSIUpdateVolTargetInfo(virStorageVolTargetPtr target, +virStorageBackendSCSIUpdateVolTargetInfo(virStorageSourcePtr target, unsigned long long *allocation, unsigned long long *capacity) { -- 1.9.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list