Page MenuHomeFreeBSD

D52509.id162082.diff
No OneTemporary

D52509.id162082.diff

diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -77,6 +77,7 @@
static d_open_t dsp_open;
static d_read_t dsp_read;
static d_write_t dsp_write;
+static d_ioctl_t dsp_ioctl_compat;
static d_ioctl_t dsp_ioctl;
static d_poll_t dsp_poll;
static d_mmap_t dsp_mmap;
@@ -87,7 +88,7 @@
.d_open = dsp_open,
.d_read = dsp_read,
.d_write = dsp_write,
- .d_ioctl = dsp_ioctl,
+ .d_ioctl = dsp_ioctl_compat,
.d_poll = dsp_poll,
.d_mmap = dsp_mmap,
.d_mmap_single = dsp_mmap_single,
@@ -671,6 +672,89 @@
return (0);
}
+static int
+dsp_ioctl_compat(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode,
+ struct thread *td)
+{
+ int ret;
+
+ switch (cmd) {
+#ifdef COMPAT_FREEBSD32
+ case AIOSFMT32:
+ case AIOGFMT32:
+ {
+ snd_chan_param data;
+ snd_chan_param32 *p32 = (snd_chan_param32 *)arg;
+
+ if (cmd == AIOSFMT32) {
+ data.play_rate = p32->play_rate;
+ data.rec_rate = p32->rec_rate;
+ data.play_format = p32->play_format;
+ data.rec_format = p32->rec_format;
+ }
+ ret = dsp_ioctl(i_dev,
+ cmd == AIOSFMT32 ? AIOSFMT : AIOGFMT,
+ (caddr_t)&data, mode, td);
+ p32->play_rate = data.play_rate;
+ p32->rec_rate = data.rec_rate;
+ p32->play_format = data.play_format;
+ p32->rec_format = data.rec_format;
+ }
+ break;
+
+ case AIOGCAP32:
+ {
+ snd_capabilities data;
+ snd_capabilities32 *p32 = (snd_capabilities32 *)arg;
+
+ data.rate_min = p32->rate_min;
+ data.rate_max = p32->rate_max;
+ data.formats = p32->formats;
+ data.bufsize = p32->bufsize;
+ data.mixers = p32->mixers;
+ data.inputs = p32->inputs;
+ data.left = p32->left;
+ data.right = p32->right;
+ ret = dsp_ioctl(i_dev, AIOGCAP, (caddr_t)&data, mode,
+ td);
+ p32->rate_min = data.rate_min;
+ p32->rate_max = data.rate_max;
+ p32->formats = data.formats;
+ p32->bufsize = data.bufsize;
+ p32->mixers = data.mixers;
+ p32->inputs = data.inputs;
+ p32->left = data.left;
+ p32->right = data.right;
+ }
+ break;
+
+ case SNDCTL_DSP_GETERROR32:
+ {
+ audio_errinfo data;
+ audio_errinfo32 *p32 = (audio_errinfo32 *)arg;
+
+ ret = dsp_ioctl(i_dev, SNDCTL_DSP_GETERROR,
+ (caddr_t)&data, mode, td);
+ p32->play_underruns = data.play_underruns;
+ p32->rec_overruns = data.rec_overruns;
+ p32->play_ptradjust = data.play_ptradjust;
+ p32->rec_ptradjust = data.rec_ptradjust;
+ p32->play_errorcount = data.play_errorcount;
+ p32->rec_errorcount = data.rec_errorcount;
+ p32->play_lasterror = data.play_lasterror;
+ p32->rec_lasterror = data.rec_lasterror;
+ p32->play_errorparm = data.play_errorparm;
+ p32->rec_errorparm = data.rec_errorparm;
+ }
+ break;
+#endif
+ default:
+ ret = dsp_ioctl(i_dev, cmd, arg, mode, td);
+ }
+
+ return (ret);
+}
+
static int
dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode,
struct thread *td)
diff --git a/sys/sys/soundcard.h b/sys/sys/soundcard.h
--- a/sys/sys/soundcard.h
+++ b/sys/sys/soundcard.h
@@ -256,6 +256,17 @@
#define AIOGFMT _IOR('f', 12, snd_chan_param) /* get format */
#define AIOSFMT _IOWR('f', 12, snd_chan_param) /* sets format */
+#if defined(_KERNEL) && defined(COMPAT_FREEBSD32)
+typedef struct _snd_chan_param32 {
+ u_int32_t play_rate; /* sampling rate */
+ u_int32_t rec_rate; /* sampling rate */
+ u_int32_t play_format; /* everything describing the format */
+ u_int32_t rec_format; /* everything describing the format */
+} snd_chan_param32;
+#define AIOGFMT32 _IOC_NEWTYPE(AIOGFMT, snd_chan_param32) /* get format */
+#define AIOSFMT32 _IOC_NEWTYPE(AIOSFMT, snd_chan_param32) /* sets format */
+#endif
+
/*
* The following structure is used to get/set the mixer setting.
* Up to 32 mixers are supported, each one with up to 32 channels.
@@ -311,6 +322,18 @@
} snd_capabilities;
#define AIOGCAP _IOWR('A', 15, snd_capabilities) /* get capabilities */
+#if defined(_KERNEL) && defined(COMPAT_FREEBSD32)
+typedef struct _snd_capabilities32 {
+ u_int32_t rate_min, rate_max; /* min-max sampling rate */
+ u_int32_t formats;
+ u_int32_t bufsize; /* DMA buffer size */
+ u_int32_t mixers; /* bitmap of available mixers */
+ u_int32_t inputs; /* bitmap of available inputs (per mixer) */
+ u_short left, right; /* how many levels are supported */
+} snd_capabilities32;
+#define AIOGCAP32 _IOC_NEWTYPE(AIOGCAP, snd_capabilities32) /* get capabilities */
+#endif
+
/*
* here is the old (Voxware) ioctl interface
*/
@@ -1600,6 +1623,24 @@
#define SNDCTL_DSP_SETPLAYVOL _IOWR('P', 24, int)
#define SNDCTL_DSP_GETERROR _IOR ('P', 25, audio_errinfo)
+#if defined(_KERNEL) && defined(COMPAT_FREEBSD32)
+typedef struct audio_errinfo32
+{
+ int play_underruns;
+ int rec_overruns;
+ unsigned int play_ptradjust;
+ unsigned int rec_ptradjust;
+ int play_errorcount;
+ int rec_errorcount;
+ int play_lasterror;
+ int rec_lasterror;
+ int32_t play_errorparm;
+ int32_t rec_errorparm;
+ int filler[16];
+} audio_errinfo32;
+#define SNDCTL_DSP_GETERROR32 _IOC_NEWTYPE (SNDCTL_DSP_GETERROR, audio_errinfo32)
+#endif
+
/*
****************************************************************************
* Sync groups for audio devices

File Metadata

Mime Type
text/plain
Expires
Wed, Aug 5, 6:15 AM (18 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36005012
Default Alt Text
D52509.id162082.diff (5 KB)

Event Timeline