From nobody Wed May 27 15:33:37 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gQYYY3XhBz6fCKw for ; Wed, 27 May 2026 15:33:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gQYYY1tmGz3XXp for ; Wed, 27 May 2026 15:33:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779896017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fV90/9M3yf2GOUwH28foDST6j/OmGnRe/CHYuWMozeU=; b=OX8BmWs2ARLQuH9bdJ0ssfL7/wKtWUNYmgH2M2whc8DQqKpwSA6lEQe2JdqWZrrCvfRQOm XajDC7FJzYNKBUBHIYtTUdYqhUxGmpevctk4QcZ3Sf9gMrt3KRSx3hwQ+jCmkjLcpcbNzP 3DHTy6bglQYDQ+Ov9cordiyUoIfv55pCVl0+YEKoc7jjINmCQ+kf/inawbPiON8tooK4gv Is5jteIhjnEpLTHSSPWAQeR+fsUeeDectIonjagyFNz9uWHKtgYlIgV+xwuyuwlNeqjkZb UtjLVIeHxvvixwGVPMlGRP+NjbFiT2bDAB5Gt7J7VeGVlzEA9G8hIOdRIU8AfQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779896017; a=rsa-sha256; cv=none; b=ONbY6tZz1rGszamYkTv+5+8T0XKd4bo7SUWAEgsFLOR4CwHxQIfguT9mv06hYQiaAHGRCT kuNqLuIrUvUBzycQoGgOhx2ImtU2olc3NplgLS8csSva5cdGBlCG1OQc6fqqvTb014Kp8/ NtryOxjX0bDqcVw3fQqdY27nwuyKElMqGkbmJAoji5rKF3wvEJx1UOUnqKT1BYhaUM5GT4 EgO7hooMlGUeWnTV796hG+DyA/YCinJMPWQcbG4PiSwo3S9mdzJ827nnvHh2uyTGplFCbx o4V5e+XYnzB9xOetuBM+lTTADDQs88qZ+/VJ3tbMOK2jXu73fVb6oxrFjsdiJw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779896017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fV90/9M3yf2GOUwH28foDST6j/OmGnRe/CHYuWMozeU=; b=gBrndcPqSL9UVvH+ke0GFEOqS1HZS2z7d0sLonCNXHUSg0xbIIM1rFj+97VlMtmm+z0wpl SK+B1ji8V2q84ZP9YzGbEOKy3TecL1N3mS17NqQxbMefORzlOy6E3tFF350hiAUBZBRVBT bvXz0XYj6x1gLg3POVKC5xUg5ld8ucGvg7LXh9odQ08V+YrYVbCL4yjNzGMD/Y1V+bzh1p 33QtePS1+eIC2/8/xRfbgijvpm3a31Rx54QlZkou61AXo278H9nWdI//ayD8aghYa3SSJr nOzBSdfx2JFgPOR4hAbvpXHtzfeSv5SgiQN/Kl1h3aXtOp30j/ptku5tFR1ThA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYYY1PYRz14HG for ; Wed, 27 May 2026 15:33:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 270cb by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:33:37 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 5589a7499add - main - sound: Retire snd_mixer->enuminfo List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5589a7499add5912a88e9424b0aec843e099fb60 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:33:37 +0000 Message-Id: <6a170ed1.270cb.17e985b7@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=5589a7499add5912a88e9424b0aec843e099fb60 commit 5589a7499add5912a88e9424b0aec843e099fb60 Author: Christos Margiolis AuthorDate: 2026-04-17 17:31:00 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:32:12 +0000 sound: Retire snd_mixer->enuminfo Instead of caching this when mix_setrecdevs() is called (which many drivers never call), calculate it when we need it. After all, it is quite rare that this structure is used by applications. Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/18 --- sys/dev/sound/pcm/mixer.c | 78 ++++++++++++++--------------------------------- 1 file changed, 23 insertions(+), 55 deletions(-) diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 0001ea7b481a..e61371d13610 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -56,7 +56,6 @@ struct snd_mixer { u_int8_t realdev[32]; char name[MIXER_NAMELEN]; struct mtx lock; - oss_mixer_enuminfo enuminfo; int modify_counter; }; @@ -493,64 +492,12 @@ mix_setdevs(struct snd_mixer *m, u_int32_t v) * recording devices. This function records that value in a structure * used by the rest of the mixer code. * - * This function also populates a structure used by the SNDCTL_DSP_*RECSRC* - * family of ioctls that are part of OSSV4. All recording device labels - * are concatenated in ascending order corresponding to their routing - * numbers. (Ex: a system might have 0 => 'vol', 1 => 'cd', 2 => 'line', - * etc.) For now, these labels are just the standard recording device - * names (cd, line1, etc.), but will eventually be fully dynamic and user - * controlled. - * * @param m mixer device context container thing * @param v mask of recording devices */ void mix_setrecdevs(struct snd_mixer *m, u_int32_t v) { - oss_mixer_enuminfo *ei; - char *loc; - int i, nvalues, nwrote, nleft, ncopied; - - ei = &m->enuminfo; - - nvalues = 0; - nwrote = 0; - nleft = sizeof(ei->strings); - loc = ei->strings; - - for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { - if ((1 << i) & v) { - ei->strindex[nvalues] = nwrote; - ncopied = strlcpy(loc, snd_mixernames[i], nleft) + 1; - /* strlcpy retval doesn't include terminator */ - - nwrote += ncopied; - nleft -= ncopied; - nvalues++; - - /* - * XXX I don't think this should ever be possible. - * Even with a move to dynamic device/channel names, - * each label is limited to ~16 characters, so that'd - * take a LOT to fill this buffer. - */ - if ((nleft <= 0) || (nvalues >= OSS_ENUM_MAXVALUE)) { - device_printf(m->dev, - "mix_setrecdevs: Not enough room to store device names--please file a bug report.\n"); - device_printf(m->dev, - "mix_setrecdevs: Please include details about your sound hardware, OS version, etc.\n"); - break; - } - - loc = &ei->strings[nwrote]; - } - } - - /* - * NB: The SNDCTL_DSP_GET_RECSRC_NAMES ioctl ignores the dev - * and ctrl fields. - */ - ei->nvalues = nvalues; m->recdevs = v; } @@ -1104,10 +1051,31 @@ mixer_ioctl_cmd(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, mtx_lock(&m->lock); switch (cmd) { - case SNDCTL_DSP_GET_RECSRC_NAMES: - bcopy((void *)&m->enuminfo, arg, sizeof(oss_mixer_enuminfo)); + case SNDCTL_DSP_GET_RECSRC_NAMES: { + oss_mixer_enuminfo *ei = (oss_mixer_enuminfo *)arg; + char *loc; + int i, nvalues, nwrote, nleft, ncopied; + + nvalues = 0; + nwrote = 0; + nleft = sizeof(ei->strings); + loc = ei->strings; + + for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { + if (!((1 << i) & m->recdevs)) + continue; + ei->strindex[nvalues] = nwrote; + ncopied = strlcpy(loc, snd_mixernames[i], nleft) + 1; + nwrote += ncopied; + nleft -= ncopied; + nvalues++; + loc = &ei->strings[nwrote]; + } + ei->nvalues = nvalues; + ret = 0; goto done; + } case SNDCTL_DSP_GET_RECSRC: ret = mixer_get_recroute(m, arg_i); goto done;