]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
sound: Get rid of snd_clone and use DEVFS_CDEVPRIV(9)
authorChristos Margiolis <christos@FreeBSD.org>
Sun, 31 Mar 2024 05:20:17 +0000 (13:20 +0800)
committerChristos Margiolis <christos@FreeBSD.org>
Sun, 31 Mar 2024 05:20:17 +0000 (13:20 +0800)
commitdc831e93bad63f9faea09f1806a7733a40bff316
treece62e04a296f2d4c2484de8a9130875f9d5fe993
parent783d3ff6d7fae619db8a7990b8a6387de0c677b5
sound: Get rid of snd_clone and use DEVFS_CDEVPRIV(9)

Currently the snd_clone framework creates device nodes on-demand for
every channel, through the dsp_clone() callback, and is responsible for
routing audio to the appropriate channel(s). This patch gets rid of the
whole snd_clone framework (including any related sysctls) and instead
uses DEVFS_CDEVPRIV(9) to handle device opening, channel allocation and
audio routing. This results in a significant reduction in code size as
well as complexity.

Behavior that is preserved:

- hw.snd.basename_clone.
- Exclusive access of an audio device (i.e VCHANs disabled).
- Multiple processes can read from/write to the device.
- A device can only be opened as many times as the maximum allowed
  channel number (see SND_MAXHWCHAN in pcm/sound.h).
- OSSv4 compatibility aliases are preserved.

Behavior changes:

Only one /dev/dspX device node is created (on attach) for each audio
device, as opposed to the current /dev/dspX.Y devices created by
snd_clone. According to the sound(4) man page, devices are not meant to
be opened through /dev/dspX.Y anyway, so it is best if we do not create
device nodes for them in the first place. As a result of this, modify
dsp_oss_audioinfo() to print /dev/dspX in the "ai->devnode", instead of
/dev/dspX.Y.

Sponsored by: The FreeBSD Foundation
MFC after: 2 months
Reviewed by: dev_submerge.ch, markj
Differential Revision: https://reviews.freebsd.org/D44411
share/man/man4/pcm.4
sys/conf/files
sys/dev/sound/clone.c [deleted file]
sys/dev/sound/clone.h [deleted file]
sys/dev/sound/pcm/dsp.c
sys/dev/sound/pcm/dsp.h
sys/dev/sound/pcm/sound.c
sys/dev/sound/pcm/sound.h
sys/modules/sound/sound/Makefile