MEDIUM: mux: Remove const on the buffer in mux->snd_buf()

This is a partial revert of the commit deccd1116 ("MEDIUM: mux: make
mux->snd_buf() take the byte count in argument"). It is a requirement to do
zero-copy transfers. This will be mandatory when the TX buffer of the
conn_stream will be used.

So, now, data are consumed by mux->snd_buf() and not only sent. So it needs to
update the buffer state. On its side, the caller must be aware the buffer can be
replaced y an empty or unallocated one.

As a side effet of this change, the function co_set_data() is now only responsible
to update the channel set, by update ->output field.
diff --git a/include/proto/channel.h b/include/proto/channel.h
index 5a1a36e..bf84a16 100644
--- a/include/proto/channel.h
+++ b/include/proto/channel.h
@@ -193,7 +193,6 @@
 /* Sets the amount of output for the channel */
 static inline void co_set_data(struct channel *c, size_t output)
 {
-	c->buf.data += output - c->output;
 	c->output = output;
 }
 
diff --git a/include/types/connection.h b/include/types/connection.h
index 3a66ed5..83c6bd1 100644
--- a/include/types/connection.h
+++ b/include/types/connection.h
@@ -311,7 +311,7 @@
 	int  (*wake)(struct connection *conn);        /* mux-layer callback to report activity, mandatory */
 	void (*update_poll)(struct conn_stream *cs);  /* commit cs flags to mux/conn */
 	size_t (*rcv_buf)(struct conn_stream *cs, struct buffer *buf, size_t count, int flags); /* Called from the upper layer to get data */
-	size_t (*snd_buf)(struct conn_stream *cs, const struct buffer *buf, size_t count, int flags); /* Called from the upper layer to send data */
+	size_t (*snd_buf)(struct conn_stream *cs, struct buffer *buf, size_t count, int flags); /* Called from the upper layer to send data */
 	int  (*rcv_pipe)(struct conn_stream *cs, struct pipe *pipe, unsigned int count); /* recv-to-pipe callback */
 	int  (*snd_pipe)(struct conn_stream *cs, struct pipe *pipe); /* send-to-pipe callback */
 	void (*shutr)(struct conn_stream *cs, enum cs_shr_mode);     /* shutr function */
diff --git a/src/checks.c b/src/checks.c
index b965ee6..31a3939 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -771,7 +771,7 @@
 		goto out;
 
 	if (b_data(&check->bo)) {
-		b_del(&check->bo, conn->mux->snd_buf(cs, &check->bo, b_data(&check->bo), 0));
+		conn->mux->snd_buf(cs, &check->bo, b_data(&check->bo), 0);
 		b_realign_if_empty(&check->bo);
 		if (conn->flags & CO_FL_ERROR || cs->flags & CS_FL_ERROR) {
 			chk_report_conn_err(check, errno, 0);
@@ -2700,7 +2700,6 @@
 
 			__cs_want_send(cs);
 			ret = conn->mux->snd_buf(cs, &check->bo, b_data(&check->bo), 0);
-			b_del(&check->bo, ret);
 			b_realign_if_empty(&check->bo);
 
 			if (ret <= 0) {
diff --git a/src/mux_h2.c b/src/mux_h2.c
index 78db21e..f46504c 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -3415,7 +3415,7 @@
 }
 
 /* Called from the upper layer, to send data */
-static size_t h2_snd_buf(struct conn_stream *cs, const struct buffer *buf, size_t count, int flags)
+static size_t h2_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t count, int flags)
 {
 	struct h2s *h2s = cs->ctx;
 	size_t total = 0;
@@ -3486,6 +3486,7 @@
 			LIST_ADDQ(&h2s->h2c->fctl_list, &h2s->list);
 	}
 
+	b_del(buf, total);
 	return total;
 }
 
diff --git a/src/mux_pt.c b/src/mux_pt.c
index 7fb3779..d6c1f83 100644
--- a/src/mux_pt.c
+++ b/src/mux_pt.c
@@ -159,9 +159,13 @@
 }
 
 /* Called from the upper layer, to send data */
-static size_t mux_pt_snd_buf(struct conn_stream *cs, const struct buffer *buf, size_t count, int flags)
+static size_t mux_pt_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t count, int flags)
 {
-	return cs->conn->xprt->snd_buf(cs->conn, buf, count, flags);
+	size_t ret = cs->conn->xprt->snd_buf(cs->conn, buf, count, flags);
+
+	if (ret > 0)
+		b_del(buf, ret);
+	return ret;
 }
 
 /* Called from the upper layer, to subscribe to events */