[REPOST PATCH v6 3/8] 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        | 44 -------------------------------------------
 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, 11 insertions(+), 79 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 32b4cc9da9..9641295c57 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2451,7 +2451,7 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def)
 
 
 virDomainHostdevDefPtr
-virDomainHostdevDefNew(virDomainXMLOptionPtr xmlopt)
+virDomainHostdevDefNew(void)
 {
     virDomainHostdevDefPtr def;
 
@@ -2461,11 +2461,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:
@@ -2544,9 +2539,6 @@ void virDomainHostdevDefClear(virDomainHostdevDefPtr def)
         }
         break;
     }
-
-    virObjectUnref(def->privateData);
-    def->privateData = NULL;
 }
 
 void virDomainTPMDefFree(virDomainTPMDefPtr def)
@@ -14683,7 +14675,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 c5a8d9b99a..5d01bb70d4 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 */
@@ -2607,7 +2606,6 @@ struct _virDomainXMLPrivateDataCallbacks {
     /* note that private data for devices are not copied when using
      * virDomainDefCopy and similar functions */
     virDomainXMLPrivateDataNewFunc    diskNew;
-    virDomainXMLPrivateDataNewFunc    hostdevNew;
     virDomainXMLPrivateDataNewFunc    vcpuNew;
     virDomainXMLPrivateDataNewFunc    chrSourceNew;
     virDomainXMLPrivateDataFormatFunc format;
@@ -2732,7 +2730,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 68636dc2a4..fdc03a57ea 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 31ec91fa12..66fa069b6f 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -965,49 +965,6 @@ qemuDomainStorageSourcePrivateDispose(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);
 
@@ -2476,7 +2433,6 @@ virDomainXMLPrivateDataCallbacks virQEMUDriverPrivateDataCallbacks = {
     .free = qemuDomainObjPrivateFree,
     .diskNew = qemuDomainDiskPrivateNew,
     .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 e021da51fc..f39fecbc52 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -376,10 +376,6 @@ struct _qemuDomainStorageSourcePrivate {
 
 virObjectPtr qemuDomainStorageSourcePrivateNew(void);
 
-# define QEMU_DOMAIN_HOSTDEV_PRIVATE(hostdev) \
-    ((qemuDomainHostdevPrivatePtr) (hostdev)->privateData)
-
-
 typedef struct _qemuDomainVcpuPrivate qemuDomainVcpuPrivate;
 typedef qemuDomainVcpuPrivate *qemuDomainVcpuPrivatePtr;
 struct _qemuDomainVcpuPrivate {
@@ -414,16 +410,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 5333163850..5d5e44792d 100644
--- a/src/qemu/qemu_parse_command.c
+++ b/src/qemu/qemu_parse_command.c
@@ -1156,7 +1156,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;
@@ -1206,7 +1206,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 a1d9b2e7d4..33aefabe5b 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -3034,7 +3034,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 8fc24b24eb..ded0acab9d 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 26af770713..e868c05695 100644
--- a/src/xenconfig/xen_sxpr.c
+++ b/src/xenconfig/xen_sxpr.c
@@ -1105,7 +1105,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 a61f1d7d58..bf6c98c86b 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 54aa470968..5b03cb6aee 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