size_t head; /* start offset of remaining data relative to area */
size_t len; /* length of data after head */
size_t size; /* buffer size in bytes */
- size_t output; /* TEMPORARY: part of <len> which is to be forwarded */
char area[0]; /* <size> bytes of stored data */
};
{
b->head = 0;
b->len = 0;
- b->output = 0;
}
/* b_sub() : decreases the buffer length by <count> */
return;
*b_tail(b) = c;
b->len++;
- b->output++;
}
/* Tries to append block <blk> at the end of buffer <b>. Supports wrapping.
memcpy(b_tail(b), blk + half, len - half);
b->len += len - half;
}
- b->output += len;
return len;
}
p = b_tail(b);
b->len += r.len;
- b->output += r.len;
while (r.len--) {
*p++ = *r.ptr++;
if (unlikely(p == end))
/* co_data() : returns the amount of output data in the channel's buffer */
static inline size_t co_data(const struct channel *c)
{
- return c->buf->output;
+ return c->output;
}
/* ci_data() : returns the amount of input data in the channel's buffer */
*/
static inline void c_adv(struct channel *c, size_t adv)
{
- c->buf->output += adv;
+ c->output += adv;
}
/* c_rew() : rewinds the channel's buffer by <adv> bytes, which means that the
*/
static inline void c_rew(struct channel *c, size_t adv)
{
- c->buf->output -= adv;
+ c->output -= adv;
}
/* c_realign_if_empty() : realign the channel's buffer if it's empty */
/* Sets the amount of output for the channel */
static inline void co_set_data(struct channel *c, size_t output)
{
- c->buf->len += output - c->buf->output;
- c->buf->output = output;
+ c->buf->len += output - c->output;
+ c->output = output;
}
chn->pipe = NULL;
chn->analysers = 0;
chn->flags = 0;
+ chn->output = 0;
}
/* Schedule up to <bytes> more bytes to be forwarded via the channel without
static inline void co_skip(struct channel *chn, int len)
{
b_del(chn->buf, len);
- chn->buf->output -= len;
+ chn->output -= len;
c_realign_if_empty(chn);
/* notify that some data was written to the SI from the buffer */
unsigned int analysers; /* bit field indicating what to do on the channel */
struct buffer *buf; /* buffer attached to the channel, always present but may move */
struct pipe *pipe; /* non-NULL only when data present */
+ size_t output; /* part of buffer which is to be forwarded */
unsigned int to_forward; /* number of bytes to forward after out without a wake-up */
unsigned short last_read; /* 16 lower bits of last read date (max pause=65s) */
unsigned char xfer_large; /* number of consecutive large xfers */