HomeFreeBSD

sound: Get rid of snd_clone and use DEVFS_CDEVPRIV(9)

Description

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, bapt, markj
Differential Revision: https://reviews.freebsd.org/D44411

(cherry picked from commit e8c0d15a64fadb4a330f2da7244becaac161bb70)

Details

Provenance
christosAuthored on Thu, Apr 11, 6:06 PM
Reviewer
dev_submerge.ch
Differential Revision
D44411: sound: Get rid of snd_clone and use DEVFS_CDEVPRIV(9)
Parents
rGcfa4bd59df08: atrtc(4): Fix a typo in a sysctl description
Branches
Unknown
Tags
Unknown