git: e6df8c379b0c - main - sound: Add missing oss_mixerinfo devnode and legacy_device fields

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Thu, 09 May 2024 19:08:45 UTC
The branch main has been updated by christos:

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

commit e6df8c379b0cf2f6d715d4903fcb1f279e38173e
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-05-09 19:08:11 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-05-09 19:08:28 +0000

    sound: Add missing oss_mixerinfo devnode and legacy_device fields
    
    They are missing from soundcard.h and are in fact used by some
    applications, such as OSS' ossinfo(1):
    http://manuals.opensound.com/developer/ossinfo.c.html
    
    The new size for filler is chosen according to the most recent official
    version of soundcard.h, which includes those 2 fields.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
    Reviewed by:    dev_submerge.ch
    Differential Revision:  https://reviews.freebsd.org/D45137
---
 sys/dev/sound/pcm/mixer.c | 11 +++++------
 sys/sys/soundcard.h       |  4 +++-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c
index a37b94dce43a..9811496853c8 100644
--- a/sys/dev/sound/pcm/mixer.c
+++ b/sys/dev/sound/pcm/mixer.c
@@ -1516,6 +1516,7 @@ mixer_oss_mixerinfo(struct cdev *i_dev, oss_mixerinfo *mi)
 			 * Mixer extensions currently aren't supported, so
 			 * leave @sa oss_mixerinfo::nrext blank for now.
 			 */
+
 			/**
 			 * @todo Fill in @sa oss_mixerinfo::priority (requires
 			 *       touching drivers?)
@@ -1529,13 +1530,11 @@ mixer_oss_mixerinfo(struct cdev *i_dev, oss_mixerinfo *mi)
 			 * default mixer. Other devices use values 1 to 9
 			 * depending on the estimated probability of being the
 			 * default device.
-			 *
-			 * XXX Described by Hannu@4Front, but not found in
-			 *     soundcard.h.
-			strlcpy(mi->devnode, devtoname(d->mixer_dev),
-			sizeof(mi->devnode));
-			mi->legacy_device = i;
 			 */
+
+			snprintf(mi->devnode, sizeof(mi->devnode), "/dev/mixer%d", i);
+			mi->legacy_device = i;
+
 			mtx_unlock(m->lock);
 		}
 
diff --git a/sys/sys/soundcard.h b/sys/sys/soundcard.h
index ddd8a51d29a5..64f57742a52b 100644
--- a/sys/sys/soundcard.h
+++ b/sys/sys/soundcard.h
@@ -1925,7 +1925,9 @@ typedef struct oss_mixerinfo
    * as the default mixer.
    */
   int priority;
-  int filler[254];		/* Reserved */
+  oss_devnode_t devnode;
+  int legacy_device;
+  int filler[245];		/* Reserved */
 } oss_mixerinfo;
 
 typedef struct oss_midi_info