git: 2693d6c7c9ca - main - snd_dummy: Create device alias

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Wed, 22 Oct 2025 11:51:34 UTC
The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=2693d6c7c9cab28967de13233342fcf9281e5636

commit 2693d6c7c9cab28967de13233342fcf9281e5636
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2025-10-22 11:51:01 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2025-10-22 11:51:01 +0000

    snd_dummy: Create device alias
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      4 days
    Reviewed by:    emaste, ziaee
    Differential Revision:  https://reviews.freebsd.org/D53237
---
 share/man/man4/snd_dummy.4 | 12 +++++++++++-
 sys/dev/sound/dummy.c      |  6 ++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/share/man/man4/snd_dummy.4 b/share/man/man4/snd_dummy.4
index 2b9d26d318ef..4ede8a806b6a 100644
--- a/share/man/man4/snd_dummy.4
+++ b/share/man/man4/snd_dummy.4
@@ -27,7 +27,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd July 15, 2024
+.Dd October 22, 2025
 .Dt SND_DUMMY 4
 .Os
 .Sh NAME
@@ -52,6 +52,16 @@ and one recording), as well as a mixer.
 .Pp
 Playback works by discarding all input, and recording by returning silence
 (zeros).
+.Sh FILES
+.Bl -tag -width "/dev/dsp.dummy" -compact
+.It Pa /dev/dsp.dummy
+Alias to the device's
+.Pa /dev/dsp%d
+file created by
+.Xr sound 4 .
+This makes it easy for tests to open the dummy devic when there are more
+devices present in the system.
+.El
 .Sh SEE ALSO
 .Xr sound 4 ,
 .Xr loader.conf 5 ,
diff --git a/sys/dev/sound/dummy.c b/sys/dev/sound/dummy.c
index 4df5b112d3f4..1f2d69708eec 100644
--- a/sys/dev/sound/dummy.c
+++ b/sys/dev/sound/dummy.c
@@ -346,6 +346,12 @@ dummy_attach(device_t dev)
 		return (ENXIO);
 	mixer_init(dev, &dummy_mixer_class, sc);
 
+	/*
+	 * Create an alias so that tests do not need to guess which one is the
+	 * dummy device if there are more devices present in the system.
+	 */
+	make_dev_alias(sc->info.dsp_dev, "dsp.dummy");
+
 	return (0);
 }