mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 15:52:55 +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;
|
return;
|
||||||
|
|
||||||
virDomainChrSourceDefClear(def);
|
virDomainChrSourceDefClear(def);
|
||||||
|
virObjectUnref(def->privateData);
|
||||||
|
|
||||||
VIR_FREE(def);
|
VIR_FREE(def);
|
||||||
}
|
}
|
||||||
@ -2125,8 +2126,6 @@ void virDomainChrDefFree(virDomainChrDefPtr def)
|
|||||||
VIR_FREE(def->seclabels);
|
VIR_FREE(def->seclabels);
|
||||||
}
|
}
|
||||||
|
|
||||||
virObjectUnref(def->privateData);
|
|
||||||
|
|
||||||
VIR_FREE(def);
|
VIR_FREE(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10318,13 +10317,17 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
|
|||||||
|
|
||||||
|
|
||||||
static virDomainChrSourceDefPtr
|
static virDomainChrSourceDefPtr
|
||||||
virDomainChrSourceDefNew(void)
|
virDomainChrSourceDefNew(virDomainXMLOptionPtr xmlopt)
|
||||||
{
|
{
|
||||||
virDomainChrSourceDefPtr def = NULL;
|
virDomainChrSourceDefPtr def = NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(def) < 0)
|
if (VIR_ALLOC(def) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (xmlopt && xmlopt->privateData.chrSourceNew &&
|
||||||
|
!(def->privateData = xmlopt->privateData.chrSourceNew()))
|
||||||
|
VIR_FREE(def);
|
||||||
|
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10342,15 +10345,9 @@ virDomainChrDefNew(virDomainXMLOptionPtr xmlopt)
|
|||||||
|
|
||||||
def->target.port = -1;
|
def->target.port = -1;
|
||||||
|
|
||||||
if (!(def->source = virDomainChrSourceDefNew()))
|
if (!(def->source = virDomainChrSourceDefNew(xmlopt)))
|
||||||
VIR_FREE(def);
|
VIR_FREE(def);
|
||||||
|
|
||||||
if (xmlopt && xmlopt->privateData.chardevNew &&
|
|
||||||
!(def->privateData = xmlopt->privateData.chardevNew())) {
|
|
||||||
virDomainChrSourceDefFree(def->source);
|
|
||||||
VIR_FREE(def);
|
|
||||||
}
|
|
||||||
|
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1078,6 +1078,7 @@ typedef enum {
|
|||||||
/* The host side information for a character device. */
|
/* The host side information for a character device. */
|
||||||
struct _virDomainChrSourceDef {
|
struct _virDomainChrSourceDef {
|
||||||
int type; /* virDomainChrType */
|
int type; /* virDomainChrType */
|
||||||
|
virObjectPtr privateData;
|
||||||
union {
|
union {
|
||||||
/* no <source> for null, vc, stdio */
|
/* no <source> for null, vc, stdio */
|
||||||
struct {
|
struct {
|
||||||
@ -1117,7 +1118,6 @@ struct _virDomainChrSourceDef {
|
|||||||
/* A complete character device, both host and domain views. */
|
/* A complete character device, both host and domain views. */
|
||||||
struct _virDomainChrDef {
|
struct _virDomainChrDef {
|
||||||
int deviceType; /* enum virDomainChrDeviceType */
|
int deviceType; /* enum virDomainChrDeviceType */
|
||||||
virObjectPtr privateData;
|
|
||||||
|
|
||||||
bool targetTypeAttr;
|
bool targetTypeAttr;
|
||||||
int targetType; /* enum virDomainChrConsoleTargetType ||
|
int targetType; /* enum virDomainChrConsoleTargetType ||
|
||||||
@ -2447,7 +2447,7 @@ struct _virDomainXMLPrivateDataCallbacks {
|
|||||||
virDomainXMLPrivateDataNewFunc diskNew;
|
virDomainXMLPrivateDataNewFunc diskNew;
|
||||||
virDomainXMLPrivateDataNewFunc hostdevNew;
|
virDomainXMLPrivateDataNewFunc hostdevNew;
|
||||||
virDomainXMLPrivateDataNewFunc vcpuNew;
|
virDomainXMLPrivateDataNewFunc vcpuNew;
|
||||||
virDomainXMLPrivateDataNewFunc chardevNew;
|
virDomainXMLPrivateDataNewFunc chrSourceNew;
|
||||||
virDomainXMLPrivateDataFormatFunc format;
|
virDomainXMLPrivateDataFormatFunc format;
|
||||||
virDomainXMLPrivateDataParseFunc parse;
|
virDomainXMLPrivateDataParseFunc parse;
|
||||||
};
|
};
|
||||||
|
@ -864,34 +864,34 @@ qemuDomainVcpuPrivateDispose(void *obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static virClassPtr qemuDomainChardevPrivateClass;
|
static virClassPtr qemuDomainChrSourcePrivateClass;
|
||||||
static void qemuDomainChardevPrivateDispose(void *obj);
|
static void qemuDomainChrSourcePrivateDispose(void *obj);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemuDomainChardevPrivateOnceInit(void)
|
qemuDomainChrSourcePrivateOnceInit(void)
|
||||||
{
|
{
|
||||||
qemuDomainChardevPrivateClass =
|
qemuDomainChrSourcePrivateClass =
|
||||||
virClassNew(virClassForObject(),
|
virClassNew(virClassForObject(),
|
||||||
"qemuDomainChardevPrivate",
|
"qemuDomainChrSourcePrivate",
|
||||||
sizeof(qemuDomainChardevPrivate),
|
sizeof(qemuDomainChrSourcePrivate),
|
||||||
qemuDomainChardevPrivateDispose);
|
qemuDomainChrSourcePrivateDispose);
|
||||||
if (!qemuDomainChardevPrivateClass)
|
if (!qemuDomainChrSourcePrivateClass)
|
||||||
return -1;
|
return -1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
VIR_ONCE_GLOBAL_INIT(qemuDomainChardevPrivate)
|
VIR_ONCE_GLOBAL_INIT(qemuDomainChrSourcePrivate)
|
||||||
|
|
||||||
static virObjectPtr
|
static virObjectPtr
|
||||||
qemuDomainChardevPrivateNew(void)
|
qemuDomainChrSourcePrivateNew(void)
|
||||||
{
|
{
|
||||||
qemuDomainChardevPrivatePtr priv;
|
qemuDomainChrSourcePrivatePtr priv;
|
||||||
|
|
||||||
if (qemuDomainChardevPrivateInitialize() < 0)
|
if (qemuDomainChrSourcePrivateInitialize() < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!(priv = virObjectNew(qemuDomainChardevPrivateClass)))
|
if (!(priv = virObjectNew(qemuDomainChrSourcePrivateClass)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return (virObjectPtr) priv;
|
return (virObjectPtr) priv;
|
||||||
@ -899,9 +899,9 @@ qemuDomainChardevPrivateNew(void)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
qemuDomainChardevPrivateDispose(void *obj)
|
qemuDomainChrSourcePrivateDispose(void *obj)
|
||||||
{
|
{
|
||||||
qemuDomainChardevPrivatePtr priv = obj;
|
qemuDomainChrSourcePrivatePtr priv = obj;
|
||||||
|
|
||||||
qemuDomainSecretInfoFree(&priv->secinfo);
|
qemuDomainSecretInfoFree(&priv->secinfo);
|
||||||
}
|
}
|
||||||
@ -1807,7 +1807,7 @@ virDomainXMLPrivateDataCallbacks virQEMUDriverPrivateDataCallbacks = {
|
|||||||
.diskNew = qemuDomainDiskPrivateNew,
|
.diskNew = qemuDomainDiskPrivateNew,
|
||||||
.vcpuNew = qemuDomainVcpuPrivateNew,
|
.vcpuNew = qemuDomainVcpuPrivateNew,
|
||||||
.hostdevNew = qemuDomainHostdevPrivateNew,
|
.hostdevNew = qemuDomainHostdevPrivateNew,
|
||||||
.chardevNew = qemuDomainChardevPrivateNew,
|
.chrSourceNew = qemuDomainChrSourcePrivateNew,
|
||||||
.parse = qemuDomainObjPrivateXMLParse,
|
.parse = qemuDomainObjPrivateXMLParse,
|
||||||
.format = qemuDomainObjPrivateXMLFormat,
|
.format = qemuDomainObjPrivateXMLFormat,
|
||||||
};
|
};
|
||||||
|
@ -352,12 +352,12 @@ struct _qemuDomainHostdevPrivate {
|
|||||||
qemuDomainSecretInfoPtr secinfo;
|
qemuDomainSecretInfoPtr secinfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
# define QEMU_DOMAIN_CHARDEV_PRIVATE(chardev) \
|
# define QEMU_DOMAIN_CHR_SOURCE_PRIVATE(dev) \
|
||||||
((qemuDomainChardevPrivatePtr) (chardev)->privateData)
|
((qemuDomainChrSourcePrivatePtr) (dev)->privateData)
|
||||||
|
|
||||||
typedef struct _qemuDomainChardevPrivate qemuDomainChardevPrivate;
|
typedef struct _qemuDomainChrSourcePrivate qemuDomainChrSourcePrivate;
|
||||||
typedef qemuDomainChardevPrivate *qemuDomainChardevPrivatePtr;
|
typedef qemuDomainChrSourcePrivate *qemuDomainChrSourcePrivatePtr;
|
||||||
struct _qemuDomainChardevPrivate {
|
struct _qemuDomainChrSourcePrivate {
|
||||||
virObject parent;
|
virObject parent;
|
||||||
|
|
||||||
/* for char devices using secret
|
/* for char devices using secret
|
||||||
|
Loading…
x
Reference in New Issue
Block a user