Module Name: src Committed By: isaki Date: Tue Jan 29 12:01:20 UTC 2019
Modified Files: src/sys/compat/ossaudio: ossaudio.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/sys/compat/ossaudio/ossaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/compat/ossaudio/ossaudio.c diff -u src/sys/compat/ossaudio/ossaudio.c:1.70 src/sys/compat/ossaudio/ossaudio.c:1.71 --- src/sys/compat/ossaudio/ossaudio.c:1.70 Fri Mar 24 14:32:29 2017 +++ src/sys/compat/ossaudio/ossaudio.c Tue Jan 29 12:01:20 2019 @@ -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 @@ oss_ioctl_audio(struct lwp *l, const str } 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",