[PATCH v5 12/16] qemu: Remove private hostdev

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

 



Since it's not longer used to shuttle the @secinfo, let's remove
the private hostdev completely.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/conf/domain_conf.c        | 12 ++---------
 src/conf/domain_conf.h        |  4 +---
 src/lxc/lxc_native.c          |  2 +-
 src/qemu/qemu_domain.c        | 50 +++----------------------------------------
 src/qemu/qemu_domain.h        | 14 ------------
 src/qemu/qemu_parse_command.c |  4 ++--
 src/vbox/vbox_common.c        |  2 +-
 src/xenconfig/xen_common.c    |  2 +-
 src/xenconfig/xen_sxpr.c      |  2 +-
 src/xenconfig/xen_xl.c        |  2 +-
 tests/virhostdevtest.c        |  2 +-
 11 files changed, 14 insertions(+), 82 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c9a0628001..bd85a3b27b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2468,7 +2468,7 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def)
 
 
 virDomainHostdevDefPtr
-virDomainHostdevDefNew(virDomainXMLOptionPtr xmlopt)
+virDomainHostdevDefNew(void)
 {
     virDomainHostdevDefPtr def;
 
@@ -2478,11 +2478,6 @@ virDomainHostdevDefNew(virDomainXMLOptionPtr xmlopt)
     if (VIR_ALLOC(def->info) < 0)
         goto error;
 
-    if (xmlopt &&
-        xmlopt->privateData.hostdevNew &&
-        !(def->privateData = xmlopt->privateData.hostdevNew()))
-        goto error;
-
     return def;
 
  error:
@@ -2561,9 +2556,6 @@ void virDomainHostdevDefClear(virDomainHostdevDefPtr def)
         }
         break;
     }
-
-    virObjectUnref(def->privateData);
-    def->privateData = NULL;
 }
 
 void virDomainTPMDefFree(virDomainTPMDefPtr def)
@@ -14459,7 +14451,7 @@ virDomainHostdevDefParseXML(virDomainXMLOptionPtr xmlopt,
 
     ctxt->node = node;
 
-    if (!(def = virDomainHostdevDefNew(xmlopt)))
+    if (!(def = virDomainHostdevDefNew()))
         goto error;
 
     if (mode) {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index dd3017e31b..169b90c754 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -439,7 +439,6 @@ struct _virDomainHostdevCaps {
 /* basic device for direct passthrough */
 struct _virDomainHostdevDef {
     virDomainDeviceDef parent; /* higher level Def containing this */
-    virObjectPtr privateData;
 
     int mode; /* enum virDomainHostdevMode */
     int startupPolicy; /* enum virDomainStartupPolicy */
@@ -2619,7 +2618,6 @@ struct _virDomainXMLPrivateDataCallbacks {
      * virDomainDefCopy and similar functions */
     virDomainXMLPrivateDataNewFunc    diskNew;
     virDomainXMLPrivateDataNewFunc    diskSrcNew;
-    virDomainXMLPrivateDataNewFunc    hostdevNew;
     virDomainXMLPrivateDataNewFunc    vcpuNew;
     virDomainXMLPrivateDataNewFunc    chrSourceNew;
     virDomainXMLPrivateDataFormatFunc format;
@@ -2740,7 +2738,7 @@ void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def);
 void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def);
 virDomainVideoDefPtr virDomainVideoDefNew(void);
 void virDomainVideoDefFree(virDomainVideoDefPtr def);
-virDomainHostdevDefPtr virDomainHostdevDefNew(virDomainXMLOptionPtr xmlopt);
+virDomainHostdevDefPtr virDomainHostdevDefNew(void);
 void virDomainHostdevDefClear(virDomainHostdevDefPtr def);
 void virDomainHostdevDefFree(virDomainHostdevDefPtr def);
 void virDomainHubDefFree(virDomainHubDefPtr def);
diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index 5fc6e7cda4..033dd427cd 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -394,7 +394,7 @@ lxcCreateNetDef(const char *type,
 static virDomainHostdevDefPtr
 lxcCreateHostdevDef(int mode, int type, const char *data)
 {
-    virDomainHostdevDefPtr hostdev = virDomainHostdevDefNew(NULL);
+    virDomainHostdevDefPtr hostdev = virDomainHostdevDefNew();
 
     if (!hostdev)
         return NULL;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 916e900e9c..a6c1d605b3 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1025,49 +1025,6 @@ qemuDomainDiskSrcPrivateDispose(void *obj)
 }
 
 
-static virClassPtr qemuDomainHostdevPrivateClass;
-static void qemuDomainHostdevPrivateDispose(void *obj);
-
-static int
-qemuDomainHostdevPrivateOnceInit(void)
-{
-    qemuDomainHostdevPrivateClass =
-        virClassNew(virClassForObject(),
-                    "qemuDomainHostdevPrivate",
-                    sizeof(qemuDomainHostdevPrivate),
-                    qemuDomainHostdevPrivateDispose);
-    if (!qemuDomainHostdevPrivateClass)
-        return -1;
-    else
-        return 0;
-}
-
-VIR_ONCE_GLOBAL_INIT(qemuDomainHostdevPrivate)
-
-static virObjectPtr
-qemuDomainHostdevPrivateNew(void)
-{
-    qemuDomainHostdevPrivatePtr priv;
-
-    if (qemuDomainHostdevPrivateInitialize() < 0)
-        return NULL;
-
-    if (!(priv = virObjectNew(qemuDomainHostdevPrivateClass)))
-        return NULL;
-
-    return (virObjectPtr) priv;
-}
-
-
-static void
-qemuDomainHostdevPrivateDispose(void *obj)
-{
-    qemuDomainHostdevPrivatePtr priv = obj;
-
-    qemuDomainSecretInfoFree(&priv->secinfo);
-}
-
-
 static virClassPtr qemuDomainVcpuPrivateClass;
 static void qemuDomainVcpuPrivateDispose(void *obj);
 
@@ -1480,14 +1437,14 @@ qemuDomainSecretDiskPrepare(virConnectPtr conn,
 void
 qemuDomainSecretHostdevDestroy(virDomainHostdevDefPtr hostdev)
 {
-    qemuDomainDiskSrcPrivatePtr diskSrcPriv;
-
     if (virHostdevIsSCSIDevice(hostdev)) {
         virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
         virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = &scsisrc->u.iscsi;
 
         if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) {
-            diskSrcPriv = QEMU_DOMAIN_DISK_SRC_PRIVATE(iscsisrc->src);
+            qemuDomainDiskSrcPrivatePtr diskSrcPriv =
+                QEMU_DOMAIN_DISK_SRC_PRIVATE(iscsisrc->src);
+
             if (diskSrcPriv && diskSrcPriv->secinfo)
                 qemuDomainSecretInfoFree(&diskSrcPriv->secinfo);
         }
@@ -2409,7 +2366,6 @@ virDomainXMLPrivateDataCallbacks virQEMUDriverPrivateDataCallbacks = {
     .diskNew = qemuDomainDiskPrivateNew,
     .diskSrcNew = qemuDomainDiskSrcPrivateNew,
     .vcpuNew = qemuDomainVcpuPrivateNew,
-    .hostdevNew = qemuDomainHostdevPrivateNew,
     .chrSourceNew = qemuDomainChrSourcePrivateNew,
     .parse = qemuDomainObjPrivateXMLParse,
     .format = qemuDomainObjPrivateXMLFormat,
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 97b2caefe3..35ed7b7c78 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -368,10 +368,6 @@ struct _qemuDomainDiskSrcPrivate {
     qemuDomainSecretInfoPtr encinfo;
 };
 
-# define QEMU_DOMAIN_HOSTDEV_PRIVATE(hostdev)	\
-    ((qemuDomainHostdevPrivatePtr) (hostdev)->privateData)
-
-
 typedef struct _qemuDomainVcpuPrivate qemuDomainVcpuPrivate;
 typedef qemuDomainVcpuPrivate *qemuDomainVcpuPrivatePtr;
 struct _qemuDomainVcpuPrivate {
@@ -406,16 +402,6 @@ struct qemuDomainDiskInfo {
     char *nodename;
 };
 
-typedef struct _qemuDomainHostdevPrivate qemuDomainHostdevPrivate;
-typedef qemuDomainHostdevPrivate *qemuDomainHostdevPrivatePtr;
-struct _qemuDomainHostdevPrivate {
-    virObject parent;
-
-    /* for hostdev storage devices using auth/secret
-     * NB: *not* to be written to qemu domain object XML */
-    qemuDomainSecretInfoPtr secinfo;
-};
-
 # define QEMU_DOMAIN_CHR_SOURCE_PRIVATE(dev)	\
     ((qemuDomainChrSourcePrivatePtr) (dev)->privateData)
 
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
index 37e1149c08..d11686c0a9 100644
--- a/src/qemu/qemu_parse_command.c
+++ b/src/qemu/qemu_parse_command.c
@@ -1158,7 +1158,7 @@ qemuParseCommandLinePCI(const char *val)
     int bus = 0, slot = 0, func = 0;
     const char *start;
     char *end;
-    virDomainHostdevDefPtr def = virDomainHostdevDefNew(NULL);
+    virDomainHostdevDefPtr def = virDomainHostdevDefNew();
 
     if (!def)
         goto error;
@@ -1208,7 +1208,7 @@ qemuParseCommandLinePCI(const char *val)
 static virDomainHostdevDefPtr
 qemuParseCommandLineUSB(const char *val)
 {
-    virDomainHostdevDefPtr def = virDomainHostdevDefNew(NULL);
+    virDomainHostdevDefPtr def = virDomainHostdevDefNew();
     virDomainHostdevSubsysUSBPtr usbsrc;
     int first = 0, second = 0;
     const char *start;
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 92ee371641..3ffaab8578 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -2989,7 +2989,7 @@ vboxHostDeviceGetXMLDesc(vboxDriverPtr data, virDomainDefPtr def, IMachine *mach
         goto release_filters;
 
     for (i = 0; i < def->nhostdevs; i++) {
-        def->hostdevs[i] = virDomainHostdevDefNew(NULL);
+        def->hostdevs[i] = virDomainHostdevDefNew();
         if (!def->hostdevs[i])
             goto release_hostdevs;
     }
diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index 6d7dc2cde4..1ad9935396 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -458,7 +458,7 @@ xenParsePCI(virConfPtr conf, virDomainDefPtr def)
                 goto skippci;
             if (virStrToLong_i(func, NULL, 16, &funcID) < 0)
                 goto skippci;
-            if (!(hostdev = virDomainHostdevDefNew(NULL)))
+            if (!(hostdev = virDomainHostdevDefNew()))
                return -1;
 
             hostdev->managed = false;
diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c
index fefa61ac23..5e7a386b10 100644
--- a/src/xenconfig/xen_sxpr.c
+++ b/src/xenconfig/xen_sxpr.c
@@ -1110,7 +1110,7 @@ xenParseSxprPCI(virDomainDefPtr def,
             goto error;
         }
 
-        if (!(dev = virDomainHostdevDefNew(NULL)))
+        if (!(dev = virDomainHostdevDefNew()))
            goto error;
 
         dev->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index 8acbfe3f69..64011d9cbe 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -733,7 +733,7 @@ xenParseXLUSB(virConfPtr conf, virDomainDefPtr def)
                 goto skipusb;
             if (virStrToLong_i(device, NULL, 16, &devNum) < 0)
                 goto skipusb;
-            if (!(hostdev = virDomainHostdevDefNew(NULL)))
+            if (!(hostdev = virDomainHostdevDefNew()))
                return -1;
 
             hostdev->managed = false;
diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c
index 0ad58ddf3d..66a0a20e39 100644
--- a/tests/virhostdevtest.c
+++ b/tests/virhostdevtest.c
@@ -88,7 +88,7 @@ myInit(void)
 
     for (i = 0; i < nhostdevs; i++) {
         virDomainHostdevSubsys subsys;
-        hostdevs[i] = virDomainHostdevDefNew(NULL);
+        hostdevs[i] = virDomainHostdevDefNew();
         if (!hostdevs[i])
             goto cleanup;
         hostdevs[i]->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
-- 
2.13.6

--
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]
  Powered by Linux