Block* netifbread(Netif *nif, Chan *c, long n, vlong offset) { Netfile *f; Block *bp; if((c->qid.type & QTDIR) || NETTYPE(c->qid.path) != Ndataqid) return devbread(c, n, offset); f = nif->f[NETID(c->qid.path)]; if(f->fat){ /* * Frame at a time (fat) allows us to provide * non-blocking performance with blocking semantics * for consumers that know ahead of time data is * contained within a single frame. Once empty, we * get in line with other blocking reads and wait our * turn. */ for(;;){ if(bp = qget(f->iq)) return bp; if(waserror()) return nil; qsleep(f->iq); poperror(); } } return qbread(f->iq, n); }
Block* netifbread(Netif *nif, Chan *c, int32_t n, int64_t offset) { if((c->qid.type & QTDIR) || NETTYPE(c->qid.path) != Ndataqid) return devbread(c, n, offset); return qbread(nif->f[NETID(c->qid.path)]->iq, n); }
Block* netifbread(Netif *nif, Chan *c, long n, ulong offset) { if((c->qid.type & QTDIR) || NETTYPE(c->qid.path) != Ndataqid) return devbread(c, n, offset); return qbread(nif->f[NETID(c->qid.path)]->in, n); }
struct block *netifbread(struct ether *nif, struct chan *c, long n, uint32_t offset) { if ((c->qid.type & QTDIR) || NETTYPE(c->qid.path) != Ndataqid) return devbread(c, n, offset); return qbread(nif->f[NETID(c->qid.path)]->in, n); }
static Block* loopbackbread(Chan *c, long n, ulong offset) { Loop *lb; lb = c->aux; if(TYPE(c->qid.path) == Qdata) return qbread(lb->link[ID(c->qid.path)].iq, n); return devbread(c, n, offset); }
static Block* pipebread(Chan *c, long n, ulong offset) { Pipe *p; p = c->aux; switch(NETTYPE(c->qid.path)){ case Qdata0: return qbread(p->q[0], n); case Qdata1: return qbread(p->q[1], n); } return devbread(c, n, offset); }
static Block* pipebread(Chan *c, int32_t n, int64_t offset) { Pipe *p; p = c->aux; switch(PIPETYPE(c->qid.path)){ case Qdata0: return qbread(p->q[0], n); case Qdata1: return qbread(p->q[1], n); } return devbread(c, n, offset); }
static Block* ipbread(Chan* ch, long n, ulong offset) { Conv *c; Proto *x; Fs *f; switch(TYPE(ch->qid)){ case Qdata: f = ipfs[ch->dev]; x = f->p[PROTO(ch->qid)]; c = x->conv[CONV(ch->qid)]; return qbread(c->rq, n); default: return devbread(ch, n, offset); } }
static struct block *pipebread(struct chan *c, long n, uint32_t offset) { Pipe *p; p = c->aux; switch (NETTYPE(c->qid.path)) { case Qdata0: if (c->flag & O_NONBLOCK) return qbread_nonblock(p->q[0], n); else return qbread(p->q[0], n); case Qdata1: if (c->flag & O_NONBLOCK) return qbread_nonblock(p->q[1], n); else return qbread(p->q[1], n); } return devbread(c, n, offset); }