qemu: Remove private hostdev

Since it's not longer used to shuttle the @secinfo, let's remove
the private hostdev completely.
This commit is contained in:
John Ferlan 2017-09-23 07:03:50 -04:00
parent 16eef5c2b4
commit 1d9108cf16
11 changed files with 11 additions and 79 deletions

View File

@ -2478,7 +2478,7 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def)
virDomainHostdevDefPtr
virDomainHostdevDefNew(virDomainXMLOptionPtr xmlopt)
virDomainHostdevDefNew(void)
{
virDomainHostdevDefPtr def;
@ -2488,11 +2488,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:
@ -2571,9 +2566,6 @@ void virDomainHostdevDefClear(virDomainHostdevDefPtr def)
}
break;
}
virObjectUnref(def->privateData);
def->privateData = NULL;
}
void virDomainTPMDefFree(virDomainTPMDefPtr def)
@ -14721,7 +14713,7 @@ virDomainHostdevDefParseXML(virDomainXMLOptionPtr xmlopt,
ctxt->node = node;
if (!(def = virDomainHostdevDefNew(xmlopt)))
if (!(def = virDomainHostdevDefNew()))
goto error;
if (mode) {

View File

@ -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 */
@ -2621,7 +2620,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;
@ -2747,7 +2745,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);

View File

@ -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;

View File

@ -966,49 +966,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);
@ -2479,7 +2436,6 @@ virDomainXMLPrivateDataCallbacks virQEMUDriverPrivateDataCallbacks = {
.free = qemuDomainObjPrivateFree,
.diskNew = qemuDomainDiskPrivateNew,
.vcpuNew = qemuDomainVcpuPrivateNew,
.hostdevNew = qemuDomainHostdevPrivateNew,
.chrSourceNew = qemuDomainChrSourcePrivateNew,
.parse = qemuDomainObjPrivateXMLParse,
.format = qemuDomainObjPrivateXMLFormat,

View File

@ -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)

View File

@ -1154,7 +1154,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;
@ -1204,7 +1204,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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -930,7 +930,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;

View File

@ -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;