1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

conf: Move 'driverName' back to disk definition structure

Currently it is not used in backing chains and does not seem that we
will need to use it so return it back to the disk definition. Thankfully
most accesses are done via the accessors.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Peter Krempa 2018-04-10 16:57:22 +02:00
parent b2e54a3377
commit 4fdcf67a63
4 changed files with 8 additions and 12 deletions

View File

@ -1784,6 +1784,7 @@ virDomainDiskDefFree(virDomainDiskDefPtr def)
VIR_FREE(def->dst); VIR_FREE(def->dst);
virStorageSourceFree(def->mirror); virStorageSourceFree(def->mirror);
VIR_FREE(def->wwn); VIR_FREE(def->wwn);
VIR_FREE(def->driverName);
VIR_FREE(def->vendor); VIR_FREE(def->vendor);
VIR_FREE(def->product); VIR_FREE(def->product);
VIR_FREE(def->domain_name); VIR_FREE(def->domain_name);
@ -1848,7 +1849,7 @@ virDomainDiskEmptySource(virDomainDiskDefPtr def)
const char * const char *
virDomainDiskGetDriver(const virDomainDiskDef *def) virDomainDiskGetDriver(const virDomainDiskDef *def)
{ {
return def->src->driverName; return def->driverName;
} }
@ -1856,11 +1857,11 @@ int
virDomainDiskSetDriver(virDomainDiskDefPtr def, const char *name) virDomainDiskSetDriver(virDomainDiskDefPtr def, const char *name)
{ {
int ret; int ret;
char *tmp = def->src->driverName; char *tmp = def->driverName;
ret = VIR_STRDUP(def->src->driverName, name); ret = VIR_STRDUP(def->driverName, name);
if (ret < 0) if (ret < 0)
def->src->driverName = tmp; def->driverName = tmp;
else else
VIR_FREE(tmp); VIR_FREE(tmp);
return ret; return ret;
@ -9137,7 +9138,7 @@ virDomainDiskDefDriverParseXML(virDomainDiskDefPtr def,
char *tmp = NULL; char *tmp = NULL;
int ret = -1; int ret = -1;
def->src->driverName = virXMLPropString(cur, "name"); def->driverName = virXMLPropString(cur, "name");
if ((tmp = virXMLPropString(cur, "cache")) && if ((tmp = virXMLPropString(cur, "cache")) &&
(def->cachemode = virDomainDiskCacheTypeFromString(tmp)) < 0) { (def->cachemode = virDomainDiskCacheTypeFromString(tmp)) < 0) {

View File

@ -644,6 +644,8 @@ struct _virDomainDiskDef {
virDomainBlockIoTuneInfo blkdeviotune; virDomainBlockIoTuneInfo blkdeviotune;
char *driverName;
char *serial; char *serial;
char *wwn; char *wwn;
char *vendor; char *vendor;

View File

@ -2048,7 +2048,6 @@ virStorageSourceCopy(const virStorageSource *src,
if (VIR_STRDUP(ret->path, src->path) < 0 || if (VIR_STRDUP(ret->path, src->path) < 0 ||
VIR_STRDUP(ret->volume, src->volume) < 0 || VIR_STRDUP(ret->volume, src->volume) < 0 ||
VIR_STRDUP(ret->driverName, src->driverName) < 0 ||
VIR_STRDUP(ret->relPath, src->relPath) < 0 || VIR_STRDUP(ret->relPath, src->relPath) < 0 ||
VIR_STRDUP(ret->backingStoreRaw, src->backingStoreRaw) < 0 || VIR_STRDUP(ret->backingStoreRaw, src->backingStoreRaw) < 0 ||
VIR_STRDUP(ret->snapshot, src->snapshot) < 0 || VIR_STRDUP(ret->snapshot, src->snapshot) < 0 ||
@ -2135,10 +2134,6 @@ virStorageSourceInitChainElement(virStorageSourcePtr newelem,
virStorageSourceSeclabelsCopy(newelem, old) < 0) virStorageSourceSeclabelsCopy(newelem, old) < 0)
goto cleanup; goto cleanup;
if (!newelem->driverName &&
VIR_STRDUP(newelem->driverName, old->driverName) < 0)
goto cleanup;
newelem->shared = old->shared; newelem->shared = old->shared;
newelem->readonly = old->readonly; newelem->readonly = old->readonly;
@ -2266,7 +2261,6 @@ virStorageSourceClear(virStorageSourcePtr def)
VIR_FREE(def->snapshot); VIR_FREE(def->snapshot);
VIR_FREE(def->configFile); VIR_FREE(def->configFile);
virStorageSourcePoolDefFree(def->srcpool); virStorageSourcePoolDefFree(def->srcpool);
VIR_FREE(def->driverName);
virBitmapFree(def->features); virBitmapFree(def->features);
VIR_FREE(def->compat); VIR_FREE(def->compat);
virStorageEncryptionFree(def->encryption); virStorageEncryptionFree(def->encryption);

View File

@ -246,7 +246,6 @@ struct _virStorageSource {
virObjectPtr privateData; virObjectPtr privateData;
char *driverName;
int format; /* virStorageFileFormat in domain backing chains, but int format; /* virStorageFileFormat in domain backing chains, but
* pool-specific enum for storage volumes */ * pool-specific enum for storage volumes */
virBitmapPtr features; virBitmapPtr features;