From nobody Thu Mar 28 18:29:29 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1673628538; cv=none; d=zohomail.com; s=zohoarc; b=dMGV92W/udPdw4bgXDEde8MN7iEvda5hX0DKr5UZPXBZUQDRzwfS3aTywSJL1htrfpcvxDaJNDj2k1BIYd8SYM/DqawTdt52bgGKs6bIGrYSzVYwkMilEwic6BD5BPT1XM8zq4331sKxncTYb6gcyJUedy9uDqvEd0XROQvyBgg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673628538; h=Content-Type:Content-Transfer-Encoding:Cc: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=XPiLURC+pasBUtX+TWccqsO1skJM4eGW3ibva3hIUKc=; b=eiNac4KkbpIRL2dj5AdWlqvNeQK35IhGBQkLYA+8ECs1ugdY3pNLElo/VlKdxjLc3YPnVNKfSZybFxs6JRdlaeia4qfWtryOtwbsfw1jGUlwDGXiEzVu/SztEWe9pLMB0VeBsCYLUNQsQPbTr4HdtwEE6UBTanUoiWnk3H6Y6zA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673628538524210.06826248852155; Fri, 13 Jan 2023 08:48:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGMoq-0006pK-T4; Fri, 13 Jan 2023 11:22:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGMon-0006lK-93 for qemu-devel@nongnu.org; Fri, 13 Jan 2023 11:22:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGMol-0005nH-OZ for qemu-devel@nongnu.org; Fri, 13 Jan 2023 11:22:12 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-616-EnuSca-6OP6zOpEqDWxxqw-1; Fri, 13 Jan 2023 11:22:02 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 19A223803917; Fri, 13 Jan 2023 16:22:02 +0000 (UTC) Received: from virtlab420.virt.lab.eng.bos.redhat.com (virtlab420.virt.lab.eng.bos.redhat.com [10.19.152.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id ABCB940C2004; Fri, 13 Jan 2023 16:22:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673626930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XPiLURC+pasBUtX+TWccqsO1skJM4eGW3ibva3hIUKc=; b=QnFgcunlXQr7i+9sAtoQsxGzWsV024Zh/AjqpNRREW0ZY3nZp3HVO9k6/9dyGkTd572mru tm6H/IfVXbY7DQPxSlRudObu8jffZ7ujTay1d3GGhWXUQshWoD6c/aPqcGmkX7bQyBxt5t QziWwLdnafL9es5Bz3U4Njs/aGkWQIk= X-MC-Unique: EnuSca-6OP6zOpEqDWxxqw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Bandan Das , Laurent Vivier , Darren Kenny , Stefan Hajnoczi , libvir-list@redhat.com, Qiuhao Li , Paolo Bonzini , Christian Schoenebeck , Thomas Huth , Gerd Hoffmann , Alexander Bulekov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 1/9] audio: don't check qemu_add_vm_change_state_handler failure Date: Fri, 13 Jan 2023 11:21:52 -0500 Message-Id: <20230113162200.3010804-2-berrange@redhat.com> In-Reply-To: <20230113162200.3010804-1-berrange@redhat.com> References: <20230113162200.3010804-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1673628539415100001 This function cannot fail since g_malloc0 aborts on OOM. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Volker R=C3=BCmelin --- audio/audio.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index d849a94a81..7b4b957945 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1712,7 +1712,6 @@ static AudioState *audio_init(Audiodev *dev, const ch= ar *name) size_t i; int done =3D 0; const char *drvname =3D NULL; - VMChangeStateEntry *e; AudioState *s; struct audio_driver *driver; /* silence gcc warning about uninitialized variable */ @@ -1830,11 +1829,7 @@ static AudioState *audio_init(Audiodev *dev, const c= har *name) s->period_ticks =3D dev->timer_period * (int64_t)SCALE_US; } =20 - e =3D qemu_add_vm_change_state_handler (audio_vm_change_state_handler,= s); - if (!e) { - dolog ("warning: Could not register change state handler\n" - "(Audio can continue looping even after stopping the VM)\n"= ); - } + qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s); =20 QTAILQ_INSERT_TAIL(&audio_states, s, list); QLIST_INIT (&s->card_head); --=20 2.38.1 From nobody Thu Mar 28 18:29:29 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1673628695; cv=none; d=zohomail.com; s=zohoarc; b=cG5k9/sNRWJ+N8lPnBK1WcPhxnO/uqW3YUZSDgR/CbI+mvNVG0Q80A+iyj+ASiE//hQ7SLdNmUxpGnh4GwbSLvlhhLGdHdIhdEuhFg9RV2r9KQ1Y9QyVnloWPQQGXybIAxOsxIJPF9JzD0DKF1PJx7W1sk9/I+4336coArtkPQQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673628695; h=Content-Type:Content-Transfer-Encoding:Cc: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=QUJZXwRhI/ZpOXg/x4d3lTmRvcHGDw/vsn6+oWZD5uY=; b=I3W2FZd1I5Vh52m19yEp7G3EMKyIBPVuelQ5Dl04/pJFvegI0vZYOouaR2kxPtVVIvpw8wWoPiOv5ZaUvNNuiF5CBEhKaSzXSkqPF+AooApNtZHdRGCy6isnG7lOCAop5XKrFIauwgFWtx6gqENf+UsRQQfzPaxeoGog3TeApxE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTP id 16736286954781010.6388082524419; Fri, 13 Jan 2023 08:51:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGMom-0006j8-Qr; Fri, 13 Jan 2023 11:22:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGMoj-0006en-Kf for qemu-devel@nongnu.org; Fri, 13 Jan 2023 11:22:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGMog-0005m5-NA for qemu-devel@nongnu.org; Fri, 13 Jan 2023 11:22:09 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-336-h_a9ZMgaM1Coyh0AoWYrXQ-1; Fri, 13 Jan 2023 11:22:02 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 86DF78533DD; Fri, 13 Jan 2023 16:22:02 +0000 (UTC) Received: from virtlab420.virt.lab.eng.bos.redhat.com (virtlab420.virt.lab.eng.bos.redhat.com [10.19.152.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2385E40C2004; Fri, 13 Jan 2023 16:22:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673626926; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QUJZXwRhI/ZpOXg/x4d3lTmRvcHGDw/vsn6+oWZD5uY=; b=bts6saHwMu9R8IT+qqjcMRfPjd9reEOH34V4DQ8nuQ/8RQXeyjJt2G2tA46nLAF68IiaIG rRrT6p3xGfibxO65o7/D7+TuhTsEKU/39CWXZsuWvn2n7uYbPf+nmj7JJD2d1SWmXKvuAh DUR1OBuv6bsI+Wtnv2LeTMxV738Cp6U= X-MC-Unique: h_a9ZMgaM1Coyh0AoWYrXQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Bandan Das , Laurent Vivier , Darren Kenny , Stefan Hajnoczi , libvir-list@redhat.com, Qiuhao Li , Paolo Bonzini , Christian Schoenebeck , Thomas Huth , Gerd Hoffmann , Alexander Bulekov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 2/9] audio: remove special audio_calloc function Date: Fri, 13 Jan 2023 11:21:53 -0500 Message-Id: <20230113162200.3010804-3-berrange@redhat.com> In-Reply-To: <20230113162200.3010804-1-berrange@redhat.com> References: <20230113162200.3010804-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1673628696789100003 The audio_calloc function does various checks on the size and nmembers parameters to detect various error conditions. There are only 5 callers * alsa_poll_helper: the pollfd count is small and bounded, * audio_pcm_create_voice_pair_: allocating a single fixed size struct * audio_pcm_sw_alloc_resources_: samples could be negative zero, or overflow, so needs a check * audio_pcm_hw_add_new_: voice size could be zero for backends that don't support audio input * st_rate_start: allocating a single fixed size struct IOW, only two of the callers need special error checks and it is clearer if their respective checks are inlined. Thus audio_calloc can be eliminated. Signed-off-by: Daniel P. Berrang=C3=A9 --- audio/alsaaudio.c | 6 +----- audio/audio.c | 20 -------------------- audio/audio_int.h | 1 - audio/audio_template.h | 28 ++++++++++++++-------------- audio/mixeng.c | 7 +------ tests/qtest/fuzz-sb16-test.c | 6 ++++-- 6 files changed, 20 insertions(+), 48 deletions(-) diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 714bfb6453..5f50dfa0bf 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -222,11 +222,7 @@ static int alsa_poll_helper (snd_pcm_t *handle, struct= pollhlp *hlp, int mask) return -1; } =20 - pfds =3D audio_calloc ("alsa_poll_helper", count, sizeof (*pfds)); - if (!pfds) { - dolog ("Could not initialize poll mode\n"); - return -1; - } + pfds =3D g_new0(struct pollfd, count); =20 err =3D snd_pcm_poll_descriptors (handle, pfds, count); if (err < 0) { diff --git a/audio/audio.c b/audio/audio.c index 7b4b957945..f397072a1f 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -146,26 +146,6 @@ static inline int audio_bits_to_index (int bits) } } =20 -void *audio_calloc (const char *funcname, int nmemb, size_t size) -{ - int cond; - size_t len; - - len =3D nmemb * size; - cond =3D !nmemb || !size; - cond |=3D nmemb < 0; - cond |=3D len < size; - - if (audio_bug ("audio_calloc", cond)) { - AUD_log (NULL, "%s passed invalid arguments to audio_calloc\n", - funcname); - AUD_log (NULL, "nmemb=3D%d size=3D%zu (len=3D%zu)\n", nmemb, size,= len); - return NULL; - } - - return g_malloc0 (len); -} - void AUD_vlog (const char *cap, const char *fmt, va_list ap) { if (cap) { diff --git a/audio/audio_int.h b/audio/audio_int.h index e87ce014a0..b0cc2cd390 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -251,7 +251,6 @@ void audio_pcm_init_info (struct audio_pcm_info *info, = struct audsettings *as); void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int= len); =20 int audio_bug (const char *funcname, int cond); -void *audio_calloc (const char *funcname, int nmemb, size_t size); =20 void audio_run(AudioState *s, const char *msg); =20 diff --git a/audio/audio_template.h b/audio/audio_template.h index 720a32e57e..564cbb1f01 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -116,13 +116,20 @@ static int glue (audio_pcm_sw_alloc_resources_, TYPE)= (SW *sw) samples =3D (int64_t)sw->HWBUF->size * sw->ratio >> 32; #endif =20 - sw->buf =3D audio_calloc(__func__, samples, sizeof(struct st_sample)); - if (!sw->buf) { - dolog ("Could not allocate buffer for `%s' (%d samples)\n", + if (audio_bug(__func__, samples <=3D 0)) { + dolog ("Could not allocate buffer for '%s', samples %d <=3D 0\n", SW_NAME (sw), samples); return -1; } =20 + if (audio_bug(__func__, (SIZE_MAX / sizeof(struct st_sample) < samples= ))) { + dolog ("Could not allocate buffer for '%s', samples %d overflows\n= ", + SW_NAME (sw), samples); + return -1; + } + + sw->buf =3D g_new0(struct st_sample, samples); + #ifdef DAC sw->rate =3D st_rate_start (sw->info.freq, sw->hw->info.freq); #else @@ -264,13 +271,12 @@ static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioSta= te *s, return NULL; } =20 - hw =3D audio_calloc(__func__, 1, glue(drv->voice_size_, TYPE)); - if (!hw) { - dolog ("Can not allocate voice `%s' size %d\n", - drv->name, glue (drv->voice_size_, TYPE)); + if (audio_bug(__func__, glue(drv->voice_size_, TYPE) =3D=3D 0)) { + dolog ("Voice size is zero"); return NULL; } =20 + hw =3D g_malloc0(glue(drv->voice_size_, TYPE)); hw->s =3D s; hw->pcm_ops =3D drv->pcm_ops; =20 @@ -398,12 +404,7 @@ static SW *glue(audio_pcm_create_voice_pair_, TYPE)( hw_as =3D *as; } =20 - sw =3D audio_calloc(__func__, 1, sizeof(*sw)); - if (!sw) { - dolog ("Could not allocate soft voice `%s' (%zu bytes)\n", - sw_name ? sw_name : "unknown", sizeof (*sw)); - goto err1; - } + sw =3D g_new0(SW, 1); sw->s =3D s; =20 hw =3D glue(audio_pcm_hw_add_, TYPE)(s, &hw_as); @@ -424,7 +425,6 @@ err3: glue (audio_pcm_hw_gc_, TYPE) (&hw); err2: g_free (sw); -err1: return NULL; } =20 diff --git a/audio/mixeng.c b/audio/mixeng.c index 100a306d6f..fe454e0725 100644 --- a/audio/mixeng.c +++ b/audio/mixeng.c @@ -414,12 +414,7 @@ struct rate { */ void *st_rate_start (int inrate, int outrate) { - struct rate *rate =3D audio_calloc(__func__, 1, sizeof(*rate)); - - if (!rate) { - dolog ("Could not allocate resampler (%zu bytes)\n", sizeof (*rate= )); - return NULL; - } + struct rate *rate =3D g_new0(struct rate, 1); =20 rate->opos =3D 0; =20 diff --git a/tests/qtest/fuzz-sb16-test.c b/tests/qtest/fuzz-sb16-test.c index fc445b1871..a28b93be3a 100644 --- a/tests/qtest/fuzz-sb16-test.c +++ b/tests/qtest/fuzz-sb16-test.c @@ -10,7 +10,8 @@ #include "libqtest.h" =20 /* - * This used to trigger the assert in audio_calloc + * This used to trigger the audio_bug calls in + * audio_pcm_sw_alloc_resources * https://bugs.launchpad.net/qemu/+bug/1910603 */ static void test_fuzz_sb16_0x1c(void) @@ -38,7 +39,8 @@ static void test_fuzz_sb16_0x91(void) } =20 /* - * This used to trigger the assert in audio_calloc + * This used to trigger the audio_bug calls in + * audio_pcm_sw_alloc_resources * through command 0xd4 */ static void test_fuzz_sb16_0xd4(void) --=20 2.38.1 From nobody Thu Mar 28 18:29:29 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1673628787; cv=none; d=zohomail.com; s=zohoarc; b=CKjY23cYgeQ67all/uWTkUpTmmgrU1mKibmJDBqX0WNhDOkGi2sBySoNIhcXz7fSOOhLjZ1oebgxLcKt1zaGpNThrQeSUomZNZvEocv8tAaTjxgNCWPv8BI6GHSGhP9O+BpdOStnAXutcRUvpexkpBkfYWwewpepUq7Wvbmrx5s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673628787; h=Content-Type:Content-Transfer-Encoding:Cc: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=7TzEFAxcv2PQvpAb3thNAe0/ZFRqlJRdD22F8VbnDMU=; b=FZtaSc1R9wWUXHIthXMPsoYxPRNYSZgc14rK4aDly93W/+1g9BzUkX8AdM1b907eiswdS8qD9UgW+iq8RFyaGt5R7C7e9/cO0IJCDwTAs41y/HnoBbM/OFICEkjpL/Uq7JG+Mvni1Mc4aUR0obnCCKA44hhlDS6jIiRgYPePieY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTP id 1673628787069511.18264950489333; Fri, 13 Jan 2023 08:53:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGMoo-0006nY-CI; Fri, 13 Jan 2023 11:22:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGMom-0006gl-0G for qemu-devel@nongnu.org; Fri, 13 Jan 2023 11:22:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGMoj-0005mk-GT for qemu-devel@nongnu.org; Fri, 13 Jan 2023 11:22:11 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-392-_4Fo9XqrM-atXzU2U2gbZw-1; Fri, 13 Jan 2023 11:22:03 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F2A6A100F909; Fri, 13 Jan 2023 16:22:02 +0000 (UTC) Received: from virtlab420.virt.lab.eng.bos.redhat.com (virtlab420.virt.lab.eng.bos.redhat.com [10.19.152.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9059440C2008; Fri, 13 Jan 2023 16:22:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673626928; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7TzEFAxcv2PQvpAb3thNAe0/ZFRqlJRdD22F8VbnDMU=; b=VLLfJEWPVViEklHzZHVB/ebDYPc5rjtU08KzYhwQOWbkApRjDu4EgUT1I0cTAMTxIrGhfe 6d/4r2BNESyTe7J1U/WPYPuvnDMdl6L1dueO8iQcJ0jm+iBDzH+06JESX5P2GrhlF7Y7sz Vf6jR4AfZptcwaQzlpX1XdBveW/f2iA= X-MC-Unique: _4Fo9XqrM-atXzU2U2gbZw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Bandan Das , Laurent Vivier , Darren Kenny , Stefan Hajnoczi , libvir-list@redhat.com, Qiuhao Li , Paolo Bonzini , Christian Schoenebeck , Thomas Huth , Gerd Hoffmann , Alexander Bulekov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 3/9] audio: remove unused 'name' in QEMUSoundCard struct Date: Fri, 13 Jan 2023 11:21:54 -0500 Message-Id: <20230113162200.3010804-4-berrange@redhat.com> In-Reply-To: <20230113162200.3010804-1-berrange@redhat.com> References: <20230113162200.3010804-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1673628787575100001 Signed-off-by: Daniel P. Berrang=C3=A9 --- audio/audio.c | 2 -- audio/audio.h | 1 - 2 files changed, 3 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index f397072a1f..94a16c2dda 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1833,7 +1833,6 @@ void AUD_register_card (const char *name, QEMUSoundCa= rd *card) card->state =3D audio_init(NULL, name); } =20 - card->name =3D g_strdup (name); memset (&card->entries, 0, sizeof (card->entries)); QLIST_INSERT_HEAD(&card->state->card_head, card, entries); } @@ -1841,7 +1840,6 @@ void AUD_register_card (const char *name, QEMUSoundCa= rd *card) void AUD_remove_card (QEMUSoundCard *card) { QLIST_REMOVE (card, entries); - g_free (card->name); } =20 static struct audio_pcm_ops capture_pcm_ops; diff --git a/audio/audio.h b/audio/audio.h index 01bdc567fb..eefb809a54 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -82,7 +82,6 @@ typedef struct SWVoiceIn SWVoiceIn; =20 typedef struct AudioState AudioState; typedef struct QEMUSoundCard { - char *name; AudioState *state; QLIST_ENTRY (QEMUSoundCard) entries; } QEMUSoundCard; --=20 2.38.1 From nobody Thu Mar 28 18:29:29 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1673629906; cv=none; d=zohomail.com; s=zohoarc; b=HKpdex0zJddtH2LJbeROB47TMiNhmn0XixXh5thdrYhqUe220fL4Bp+4wJ9fKDnQljBrkpEgeXLEKbMpJtdsuP5hJlp33KMd951CEeAJD8GH1VW4wum6sI5/WjEayK7PYtABPGorOcycGmp2xenk5tw+NkICCdNjMon3lp7p2xk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673629906; h=Content-Type:Content-Transfer-Encoding:Cc: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=Qj/HapzcHsz+lqoeq6mPy+OvCjqNa7TRsHescVWlvFg=; b=YgT0B2cub4bpJpxY1aXRMdNol4msDeh8OCtca3CRvcciTAkI7lCpyhNxs6R+SngQg/I5frcC8Np7rxgRKpEhuLhklYWMxp3NLzJNtoIqD6Q4KzoHYfRJazLcqvxtQkK/TqwQ/AP42nVp6IiCrD1DLNNv+OVYFf+ONkoRSQ1Kc4E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673629906741154.25184164229233; Fri, 13 Jan 2023 09:11:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGMol-0006fn-2H; Fri, 13 Jan 2023 11:22:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGMoi-0006e1-0Y for qemu-devel@nongnu.org; Fri, 13 Jan 2023 11:22:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGMog-0005lu-HJ for qemu-devel@nongnu.org; Fri, 13 Jan 2023 11:22:07 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-632-unUBocPKOxG0JG3N_nxEgg-1; Fri, 13 Jan 2023 11:22:03 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6A5BA380391F; Fri, 13 Jan 2023 16:22:03 +0000 (UTC) Received: from virtlab420.virt.lab.eng.bos.redhat.com (virtlab420.virt.lab.eng.bos.redhat.com [10.19.152.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0898940C2007; Fri, 13 Jan 2023 16:22:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673626925; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Qj/HapzcHsz+lqoeq6mPy+OvCjqNa7TRsHescVWlvFg=; b=QRIwQa8366a+Ob0l7h0yeA0i2U17KDR7lUT2lnA2L6MNzZpv4kIrfOVqo88vIliGpoHSwf ykXm8D34vXwMRxQxHnfJ7bbRi2aG5h4oIs9WxXOwQ3Dl2j2iWcQ6Wbjg+rVAmb5TJSQQm/ NMAMLqb/mQmyhULNM9yXHOotC4CJUvk= X-MC-Unique: unUBocPKOxG0JG3N_nxEgg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Bandan Das , Laurent Vivier , Darren Kenny , Stefan Hajnoczi , libvir-list@redhat.com, Qiuhao Li , Paolo Bonzini , Christian Schoenebeck , Thomas Huth , Gerd Hoffmann , Alexander Bulekov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 4/9] audio: remove QEMUSoundCard linked list Date: Fri, 13 Jan 2023 11:21:55 -0500 Message-Id: <20230113162200.3010804-5-berrange@redhat.com> In-Reply-To: <20230113162200.3010804-1-berrange@redhat.com> References: <20230113162200.3010804-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1673629909756100001 No code ever iterates over the list Signed-off-by: Daniel P. Berrang=C3=A9 --- audio/audio.c | 5 ----- audio/audio.h | 1 - audio/audio_int.h | 1 - 3 files changed, 7 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 94a16c2dda..217095306f 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1812,7 +1812,6 @@ static AudioState *audio_init(Audiodev *dev, const ch= ar *name) qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s); =20 QTAILQ_INSERT_TAIL(&audio_states, s, list); - QLIST_INIT (&s->card_head); vmstate_register (NULL, 0, &vmstate_audio, s); return s; } @@ -1832,14 +1831,10 @@ void AUD_register_card (const char *name, QEMUSound= Card *card) if (!card->state) { card->state =3D audio_init(NULL, name); } - - memset (&card->entries, 0, sizeof (card->entries)); - QLIST_INSERT_HEAD(&card->state->card_head, card, entries); } =20 void AUD_remove_card (QEMUSoundCard *card) { - QLIST_REMOVE (card, entries); } =20 static struct audio_pcm_ops capture_pcm_ops; diff --git a/audio/audio.h b/audio/audio.h index eefb809a54..ebcc540431 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -83,7 +83,6 @@ typedef struct SWVoiceIn SWVoiceIn; typedef struct AudioState AudioState; typedef struct QEMUSoundCard { AudioState *state; - QLIST_ENTRY (QEMUSoundCard) entries; } QEMUSoundCard; =20 typedef struct QEMUAudioTimeStamp { diff --git a/audio/audio_int.h b/audio/audio_int.h index b0cc2cd390..ca62e49ee5 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -225,7 +225,6 @@ typedef struct AudioState { void *drv_opaque; =20 QEMUTimer *ts; - QLIST_HEAD (card_listhead, QEMUSoundCard) card_head; QLIST_HEAD (hw_in_listhead, HWVoiceIn) hw_head_in; QLIST_HEAD (hw_out_listhead, HWVoiceOut) hw_head_out; QLIST_HEAD (cap_listhead, CaptureVoiceOut) cap_head; --=20 2.38.1 From nobody Thu Mar 28 18:29:29 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1673632343; cv=none; d=zohomail.com; s=zohoarc; b=jHNw2xbasT9RwlY+bj1le5ujCGoP4ReElMR1TE2CE1mKH0KyZCSgkUMprhk3QPMiRXCegqDcxdROrwG5akUdht4NpNt1PunRQuo2wzf0LA8unBaaESxA81OrtsyQGp+KBAG0TV8wvXlp7e1W9LB9hMm3sq/gGQ8e/WTpF31W9Yk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673632343; h=Content-Type:Content-Transfer-Encoding:Cc: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=KAQDfWpLcqoo9B3hgDRi7A7BLl+HhUfF24Yv3pMnP3I=; b=ekx4SfpcX4veF+BXiYWxyBkYQO3CDrekCwztRJqKAwNQ4yZ399ReYMvqktqNvKAa73krScvIea1HKbzly42neZFTXML6NW1jD3vwr7dsMY7xP3gV0DljAZoU/maKwIYNUH49OMoa998jpBNU7HcUjfFJB/S7SRcKJh3nwN66vHI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTP id 1673632343901922.6290570843241; Fri, 13 Jan 2023 09:52:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGMon-0006n6-HD; Fri, 13 Jan 2023 11:22:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGMol-0006g1-AD for qemu-devel@nongnu.org; Fri, 13 Jan 2023 11:22:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGMoj-0005mP-BE for qemu-devel@nongnu.org; Fri, 13 Jan 2023 11:22:10 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-357-vEquTEDoOFu0D4j0Q6cDyQ-1; Fri, 13 Jan 2023 11:22:04 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D7E5280D0F2; Fri, 13 Jan 2023 16:22:03 +0000 (UTC) Received: from virtlab420.virt.lab.eng.bos.redhat.com (virtlab420.virt.lab.eng.bos.redhat.com [10.19.152.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 744E240C2007; Fri, 13 Jan 2023 16:22:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673626927; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KAQDfWpLcqoo9B3hgDRi7A7BLl+HhUfF24Yv3pMnP3I=; b=PL1uhUBkhlXyD/L9vyAl9Es2nIkJv/3+93WSVDoVK9nDmtXdQfGLV/16coO/rgS/ES0/jU h8FAOHRyNSoWySM2YSRXBc5tFQS74ux7Fkm1su5M+69lBSKGE+4tanKrcBUIMdvpb5yTZA h6EmsIzYsObrAS2jA3bmrB34zwN+yeg= X-MC-Unique: vEquTEDoOFu0D4j0Q6cDyQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Bandan Das , Laurent Vivier , Darren Kenny , Stefan Hajnoczi , libvir-list@redhat.com, Qiuhao Li , Paolo Bonzini , Christian Schoenebeck , Thomas Huth , Gerd Hoffmann , Alexander Bulekov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 5/9] audio: remove empty AUD_remove_card method Date: Fri, 13 Jan 2023 11:21:56 -0500 Message-Id: <20230113162200.3010804-6-berrange@redhat.com> In-Reply-To: <20230113162200.3010804-1-berrange@redhat.com> References: <20230113162200.3010804-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1673632346173100005 Since the linked list of QEMUSoundCard structs was removed, AUD_remove_card does nothing useful. Signed-off-by: Daniel P. Berrang=C3=A9 --- audio/audio.c | 4 ---- audio/audio.h | 1 - hw/audio/ac97.c | 1 - hw/audio/adlib.c | 1 - hw/audio/es1370.c | 1 - hw/audio/gus.c | 1 - hw/audio/hda-codec.c | 1 - hw/audio/wm8750.c | 1 - hw/usb/dev-audio.c | 1 - 9 files changed, 12 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 217095306f..00128c2ad7 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1833,10 +1833,6 @@ void AUD_register_card (const char *name, QEMUSoundC= ard *card) } } =20 -void AUD_remove_card (QEMUSoundCard *card) -{ -} - static struct audio_pcm_ops capture_pcm_ops; =20 CaptureVoiceOut *AUD_add_capture( diff --git a/audio/audio.h b/audio/audio.h index ebcc540431..8ee0e2159a 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -93,7 +93,6 @@ void AUD_vlog (const char *cap, const char *fmt, va_list = ap) G_GNUC_PRINTF(2, 0) void AUD_log (const char *cap, const char *fmt, ...) G_GNUC_PRINTF(2, 3); =20 void AUD_register_card (const char *name, QEMUSoundCard *card); -void AUD_remove_card (QEMUSoundCard *card); CaptureVoiceOut *AUD_add_capture( AudioState *s, struct audsettings *as, diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c index 364cdfa733..fd8d3abba4 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -1358,7 +1358,6 @@ static void ac97_exit(PCIDevice *dev) AUD_close_in(&s->card, s->voice_pi); AUD_close_out(&s->card, s->voice_po); AUD_close_in(&s->card, s->voice_mc); - AUD_remove_card(&s->card); } =20 static Property ac97_properties[] =3D { diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index 5f979b1487..79b1b8e271 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -240,7 +240,6 @@ static void Adlib_fini (AdlibState *s) =20 s->active =3D 0; s->enabled =3D 0; - AUD_remove_card (&s->card); } =20 static MemoryRegionPortio adlib_portio_list[] =3D { diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index 54cc19a637..9a504db37e 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -882,7 +882,6 @@ static void es1370_exit(PCIDevice *dev) } =20 AUD_close_in(&s->card, s->adc_voice); - AUD_remove_card(&s->card); } =20 static Property es1370_properties[] =3D { diff --git a/hw/audio/gus.c b/hw/audio/gus.c index 42f010b671..c086502708 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -263,7 +263,6 @@ static void gus_realizefn (DeviceState *dev, Error **er= rp) ); =20 if (!s->voice) { - AUD_remove_card (&s->card); error_setg(errp, "No voice"); return; } diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c index feb8f9e2bb..f70a6798df 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -743,7 +743,6 @@ static void hda_audio_exit(HDACodecDevice *hda) AUD_close_in(&a->card, st->voice.in); } } - AUD_remove_card(&a->card); } =20 static int hda_audio_post_load(void *opaque, int version) diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c index b5722b37c3..b63943dd3e 100644 --- a/hw/audio/wm8750.c +++ b/hw/audio/wm8750.c @@ -634,7 +634,6 @@ static void wm8750_fini(I2CSlave *i2c) WM8750State *s =3D WM8750(i2c); =20 wm8750_reset(I2C_SLAVE(s)); - AUD_remove_card(&s->card); g_free(s); } #endif diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c index 8748c1ba04..72cc89548e 100644 --- a/hw/usb/dev-audio.c +++ b/hw/usb/dev-audio.c @@ -934,7 +934,6 @@ static void usb_audio_unrealize(USBDevice *dev) =20 usb_audio_set_output_altset(s, ALTSET_OFF); AUD_close_out(&s->card, s->out.voice); - AUD_remove_card(&s->card); =20 streambuf_fini(&s->out.buf); } --=20 2.38.1 From nobody Thu Mar 28 18:29:29 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1673628577; cv=none; d=zohomail.com; s=zohoarc; b=jdyhVSTMJB+fRzH7TokTCMuqEJrl8L7ZUKAh/sm5FIg1l5grsidCrvbG/6e23bKItcDSdYvLMQInsi/MEuDJSvB6/qE6YvE/DzvVyhFB9ULp+4IZ/GVQ0BaRJLCNQ/IcHGNzXl6G+pQdr72UwZzVP9o4U5/kQihZi9Di5rFK9/4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673628577; h=Content-Type:Content-Transfer-Encoding:Cc: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=Tzfv8E4HkalhE4DNSV/r4avzE4q8NByPAEoX0XIFwBU=; b=h6zWDxDhdmUCP2Nwvc8VDqsHXZpAIC0T612ZaRs+alrlkMcJXZBOMp3YABF6iBhk73lFlLWdaD76VU3d0V+GjRLWW2rTJcNOrrprFuBXh9JKz4m44fRzBU7lhQ8jwY9UUhcr7IcVNQKfZ6Star4/cwL50QAV9H500EYUGXXF0a8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673628576809753.7428241461898; Fri, 13 Jan 2023 08:49:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGMom-0006je-SY; Fri, 13 Jan 2023 11:22:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGMok-0006fE-0e for qemu-devel@nongnu.org; Fri, 13 Jan 2023 11:22:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGMoi-0005mY-FR for qemu-devel@nongnu.org; Fri, 13 Jan 2023 11:22:09 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-615-4-7xkiNiMoOld1ktRhwCuQ-1; Fri, 13 Jan 2023 11:22:04 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 50F828533E5; Fri, 13 Jan 2023 16:22:04 +0000 (UTC) Received: from virtlab420.virt.lab.eng.bos.redhat.com (virtlab420.virt.lab.eng.bos.redhat.com [10.19.152.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id E177C40C2009; Fri, 13 Jan 2023 16:22:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673626927; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Tzfv8E4HkalhE4DNSV/r4avzE4q8NByPAEoX0XIFwBU=; b=GVodUS1JPDhsZo5M0Uvxp6l66JrGQ7lKUba9gm3IzqyIeRnW9gOtBGemZe1VmwV1JnzhWv jKEsZVFGzP4N23igdcKbU0sw8geKGYXSgygVyLFyLre5HAMHYx8Q1Stpsr7TowoXVwMlK2 ERoRWZ4nfWUwmZKs9Kei5KTDjlNn5qY= X-MC-Unique: 4-7xkiNiMoOld1ktRhwCuQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Bandan Das , Laurent Vivier , Darren Kenny , Stefan Hajnoczi , libvir-list@redhat.com, Qiuhao Li , Paolo Bonzini , Christian Schoenebeck , Thomas Huth , Gerd Hoffmann , Alexander Bulekov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 6/9] docs: split the deprecation warning for soundcards vs VNC Date: Fri, 13 Jan 2023 11:21:57 -0500 Message-Id: <20230113162200.3010804-7-berrange@redhat.com> In-Reply-To: <20230113162200.3010804-1-berrange@redhat.com> References: <20230113162200.3010804-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1673628577731100001 Both soundcards and VNC will require the audiodev=3D property but lets split the deprecation message since these are distinct functional areas. Signed-off-by: Daniel P. Berrang=C3=A9 --- docs/about/deprecated.rst | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 68d29642d7..f8b4e19a4c 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -31,13 +31,17 @@ backend settings instead of environment variables. To = ease migration to the new format, the ``-audiodev-help`` option can be used to convert the current values of the environment variables to ``-audiodev`` options. =20 -Creating sound card devices and vnc without ``audiodev=3D`` property (sinc= e 4.2) -''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''= '''' +Creating sound card devices without ``audiodev=3D`` property (since 4.2) +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' =20 When not using the deprecated legacy audio config, each sound card -should specify an ``audiodev=3D`` property. Additionally, when using -vnc, you should specify an ``audiodev=3D`` property if you plan to -transmit audio through the VNC protocol. +should specify an ``audiodev=3D`` property. + +Supporting audio transfer over vnc without ``audiodev=3D`` property (since= 4.2) +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''= ''' + +When using vnc, you should specify an ``audiodev=3D`` property if you +intend to allow clients to request audio transfer through the VNC protocol. =20 Short-form boolean options (since 6.0) '''''''''''''''''''''''''''''''''''''' --=20 2.38.1 From nobody Thu Mar 28 18:29:29 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1673632172; cv=none; d=zohomail.com; s=zohoarc; b=cElmi/hYlTMIz7WPL0uhKSqYqOwSV/daEfrwwICoMe9BmmXylzaUxF2QEmJZ3nBJbaYBIWXTUSF3lUlLl7GgaKLe+RmmwNDDlbIxnHOpmyx8S+As5qZZJ5b9OsUyJw6cyyxf28E5s/WYYyVkniotRnYuWxqSv9oDgO/C6QumxFQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673632172; h=Content-Type:Content-Transfer-Encoding:Cc: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=JWtr3IkFkZPanTUxj9VN9+uXxoW9kIuEKYwCuuJuEQI=; b=FID15WenRjvN9T/w5i65B5/dCVsXxZhiHS1EguBe0zqMtJCZsurDW3PXCx2k6XlSI5cyZhLaTR94L1ZBjDdvloAPOZL6YsrgKR3waftaA4HW/GYSBUE229Rcjq/zuFRJLb92NHGMmB26sPBvV0u9p3iJPHZbFaXVTB9/8SsbQrA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673632172478625.6349710588214; Fri, 13 Jan 2023 09:49:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGMon-0006nA-Ja; Fri, 13 Jan 2023 11:22:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGMom-0006gz-64 for qemu-devel@nongnu.org; Fri, 13 Jan 2023 11:22:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGMok-0005n2-Jv for qemu-devel@nongnu.org; Fri, 13 Jan 2023 11:22:11 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-449-xcD7qVLjPzC4fMH2km8Zaw-1; Fri, 13 Jan 2023 11:22:05 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BE05E3C0D872; Fri, 13 Jan 2023 16:22:04 +0000 (UTC) Received: from virtlab420.virt.lab.eng.bos.redhat.com (virtlab420.virt.lab.eng.bos.redhat.com [10.19.152.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 59E5240C200A; Fri, 13 Jan 2023 16:22:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673626929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JWtr3IkFkZPanTUxj9VN9+uXxoW9kIuEKYwCuuJuEQI=; b=HsSNOo5RivpyT5ZhbjddVy/BY7SVTlfLrPt6lK10b2fsd23WJLdpHiJi+OGkqmkPH+ypjS SjucIb8EhlBTrQ+jevJgaUXyiJ9JjBX3oQ6kq9GCOrRKJtuleJIOQM1kyAMwFAY1Xy2XrJ cjNlEFt/deWlsGGf0Z8r/zJEfAAg5A8= X-MC-Unique: xcD7qVLjPzC4fMH2km8Zaw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Bandan Das , Laurent Vivier , Darren Kenny , Stefan Hajnoczi , libvir-list@redhat.com, Qiuhao Li , Paolo Bonzini , Christian Schoenebeck , Thomas Huth , Gerd Hoffmann , Alexander Bulekov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 7/9] ui/vnc: don't accept VNC_ENCODING_AUDIO without audiodev Date: Fri, 13 Jan 2023 11:21:58 -0500 Message-Id: <20230113162200.3010804-8-berrange@redhat.com> In-Reply-To: <20230113162200.3010804-1-berrange@redhat.com> References: <20230113162200.3010804-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1673632174286100005 If we have no audio state configured, then we don't want to advertize the VNC_ENCODING_AUDIO feature. If a client attempts to use it despite being disabled, we should also reject it. Signed-off-by: Daniel P. Berrang=C3=A9 --- docs/about/deprecated.rst | 6 ------ docs/about/removed-features.rst | 6 ++++++ ui/vnc.c | 10 +++++++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index f8b4e19a4c..09269f55e6 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -37,12 +37,6 @@ Creating sound card devices without ``audiodev=3D`` prop= erty (since 4.2) When not using the deprecated legacy audio config, each sound card should specify an ``audiodev=3D`` property. =20 -Supporting audio transfer over vnc without ``audiodev=3D`` property (since= 4.2) -''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''= ''' - -When using vnc, you should specify an ``audiodev=3D`` property if you -intend to allow clients to request audio transfer through the VNC protocol. - Short-form boolean options (since 6.0) '''''''''''''''''''''''''''''''''''''' =20 diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.= rst index c918cabd1a..8a8e0faff0 100644 --- a/docs/about/removed-features.rst +++ b/docs/about/removed-features.rst @@ -422,6 +422,12 @@ the value is hexadecimal. That is, '0x20M' should be = written either as ``tty`` and ``parport`` used to be aliases for ``serial`` and ``parallel`` respectively. The actual backend names should be used instead. =20 +Supporting audio transfer over vnc without ``audiodev=3D`` property (remov= ed in 8.0) +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''= '''''''' + +When using vnc, you should specify an ``audiodev=3D`` property if you +intend to allow clients to request audio transfer through the VNC protocol. + QEMU Machine Protocol (QMP) commands ------------------------------------ =20 diff --git a/ui/vnc.c b/ui/vnc.c index d9eacad759..6b3cbf365e 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -2199,7 +2199,9 @@ static void set_encodings(VncState *vs, int32_t *enco= dings, size_t n_encodings) send_ext_key_event_ack(vs); break; case VNC_ENCODING_AUDIO: - send_ext_audio_ack(vs); + if (vs->vd->audio_state !=3D NULL) { + send_ext_audio_ack(vs); + } break; case VNC_ENCODING_WMVi: vs->features |=3D VNC_FEATURE_WMVI_MASK; @@ -2506,6 +2508,12 @@ static int protocol_client_msg(VncState *vs, uint8_t= *data, size_t len) read_u32(data, 4), read_u32(data, 8)); break; case VNC_MSG_CLIENT_QEMU_AUDIO: + if (vs->vd->audio_state =3D=3D NULL) { + error_report("vnc: QEMU audio client message while disable= d"); + vnc_client_error(vs); + break; + } + if (len =3D=3D 2) return 4; =20 --=20 2.38.1 From nobody Thu Mar 28 18:29:29 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1673629946; cv=none; d=zohomail.com; s=zohoarc; b=YSDdZcFYR0bht0mIMGFjO9cO4C7AhxJAZoou0SdSvI7TLldaVcSYuemNFBhg5pnUJYQpr2nSRkqA0TtUNaRu+3TtN7L2tou8AmZyTcMIxFUws/xr5DHTjA4HHOj3WNT1k4TGx0tDAMFbqpCHm4sIGQmpXPXfJFYJGIJOoC3H+GA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673629946; h=Content-Type:Content-Transfer-Encoding:Cc: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=Fxf2eQfpj317yGTxZbl+GiSK/HZWUlTW19vBt7sQhNQ=; b=Q8++JbBxGsjrmFcMowJkNmJG+Pi4Ky1RfJeFjWy5Q2PISxu9dh5aIPUoNNfdCF71ZpEx+pgTsNmdObmqEdrNwWdWXrL4rQNv8e62Vcs71QEQVajbQY7DqmX+rnSoqlN2hiGnxpO/zWJq2uPXGaZtDKj2nrLMQQu9favkFoB9AIw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673629946876563.7765183041344; Fri, 13 Jan 2023 09:12:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGMou-0006qk-0x; Fri, 13 Jan 2023 11:22:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGMos-0006q4-JA for qemu-devel@nongnu.org; Fri, 13 Jan 2023 11:22:18 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGMoq-0005oR-Df for qemu-devel@nongnu.org; Fri, 13 Jan 2023 11:22:18 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-110-g-s-igF4PfuWmO4tEMYTAA-1; Fri, 13 Jan 2023 11:22:05 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3793C3802B8E; Fri, 13 Jan 2023 16:22:05 +0000 (UTC) Received: from virtlab420.virt.lab.eng.bos.redhat.com (virtlab420.virt.lab.eng.bos.redhat.com [10.19.152.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id C82E940C2008; Fri, 13 Jan 2023 16:22:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673626935; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fxf2eQfpj317yGTxZbl+GiSK/HZWUlTW19vBt7sQhNQ=; b=MF2vGN+8INcKgjDe5UQD/KuRK6FbU/JjId2MDqko+TxLZi2+TfZ/sgQhPvj/4gIfSwK8EE 5SQn+6IyaiNyML/FZDGRGz1Y0pzmkgnhz6q6vbVR244y++thpYC8wiBvsXt6N2nqbvbfd9 5qR+kWqgogzv/k3irFGxqBK4nZYEzyM= X-MC-Unique: g-s-igF4PfuWmO4tEMYTAA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Bandan Das , Laurent Vivier , Darren Kenny , Stefan Hajnoczi , libvir-list@redhat.com, Qiuhao Li , Paolo Bonzini , Christian Schoenebeck , Thomas Huth , Gerd Hoffmann , Alexander Bulekov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 8/9] audio: audio state is now mandatory for capture Date: Fri, 13 Jan 2023 11:21:59 -0500 Message-Id: <20230113162200.3010804-9-berrange@redhat.com> In-Reply-To: <20230113162200.3010804-1-berrange@redhat.com> References: <20230113162200.3010804-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1673629948991100001 Both callers of AUD_add_capture will now ensure that the audio state is non-NULL. Signed-off-by: Daniel P. Berrang=C3=A9 --- audio/audio.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 00128c2ad7..64b75cdf94 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1845,13 +1845,6 @@ CaptureVoiceOut *AUD_add_capture( CaptureVoiceOut *cap; struct capture_callback *cb; =20 - if (!s) { - if (!legacy_config) { - dolog("Capturing without setting an audiodev is deprecated\n"); - } - s =3D audio_init(NULL, NULL); - } - if (!audio_get_pdo_out(s->dev)->mixing_engine) { dolog("Can't capture with mixeng disabled\n"); return NULL; --=20 2.38.1 From nobody Thu Mar 28 18:29:29 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1673632171; cv=none; d=zohomail.com; s=zohoarc; b=fpSFn6/r+GrmOgvpAwxEEmHAKTOlwdn5+dvM+T+z0TqcKugMFspz1XKQ73LqR2MRoWdH4Dlpx+kBxeSJF5FRhO7hE6L58YlErzsRVbBixW17CgaAAc04wXIv3mFyI9AwiaY+RYcL+1NndixmbcnT1ytIt8EAFu8q8OIDhEFyS/0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673632171; h=Content-Type:Content-Transfer-Encoding:Cc: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=Kbrmk52uqo30F4UpTtTeImHrBkxUwIvXkcoxIAqgaes=; b=Y/GX2Qy1FcjW16itY+1gMLue5I/rGA2pW4hGSXiy7Kdbnw1wHo5GTqr7cHcEW1EREsvmJcyW7eQCyLHRJGxqYPGxw45TYywfPNYNe6OIhzvHb6Q85RBuT8pL792WKhfBMs0vEWMwmvUrAaWqhA7Igp1ouBB20Plzh8yXufULqXI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1673632171584266.43121240806374; Fri, 13 Jan 2023 09:49:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGMon-0006nR-WF; Fri, 13 Jan 2023 11:22:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGMom-0006hC-AK for qemu-devel@nongnu.org; Fri, 13 Jan 2023 11:22:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGMoj-0005mX-C3 for qemu-devel@nongnu.org; Fri, 13 Jan 2023 11:22:12 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-99-G5n2thAYPT6saHtTHQbelQ-1; Fri, 13 Jan 2023 11:22:06 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A7EBD29324A4; Fri, 13 Jan 2023 16:22:05 +0000 (UTC) Received: from virtlab420.virt.lab.eng.bos.redhat.com (virtlab420.virt.lab.eng.bos.redhat.com [10.19.152.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4214640C2009; Fri, 13 Jan 2023 16:22:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673626927; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kbrmk52uqo30F4UpTtTeImHrBkxUwIvXkcoxIAqgaes=; b=GV1HybMd4DgMOlUEHqnrTiqpT9XdwQ8LutdxFlbiQZd8S0BKGIAsviXYRXSAazpmLMQM4L 5KkyE4ka5gv03M7hgMHNzcrOQL8OnAIlvejXGwqlai+pD8qcSThqKw6iOXdrxAtky4ynGI 1b7msDhkfLb687xmyqZ9gmBgLY2hOdo= X-MC-Unique: G5n2thAYPT6saHtTHQbelQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Bandan Das , Laurent Vivier , Darren Kenny , Stefan Hajnoczi , libvir-list@redhat.com, Qiuhao Li , Paolo Bonzini , Christian Schoenebeck , Thomas Huth , Gerd Hoffmann , Alexander Bulekov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 9/9] audio: remove support for QEMU_AUDIO_ env variables Date: Fri, 13 Jan 2023 11:22:00 -0500 Message-Id: <20230113162200.3010804-10-berrange@redhat.com> In-Reply-To: <20230113162200.3010804-1-berrange@redhat.com> References: <20230113162200.3010804-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1673632172320100003 All user created devices and the builtin pcspk can be given a audiodev property. A few devices using audiodevs though cannot be configured directly as they are built-in devices created programmatically by the machine type. To enable those to continue to be used we leave in the logic that picks the first audiodev if none is set explicitly. Ideally this will be removed once there is a way to configure all built-in devices. Even for devices which can be configured explicitly, though, if the 'audiodev' property is mandated to be set to a valid ID at time of realize(), it will break several of our test suites which expect to be able to instantiate any device without setting any properties. So as a final fallback, we have logic that creates an audiodev with the 'none' backend type, which will be used in no -audiodev devices are present at all. Signed-off-by: Daniel P. Berrang=C3=A9 --- audio/audio.c | 26 +- audio/audio.h | 1 - audio/audio_legacy.c | 552 -------------------------------- audio/meson.build | 1 - docs/about/deprecated.rst | 8 - docs/about/removed-features.rst | 8 + softmmu/vl.c | 4 - tests/qtest/libqtest.c | 3 - 8 files changed, 14 insertions(+), 589 deletions(-) delete mode 100644 audio/audio_legacy.c diff --git a/audio/audio.c b/audio/audio.c index 64b75cdf94..f70075c7e4 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -108,8 +108,6 @@ const struct mixeng_volume nominal_volume =3D { #endif }; =20 -static bool legacy_config =3D true; - int audio_bug (const char *funcname, int cond) { if (cond) { @@ -1684,7 +1682,7 @@ static AudiodevListEntry *audiodev_find( * if we have dev, this function was called because of an -audiodev argume= nt =3D> * initialize a new state with it * if dev =3D=3D NULL =3D> legacy implicit initialization, return the alre= ady created - * state or create a new one + * state or create a new no-op one. */ static AudioState *audio_init(Audiodev *dev, const char *name) { @@ -1716,27 +1714,15 @@ static AudioState *audio_init(Audiodev *dev, const = char *name) =20 if (dev) { /* -audiodev option */ - legacy_config =3D false; drvname =3D AudiodevDriver_str(dev->driver); } else if (!QTAILQ_EMPTY(&audio_states)) { - if (!legacy_config) { - dolog("Device %s: audiodev default parameter is deprecated, pl= ease " - "specify audiodev=3D%s\n", name, - QTAILQ_FIRST(&audio_states)->dev->id); - } return QTAILQ_FIRST(&audio_states); } else { - /* legacy implicit initialization */ - head =3D audio_handle_legacy_opts(); - /* - * In case of legacy initialization, all Audiodevs in the list wil= l have - * the same configuration (except the driver), so it doesn't matte= r which - * one we chose. We need an Audiodev to set up AudioState before = we can - * init a driver. Also note that dev at this point is still in the - * list. - */ - dev =3D QSIMPLEQ_FIRST(&head)->dev; - audio_validate_opts(dev, &error_abort); + dev =3D g_new0(Audiodev, 1); + dev->id =3D g_strdup("none"); + dev->driver =3D AUDIODEV_DRIVER_NONE; + + audio_create_pdos(dev); } =20 s =3D g_new0(AudioState, 1); diff --git a/audio/audio.h b/audio/audio.h index 8ee0e2159a..9f7ad056da 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -169,7 +169,6 @@ void audio_define(Audiodev *audio); void audio_parse_option(const char *opt); bool audio_init_audiodevs(void); void audio_help(void); -void audio_legacy_help(void); =20 AudioState *audio_state_by_name(const char *name); const char *audio_get_id(QEMUSoundCard *card); diff --git a/audio/audio_legacy.c b/audio/audio_legacy.c deleted file mode 100644 index 18a89ffffb..0000000000 --- a/audio/audio_legacy.c +++ /dev/null @@ -1,552 +0,0 @@ -/* - * QEMU Audio subsystem: legacy configuration handling - * - * Copyright (c) 2015-2019 Zolt=C3=A1n K=C5=91v=C3=A1g=C3=B3 - * - * Permission is hereby granted, free of charge, to any person obtaining a= copy - * of this software and associated documentation files (the "Software"), t= o deal - * in the Software without restriction, including without limitation the r= ights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included= in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN - * THE SOFTWARE. - */ -#include "qemu/osdep.h" -#include "audio.h" -#include "audio_int.h" -#include "qemu/cutils.h" -#include "qemu/timer.h" -#include "qapi/error.h" -#include "qapi/qapi-visit-audio.h" -#include "qapi/visitor-impl.h" - -#define AUDIO_CAP "audio-legacy" -#include "audio_int.h" - -static uint32_t toui32(const char *str) -{ - unsigned long long ret; - if (parse_uint_full(str, &ret, 10) || ret > UINT32_MAX) { - dolog("Invalid integer value `%s'\n", str); - exit(1); - } - return ret; -} - -/* helper functions to convert env variables */ -static void get_bool(const char *env, bool *dst, bool *has_dst) -{ - const char *val =3D getenv(env); - if (val) { - *dst =3D toui32(val) !=3D 0; - *has_dst =3D true; - } -} - -static void get_int(const char *env, uint32_t *dst, bool *has_dst) -{ - const char *val =3D getenv(env); - if (val) { - *dst =3D toui32(val); - *has_dst =3D true; - } -} - -static void get_str(const char *env, char **dst) -{ - const char *val =3D getenv(env); - if (val) { - g_free(*dst); - *dst =3D g_strdup(val); - } -} - -static void get_fmt(const char *env, AudioFormat *dst, bool *has_dst) -{ - const char *val =3D getenv(env); - if (val) { - size_t i; - for (i =3D 0; AudioFormat_lookup.size; ++i) { - if (strcasecmp(val, AudioFormat_lookup.array[i]) =3D=3D 0) { - *dst =3D i; - *has_dst =3D true; - return; - } - } - - dolog("Invalid audio format `%s'\n", val); - exit(1); - } -} - - -static void get_millis_to_usecs(const char *env, uint32_t *dst, bool *has_= dst) -{ - const char *val =3D getenv(env); - if (val) { - *dst =3D toui32(val) * 1000; - *has_dst =3D true; - } -} - -static uint32_t frames_to_usecs(uint32_t frames, - AudiodevPerDirectionOptions *pdo) -{ - uint32_t freq =3D pdo->has_frequency ? pdo->frequency : 44100; - return (frames * 1000000 + freq / 2) / freq; -} - - -static void get_frames_to_usecs(const char *env, uint32_t *dst, bool *has_= dst, - AudiodevPerDirectionOptions *pdo) -{ - const char *val =3D getenv(env); - if (val) { - *dst =3D frames_to_usecs(toui32(val), pdo); - *has_dst =3D true; - } -} - -static uint32_t samples_to_usecs(uint32_t samples, - AudiodevPerDirectionOptions *pdo) -{ - uint32_t channels =3D pdo->has_channels ? pdo->channels : 2; - return frames_to_usecs(samples / channels, pdo); -} - -static void get_samples_to_usecs(const char *env, uint32_t *dst, bool *has= _dst, - AudiodevPerDirectionOptions *pdo) -{ - const char *val =3D getenv(env); - if (val) { - *dst =3D samples_to_usecs(toui32(val), pdo); - *has_dst =3D true; - } -} - -static uint32_t bytes_to_usecs(uint32_t bytes, AudiodevPerDirectionOptions= *pdo) -{ - AudioFormat fmt =3D pdo->has_format ? pdo->format : AUDIO_FORMAT_S16; - uint32_t bytes_per_sample =3D audioformat_bytes_per_sample(fmt); - return samples_to_usecs(bytes / bytes_per_sample, pdo); -} - -static void get_bytes_to_usecs(const char *env, uint32_t *dst, bool *has_d= st, - AudiodevPerDirectionOptions *pdo) -{ - const char *val =3D getenv(env); - if (val) { - *dst =3D bytes_to_usecs(toui32(val), pdo); - *has_dst =3D true; - } -} - -/* backend specific functions */ -/* ALSA */ -static void handle_alsa_per_direction( - AudiodevAlsaPerDirectionOptions *apdo, const char *prefix) -{ - char buf[64]; - size_t len =3D strlen(prefix); - bool size_in_usecs =3D false; - bool dummy; - - memcpy(buf, prefix, len); - strcpy(buf + len, "TRY_POLL"); - get_bool(buf, &apdo->try_poll, &apdo->has_try_poll); - - strcpy(buf + len, "DEV"); - get_str(buf, &apdo->dev); - - strcpy(buf + len, "SIZE_IN_USEC"); - get_bool(buf, &size_in_usecs, &dummy); - - strcpy(buf + len, "PERIOD_SIZE"); - get_int(buf, &apdo->period_length, &apdo->has_period_length); - if (apdo->has_period_length && !size_in_usecs) { - apdo->period_length =3D frames_to_usecs( - apdo->period_length, - qapi_AudiodevAlsaPerDirectionOptions_base(apdo)); - } - - strcpy(buf + len, "BUFFER_SIZE"); - get_int(buf, &apdo->buffer_length, &apdo->has_buffer_length); - if (apdo->has_buffer_length && !size_in_usecs) { - apdo->buffer_length =3D frames_to_usecs( - apdo->buffer_length, - qapi_AudiodevAlsaPerDirectionOptions_base(apdo)); - } -} - -static void handle_alsa(Audiodev *dev) -{ - AudiodevAlsaOptions *aopt =3D &dev->u.alsa; - handle_alsa_per_direction(aopt->in, "QEMU_ALSA_ADC_"); - handle_alsa_per_direction(aopt->out, "QEMU_ALSA_DAC_"); - - get_millis_to_usecs("QEMU_ALSA_THRESHOLD", - &aopt->threshold, &aopt->has_threshold); -} - -/* coreaudio */ -static void handle_coreaudio(Audiodev *dev) -{ - get_frames_to_usecs( - "QEMU_COREAUDIO_BUFFER_SIZE", - &dev->u.coreaudio.out->buffer_length, - &dev->u.coreaudio.out->has_buffer_length, - qapi_AudiodevCoreaudioPerDirectionOptions_base(dev->u.coreaudio.ou= t)); - get_int("QEMU_COREAUDIO_BUFFER_COUNT", - &dev->u.coreaudio.out->buffer_count, - &dev->u.coreaudio.out->has_buffer_count); -} - -/* dsound */ -static void handle_dsound(Audiodev *dev) -{ - get_millis_to_usecs("QEMU_DSOUND_LATENCY_MILLIS", - &dev->u.dsound.latency, &dev->u.dsound.has_latency= ); - get_bytes_to_usecs("QEMU_DSOUND_BUFSIZE_OUT", - &dev->u.dsound.out->buffer_length, - &dev->u.dsound.out->has_buffer_length, - dev->u.dsound.out); - get_bytes_to_usecs("QEMU_DSOUND_BUFSIZE_IN", - &dev->u.dsound.in->buffer_length, - &dev->u.dsound.in->has_buffer_length, - dev->u.dsound.in); -} - -/* OSS */ -static void handle_oss_per_direction( - AudiodevOssPerDirectionOptions *opdo, const char *try_poll_env, - const char *dev_env) -{ - get_bool(try_poll_env, &opdo->try_poll, &opdo->has_try_poll); - get_str(dev_env, &opdo->dev); - - get_bytes_to_usecs("QEMU_OSS_FRAGSIZE", - &opdo->buffer_length, &opdo->has_buffer_length, - qapi_AudiodevOssPerDirectionOptions_base(opdo)); - get_int("QEMU_OSS_NFRAGS", &opdo->buffer_count, - &opdo->has_buffer_count); -} - -static void handle_oss(Audiodev *dev) -{ - AudiodevOssOptions *oopt =3D &dev->u.oss; - handle_oss_per_direction(oopt->in, "QEMU_AUDIO_ADC_TRY_POLL", - "QEMU_OSS_ADC_DEV"); - handle_oss_per_direction(oopt->out, "QEMU_AUDIO_DAC_TRY_POLL", - "QEMU_OSS_DAC_DEV"); - - get_bool("QEMU_OSS_MMAP", &oopt->try_mmap, &oopt->has_try_mmap); - get_bool("QEMU_OSS_EXCLUSIVE", &oopt->exclusive, &oopt->has_exclusive); - get_int("QEMU_OSS_POLICY", &oopt->dsp_policy, &oopt->has_dsp_policy); -} - -/* pulseaudio */ -static void handle_pa_per_direction( - AudiodevPaPerDirectionOptions *ppdo, const char *env) -{ - get_str(env, &ppdo->name); -} - -static void handle_pa(Audiodev *dev) -{ - handle_pa_per_direction(dev->u.pa.in, "QEMU_PA_SOURCE"); - handle_pa_per_direction(dev->u.pa.out, "QEMU_PA_SINK"); - - get_samples_to_usecs( - "QEMU_PA_SAMPLES", &dev->u.pa.in->buffer_length, - &dev->u.pa.in->has_buffer_length, - qapi_AudiodevPaPerDirectionOptions_base(dev->u.pa.in)); - get_samples_to_usecs( - "QEMU_PA_SAMPLES", &dev->u.pa.out->buffer_length, - &dev->u.pa.out->has_buffer_length, - qapi_AudiodevPaPerDirectionOptions_base(dev->u.pa.out)); - - get_str("QEMU_PA_SERVER", &dev->u.pa.server); -} - -/* SDL */ -static void handle_sdl(Audiodev *dev) -{ - /* SDL is output only */ - get_samples_to_usecs("QEMU_SDL_SAMPLES", &dev->u.sdl.out->buffer_lengt= h, - &dev->u.sdl.out->has_buffer_length, - qapi_AudiodevSdlPerDirectionOptions_base(dev->u.sdl.out)); -} - -/* wav */ -static void handle_wav(Audiodev *dev) -{ - get_int("QEMU_WAV_FREQUENCY", - &dev->u.wav.out->frequency, &dev->u.wav.out->has_frequency); - get_fmt("QEMU_WAV_FORMAT", &dev->u.wav.out->format, - &dev->u.wav.out->has_format); - get_int("QEMU_WAV_DAC_FIXED_CHANNELS", - &dev->u.wav.out->channels, &dev->u.wav.out->has_channels); - get_str("QEMU_WAV_PATH", &dev->u.wav.path); -} - -/* general */ -static void handle_per_direction( - AudiodevPerDirectionOptions *pdo, const char *prefix) -{ - char buf[64]; - size_t len =3D strlen(prefix); - - memcpy(buf, prefix, len); - strcpy(buf + len, "FIXED_SETTINGS"); - get_bool(buf, &pdo->fixed_settings, &pdo->has_fixed_settings); - - strcpy(buf + len, "FIXED_FREQ"); - get_int(buf, &pdo->frequency, &pdo->has_frequency); - - strcpy(buf + len, "FIXED_FMT"); - get_fmt(buf, &pdo->format, &pdo->has_format); - - strcpy(buf + len, "FIXED_CHANNELS"); - get_int(buf, &pdo->channels, &pdo->has_channels); - - strcpy(buf + len, "VOICES"); - get_int(buf, &pdo->voices, &pdo->has_voices); -} - -static AudiodevListEntry *legacy_opt(const char *drvname) -{ - AudiodevListEntry *e =3D g_new0(AudiodevListEntry, 1); - e->dev =3D g_new0(Audiodev, 1); - e->dev->id =3D g_strdup(drvname); - e->dev->driver =3D qapi_enum_parse( - &AudiodevDriver_lookup, drvname, -1, &error_abort); - - audio_create_pdos(e->dev); - - handle_per_direction(audio_get_pdo_in(e->dev), "QEMU_AUDIO_ADC_"); - handle_per_direction(audio_get_pdo_out(e->dev), "QEMU_AUDIO_DAC_"); - - /* Original description: Timer period in HZ (0 - use lowest possible) = */ - get_int("QEMU_AUDIO_TIMER_PERIOD", - &e->dev->timer_period, &e->dev->has_timer_period); - if (e->dev->has_timer_period && e->dev->timer_period) { - e->dev->timer_period =3D NANOSECONDS_PER_SECOND / 1000 / - e->dev->timer_period; - } - - switch (e->dev->driver) { - case AUDIODEV_DRIVER_ALSA: - handle_alsa(e->dev); - break; - - case AUDIODEV_DRIVER_COREAUDIO: - handle_coreaudio(e->dev); - break; - - case AUDIODEV_DRIVER_DSOUND: - handle_dsound(e->dev); - break; - - case AUDIODEV_DRIVER_OSS: - handle_oss(e->dev); - break; - - case AUDIODEV_DRIVER_PA: - handle_pa(e->dev); - break; - - case AUDIODEV_DRIVER_SDL: - handle_sdl(e->dev); - break; - - case AUDIODEV_DRIVER_WAV: - handle_wav(e->dev); - break; - - default: - break; - } - - return e; -} - -AudiodevListHead audio_handle_legacy_opts(void) -{ - const char *drvname =3D getenv("QEMU_AUDIO_DRV"); - AudiodevListHead head =3D QSIMPLEQ_HEAD_INITIALIZER(head); - - if (drvname) { - AudiodevListEntry *e; - audio_driver *driver =3D audio_driver_lookup(drvname); - if (!driver) { - dolog("Unknown audio driver `%s'\n", drvname); - exit(1); - } - e =3D legacy_opt(drvname); - QSIMPLEQ_INSERT_TAIL(&head, e, next); - } else { - for (int i =3D 0; audio_prio_list[i]; i++) { - audio_driver *driver =3D audio_driver_lookup(audio_prio_list[i= ]); - if (driver && driver->can_be_default) { - AudiodevListEntry *e =3D legacy_opt(driver->name); - QSIMPLEQ_INSERT_TAIL(&head, e, next); - } - } - if (QSIMPLEQ_EMPTY(&head)) { - dolog("Internal error: no default audio driver available\n"); - exit(1); - } - } - - return head; -} - -/* visitor to print -audiodev option */ -typedef struct { - Visitor visitor; - - bool comma; - GList *path; -} LegacyPrintVisitor; - -static bool lv_start_struct(Visitor *v, const char *name, void **obj, - size_t size, Error **errp) -{ - LegacyPrintVisitor *lv =3D (LegacyPrintVisitor *) v; - lv->path =3D g_list_append(lv->path, g_strdup(name)); - return true; -} - -static void lv_end_struct(Visitor *v, void **obj) -{ - LegacyPrintVisitor *lv =3D (LegacyPrintVisitor *) v; - lv->path =3D g_list_delete_link(lv->path, g_list_last(lv->path)); -} - -static void lv_print_key(Visitor *v, const char *name) -{ - GList *e; - LegacyPrintVisitor *lv =3D (LegacyPrintVisitor *) v; - if (lv->comma) { - putchar(','); - } else { - lv->comma =3D true; - } - - for (e =3D lv->path; e; e =3D e->next) { - if (e->data) { - printf("%s.", (const char *) e->data); - } - } - - printf("%s=3D", name); -} - -static bool lv_type_int64(Visitor *v, const char *name, int64_t *obj, - Error **errp) -{ - lv_print_key(v, name); - printf("%" PRIi64, *obj); - return true; -} - -static bool lv_type_uint64(Visitor *v, const char *name, uint64_t *obj, - Error **errp) -{ - lv_print_key(v, name); - printf("%" PRIu64, *obj); - return true; -} - -static bool lv_type_bool(Visitor *v, const char *name, bool *obj, Error **= errp) -{ - lv_print_key(v, name); - printf("%s", *obj ? "on" : "off"); - return true; -} - -static bool lv_type_str(Visitor *v, const char *name, char **obj, Error **= errp) -{ - const char *str =3D *obj; - lv_print_key(v, name); - - while (*str) { - if (*str =3D=3D ',') { - putchar(','); - } - putchar(*str++); - } - return true; -} - -static void lv_complete(Visitor *v, void *opaque) -{ - LegacyPrintVisitor *lv =3D (LegacyPrintVisitor *) v; - assert(lv->path =3D=3D NULL); -} - -static void lv_free(Visitor *v) -{ - LegacyPrintVisitor *lv =3D (LegacyPrintVisitor *) v; - - g_list_free_full(lv->path, g_free); - g_free(lv); -} - -static Visitor *legacy_visitor_new(void) -{ - LegacyPrintVisitor *lv =3D g_new0(LegacyPrintVisitor, 1); - - lv->visitor.start_struct =3D lv_start_struct; - lv->visitor.end_struct =3D lv_end_struct; - /* lists not supported */ - lv->visitor.type_int64 =3D lv_type_int64; - lv->visitor.type_uint64 =3D lv_type_uint64; - lv->visitor.type_bool =3D lv_type_bool; - lv->visitor.type_str =3D lv_type_str; - - lv->visitor.type =3D VISITOR_OUTPUT; - lv->visitor.complete =3D lv_complete; - lv->visitor.free =3D lv_free; - - return &lv->visitor; -} - -void audio_legacy_help(void) -{ - AudiodevListHead head; - AudiodevListEntry *e; - - printf("Environment variable based configuration deprecated.\n"); - printf("Please use the new -audiodev option.\n"); - - head =3D audio_handle_legacy_opts(); - printf("\nEquivalent -audiodev to your current environment variables:\= n"); - if (!getenv("QEMU_AUDIO_DRV")) { - printf("(Since you didn't specify QEMU_AUDIO_DRV, I'll list all " - "possibilities)\n"); - } - - QSIMPLEQ_FOREACH(e, &head, next) { - Visitor *v; - Audiodev *dev =3D e->dev; - printf("-audiodev "); - - v =3D legacy_visitor_new(); - visit_type_Audiodev(v, NULL, &dev, &error_abort); - visit_free(v); - - printf("\n"); - } - audio_free_audiodev_list(&head); -} diff --git a/audio/meson.build b/audio/meson.build index 34aed78342..95cacc20db 100644 --- a/audio/meson.build +++ b/audio/meson.build @@ -1,6 +1,5 @@ softmmu_ss.add([spice_headers, files('audio.c')]) softmmu_ss.add(files( - 'audio_legacy.c', 'mixeng.c', 'noaudio.c', 'wavaudio.c', diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 09269f55e6..f118105652 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -23,14 +23,6 @@ deprecated. System emulator command line arguments -------------------------------------- =20 -``QEMU_AUDIO_`` environment variables and ``-audio-help`` (since 4.0) -''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' - -The ``-audiodev`` argument is now the preferred way to specify audio -backend settings instead of environment variables. To ease migration to -the new format, the ``-audiodev-help`` option can be used to convert -the current values of the environment variables to ``-audiodev`` options. - Creating sound card devices without ``audiodev=3D`` property (since 4.2) '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' =20 diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.= rst index 8a8e0faff0..ffdd4a6d5d 100644 --- a/docs/about/removed-features.rst +++ b/docs/about/removed-features.rst @@ -428,6 +428,14 @@ Supporting audio transfer over vnc without ``audiodev= =3D`` property (removed in 8. When using vnc, you should specify an ``audiodev=3D`` property if you intend to allow clients to request audio transfer through the VNC protocol. =20 +``QEMU_AUDIO_`` environment variables and ``-audio-help`` (rwemoved in 8.0) +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +The ``-audiodev`` argument is now the preferred way to specify audio +backend settings instead of environment variables. To ease migration to +the new format, the ``-audiodev-help`` option can be used to convert +the current values of the environment variables to ``-audiodev`` options. + QEMU Machine Protocol (QMP) commands ------------------------------------ =20 diff --git a/softmmu/vl.c b/softmmu/vl.c index 9bd0e52d01..f7759ce367 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2852,10 +2852,6 @@ void qemu_init(int argc, char **argv) } break; #endif - case QEMU_OPTION_audio_help: - audio_legacy_help(); - exit (0); - break; case QEMU_OPTION_audiodev: audio_parse_option(optarg); break; diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 5cb38f90da..24bae43bed 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -413,9 +413,6 @@ QTestState *qtest_init_without_qmp_handshake(const char= *extra_args) */ prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); #endif /* __linux__ */ - if (!g_setenv("QEMU_AUDIO_DRV", "none", true)) { - exit(1); - } execlp("/bin/sh", "sh", "-c", command, NULL); exit(1); } --=20 2.38.1