MEDIUM: buffers: move "output" from struct buffer to struct channel

Since we never access this field directly anymore, but only through the
channel's wrappers, it can now move to the channel. The buffers are now
completely free from the distinction between input and output data.
diff --git a/include/common/buf.h b/include/common/buf.h
index e028f90..c38d65d 100644
--- a/include/common/buf.h
+++ b/include/common/buf.h
@@ -35,7 +35,6 @@
 	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 */
 };
 
@@ -367,7 +366,6 @@
 {
 	b->head = 0;
 	b->len  = 0;
-	b->output = 0;
 }
 
 /* b_sub() : decreases the buffer length by <count> */
diff --git a/include/common/buffer.h b/include/common/buffer.h
index fde7b03..018b19e 100644
--- a/include/common/buffer.h
+++ b/include/common/buffer.h
@@ -135,7 +135,6 @@
 		return;
 	*b_tail(b) = c;
 	b->len++;
-	b->output++;
 }
 
 /* Tries to append block <blk> at the end of buffer <b>. Supports wrapping.
@@ -161,7 +160,6 @@
 		memcpy(b_tail(b), blk + half, len - half);
 		b->len += len - half;
 	}
-	b->output += len;
 	return len;
 }
 
@@ -470,7 +468,6 @@
 
 	p = b_tail(b);
 	b->len += r.len;
-	b->output += r.len;
 	while (r.len--) {
 		*p++ = *r.ptr++;
 		if (unlikely(p == end))
diff --git a/include/proto/channel.h b/include/proto/channel.h
index 6241237..b2efae8 100644
--- a/include/proto/channel.h
+++ b/include/proto/channel.h
@@ -128,7 +128,7 @@
 /* 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 */
@@ -170,7 +170,7 @@
  */
 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
@@ -180,7 +180,7 @@
  */
 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 */
@@ -192,8 +192,8 @@
 /* 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;
 }
 
 
@@ -324,6 +324,7 @@
 	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
@@ -767,7 +768,7 @@
 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 */
diff --git a/include/types/channel.h b/include/types/channel.h
index c483399..5205bd6 100644
--- a/include/types/channel.h
+++ b/include/types/channel.h
@@ -189,6 +189,7 @@
 	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 */