X-Git-Url: http://git.archive.openwrt.org/?p=project%2Flibubox.git;a=blobdiff_plain;f=ustream.h;h=6431744155f810f5c8d2b8d3a4b57c47de60e490;hp=2df429c0a165a341ca83ec557c3e6d760600fe94;hb=4ab499899ce2ed884a1235ada501c39e355911e7;hpb=a9b44ebe556c3f60de2fc1154d48a26f43aa15b7 diff --git a/ustream.h b/ustream.h index 2df429c..6431744 100644 --- a/ustream.h +++ b/ustream.h @@ -163,6 +163,19 @@ static inline bool ustream_read_blocked(struct ustream *s) return !!(s->read_blocked & READ_BLOCKED_USER); } +static inline int ustream_pending_data(struct ustream *s, bool write) +{ + struct ustream_buf_list *b = write ? &s->w : &s->r; + return b->data_bytes; +} + +static inline bool ustream_read_buf_full(struct ustream *s) +{ + struct ustream_buf *buf = s->r.data_tail; + return buf && buf->data == buf->head && buf->tail == buf->end && + s->r.buffers == s->r.max_buffers; +} + /*** --- functions only used by ustream implementations --- ***/ /* ustream_init_defaults: fill default callbacks and options */