From nobody Fri May 3 00:59:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636648633; cv=none; d=zohomail.com; s=zohoarc; b=PLYshKM5ElPBEBDNcUHkRhJ3f++uThmN2Q0Sst2v1O1GTYyKq4LxMlMqe8vR9UtOdWIBgVPwPDMwVkKqE9iMXZI6uNm2O3tRJsvyU5k6kL3mHZL9YifIX/ytzcrT+MD5PTAouOO02GHP0UDPNgommrmAvxLzoyxOgn5vQc1L55Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636648633; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tlIzh7r+Xtxep82UAZTGho3w1hzlqKJH0FXUtkdM6Vs=; b=lq6+QuaI0IBNabSzkPU3dfFx10R5OB4OBkH+6spEFiZsleD/f/vlxO8hRF1WBU3FpfYDxh5TwAwfU+lCbs24Vw2GUMKxCgBILYmv7poA8Jaz36//IlmIiP/JqDsOK4Vz9+DlOpIYwSWoS7Va5yGJNn9QB7BTVuCWVaFd3JA6QrE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1636648633074390.5823360366628; Thu, 11 Nov 2021 08:37:13 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-162-OjsnuKkXNV-yqXUQqqCHXw-1; Thu, 11 Nov 2021 11:35:57 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EB3B487D541; Thu, 11 Nov 2021 16:35:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BD5F45D6D7; Thu, 11 Nov 2021 16:35:49 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 550851819AC1; Thu, 11 Nov 2021 16:35:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1ABGZkOk013707 for ; Thu, 11 Nov 2021 11:35:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id EB9E119D9D; Thu, 11 Nov 2021 16:35:46 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.194.191]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FE8A19C59; Thu, 11 Nov 2021 16:35:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636648632; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=tlIzh7r+Xtxep82UAZTGho3w1hzlqKJH0FXUtkdM6Vs=; b=ZcW/7LysfXoKC7E+U7Pq4dy45f4B1EtmYLJ5xHJixU2DwK3xEKdQzNW7BuBunFtFWJ3v8I byJ4aT0ouc18uvRDcynQKPr+OQll2XOuTRYQ9Xa5DCg3kYqm9IvZ9Fs/qUZYvGa31XhEO7 k3wpCu28By0CVSYV9PK0zDsBEW8brE4= X-MC-Unique: OjsnuKkXNV-yqXUQqqCHXw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/2] conf: add helper for comparing virDomainAudioDef objects Date: Thu, 11 Nov 2021 16:35:42 +0000 Message-Id: <20211111163543.1652878-2-berrange@redhat.com> In-Reply-To: <20211111163543.1652878-1-berrange@redhat.com> References: <20211111163543.1652878-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1636648634866100001 It is useful to be able to deeply check them for equality. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 144 +++++++++++++++++++++++++++++++++++++++ src/conf/domain_conf.h | 3 + src/libvirt_private.syms | 1 + 3 files changed, 148 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index da0c64b460..f919d3f7a0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -29842,6 +29842,150 @@ virDomainAudioIOCommonIsSet(virDomainAudioIOCommo= n *common) common->bufferLength; } =20 + +static bool +virDomainAudioIOCommonIsEqual(virDomainAudioIOCommon *this, + virDomainAudioIOCommon *that) +{ + return this->mixingEngine =3D=3D that->mixingEngine && + this->fixedSettings =3D=3D that->fixedSettings && + this->frequency =3D=3D that->frequency && + this->channels =3D=3D that->channels && + this->voices =3D=3D that->voices && + this->format =3D=3D that->format && + this->bufferLength =3D=3D that->bufferLength; +} + +static bool +virDomainAudioIOALSAIsEqual(virDomainAudioIOALSA *this, + virDomainAudioIOALSA *that) +{ + return STREQ_NULLABLE(this->dev, that->dev); +} + +static bool +virDomainAudioIOCoreAudioIsEqual(virDomainAudioIOCoreAudio *this, + virDomainAudioIOCoreAudio *that) +{ + return this->bufferCount =3D=3D that->bufferCount; +} + +static bool +virDomainAudioIOJackIsEqual(virDomainAudioIOJack *this, + virDomainAudioIOJack *that) +{ + return STREQ_NULLABLE(this->serverName, that->serverName) && + STREQ_NULLABLE(this->clientName, that->clientName) && + STREQ_NULLABLE(this->connectPorts, that->connectPorts) && + this->exactName =3D=3D that->exactName; +} + +static bool +virDomainAudioIOOSSIsEqual(virDomainAudioIOOSS *this, + virDomainAudioIOOSS *that) +{ + return STREQ_NULLABLE(this->dev, that->dev) && + this->bufferCount =3D=3D that->bufferCount && + this->tryPoll =3D=3D that->tryPoll; +} + +static bool +virDomainAudioIOPulseAudioIsEqual(virDomainAudioIOPulseAudio *this, + virDomainAudioIOPulseAudio *that) +{ + return STREQ_NULLABLE(this->name, that->name) && + STREQ_NULLABLE(this->streamName, that->streamName) && + this->latency =3D=3D that->latency; +} + +static bool +virDomainAudioIOSDLIsEqual(virDomainAudioIOSDL *this, + virDomainAudioIOSDL *that) +{ + return this->bufferCount =3D=3D that->bufferCount; +} + + +static bool +virDomainAudioBackendIsEqual(virDomainAudioDef *this, + virDomainAudioDef *that) +{ + if (this->type !=3D that->type) + return false; + + switch (this->type) { + case VIR_DOMAIN_AUDIO_TYPE_NONE: + return true; + + case VIR_DOMAIN_AUDIO_TYPE_ALSA: + return virDomainAudioIOALSAIsEqual(&this->backend.alsa.input, + &that->backend.alsa.input) && + virDomainAudioIOALSAIsEqual(&this->backend.alsa.output, + &that->backend.alsa.output); + + case VIR_DOMAIN_AUDIO_TYPE_COREAUDIO: + return virDomainAudioIOCoreAudioIsEqual(&this->backend.coreaudio.i= nput, + &that->backend.coreaudio.i= nput) && + virDomainAudioIOCoreAudioIsEqual(&this->backend.coreaudio.outp= ut, + &that->backend.coreaudio.outp= ut); + + case VIR_DOMAIN_AUDIO_TYPE_JACK: + return virDomainAudioIOJackIsEqual(&this->backend.jack.input, + &that->backend.jack.input) && + virDomainAudioIOJackIsEqual(&this->backend.jack.output, + &that->backend.jack.output); + + case VIR_DOMAIN_AUDIO_TYPE_OSS: + return virDomainAudioIOOSSIsEqual(&this->backend.oss.input, + &that->backend.oss.input) && + virDomainAudioIOOSSIsEqual(&this->backend.oss.output, + &that->backend.oss.output) && + this->backend.oss.tryMMap =3D=3D that->backend.oss.tryMMap && + this->backend.oss.exclusive =3D=3D that->backend.oss.exclusive= && + this->backend.oss.dspPolicySet =3D=3D that->backend.oss.dspPol= icySet && + this->backend.oss.dspPolicy =3D=3D that->backend.oss.dspPolicy; + + case VIR_DOMAIN_AUDIO_TYPE_PULSEAUDIO: + return virDomainAudioIOPulseAudioIsEqual(&this->backend.pulseaudio= .input, + &that->backend.pulseaudio= .input) && + virDomainAudioIOPulseAudioIsEqual(&this->backend.pulseaudio.ou= tput, + &that->backend.pulseaudio.ou= tput) && + STREQ_NULLABLE(this->backend.pulseaudio.serverName, + that->backend.pulseaudio.serverName); + + case VIR_DOMAIN_AUDIO_TYPE_SDL: + return virDomainAudioIOSDLIsEqual(&this->backend.sdl.input, + &that->backend.sdl.input) && + virDomainAudioIOSDLIsEqual(&this->backend.sdl.output, + &that->backend.sdl.output) && + this->backend.sdl.driver =3D=3D that->backend.sdl.driver; + + case VIR_DOMAIN_AUDIO_TYPE_SPICE: + return true; + + case VIR_DOMAIN_AUDIO_TYPE_FILE: + return STREQ_NULLABLE(this->backend.file.path, that->backend.file.= path); + + case VIR_DOMAIN_AUDIO_TYPE_LAST: + default: + return false; + } +} + + +bool +virDomainAudioIsEqual(virDomainAudioDef *this, + virDomainAudioDef *that) +{ + return this->type =3D=3D that->type && + this->id =3D=3D that->id && + this->timerPeriod =3D=3D that->timerPeriod && + virDomainAudioIOCommonIsEqual(&this->input, &that->input) && + virDomainAudioIOCommonIsEqual(&this->output, &that->output) && + virDomainAudioBackendIsEqual(this, that); +} + + char * virDomainObjGetMetadata(virDomainObj *vm, int type, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index ab9a7d66f8..cf880ccb3c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -4015,6 +4015,9 @@ bool virDomainSoundModelSupportsCodecs(virDomainSoundDef *def); bool virDomainAudioIOCommonIsSet(virDomainAudioIOCommon *common); +bool +virDomainAudioIsEqual(virDomainAudioDef *this, + virDomainAudioDef *that); =20 const char *virDomainChrSourceDefGetPath(virDomainChrSourceDef *chr); =20 diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 9ee8fda25f..a369d9c113 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -231,6 +231,7 @@ virDomainAudioDefFree; virDomainAudioFormatTypeFromString; virDomainAudioFormatTypeToString; virDomainAudioIOCommonIsSet; +virDomainAudioIsEqual; virDomainAudioSDLDriverTypeFromString; virDomainAudioSDLDriverTypeToString; virDomainAudioTypeTypeFromString; --=20 2.31.1 From nobody Fri May 3 00:59:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636648560; cv=none; d=zohomail.com; s=zohoarc; b=YOT3L/oY0kW7U2YSz0Bl26ZXfQfQxozWc3zTq2xDKUqZzbYpJEjUfYFsbGWm7dt/9FALnbcWppRXN8g6jKzERPmLLtfncWwwiH8Iv25cQ0fDLFIjWDzkHUhB3DpUDbuERpnTfVOkgi8cL27rwWyzP/o/dSmYpKngzVhn3yuqekM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636648560; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hcsOdbA1w+20IRG/hsHC9n9PObEUEAHfN+oYVHOb7Po=; b=kS1M+Evo2Cxj/yOIQSpC3+Y+OS4Z5q1WFV0WGmu2bXYQNLnwkKcMobplq8Scwgxpchx9qLSk9KdLYthDy5fWrcc1xL96E6iS7dH02OcH4VPpzxLIj3dvaDThcrKQaxEKUukUCE+6tZVpyhdDCIH2MQlbGJM/e0YUn0j4E53YWiY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1636648560700665.618437356047; Thu, 11 Nov 2021 08:36:00 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-457-Hp53dLTvOPmlTLoCrZzY_A-1; Thu, 11 Nov 2021 11:35:55 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 37E90100B790; Thu, 11 Nov 2021 16:35:50 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 18A075DF56; Thu, 11 Nov 2021 16:35:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DFA581832DD4; Thu, 11 Nov 2021 16:35:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1ABGZmIf013717 for ; Thu, 11 Nov 2021 11:35:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 19BA819D9D; Thu, 11 Nov 2021 16:35:48 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.194.191]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47FE419C59; Thu, 11 Nov 2021 16:35:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636648558; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=hcsOdbA1w+20IRG/hsHC9n9PObEUEAHfN+oYVHOb7Po=; b=aCAuvyzxnPOQZPB+2EMLg4K0a0yTD2dYbRHvFSLIV753fD9w14WpxqZ08TTm32yN4m6caG +aacVf6zJu8pEzqK1iymRue3gNXFWRTPcL0+YdNE7NyG8WU1YZws8+sdjmxUXApVP2BSi5 0I78hlZw9HSOJt3QL6RUpryFwGZmbWs= X-MC-Unique: Hp53dLTvOPmlTLoCrZzY_A-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/2] qemu: don't strip audio elements with user config present Date: Thu, 11 Nov 2021 16:35:43 +0000 Message-Id: <20211111163543.1652878-3-berrange@redhat.com> In-Reply-To: <20211111163543.1652878-1-berrange@redhat.com> References: <20211111163543.1652878-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1636648562712100003 To support backwards live migration we must strip the default added audio element, however, we are too aggressive in doing so. We are only comparing a couple of attributes for equality, so risk stripping config that was user customized. To improve this we need to a deep comparison of the audio config. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- src/qemu/qemu_domain.c | 72 +++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index fb203bc830..ef0a08d405 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3507,17 +3507,15 @@ qemuDomainDefSuggestDefaultAudioBackend(virQEMUDriv= er *driver, } =20 static int -qemuDomainDefClearDefaultAudioBackend(virQEMUDriver *driver, - virDomainDef *def) +qemuDomainDefCreateDefaultAudioBackend(virQEMUDriver *driver, + virDomainDef *def, + virDomainAudioDef **audioout) { bool addAudio; int audioBackend; int audioSDLDriver; - virDomainAudioDef *audio; =20 - if (def->naudios !=3D 1) { - return 0; - } + *audioout =3D NULL; =20 if (qemuDomainDefSuggestDefaultAudioBackend(driver, def, @@ -3526,21 +3524,45 @@ qemuDomainDefClearDefaultAudioBackend(virQEMUDriver= *driver, &audioSDLDriver) < 0) return -1; =20 - if (!addAudio) - return 0; + if (addAudio) { + virDomainAudioDef *audio =3D g_new0(virDomainAudioDef, 1); + + audio->type =3D audioBackend; + audio->id =3D 1; =20 - audio =3D def->audios[0]; - if (audio->type !=3D audioBackend) + if (audioBackend =3D=3D VIR_DOMAIN_AUDIO_TYPE_SDL) + audio->backend.sdl.driver =3D audioSDLDriver; + + *audioout =3D audio; + } + + return 0; +} + + +static int +qemuDomainDefClearDefaultAudioBackend(virQEMUDriver *driver, + virDomainDef *def) +{ + virDomainAudioDef *audio =3D NULL; + + if (def->naudios !=3D 1) { return 0; + } =20 - if (audio->type =3D=3D VIR_DOMAIN_AUDIO_TYPE_SDL && - audio->backend.sdl.driver !=3D audioSDLDriver) + if (qemuDomainDefCreateDefaultAudioBackend(driver, def, &audio) < 0) + return -1; + + if (!audio) return 0; =20 + if (virDomainAudioIsEqual(def->audios[0], audio)) { + virDomainAudioDefFree(def->audios[0]); + g_free(def->audios); + def->naudios =3D 0; + def->audios =3D NULL; + } virDomainAudioDefFree(audio); - g_free(def->audios); - def->naudios =3D 0; - def->audios =3D NULL; =20 return 0; } @@ -3549,33 +3571,19 @@ static int qemuDomainDefAddDefaultAudioBackend(virQEMUDriver *driver, virDomainDef *def) { - bool addAudio; - int audioBackend; - int audioSDLDriver; + virDomainAudioDef *audio; =20 if (def->naudios > 0) { return 0; } =20 - if (qemuDomainDefSuggestDefaultAudioBackend(driver, - def, - &addAudio, - &audioBackend, - &audioSDLDriver) < 0) + if (qemuDomainDefCreateDefaultAudioBackend(driver, def, &audio) < 0) return -1; =20 - if (addAudio) { - virDomainAudioDef *audio =3D g_new0(virDomainAudioDef, 1); - - audio->type =3D audioBackend; - audio->id =3D 1; - + if (audio) { def->naudios =3D 1; def->audios =3D g_new0(virDomainAudioDef *, def->naudios); def->audios[0] =3D audio; - - if (audioBackend =3D=3D VIR_DOMAIN_AUDIO_TYPE_SDL) - audio->backend.sdl.driver =3D audioSDLDriver; } =20 return 0; --=20 2.31.1