qio: Remove qconsume()
[akaros.git] / kern / src / ns / qio.c
index 6835c20..113c345 100644 (file)
@@ -745,78 +745,6 @@ int qdiscard(struct queue *q, int len)
        return sofar;
 }
 
-/*
- *  Interrupt level copy out of a queue, return # bytes copied.
- */
-int qconsume(struct queue *q, void *vp, int len)
-{
-       struct block *b;
-       int n, dowakeup;
-       uint8_t *p = vp;
-       struct block *tofree = NULL;
-
-       /* sync with qwrite */
-       spin_lock_irqsave(&q->lock);
-
-       for (;;) {
-               b = q->bfirst;
-               if (b == 0) {
-                       q->state |= Qstarve;
-                       spin_unlock_irqsave(&q->lock);
-                       return -1;
-               }
-               QDEBUG checkb(b, "qconsume 1");
-
-               n = BLEN(b);
-               if (n > 0)
-                       break;
-               q->bfirst = b->next;
-               q->len -= BALLOC(b);
-
-               /* remember to free this */
-               b->next = tofree;
-               tofree = b;
-       };
-
-       PANIC_EXTRA(b);
-       if (n < len)
-               len = n;
-       memmove(p, b->rp, len);
-       consumecnt += n;
-       b->rp += len;
-       q->dlen -= len;
-
-       /* discard the block if we're done with it */
-       if ((q->state & Qmsg) || len == n) {
-               q->bfirst = b->next;
-               b->next = 0;
-               q->len -= BALLOC(b);
-               q->dlen -= BLEN(b);
-
-               /* remember to free this */
-               b->next = tofree;
-               tofree = b;
-       }
-
-       /* if writer flow controlled, restart */
-       if ((q->state & Qflow) && q->len < q->limit / 2) {
-               q->state &= ~Qflow;
-               dowakeup = 1;
-       } else
-               dowakeup = 0;
-
-       spin_unlock_irqsave(&q->lock);
-
-       if (dowakeup)
-               rendez_wakeup(&q->wr);
-       qwake_cb(q, FDTAP_FILT_WRITABLE);
-
-       if (tofree != NULL)
-               freeblist(tofree);
-
-       return len;
-}
-
 ssize_t qpass(struct queue *q, struct block *b)
 {
        return __qbwrite(q, b, QIO_LIMIT | QIO_DROP_OVERFLOW);