Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2196870/?format=api
{ "id": 2196870, "url": "http://patchwork.ozlabs.org/api/patches/2196870/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260216-audio-v1-65-e676662e4514@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260216-audio-v1-65-e676662e4514@redhat.com>", "list_archive_url": null, "date": "2026-02-16T11:15:54", "name": "[65/85] audio/oss: replace custom logging with report & trace", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "26cadd80175562b1e614319198bb921adba273b5", "submitter": { "id": 66774, "url": "http://patchwork.ozlabs.org/api/people/66774/?format=api", "name": "Marc-André Lureau", "email": "marcandre.lureau@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260216-audio-v1-65-e676662e4514@redhat.com/mbox/", "series": [ { "id": 492294, "url": "http://patchwork.ozlabs.org/api/series/492294/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=492294", "date": "2026-02-16T11:14:52", "name": "audio: cleanups & add a manual test", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/492294/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2196870/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2196870/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=NLbMazNn;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fF0sL2ZSSz1xwF\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 16 Feb 2026 22:28:54 +1100 (AEDT)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1vrwfk-0000z7-Gd; Mon, 16 Feb 2026 06:21:48 -0500", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <marcandre.lureau@redhat.com>)\n id 1vrwcr-0007IG-WF\n for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:51 -0500", "from us-smtp-delivery-124.mimecast.com ([170.10.129.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <marcandre.lureau@redhat.com>)\n id 1vrwcp-0008ML-F1\n for qemu-devel@nongnu.org; Mon, 16 Feb 2026 06:18:49 -0500", "from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-599-u2Bp3mhwM0ybXtk98bioWg-1; Mon,\n 16 Feb 2026 06:18:43 -0500", "from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 58E4E18004BB; Mon, 16 Feb 2026 11:18:41 +0000 (UTC)", "from localhost (unknown [10.45.242.26])\n by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id AA5971800464; Mon, 16 Feb 2026 11:18:40 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1771240726;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=hLSoXVhoQIeUoHnSqf7NdVnGnnPXay6u7AUxyZ65rWQ=;\n b=NLbMazNnxJgLHPOGy6Fe6CWYG/MeH3ZEndh9AXeUxc9cB/ToaoWQwsJ6ouySd9kfx5QhmI\n 3Sc6RV7VLbEQBjVrr+X031j7bAXbzjULdjwQnYV8xqxJIETOmoaZNLARGiLT3hoVa8b4eU\n Isbz0qJGu61rL7RmGcqMhS1+jkkE/ZU=", "X-MC-Unique": "u2Bp3mhwM0ybXtk98bioWg-1", "X-Mimecast-MFC-AGG-ID": "u2Bp3mhwM0ybXtk98bioWg_1771240721", "From": "=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>", "Date": "Mon, 16 Feb 2026 12:15:54 +0100", "Subject": "[PATCH 65/85] audio/oss: replace custom logging with report &\n trace", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "8bit", "Message-Id": "<20260216-audio-v1-65-e676662e4514@redhat.com>", "References": "<20260216-audio-v1-0-e676662e4514@redhat.com>", "In-Reply-To": "<20260216-audio-v1-0-e676662e4514@redhat.com>", "To": "qemu-devel@nongnu.org", "Cc": "Gerd Hoffmann <kraxel@redhat.com>, Eduardo Habkost <eduardo@habkost.net>,\n Paolo Bonzini <pbonzini@redhat.com>,\n =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= <berrange@redhat.com>, =?utf-8?q?Phil?=\n\t=?utf-8?q?ippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>,\n John Snow <jsnow@redhat.com>, Cleber Rosa <crosa@redhat.com>,\n Christian Schoenebeck <qemu_oss@crudebyte.com>,\n Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>,\n Thomas Huth <huth@tuxfamily.org>, Alexandre Ratchov <alex@caoua.org>,\n\t=?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org>,\n Laurent Vivier <laurent@vivier.eu>, \"Michael S. Tsirkin\" <mst@redhat.com>,\n Manos Pitsidianakis <manos.pitsidianakis@linaro.org>,\n Alistair Francis <alistair@alistair23.me>,\n \"Edgar E. Iglesias\" <edgar.iglesias@gmail.com>,\n Peter Maydell <peter.maydell@linaro.org>, qemu-arm@nongnu.org, =?utf-8?q?M?=\n\t=?utf-8?q?arc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>,\n Mark Cave-Ayland <mark.caveayland@nutanix.com>", "X-Developer-Signature": "v=1; a=openpgp-sha256; l=16589;\n i=marcandre.lureau@redhat.com; h=from:subject:message-id;\n bh=lywGw39/K7tbYnTEejhPkXeJI8LPyKiBTCBxJgYT1QE=;\n b=kA0DAAoB2ujhCXWWnOUByyZiAGmS/FGgfCj2YjnLyA349Yy2aVqG26hNPn8fFkoBofZH157sz\n okCMwQAAQoAHRYhBIepvZM/h8YG0nb2Ldro4Ql1lpzlBQJpkvxRAAoJENro4Ql1lpzlt5gP/AxQ\n tV8FrcIA7ePhB3T8atS+KwV57ns5GnHlwvAH5rDBqRziozFSsnknJZz0pIcHXxcLiBc/f7Iv2JD\n a1aNpweI3DIha8ez0g8WNd/in6t9hxEaFMl4gnmxgr/n29dtYluRRwVISYLrQKqAK1uISTUiINq\n q9yptjMhUkbp5rWJ9HJtzFnKshz3BAPks4Fd/cJfvHvd6oo/jENTc9GFH/YHMhwMhX8S2y/nkb/\n NyeqscBOMee9tarX/i58azdCiGYqYgCApl1ItJnd7o8G7Z/dGf6+nM2XqaGWbH1rHm8YhrWYqHg\n n0JEMaTLORUbcUSEhVwkhZhn2xUGzLD6CREcOw2dxZwhWU3No5ANwmBx9z0BAlvKVgbQOxS7MRL\n y/DvfyCPPy+Ssc6yoSe5tIT0VDCa+NCGBNkOeq8Plx1/dv1JZ7aLpBc1C28S/XRib4Q3l1zsNc1\n 4O7L3IRpx1KcVZqwzT65R2vzJW4XLdIq+DE+7d2GBrQ56D7eb4yZVoPyWDndiPZUh2XjtDHMoWi\n 0AM8Lio4ObSYR2E7n9+X7PsG4mVuI0VkxIVX93/qLMj7PKrPjO9J6Vx0i7j5USauZlmCOcCLUo8\n GgWm2UOTvBvtMeRL+6FRtSSzvdMzUUyUOiCqZxDfBzgTw+am9jxKtkg+aXKkiMfGBHpGba8wTZA\n DaRYw", "X-Developer-Key": "i=marcandre.lureau@redhat.com; a=openpgp;\n fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5", "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.111", "Received-SPF": "pass client-ip=170.10.129.124;\n envelope-from=marcandre.lureau@redhat.com;\n 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,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n SPF_HELO_PASS=-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": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "Replace the custom audio logging infrastructure with standard QEMU\nerror reporting and tracing.\n\nNote the patch drops DEBUG_MISMATCH condition, and now always trace\nactual audio parameters.\n\nSigned-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\nReviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>\n---\n audio/ossaudio.c | 176 +++++++++++++++++++++++------------------------------\n audio/trace-events | 5 ++\n 2 files changed, 81 insertions(+), 100 deletions(-)", "diff": "diff --git a/audio/ossaudio.c b/audio/ossaudio.c\nindex d12c65dd0d7..81f49f9a7e7 100644\n--- a/audio/ossaudio.c\n+++ b/audio/ossaudio.c\n@@ -31,11 +31,10 @@\n #include \"qemu/host-utils.h\"\n #include \"qapi/error.h\"\n #include \"qemu/audio.h\"\n+#include \"qemu/error-report.h\"\n #include \"qom/object.h\"\n-#include \"trace.h\"\n-\n-#define AUDIO_CAP \"oss\"\n #include \"audio_int.h\"\n+#include \"trace.h\"\n \n #define TYPE_AUDIO_OSS \"audio-oss\"\n OBJECT_DECLARE_SIMPLE_TYPE(AudioOss, AUDIO_OSS)\n@@ -76,43 +75,40 @@ struct oss_params {\n int fragsize;\n };\n \n-static void G_GNUC_PRINTF (2, 3) oss_logerr (int err, const char *fmt, ...)\n+static void G_GNUC_PRINTF(2, 3) oss_logerr(int err, const char *fmt, ...)\n {\n va_list ap;\n \n- va_start (ap, fmt);\n- AUD_vlog (AUDIO_CAP, fmt, ap);\n- va_end (ap);\n+ error_printf(\"oss: \");\n+ va_start(ap, fmt);\n+ error_vprintf(fmt, ap);\n+ va_end(ap);\n \n- AUD_log (AUDIO_CAP, \"Reason: %s\\n\", strerror (err));\n+ error_printf(\" Reason: %s\\n\", strerror(err));\n }\n \n-static void G_GNUC_PRINTF (3, 4) oss_logerr2 (\n- int err,\n- const char *typ,\n- const char *fmt,\n- ...\n- )\n+static void G_GNUC_PRINTF(3, 4) oss_logerr2(int err, const char *typ,\n+ const char *fmt, ...)\n {\n va_list ap;\n \n- AUD_log (AUDIO_CAP, \"Could not initialize %s\\n\", typ);\n+ error_printf(\"oss: Could not initialize %s: \", typ);\n \n- va_start (ap, fmt);\n- AUD_vlog (AUDIO_CAP, fmt, ap);\n- va_end (ap);\n+ va_start(ap, fmt);\n+ error_vprintf(fmt, ap);\n+ va_end(ap);\n \n- AUD_log (AUDIO_CAP, \"Reason: %s\\n\", strerror (err));\n+ error_printf(\" Reason: %s\\n\", strerror(err));\n }\n \n-static void oss_anal_close (int *fdp)\n+static void oss_anal_close(int *fdp)\n {\n int err;\n \n- qemu_set_fd_handler (*fdp, NULL, NULL, NULL);\n- err = close (*fdp);\n+ qemu_set_fd_handler(*fdp, NULL, NULL, NULL);\n+ err = close(*fdp);\n if (err) {\n- oss_logerr (errno, \"Failed to close file(fd=%d)\\n\", *fdp);\n+ oss_logerr(errno, \"Failed to close file(fd=%d)\", *fdp);\n }\n *fdp = -1;\n }\n@@ -159,10 +155,7 @@ static int aud_to_ossfmt(AudioFormat fmt, bool big_endian)\n return big_endian ? AFMT_U16_BE : AFMT_U16_LE;\n \n default:\n- dolog (\"Internal logic error: Bad audio format %d\\n\", fmt);\n-#ifdef DEBUG_AUDIO\n- abort ();\n-#endif\n+ error_report(\"oss: Internal logic error: Bad audio format %d\", fmt);\n return AFMT_U8;\n }\n }\n@@ -201,27 +194,13 @@ static int oss_to_audfmt (int ossfmt, AudioFormat *fmt, int *endianness)\n break;\n \n default:\n- dolog (\"Unrecognized audio format %d\\n\", ossfmt);\n+ error_report(\"oss: Unrecognized audio format %d\", ossfmt);\n return -1;\n }\n \n return 0;\n }\n \n-#if defined DEBUG_MISMATCHES || defined DEBUG\n-static void oss_dump_info (struct oss_params *req, struct oss_params *obt)\n-{\n- dolog (\"parameter | requested value | obtained value\\n\");\n- dolog (\"format | %10d | %10d\\n\", req->fmt, obt->fmt);\n- dolog (\"channels | %10d | %10d\\n\",\n- req->nchannels, obt->nchannels);\n- dolog (\"frequency | %10d | %10d\\n\", req->freq, obt->freq);\n- dolog (\"nfrags | %10d | %10d\\n\", req->nfrags, obt->nfrags);\n- dolog (\"fragsize | %10d | %10d\\n\",\n- req->fragsize, obt->fragsize);\n-}\n-#endif\n-\n #ifdef USE_DSP_POLICY\n static int oss_get_version (int fd, int *version, const char *typ)\n {\n@@ -240,7 +219,7 @@ static int oss_get_version (int fd, int *version, const char *typ)\n return 0;\n }\n #endif\n- oss_logerr2 (errno, typ, \"Failed to get OSS version\\n\");\n+ oss_logerr2(errno, typ, \"Failed to get OSS version\");\n return -1;\n }\n return 0;\n@@ -269,7 +248,7 @@ static int oss_open(int in, struct oss_params *req, audsettings *as,\n \n fd = open (dspname, oflags | O_NONBLOCK);\n if (-1 == fd) {\n- oss_logerr2 (errno, typ, \"Failed to open `%s'\\n\", dspname);\n+ oss_logerr2(errno, typ, \"Failed to open '%s'\", dspname);\n return -1;\n }\n \n@@ -281,23 +260,23 @@ static int oss_open(int in, struct oss_params *req, audsettings *as,\n qapi_AudiodevOssPerDirectionOptions_base(opdo), as, 23220);\n \n if (ioctl (fd, SNDCTL_DSP_SAMPLESIZE, &fmt)) {\n- oss_logerr2 (errno, typ, \"Failed to set sample size %d\\n\", req->fmt);\n+ oss_logerr2(errno, typ, \"Failed to set sample size %d\", req->fmt);\n goto err;\n }\n \n if (ioctl (fd, SNDCTL_DSP_CHANNELS, &nchannels)) {\n- oss_logerr2 (errno, typ, \"Failed to set number of channels %d\\n\",\n- req->nchannels);\n+ oss_logerr2(errno, typ, \"Failed to set number of channels %d\",\n+ req->nchannels);\n goto err;\n }\n \n if (ioctl (fd, SNDCTL_DSP_SPEED, &freq)) {\n- oss_logerr2 (errno, typ, \"Failed to set frequency %d\\n\", req->freq);\n+ oss_logerr2(errno, typ, \"Failed to set frequency %d\", req->freq);\n goto err;\n }\n \n if (ioctl (fd, SNDCTL_DSP_NONBLOCK, NULL)) {\n- oss_logerr2 (errno, typ, \"Failed to set non-blocking mode\\n\");\n+ oss_logerr2(errno, typ, \"Failed to set non-blocking mode\");\n goto err;\n }\n \n@@ -311,9 +290,9 @@ static int oss_open(int in, struct oss_params *req, audsettings *as,\n if (version >= 0x040000) {\n int policy2 = policy;\n if (ioctl(fd, SNDCTL_DSP_POLICY, &policy2)) {\n- oss_logerr2 (errno, typ,\n- \"Failed to set timing policy to %d\\n\",\n- policy);\n+ oss_logerr2(errno, typ,\n+ \"Failed to set timing policy to %d\",\n+ policy);\n goto err;\n }\n setfragment = 0;\n@@ -325,20 +304,20 @@ static int oss_open(int in, struct oss_params *req, audsettings *as,\n if (setfragment) {\n int mmmmssss = (req->nfrags << 16) | ctz32 (req->fragsize);\n if (ioctl (fd, SNDCTL_DSP_SETFRAGMENT, &mmmmssss)) {\n- oss_logerr2 (errno, typ, \"Failed to set buffer length (%d, %d)\\n\",\n- req->nfrags, req->fragsize);\n+ oss_logerr2(errno, typ, \"Failed to set buffer length (%d, %d)\",\n+ req->nfrags, req->fragsize);\n goto err;\n }\n }\n \n if (ioctl (fd, in ? SNDCTL_DSP_GETISPACE : SNDCTL_DSP_GETOSPACE, &abinfo)) {\n- oss_logerr2 (errno, typ, \"Failed to get buffer length\\n\");\n+ oss_logerr2(errno, typ, \"Failed to get buffer length\");\n goto err;\n }\n \n if (!abinfo.fragstotal || !abinfo.fragsize) {\n- AUD_log (AUDIO_CAP, \"Returned bogus buffer information(%d, %d) for %s\\n\",\n- abinfo.fragstotal, abinfo.fragsize, typ);\n+ error_report(\"oss: Returned bogus buffer information(%d, %d) for %s\",\n+ abinfo.fragstotal, abinfo.fragsize, typ);\n goto err;\n }\n \n@@ -349,20 +328,13 @@ static int oss_open(int in, struct oss_params *req, audsettings *as,\n obt->fragsize = abinfo.fragsize;\n *pfd = fd;\n \n-#ifdef DEBUG_MISMATCHES\n- if ((req->fmt != obt->fmt) ||\n- (req->nchannels != obt->nchannels) ||\n- (req->freq != obt->freq) ||\n- (req->fragsize != obt->fragsize) ||\n- (req->nfrags != obt->nfrags)) {\n- dolog (\"Audio parameters mismatch\\n\");\n- oss_dump_info (req, obt);\n- }\n-#endif\n+ trace_oss_out_params(\n+ req->fmt, obt->fmt,\n+ req->nchannels, obt->nchannels,\n+ req->freq, obt->freq,\n+ req->nfrags, obt->nfrags,\n+ req->fragsize, obt->fragsize);\n \n-#ifdef DEBUG\n- oss_dump_info (req, obt);\n-#endif\n return 0;\n \n err:\n@@ -378,7 +350,7 @@ static size_t oss_get_available_bytes(OSSVoiceOut *oss)\n \n err = ioctl(oss->fd, SNDCTL_DSP_GETOPTR, &cntinfo);\n if (err < 0) {\n- oss_logerr(errno, \"SNDCTL_DSP_GETOPTR failed\\n\");\n+ oss_logerr(errno, \"SNDCTL_DSP_GETOPTR failed\");\n return 0;\n }\n \n@@ -459,8 +431,7 @@ static size_t oss_write(HWVoiceOut *hw, void *buf, size_t len)\n bytes_written = write(oss->fd, pcm, len);\n if (bytes_written < 0) {\n if (errno != EAGAIN) {\n- oss_logerr(errno, \"failed to write %zu bytes\\n\",\n- len);\n+ oss_logerr(errno, \"failed to write %zu bytes\", len);\n }\n return pos;\n }\n@@ -474,18 +445,18 @@ static size_t oss_write(HWVoiceOut *hw, void *buf, size_t len)\n return pos;\n }\n \n-static void oss_fini_out (HWVoiceOut *hw)\n+static void oss_fini_out(HWVoiceOut *hw)\n {\n int err;\n- OSSVoiceOut *oss = (OSSVoiceOut *) hw;\n+ OSSVoiceOut *oss = (OSSVoiceOut *)hw;\n \n- ldebug (\"oss_fini\\n\");\n- oss_anal_close (&oss->fd);\n+ trace_oss_fini_out();\n+ oss_anal_close(&oss->fd);\n \n if (oss->mmapped && hw->buf_emul) {\n err = munmap(hw->buf_emul, hw->size_emul);\n if (err) {\n- oss_logerr(errno, \"Failed to unmap buffer %p, size %zu\\n\",\n+ oss_logerr(errno, \"Failed to unmap buffer %p, size %zu\",\n hw->buf_emul, hw->size_emul);\n }\n hw->buf_emul = NULL;\n@@ -526,8 +497,8 @@ static int oss_init_out(HWVoiceOut *hw, struct audsettings *as)\n oss->fragsize = obt.fragsize;\n \n if (obt.nfrags * obt.fragsize % hw->info.bytes_per_frame) {\n- dolog (\"warning: Misaligned DAC buffer, size %d, alignment %d\\n\",\n- obt.nfrags * obt.fragsize, hw->info.bytes_per_frame);\n+ warn_report(\"oss: Misaligned DAC buffer, size %d, alignment %d\",\n+ obt.nfrags * obt.fragsize, hw->info.bytes_per_frame);\n }\n \n hw->samples = (obt.nfrags * obt.fragsize) / hw->info.bytes_per_frame;\n@@ -544,20 +515,16 @@ static int oss_init_out(HWVoiceOut *hw, struct audsettings *as)\n 0\n );\n if (hw->buf_emul == MAP_FAILED) {\n- oss_logerr(errno, \"Failed to map %zu bytes of DAC\\n\",\n- hw->size_emul);\n+ oss_logerr(errno, \"Failed to map %zu bytes of DAC\", hw->size_emul);\n hw->buf_emul = NULL;\n } else {\n int trig = 0;\n if (ioctl (fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) {\n- oss_logerr (errno, \"SNDCTL_DSP_SETTRIGGER 0 failed\\n\");\n+ oss_logerr(errno, \"SNDCTL_DSP_SETTRIGGER 0 failed\");\n } else {\n trig = PCM_ENABLE_OUTPUT;\n- if (ioctl (fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) {\n- oss_logerr (\n- errno,\n- \"SNDCTL_DSP_SETTRIGGER PCM_ENABLE_OUTPUT failed\\n\"\n- );\n+ if (ioctl(fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) {\n+ oss_logerr(errno, \"SNDCTL_DSP_SETTRIGGER PCM_ENABLE_OUTPUT failed\");\n } else {\n oss->mmapped = 1;\n }\n@@ -566,7 +533,7 @@ static int oss_init_out(HWVoiceOut *hw, struct audsettings *as)\n if (!oss->mmapped) {\n err = munmap(hw->buf_emul, hw->size_emul);\n if (err) {\n- oss_logerr(errno, \"Failed to unmap buffer %p size %zu\\n\",\n+ oss_logerr(errno, \"Failed to unmap buffer %p size %zu\",\n hw->buf_emul, hw->size_emul);\n }\n hw->buf_emul = NULL;\n@@ -582,13 +549,14 @@ static int oss_init_out(HWVoiceOut *hw, struct audsettings *as)\n static void oss_enable_out(HWVoiceOut *hw, bool enable)\n {\n int trig;\n- OSSVoiceOut *oss = (OSSVoiceOut *) hw;\n+ OSSVoiceOut *oss = (OSSVoiceOut *)hw;\n AudiodevOssPerDirectionOptions *opdo = oss->dev->u.oss.out;\n \n+ trace_oss_enable_out(enable);\n+\n if (enable) {\n hw->poll_mode = opdo->try_poll;\n \n- ldebug(\"enabling voice\\n\");\n if (hw->poll_mode) {\n oss_poll_out(hw);\n }\n@@ -601,12 +569,12 @@ static void oss_enable_out(HWVoiceOut *hw, bool enable)\n trig = PCM_ENABLE_OUTPUT;\n if (ioctl(oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) {\n oss_logerr(errno,\n- \"SNDCTL_DSP_SETTRIGGER PCM_ENABLE_OUTPUT failed\\n\");\n+ \"SNDCTL_DSP_SETTRIGGER PCM_ENABLE_OUTPUT failed\");\n return;\n }\n } else {\n if (hw->poll_mode) {\n- qemu_set_fd_handler (oss->fd, NULL, NULL, NULL);\n+ qemu_set_fd_handler(oss->fd, NULL, NULL, NULL);\n hw->poll_mode = 0;\n }\n \n@@ -614,10 +582,9 @@ static void oss_enable_out(HWVoiceOut *hw, bool enable)\n return;\n }\n \n- ldebug (\"disabling voice\\n\");\n trig = 0;\n- if (ioctl (oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) {\n- oss_logerr (errno, \"SNDCTL_DSP_SETTRIGGER 0 failed\\n\");\n+ if (ioctl(oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) {\n+ oss_logerr(errno, \"SNDCTL_DSP_SETTRIGGER 0 failed\");\n return;\n }\n }\n@@ -654,9 +621,16 @@ static int oss_init_in(HWVoiceIn *hw, struct audsettings *as)\n oss->nfrags = obt.nfrags;\n oss->fragsize = obt.fragsize;\n \n+ trace_oss_in_params(\n+ req.fmt, obt.fmt,\n+ req.nchannels, obt.nchannels,\n+ req.freq, obt.freq,\n+ req.nfrags, obt.nfrags,\n+ req.fragsize, obt.fragsize);\n+\n if (obt.nfrags * obt.fragsize % hw->info.bytes_per_frame) {\n- dolog (\"warning: Misaligned ADC buffer, size %d, alignment %d\\n\",\n- obt.nfrags * obt.fragsize, hw->info.bytes_per_frame);\n+ warn_report(\"oss: Misaligned ADC buffer, size %d, alignment %d\",\n+ obt.nfrags * obt.fragsize, hw->info.bytes_per_frame);\n }\n \n hw->samples = (obt.nfrags * obt.fragsize) / hw->info.bytes_per_frame;\n@@ -690,7 +664,7 @@ static size_t oss_read(HWVoiceIn *hw, void *buf, size_t len)\n case EAGAIN:\n break;\n default:\n- oss_logerr(errno, \"Failed to read %zu bytes of audio (to %p)\\n\",\n+ oss_logerr(errno, \"Failed to read %zu bytes of audio (to %p)\",\n len, dst);\n break;\n }\n@@ -706,9 +680,11 @@ static size_t oss_read(HWVoiceIn *hw, void *buf, size_t len)\n \n static void oss_enable_in(HWVoiceIn *hw, bool enable)\n {\n- OSSVoiceIn *oss = (OSSVoiceIn *) hw;\n+ OSSVoiceIn *oss = (OSSVoiceIn *)hw;\n AudiodevOssPerDirectionOptions *opdo = oss->dev->u.oss.out;\n \n+ trace_oss_enable_in(enable);\n+\n if (enable) {\n hw->poll_mode = opdo->try_poll;\n \ndiff --git a/audio/trace-events b/audio/trace-events\nindex 79744456cec..f33be2dd8e3 100644\n--- a/audio/trace-events\n+++ b/audio/trace-events\n@@ -17,6 +17,11 @@ alsa_enable_in(bool enable) \"enable=%d\"\n \n # ossaudio.c\n oss_version(int version) \"OSS version = 0x%x\"\n+oss_out_params(int req_fmt, int obt_fmt, int req_channels, int obt_channels, int req_freq, int obt_freq, int req_nfrags, int obt_nfrags, int req_fragsize, int obt_fragsize) \"fmt=%d->%d, channels %d->%d, freq=%d->%d, nfrags=%d->%d, fragsize=%d->%d\"\n+oss_in_params(int req_fmt, int obt_fmt, int req_channels, int obt_channels, int req_freq, int obt_freq, int req_nfrags, int obt_nfrags, int req_fragsize, int obt_fragsize) \"fmt=%d->%d, channels %d->%d, freq=%d->%d, nfrags=%d->%d, fragsize=%d->%d\"\n+oss_fini_out(void) \"\"\n+oss_enable_out(bool enable) \"enable=%d\"\n+oss_enable_in(bool enable) \"enable=%d\"\n \n # dbusaudio.c\n dbus_audio_register(const char *s, const char *dir) \"sender = %s, dir = %s\"\n", "prefixes": [ "65/85" ] }