Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/ossaudio Revert a wrong OSS_SNDCTL_DSP_GETOSPACE ...



details:   https://anonhg.NetBSD.org/src/rev/c5a44c9dce4a
branches:  trunk
changeset: 447964:c5a44c9dce4a
user:      isaki <isaki%NetBSD.org@localhost>
date:      Tue Jan 29 12:01:20 2019 +0000

description:
Revert a wrong OSS_SNDCTL_DSP_GETOSPACE part of rev1.70.
- 'fragments' is the number of full free blocks and should not be
  negative value.
- 'bytes' should not be rounded down.

diffstat:

 sys/compat/ossaudio/ossaudio.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (34 lines):

diff -r 26b87ace4abb -r c5a44c9dce4a sys/compat/ossaudio/ossaudio.c
--- a/sys/compat/ossaudio/ossaudio.c    Tue Jan 29 11:54:02 2019 +0000
+++ b/sys/compat/ossaudio/ossaudio.c    Tue Jan 29 12:01:20 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ossaudio.c,v 1.70 2017/03/24 14:32:29 nat Exp $        */
+/*     $NetBSD: ossaudio.c,v 1.71 2019/01/29 12:01:20 isaki Exp $      */
 
 /*-
  * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.70 2017/03/24 14:32:29 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.71 2019/01/29 12:01:20 isaki Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -619,11 +619,12 @@
                }
                setblocksize(fp, &tmpinfo);
                bufinfo.fragsize = tmpinfo.blocksize;
-               bufinfo.fragments = (tmpinfo.hiwat * tmpinfo.blocksize -
-                   (tmpinfo.play.seek + tmpinfo.blocksize -1)) /
+               bufinfo.fragments = tmpinfo.hiwat -
+                   (tmpinfo.play.seek + tmpinfo.blocksize - 1) /
                    tmpinfo.blocksize;
                bufinfo.fragstotal = tmpinfo.hiwat;
-               bufinfo.bytes = bufinfo.fragments * tmpinfo.blocksize;
+               bufinfo.bytes =
+                   tmpinfo.hiwat * tmpinfo.blocksize - tmpinfo.play.seek;
                error = copyout(&bufinfo, SCARG(uap, data), sizeof bufinfo);
                if (error) {
                        DPRINTF(("%s: SNDCTL_DSP_GETOSPACE = %d\n",



Home | Main Index | Thread Index | Old Index