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

View File

@ -439,7 +439,6 @@ struct _virDomainHostdevCaps {
/* basic device for direct passthrough */ /* basic device for direct passthrough */
struct _virDomainHostdevDef { struct _virDomainHostdevDef {
virDomainDeviceDef parent; /* higher level Def containing this */ virDomainDeviceDef parent; /* higher level Def containing this */
virObjectPtr privateData;
int mode; /* enum virDomainHostdevMode */ int mode; /* enum virDomainHostdevMode */
int startupPolicy; /* enum virDomainStartupPolicy */ int startupPolicy; /* enum virDomainStartupPolicy */
@ -2621,7 +2620,6 @@ struct _virDomainXMLPrivateDataCallbacks {
/* note that private data for devices are not copied when using /* note that private data for devices are not copied when using
* virDomainDefCopy and similar functions */ * virDomainDefCopy and similar functions */
virDomainXMLPrivateDataNewFunc diskNew; virDomainXMLPrivateDataNewFunc diskNew;
virDomainXMLPrivateDataNewFunc hostdevNew;
virDomainXMLPrivateDataNewFunc vcpuNew; virDomainXMLPrivateDataNewFunc vcpuNew;
virDomainXMLPrivateDataNewFunc chrSourceNew; virDomainXMLPrivateDataNewFunc chrSourceNew;
virDomainXMLPrivateDataFormatFunc format; virDomainXMLPrivateDataFormatFunc format;
@ -2747,7 +2745,7 @@ void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def);
void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def); void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def);
virDomainVideoDefPtr virDomainVideoDefNew(void); virDomainVideoDefPtr virDomainVideoDefNew(void);
void virDomainVideoDefFree(virDomainVideoDefPtr def); void virDomainVideoDefFree(virDomainVideoDefPtr def);
virDomainHostdevDefPtr virDomainHostdevDefNew(virDomainXMLOptionPtr xmlopt); virDomainHostdevDefPtr virDomainHostdevDefNew(void);
void virDomainHostdevDefClear(virDomainHostdevDefPtr def); void virDomainHostdevDefClear(virDomainHostdevDefPtr def);
void virDomainHostdevDefFree(virDomainHostdevDefPtr def); void virDomainHostdevDefFree(virDomainHostdevDefPtr def);
void virDomainHubDefFree(virDomainHubDefPtr def); void virDomainHubDefFree(virDomainHubDefPtr def);

View File

@ -394,7 +394,7 @@ lxcCreateNetDef(const char *type,
static virDomainHostdevDefPtr static virDomainHostdevDefPtr
lxcCreateHostdevDef(int mode, int type, const char *data) lxcCreateHostdevDef(int mode, int type, const char *data)
{ {
virDomainHostdevDefPtr hostdev = virDomainHostdevDefNew(NULL); virDomainHostdevDefPtr hostdev = virDomainHostdevDefNew();
if (!hostdev) if (!hostdev)
return NULL; 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 virClassPtr qemuDomainVcpuPrivateClass;
static void qemuDomainVcpuPrivateDispose(void *obj); static void qemuDomainVcpuPrivateDispose(void *obj);
@ -2479,7 +2436,6 @@ virDomainXMLPrivateDataCallbacks virQEMUDriverPrivateDataCallbacks = {
.free = qemuDomainObjPrivateFree, .free = qemuDomainObjPrivateFree,
.diskNew = qemuDomainDiskPrivateNew, .diskNew = qemuDomainDiskPrivateNew,
.vcpuNew = qemuDomainVcpuPrivateNew, .vcpuNew = qemuDomainVcpuPrivateNew,
.hostdevNew = qemuDomainHostdevPrivateNew,
.chrSourceNew = qemuDomainChrSourcePrivateNew, .chrSourceNew = qemuDomainChrSourcePrivateNew,
.parse = qemuDomainObjPrivateXMLParse, .parse = qemuDomainObjPrivateXMLParse,
.format = qemuDomainObjPrivateXMLFormat, .format = qemuDomainObjPrivateXMLFormat,

View File

@ -376,10 +376,6 @@ struct _qemuDomainStorageSourcePrivate {
virObjectPtr qemuDomainStorageSourcePrivateNew(void); virObjectPtr qemuDomainStorageSourcePrivateNew(void);
# define QEMU_DOMAIN_HOSTDEV_PRIVATE(hostdev) \
((qemuDomainHostdevPrivatePtr) (hostdev)->privateData)
typedef struct _qemuDomainVcpuPrivate qemuDomainVcpuPrivate; typedef struct _qemuDomainVcpuPrivate qemuDomainVcpuPrivate;
typedef qemuDomainVcpuPrivate *qemuDomainVcpuPrivatePtr; typedef qemuDomainVcpuPrivate *qemuDomainVcpuPrivatePtr;
struct _qemuDomainVcpuPrivate { struct _qemuDomainVcpuPrivate {
@ -414,16 +410,6 @@ struct qemuDomainDiskInfo {
char *nodename; 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) \ # define QEMU_DOMAIN_CHR_SOURCE_PRIVATE(dev) \
((qemuDomainChrSourcePrivatePtr) (dev)->privateData) ((qemuDomainChrSourcePrivatePtr) (dev)->privateData)

View File

@ -1154,7 +1154,7 @@ qemuParseCommandLinePCI(const char *val)
int bus = 0, slot = 0, func = 0; int bus = 0, slot = 0, func = 0;
const char *start; const char *start;
char *end; char *end;
virDomainHostdevDefPtr def = virDomainHostdevDefNew(NULL); virDomainHostdevDefPtr def = virDomainHostdevDefNew();
if (!def) if (!def)
goto error; goto error;
@ -1204,7 +1204,7 @@ qemuParseCommandLinePCI(const char *val)
static virDomainHostdevDefPtr static virDomainHostdevDefPtr
qemuParseCommandLineUSB(const char *val) qemuParseCommandLineUSB(const char *val)
{ {
virDomainHostdevDefPtr def = virDomainHostdevDefNew(NULL); virDomainHostdevDefPtr def = virDomainHostdevDefNew();
virDomainHostdevSubsysUSBPtr usbsrc; virDomainHostdevSubsysUSBPtr usbsrc;
int first = 0, second = 0; int first = 0, second = 0;
const char *start; const char *start;

View File

@ -3034,7 +3034,7 @@ vboxHostDeviceGetXMLDesc(vboxDriverPtr data, virDomainDefPtr def, IMachine *mach
goto release_filters; goto release_filters;
for (i = 0; i < def->nhostdevs; i++) { for (i = 0; i < def->nhostdevs; i++) {
def->hostdevs[i] = virDomainHostdevDefNew(NULL); def->hostdevs[i] = virDomainHostdevDefNew();
if (!def->hostdevs[i]) if (!def->hostdevs[i])
goto release_hostdevs; goto release_hostdevs;
} }

View File

@ -458,7 +458,7 @@ xenParsePCI(virConfPtr conf, virDomainDefPtr def)
goto skippci; goto skippci;
if (virStrToLong_i(func, NULL, 16, &funcID) < 0) if (virStrToLong_i(func, NULL, 16, &funcID) < 0)
goto skippci; goto skippci;
if (!(hostdev = virDomainHostdevDefNew(NULL))) if (!(hostdev = virDomainHostdevDefNew()))
return -1; return -1;
hostdev->managed = false; hostdev->managed = false;

View File

@ -1105,7 +1105,7 @@ xenParseSxprPCI(virDomainDefPtr def,
goto error; goto error;
} }
if (!(dev = virDomainHostdevDefNew(NULL))) if (!(dev = virDomainHostdevDefNew()))
goto error; goto error;
dev->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS; dev->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;

View File

@ -930,7 +930,7 @@ xenParseXLUSB(virConfPtr conf, virDomainDefPtr def)
goto skipusb; goto skipusb;
if (virStrToLong_i(device, NULL, 16, &devNum) < 0) if (virStrToLong_i(device, NULL, 16, &devNum) < 0)
goto skipusb; goto skipusb;
if (!(hostdev = virDomainHostdevDefNew(NULL))) if (!(hostdev = virDomainHostdevDefNew()))
return -1; return -1;
hostdev->managed = false; hostdev->managed = false;

View File

@ -88,7 +88,7 @@ myInit(void)
for (i = 0; i < nhostdevs; i++) { for (i = 0; i < nhostdevs; i++) {
virDomainHostdevSubsys subsys; virDomainHostdevSubsys subsys;
hostdevs[i] = virDomainHostdevDefNew(NULL); hostdevs[i] = virDomainHostdevDefNew();
if (!hostdevs[i]) if (!hostdevs[i])
goto cleanup; goto cleanup;
hostdevs[i]->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS; hostdevs[i]->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;