[PATCH 2/2] Remove unnecessary virDomainDefClearDeviceAliases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nothing in the code path after the removed call has needs/uses the alias
anyway (as would be the case for command line building or talking to monitor).
The alias is VIR_FREE'd in virDomainDeviceInfoClear which is called for any
device that needs/uses an alias via virDomainDeviceDefFree or virDomainDefFree
as well as during virDomainDeviceInfoFree for host devices.

For persistent domains, the domain definition (including aliases) gets
freed a few screens later when it's replaced with newDef.

For transient domains, the definition is freed/unref'd along with the
virDomainObj a few moments later.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/conf/domain_conf.c   | 15 ---------------
 src/conf/domain_conf.h   |  1 -
 src/libvirt_private.syms |  1 -
 src/qemu/qemu_process.c  |  2 --
 4 files changed, 19 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 132044f..13e5dc9 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3352,15 +3352,6 @@ void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info)
 }
 
 
-static int virDomainDeviceInfoClearAlias(virDomainDefPtr def ATTRIBUTE_UNUSED,
-                                         virDomainDeviceDefPtr device ATTRIBUTE_UNUSED,
-                                         virDomainDeviceInfoPtr info,
-                                         void *opaque ATTRIBUTE_UNUSED)
-{
-    VIR_FREE(info->alias);
-    return 0;
-}
-
 static int
 virDomainDeviceInfoIterateInternal(virDomainDefPtr def,
                                    virDomainDeviceInfoCallback cb,
@@ -4729,12 +4720,6 @@ virDomainDefValidate(virDomainDefPtr def,
 }
 
 
-void virDomainDefClearDeviceAliases(virDomainDefPtr def)
-{
-    virDomainDeviceInfoIterate(def, virDomainDeviceInfoClearAlias, NULL);
-}
-
-
 /* Generate a string representation of a device address
  * @info address Device address to stringify
  */
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ac32468..3c2f182 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2534,7 +2534,6 @@ virDomainDeviceInfoPtr virDomainDeviceGetInfo(virDomainDeviceDefPtr device);
 int virDomainDeviceInfoCopy(virDomainDeviceInfoPtr dst,
                             virDomainDeviceInfoPtr src);
 void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info);
-void virDomainDefClearDeviceAliases(virDomainDefPtr def);
 void virDomainTPMDefFree(virDomainTPMDefPtr def);
 
 typedef int (*virDomainDeviceInfoCallback)(virDomainDefPtr def,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index e15309a..b8330d0 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -209,7 +209,6 @@ virDomainDefAddController;
 virDomainDefAddImplicitDevices;
 virDomainDefAddUSBController;
 virDomainDefCheckABIStability;
-virDomainDefClearDeviceAliases;
 virDomainDefCompatibleDevice;
 virDomainDefCopy;
 virDomainDefFindDevice;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 4adb14e..76be3de 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5689,8 +5689,6 @@ void qemuProcessStop(virQEMUDriverPtr driver,
     virStringFreeList(priv->qemuDevices);
     priv->qemuDevices = NULL;
 
-    virDomainDefClearDeviceAliases(vm->def);
-
     qemuHostdevReAttachDomainDevices(driver, vm->def);
 
     def = vm->def;
-- 
2.5.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]