Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Blocksizes sould be rounded to a power of 2 as OSS a...



details:   https://anonhg.NetBSD.org/src/rev/3db5846296e9
branches:  trunk
changeset: 827569:3db5846296e9
user:      nat <nat%NetBSD.org@localhost>
date:      Fri Nov 03 21:15:18 2017 +0000

description:
Blocksizes sould be rounded to a power of 2 as OSS applications need this.

Tested by martin@.

diffstat:

 sys/dev/audio.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r 841a2f4df7a2 -r 3db5846296e9 sys/dev/audio.c
--- a/sys/dev/audio.c   Fri Nov 03 21:12:44 2017 +0000
+++ b/sys/dev/audio.c   Fri Nov 03 21:15:18 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.427 2017/11/03 21:12:44 nat Exp $  */
+/*     $NetBSD: audio.c,v 1.428 2017/11/03 21:15:18 nat Exp $  */
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.427 2017/11/03 21:12:44 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.428 2017/11/03 21:15:18 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -2020,6 +2020,12 @@
                                hwblksize = sc->sc_hwvc->sc_mrr.blksize;
                }
 
+               int tmpblksize = 1;      
+               /* round blocksize to a power of 2 */    
+               while (tmpblksize < blksize)     
+                       tmpblksize <<= 1;        
+
+               blksize = tmpblksize;
                if (blksize > hwblksize)
                        blksize = hwblksize;
        }



Home | Main Index | Thread Index | Old Index