mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
conf: add virDomainVideoDefNew
To handle setting a default heads value. Convert callers that were doing it by hand Reviewed-by: John Ferlan <jferlan@redhat.com> Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
5db046211f
commit
ac87932ee3
@ -2407,6 +2407,20 @@ void virDomainShmemDefFree(virDomainShmemDefPtr def)
|
|||||||
VIR_FREE(def);
|
VIR_FREE(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
virDomainVideoDefPtr
|
||||||
|
virDomainVideoDefNew(void)
|
||||||
|
{
|
||||||
|
virDomainVideoDefPtr def;
|
||||||
|
|
||||||
|
if (VIR_ALLOC(def) < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
def->heads = 1;
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void virDomainVideoDefFree(virDomainVideoDefPtr def)
|
void virDomainVideoDefFree(virDomainVideoDefPtr def)
|
||||||
{
|
{
|
||||||
if (!def)
|
if (!def)
|
||||||
@ -13962,7 +13976,7 @@ virDomainVideoDefParseXML(xmlNodePtr node,
|
|||||||
|
|
||||||
ctxt->node = node;
|
ctxt->node = node;
|
||||||
|
|
||||||
if (VIR_ALLOC(def) < 0)
|
if (!(def = virDomainVideoDefNew()))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
cur = node->children;
|
cur = node->children;
|
||||||
@ -14060,8 +14074,6 @@ virDomainVideoDefParseXML(xmlNodePtr node,
|
|||||||
_("cannot parse video heads '%s'"), heads);
|
_("cannot parse video heads '%s'"), heads);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
def->heads = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0)
|
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0)
|
||||||
@ -21207,7 +21219,7 @@ virDomainDefAddImplicitVideo(virDomainDefPtr def)
|
|||||||
if (def->ngraphics == 0 || def->nvideos > 0)
|
if (def->ngraphics == 0 || def->nvideos > 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (VIR_ALLOC(video) < 0)
|
if (!(video = virDomainVideoDefNew()))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
video->type = virDomainVideoDefaultType(def);
|
video->type = virDomainVideoDefaultType(def);
|
||||||
if (video->type < 0) {
|
if (video->type < 0) {
|
||||||
@ -21215,7 +21227,6 @@ virDomainDefAddImplicitVideo(virDomainDefPtr def)
|
|||||||
_("cannot determine default video type"));
|
_("cannot determine default video type"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
video->heads = 1;
|
|
||||||
if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, video) < 0)
|
if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, video) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
@ -2727,6 +2727,7 @@ void virDomainSoundDefFree(virDomainSoundDefPtr def);
|
|||||||
void virDomainMemballoonDefFree(virDomainMemballoonDefPtr def);
|
void virDomainMemballoonDefFree(virDomainMemballoonDefPtr def);
|
||||||
void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def);
|
void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def);
|
||||||
void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def);
|
void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def);
|
||||||
|
virDomainVideoDefPtr virDomainVideoDefNew(void);
|
||||||
void virDomainVideoDefFree(virDomainVideoDefPtr def);
|
void virDomainVideoDefFree(virDomainVideoDefPtr def);
|
||||||
virDomainHostdevDefPtr virDomainHostdevDefNew(virDomainXMLOptionPtr xmlopt);
|
virDomainHostdevDefPtr virDomainHostdevDefNew(virDomainXMLOptionPtr xmlopt);
|
||||||
void virDomainHostdevDefClear(virDomainHostdevDefPtr def);
|
void virDomainHostdevDefClear(virDomainHostdevDefPtr def);
|
||||||
|
@ -530,6 +530,7 @@ virDomainUSBDeviceDefForeach;
|
|||||||
virDomainVideoDefaultRAM;
|
virDomainVideoDefaultRAM;
|
||||||
virDomainVideoDefaultType;
|
virDomainVideoDefaultType;
|
||||||
virDomainVideoDefFree;
|
virDomainVideoDefFree;
|
||||||
|
virDomainVideoDefNew;
|
||||||
virDomainVideoTypeFromString;
|
virDomainVideoTypeFromString;
|
||||||
virDomainVideoTypeToString;
|
virDomainVideoTypeToString;
|
||||||
virDomainVideoVGAConfTypeFromString;
|
virDomainVideoVGAConfTypeFromString;
|
||||||
|
@ -2605,10 +2605,9 @@ qemuParseCommandLine(virCapsPtr caps,
|
|||||||
|
|
||||||
if (def->ngraphics) {
|
if (def->ngraphics) {
|
||||||
virDomainVideoDefPtr vid;
|
virDomainVideoDefPtr vid;
|
||||||
if (VIR_ALLOC(vid) < 0)
|
if (!(vid = virDomainVideoDefNew()))
|
||||||
goto error;
|
goto error;
|
||||||
vid->type = video;
|
vid->type = video;
|
||||||
vid->heads = 1;
|
|
||||||
|
|
||||||
if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, vid) < 0) {
|
if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, vid) < 0) {
|
||||||
virDomainVideoDefFree(vid);
|
virDomainVideoDefFree(vid);
|
||||||
|
@ -553,12 +553,11 @@ prlsdkAddDomainVideoInfoCt(virDomainDefPtr def)
|
|||||||
if (def->ngraphics == 0)
|
if (def->ngraphics == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (VIR_ALLOC(video) < 0)
|
if (!(video = virDomainVideoDefNew()))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
video->type = VIR_DOMAIN_VIDEO_TYPE_PARALLELS;
|
video->type = VIR_DOMAIN_VIDEO_TYPE_PARALLELS;
|
||||||
video->vram = 0;
|
video->vram = 0;
|
||||||
video->heads = 1;
|
|
||||||
|
|
||||||
if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, video) < 0)
|
if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, video) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
Reference in New Issue
Block a user