Since the function takes care of the forward count and involves more than
buffer knowledge, rename it.
* close to happen. The test is optimized to avoid as many operations as
* possible for the fast case and to be used as an "if" condition.
*/
-static inline int bi_full(const struct channel *b)
+static inline int channel_full(const struct channel *b)
{
int rem = b->buf.size;
buf->buf.i = 0;
buf->flags &= ~BF_FULL;
- if (bi_full(buf))
- buf->flags |= BF_FULL;
}
/* marks the buffer as "shutdown" ASAP for reads */
if (buffer_len(&buf->buf) == 0)
buf->buf.p = buf->buf.data;
- if (!bi_full(buf))
+ if (!channel_full(buf))
buf->flags &= ~BF_FULL;
/* notify that some data was written to the SI from the buffer */
buf->total += len;
buf->flags &= ~BF_FULL;
- if (bi_full(buf))
+ if (channel_full(buf))
buf->flags |= BF_FULL;
return -1;
*bi_end(&buf->buf) = c;
buf->buf.i++;
- if (bi_full(buf))
+ if (channel_full(buf))
buf->flags |= BF_FULL;
buf->flags |= BF_READ_PARTIAL;
}
buf->flags &= ~BF_FULL;
- if (bi_full(buf))
+ if (channel_full(buf))
buf->flags |= BF_FULL;
/* notify that some data was read from the SI into the buffer */
b->flags &= ~BF_FULL;
if (buffer_len(&b->buf) == 0)
b->buf.p = b->buf.data;
- if (bi_full(b))
+ if (channel_full(b))
b->flags |= BF_FULL;
return delta;
b->buf.i += delta;
b->flags &= ~BF_FULL;
- if (bi_full(b))
+ if (channel_full(b))
b->flags |= BF_FULL;
return delta;
b->flags |= BF_WRITE_PARTIAL;
- if (likely(!bi_full(b)))
+ if (likely(!channel_full(b)))
b->flags &= ~BF_FULL;
if (!b->buf.o) {
b->flags |= BF_READ_PARTIAL;
b->total += ret;
- if (bi_full(b)) {
+ if (channel_full(b)) {
/* The buffer is now full, there's no point in going through
* the loop again.
*/