ref: 5cbffd6e6b4430724532beb5bb130ea701cd1a70
parent: 8f782ac916c3dd480e131c70b9c71e3479acdabd
author: cinap_lenrek <[email protected]>
date: Tue Nov 8 16:03:08 EST 2016
kernel/qio: maintain Block.next pointer in padblock()
--- a/sys/src/9/port/qio.c
+++ b/sys/src/9/port/qio.c
@@ -78,16 +78,12 @@
int n;
Block *nbp;
- if(bp->next != nil)
- panic("padblock %#p", getcallerpc(&bp));
-
- QDEBUG checkb(bp, "padblock 1");
+ QDEBUG checkb(bp, "padblock 0");
if(size >= 0){
if(bp->rp - bp->base >= size){
bp->rp -= size;
return bp;
}
-
n = BLEN(bp);
nbp = allocb(size+n);
nbp->rp += size;
@@ -99,12 +95,12 @@
size = -size;
if(bp->lim - bp->wp >= size)
return bp;
-
n = BLEN(bp);
- nbp = allocb(size+n);
+ nbp = allocb(n+size);
memmove(nbp->wp, bp->rp, n);
nbp->wp += n;
}
+ nbp->next = bp->next;
freeb(bp);
padblockcnt++;
QDEBUG checkb(nbp, "padblock 1");