mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 07:05:28 +00:00
conf: Move the privateData from virDomainChrDef to virDomainChrSourceDef
Commit id '5f2a132786' should have placed the data in the host source def structure since that's also used by smartcard, redirdev, and rng in order to provide a backend tcp channel. The data in the private structure will be necessary in order to provide the secret properly. This also renames the previous names from "Chardev" to "ChrSource" for the private data structures and API's
This commit is contained in:
parent
77a12987a4
commit
7bd8312e7f
@ -2024,6 +2024,7 @@ void virDomainChrSourceDefFree(virDomainChrSourceDefPtr def)
|
||||
return;
|
||||
|
||||
virDomainChrSourceDefClear(def);
|
||||
virObjectUnref(def->privateData);
|
||||
|
||||
VIR_FREE(def);
|
||||
}
|
||||
@ -2125,8 +2126,6 @@ void virDomainChrDefFree(virDomainChrDefPtr def)
|
||||
VIR_FREE(def->seclabels);
|
||||
}
|
||||
|
||||
virObjectUnref(def->privateData);
|
||||
|
||||
VIR_FREE(def);
|
||||
}
|
||||
|
||||
@ -10318,13 +10317,17 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
|
||||
|
||||
|
||||
static virDomainChrSourceDefPtr
|
||||
virDomainChrSourceDefNew(void)
|
||||
virDomainChrSourceDefNew(virDomainXMLOptionPtr xmlopt)
|
||||
{
|
||||
virDomainChrSourceDefPtr def = NULL;
|
||||
|
||||
if (VIR_ALLOC(def) < 0)
|
||||
return NULL;
|
||||
|
||||
if (xmlopt && xmlopt->privateData.chrSourceNew &&
|
||||
!(def->privateData = xmlopt->privateData.chrSourceNew()))
|
||||
VIR_FREE(def);
|
||||
|
||||
return def;
|
||||
}
|
||||
|
||||
@ -10342,15 +10345,9 @@ virDomainChrDefNew(virDomainXMLOptionPtr xmlopt)
|
||||
|
||||
def->target.port = -1;
|
||||
|
||||
if (!(def->source = virDomainChrSourceDefNew()))
|
||||
if (!(def->source = virDomainChrSourceDefNew(xmlopt)))
|
||||
VIR_FREE(def);
|
||||
|
||||
if (xmlopt && xmlopt->privateData.chardevNew &&
|
||||
!(def->privateData = xmlopt->privateData.chardevNew())) {
|
||||
virDomainChrSourceDefFree(def->source);
|
||||
VIR_FREE(def);
|
||||
}
|
||||
|
||||
return def;
|
||||
}
|
||||
|
||||
|
@ -1078,6 +1078,7 @@ typedef enum {
|
||||
/* The host side information for a character device. */
|
||||
struct _virDomainChrSourceDef {
|
||||
int type; /* virDomainChrType */
|
||||
virObjectPtr privateData;
|
||||
union {
|
||||
/* no <source> for null, vc, stdio */
|
||||
struct {
|
||||
@ -1117,7 +1118,6 @@ struct _virDomainChrSourceDef {
|
||||
/* A complete character device, both host and domain views. */
|
||||
struct _virDomainChrDef {
|
||||
int deviceType; /* enum virDomainChrDeviceType */
|
||||
virObjectPtr privateData;
|
||||
|
||||
bool targetTypeAttr;
|
||||
int targetType; /* enum virDomainChrConsoleTargetType ||
|
||||
@ -2447,7 +2447,7 @@ struct _virDomainXMLPrivateDataCallbacks {
|
||||
virDomainXMLPrivateDataNewFunc diskNew;
|
||||
virDomainXMLPrivateDataNewFunc hostdevNew;
|
||||
virDomainXMLPrivateDataNewFunc vcpuNew;
|
||||
virDomainXMLPrivateDataNewFunc chardevNew;
|
||||
virDomainXMLPrivateDataNewFunc chrSourceNew;
|
||||
virDomainXMLPrivateDataFormatFunc format;
|
||||
virDomainXMLPrivateDataParseFunc parse;
|
||||
};
|
||||
|
@ -864,34 +864,34 @@ qemuDomainVcpuPrivateDispose(void *obj)
|
||||
}
|
||||
|
||||
|
||||
static virClassPtr qemuDomainChardevPrivateClass;
|
||||
static void qemuDomainChardevPrivateDispose(void *obj);
|
||||
static virClassPtr qemuDomainChrSourcePrivateClass;
|
||||
static void qemuDomainChrSourcePrivateDispose(void *obj);
|
||||
|
||||
static int
|
||||
qemuDomainChardevPrivateOnceInit(void)
|
||||
qemuDomainChrSourcePrivateOnceInit(void)
|
||||
{
|
||||
qemuDomainChardevPrivateClass =
|
||||
qemuDomainChrSourcePrivateClass =
|
||||
virClassNew(virClassForObject(),
|
||||
"qemuDomainChardevPrivate",
|
||||
sizeof(qemuDomainChardevPrivate),
|
||||
qemuDomainChardevPrivateDispose);
|
||||
if (!qemuDomainChardevPrivateClass)
|
||||
"qemuDomainChrSourcePrivate",
|
||||
sizeof(qemuDomainChrSourcePrivate),
|
||||
qemuDomainChrSourcePrivateDispose);
|
||||
if (!qemuDomainChrSourcePrivateClass)
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
VIR_ONCE_GLOBAL_INIT(qemuDomainChardevPrivate)
|
||||
VIR_ONCE_GLOBAL_INIT(qemuDomainChrSourcePrivate)
|
||||
|
||||
static virObjectPtr
|
||||
qemuDomainChardevPrivateNew(void)
|
||||
qemuDomainChrSourcePrivateNew(void)
|
||||
{
|
||||
qemuDomainChardevPrivatePtr priv;
|
||||
qemuDomainChrSourcePrivatePtr priv;
|
||||
|
||||
if (qemuDomainChardevPrivateInitialize() < 0)
|
||||
if (qemuDomainChrSourcePrivateInitialize() < 0)
|
||||
return NULL;
|
||||
|
||||
if (!(priv = virObjectNew(qemuDomainChardevPrivateClass)))
|
||||
if (!(priv = virObjectNew(qemuDomainChrSourcePrivateClass)))
|
||||
return NULL;
|
||||
|
||||
return (virObjectPtr) priv;
|
||||
@ -899,9 +899,9 @@ qemuDomainChardevPrivateNew(void)
|
||||
|
||||
|
||||
static void
|
||||
qemuDomainChardevPrivateDispose(void *obj)
|
||||
qemuDomainChrSourcePrivateDispose(void *obj)
|
||||
{
|
||||
qemuDomainChardevPrivatePtr priv = obj;
|
||||
qemuDomainChrSourcePrivatePtr priv = obj;
|
||||
|
||||
qemuDomainSecretInfoFree(&priv->secinfo);
|
||||
}
|
||||
@ -1807,7 +1807,7 @@ virDomainXMLPrivateDataCallbacks virQEMUDriverPrivateDataCallbacks = {
|
||||
.diskNew = qemuDomainDiskPrivateNew,
|
||||
.vcpuNew = qemuDomainVcpuPrivateNew,
|
||||
.hostdevNew = qemuDomainHostdevPrivateNew,
|
||||
.chardevNew = qemuDomainChardevPrivateNew,
|
||||
.chrSourceNew = qemuDomainChrSourcePrivateNew,
|
||||
.parse = qemuDomainObjPrivateXMLParse,
|
||||
.format = qemuDomainObjPrivateXMLFormat,
|
||||
};
|
||||
|
@ -352,12 +352,12 @@ struct _qemuDomainHostdevPrivate {
|
||||
qemuDomainSecretInfoPtr secinfo;
|
||||
};
|
||||
|
||||
# define QEMU_DOMAIN_CHARDEV_PRIVATE(chardev) \
|
||||
((qemuDomainChardevPrivatePtr) (chardev)->privateData)
|
||||
# define QEMU_DOMAIN_CHR_SOURCE_PRIVATE(dev) \
|
||||
((qemuDomainChrSourcePrivatePtr) (dev)->privateData)
|
||||
|
||||
typedef struct _qemuDomainChardevPrivate qemuDomainChardevPrivate;
|
||||
typedef qemuDomainChardevPrivate *qemuDomainChardevPrivatePtr;
|
||||
struct _qemuDomainChardevPrivate {
|
||||
typedef struct _qemuDomainChrSourcePrivate qemuDomainChrSourcePrivate;
|
||||
typedef qemuDomainChrSourcePrivate *qemuDomainChrSourcePrivatePtr;
|
||||
struct _qemuDomainChrSourcePrivate {
|
||||
virObject parent;
|
||||
|
||||
/* for char devices using secret
|
||||
|
Loading…
Reference in New Issue
Block a user