summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-09-14 03:35:15 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2012-09-14 03:35:15 +0200
commit336df4d4aed17394d5a5fc8ae1f1c24df4c1cf5e (patch)
treea339dedfbab1b8ab9e10263715802425ca931ea9
parentd6e505167c3ea27e276319a0ee2387aa9b2be6b5 (diff)
downloadplan9front-336df4d4aed17394d5a5fc8ae1f1c24df4c1cf5e.tar.xz
Qcoalesce patch to satisfy full read length
-rw-r--r--sys/src/9/omap/devuart.c2
-rw-r--r--sys/src/9/pc/devkbd.c2
-rw-r--r--sys/src/9/pc/psaux.c2
-rw-r--r--sys/src/9/port/devuart.c2
-rw-r--r--sys/src/9/port/qio.c12
5 files changed, 8 insertions, 12 deletions
diff --git a/sys/src/9/omap/devuart.c b/sys/src/9/omap/devuart.c
index 051ad0091..af7ed0005 100644
--- a/sys/src/9/omap/devuart.c
+++ b/sys/src/9/omap/devuart.c
@@ -47,7 +47,7 @@ uartenable(Uart *p)
// return nil;
if(p->iq == nil){
- if((p->iq = qopen(8*1024, 0, uartflow, p)) == nil)
+ if((p->iq = qopen(8*1024, Qcoalesce, uartflow, p)) == nil)
return nil;
}
else
diff --git a/sys/src/9/pc/devkbd.c b/sys/src/9/pc/devkbd.c
index 6c418ae6d..978a48247 100644
--- a/sys/src/9/pc/devkbd.c
+++ b/sys/src/9/pc/devkbd.c
@@ -432,7 +432,7 @@ outbyte(int port, int c)
void
kbdenable(void)
{
- kbd.q = qopen(4*1024, 0, 0, 0);
+ kbd.q = qopen(1024, Qcoalesce, 0, 0);
if(kbd.q == nil)
panic("kbdenable");
qnoblock(kbd.q, 1);
diff --git a/sys/src/9/pc/psaux.c b/sys/src/9/pc/psaux.c
index e0c5d9f61..4d187584c 100644
--- a/sys/src/9/pc/psaux.c
+++ b/sys/src/9/pc/psaux.c
@@ -48,7 +48,7 @@ psauxwrite(Chan*, void *a, long n, vlong)
void
psauxlink(void)
{
- psauxq = qopen(1024, 0, 0, 0);
+ psauxq = qopen(1024, Qcoalesce, 0, 0);
if(psauxq == nil)
panic("psauxlink");
qnoblock(psauxq, 1);
diff --git a/sys/src/9/port/devuart.c b/sys/src/9/port/devuart.c
index 62f42ac17..9fc9a0123 100644
--- a/sys/src/9/port/devuart.c
+++ b/sys/src/9/port/devuart.c
@@ -44,7 +44,7 @@ uartenable(Uart *p)
if(p->enabled)
return p;
if(p->iq == nil){
- if((p->iq = qopen(8*1024, 0, uartflow, p)) == nil)
+ if((p->iq = qopen(8*1024, Qcoalesce, uartflow, p)) == nil)
return nil;
}
else
diff --git a/sys/src/9/port/qio.c b/sys/src/9/port/qio.c
index caf09a4bd..df3c74dc7 100644
--- a/sys/src/9/port/qio.c
+++ b/sys/src/9/port/qio.c
@@ -1097,29 +1097,25 @@ again:
if(q->state & Qcoalesce){
/* when coalescing, 0 length blocks just go away */
b = q->bfirst;
- if(BLEN(b) <= 0){
+ m = BLEN(b);
+ if(m <= 0){
freeb(qremove(q));
goto again;
}
/* grab the first block plus as many
- * following blocks as will completely
+ * following blocks as will partially
* fit in the read.
*/
n = 0;
l = &first;
- m = BLEN(b);
for(;;) {
*l = qremove(q);
l = &b->next;
n += m;
-
- b = q->bfirst;
- if(b == nil)
+ if(n >= len || (b = q->bfirst) == nil)
break;
m = BLEN(b);
- if(n+m > len)
- break;
}
} else {
first = qremove(q);