mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +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);
|
||||
}
|
||||
|
||||
|
||||
virDomainVideoDefPtr
|
||||
virDomainVideoDefNew(void)
|
||||
{
|
||||
virDomainVideoDefPtr def;
|
||||
|
||||
if (VIR_ALLOC(def) < 0)
|
||||
return NULL;
|
||||
|
||||
def->heads = 1;
|
||||
return def;
|
||||
}
|
||||
|
||||
|
||||
void virDomainVideoDefFree(virDomainVideoDefPtr def)
|
||||
{
|
||||
if (!def)
|
||||
@ -13962,7 +13976,7 @@ virDomainVideoDefParseXML(xmlNodePtr node,
|
||||
|
||||
ctxt->node = node;
|
||||
|
||||
if (VIR_ALLOC(def) < 0)
|
||||
if (!(def = virDomainVideoDefNew()))
|
||||
return NULL;
|
||||
|
||||
cur = node->children;
|
||||
@ -14060,8 +14074,6 @@ virDomainVideoDefParseXML(xmlNodePtr node,
|
||||
_("cannot parse video heads '%s'"), heads);
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
def->heads = 1;
|
||||
}
|
||||
|
||||
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0)
|
||||
@ -21207,7 +21219,7 @@ virDomainDefAddImplicitVideo(virDomainDefPtr def)
|
||||
if (def->ngraphics == 0 || def->nvideos > 0)
|
||||
return 0;
|
||||
|
||||
if (VIR_ALLOC(video) < 0)
|
||||
if (!(video = virDomainVideoDefNew()))
|
||||
goto cleanup;
|
||||
video->type = virDomainVideoDefaultType(def);
|
||||
if (video->type < 0) {
|
||||
@ -21215,7 +21227,6 @@ virDomainDefAddImplicitVideo(virDomainDefPtr def)
|
||||
_("cannot determine default video type"));
|
||||
goto cleanup;
|
||||
}
|
||||
video->heads = 1;
|
||||
if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, video) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -2727,6 +2727,7 @@ void virDomainSoundDefFree(virDomainSoundDefPtr def);
|
||||
void virDomainMemballoonDefFree(virDomainMemballoonDefPtr def);
|
||||
void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def);
|
||||
void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def);
|
||||
virDomainVideoDefPtr virDomainVideoDefNew(void);
|
||||
void virDomainVideoDefFree(virDomainVideoDefPtr def);
|
||||
virDomainHostdevDefPtr virDomainHostdevDefNew(virDomainXMLOptionPtr xmlopt);
|
||||
void virDomainHostdevDefClear(virDomainHostdevDefPtr def);
|
||||
|
@ -530,6 +530,7 @@ virDomainUSBDeviceDefForeach;
|
||||
virDomainVideoDefaultRAM;
|
||||
virDomainVideoDefaultType;
|
||||
virDomainVideoDefFree;
|
||||
virDomainVideoDefNew;
|
||||
virDomainVideoTypeFromString;
|
||||
virDomainVideoTypeToString;
|
||||
virDomainVideoVGAConfTypeFromString;
|
||||
|
@ -2605,10 +2605,9 @@ qemuParseCommandLine(virCapsPtr caps,
|
||||
|
||||
if (def->ngraphics) {
|
||||
virDomainVideoDefPtr vid;
|
||||
if (VIR_ALLOC(vid) < 0)
|
||||
if (!(vid = virDomainVideoDefNew()))
|
||||
goto error;
|
||||
vid->type = video;
|
||||
vid->heads = 1;
|
||||
|
||||
if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, vid) < 0) {
|
||||
virDomainVideoDefFree(vid);
|
||||
|
@ -553,12 +553,11 @@ prlsdkAddDomainVideoInfoCt(virDomainDefPtr def)
|
||||
if (def->ngraphics == 0)
|
||||
return 0;
|
||||
|
||||
if (VIR_ALLOC(video) < 0)
|
||||
if (!(video = virDomainVideoDefNew()))
|
||||
goto cleanup;
|
||||
|
||||
video->type = VIR_DOMAIN_VIDEO_TYPE_PARALLELS;
|
||||
video->vram = 0;
|
||||
video->heads = 1;
|
||||
|
||||
if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, video) < 0)
|
||||
goto cleanup;
|
||||
|
Loading…
x
Reference in New Issue
Block a user