[experimental-ims] 9b65ebc Push worker->busyobj shift up through VFP's.

Geoff Simmons geoff at varnish-cache.org
Fri Feb 17 13:58:54 CET 2012


commit 9b65ebca918039344ec7450c4de580a59547f4b6
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Feb 15 13:29:31 2012 +0000

    Push worker->busyobj shift up through VFP's.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index a47edf1..daa01f4 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -219,9 +219,9 @@ struct dstat {
 
 /* Fetch processors --------------------------------------------------*/
 
-typedef void vfp_begin_f(struct worker *, size_t );
-typedef int vfp_bytes_f(struct worker *, struct http_conn *, ssize_t);
-typedef int vfp_end_f(struct worker *);
+typedef void vfp_begin_f(struct busyobj *, size_t );
+typedef int vfp_bytes_f(struct busyobj *, struct http_conn *, ssize_t);
+typedef int vfp_end_f(struct busyobj *);
 
 struct vfp {
 	vfp_begin_f	*begin;
diff --git a/bin/varnishd/cache/cache_esi_fetch.c b/bin/varnishd/cache/cache_esi_fetch.c
index 6b57011..14ca31b 100644
--- a/bin/varnishd/cache/cache_esi_fetch.c
+++ b/bin/varnishd/cache/cache_esi_fetch.c
@@ -292,15 +292,12 @@ vfp_esi_bytes_gg(const struct busyobj *bo, struct vef_priv *vef,
 
 /*---------------------------------------------------------------------*/
 
-static void __match_proto__()
-vfp_esi_begin(struct worker *wrk, size_t estimate)
+static void __match_proto__(vfp_begin_f)
+vfp_esi_begin(struct busyobj *bo, size_t estimate)
 {
-	struct busyobj *bo;
 	struct vef_priv *vef;
 
 	(void)estimate;
-	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	bo = wrk->busyobj;
 	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
 
 	ALLOC_OBJ(vef, VEF_MAGIC);
@@ -310,16 +307,16 @@ vfp_esi_begin(struct worker *wrk, size_t estimate)
 
 	AZ(bo->vgz_rx);
 	if (bo->is_gzip && bo->do_gunzip) {
-		bo->vgz_rx = VGZ_NewUngzip(wrk->vsl, "U F E");
+		bo->vgz_rx = VGZ_NewUngzip(bo->vsl, "U F E");
 		VEP_Init(bo, NULL);
 		vef->ibuf_sz = cache_param->gzip_buffer;
 	} else if (bo->is_gunzip && bo->do_gzip) {
-		vef->vgz = VGZ_NewGzip(wrk->vsl, "G F E");
+		vef->vgz = VGZ_NewGzip(bo->vsl, "G F E");
 		VEP_Init(bo, vfp_vep_callback);
 		vef->ibuf_sz = cache_param->gzip_buffer;
 	} else if (bo->is_gzip) {
-		bo->vgz_rx = VGZ_NewUngzip(wrk->vsl, "U F E");
-		vef->vgz = VGZ_NewGzip(wrk->vsl, "G F E");
+		bo->vgz_rx = VGZ_NewUngzip(bo->vsl, "U F E");
+		vef->vgz = VGZ_NewGzip(bo->vsl, "G F E");
 		VEP_Init(bo, vfp_vep_callback);
 		vef->ibuf_sz = cache_param->gzip_buffer;
 		vef->ibuf2_sz = cache_param->gzip_buffer;
@@ -339,15 +336,12 @@ vfp_esi_begin(struct worker *wrk, size_t estimate)
 	AN(bo->vep);
 }
 
-static int __match_proto__()
-vfp_esi_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
+static int __match_proto__(vfp_bytes_f)
+vfp_esi_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes)
 {
-	struct busyobj *bo;
 	struct vef_priv *vef;
 	int i;
 
-	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	bo = wrk->busyobj;
 	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
 	vef = bo->vef_priv;
 	CHECK_OBJ_NOTNULL(vef, VEF_MAGIC);
@@ -367,17 +361,14 @@ vfp_esi_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
 	return (i);
 }
 
-static int __match_proto__()
-vfp_esi_end(struct worker *wrk)
+static int __match_proto__(vfp_end_f)
+vfp_esi_end(struct busyobj *bo)
 {
 	struct vsb *vsb;
 	struct vef_priv *vef;
-	struct busyobj *bo;
 	ssize_t l;
 	int retval;
 
-	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	bo = wrk->busyobj;
 	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
 	AN(bo->vep);
 
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index e520e6d..372ce08 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -87,12 +87,12 @@ FetchError(struct busyobj *bo, const char *error)
  * 'estimate' is the estimate of the number of bytes we expect to receive,
  * as seen on the socket, or zero if unknown.
  */
-static void __match_proto__()
-vfp_nop_begin(struct worker *wrk, size_t estimate)
+static void __match_proto__(vfp_begin_f)
+vfp_nop_begin(struct busyobj *bo, size_t estimate)
 {
 
 	if (estimate > 0)
-		(void)FetchStorage(wrk->busyobj, estimate);
+		(void)FetchStorage(bo, estimate);
 }
 
 /*--------------------------------------------------------------------
@@ -106,15 +106,15 @@ vfp_nop_begin(struct worker *wrk, size_t estimate)
  * Return 1 when 'bytes' have been processed.
  */
 
-static int __match_proto__()
-vfp_nop_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
+static int __match_proto__(vfp_bytes_f)
+vfp_nop_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes)
 {
 	ssize_t l, wl;
 	struct storage *st;
 
-	AZ(wrk->busyobj->fetch_failed);
+	AZ(bo->fetch_failed);
 	while (bytes > 0) {
-		st = FetchStorage(wrk->busyobj, 0);
+		st = FetchStorage(bo, 0);
 		if (st == NULL)
 			return(-1);
 		l = st->space - st->len;
@@ -124,7 +124,7 @@ vfp_nop_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
 		if (wl <= 0)
 			return (wl);
 		st->len += wl;
-		wrk->busyobj->fetch_obj->len += wl;
+		bo->fetch_obj->len += wl;
 		bytes -= wl;
 	}
 	return (1);
@@ -139,17 +139,17 @@ vfp_nop_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
  * Return 0 for OK
  */
 
-static int __match_proto__()
-vfp_nop_end(struct worker *wrk)
+static int __match_proto__(vfp_end_f)
+vfp_nop_end(struct busyobj *bo)
 {
 	struct storage *st;
 
-	st = VTAILQ_LAST(&wrk->busyobj->fetch_obj->store, storagehead);
+	st = VTAILQ_LAST(&bo->fetch_obj->store, storagehead);
 	if (st == NULL)
 		return (0);
 
 	if (st->len == 0) {
-		VTAILQ_REMOVE(&wrk->busyobj->fetch_obj->store, st, list);
+		VTAILQ_REMOVE(&bo->fetch_obj->store, st, list);
 		STV_free(st);
 		return (0);
 	}
@@ -224,20 +224,20 @@ fetch_number(const char *nbr, int radix)
 /*--------------------------------------------------------------------*/
 
 static int
-fetch_straight(struct worker *wrk, struct http_conn *htc, ssize_t cl)
+fetch_straight(struct busyobj *bo, struct http_conn *htc, ssize_t cl)
 {
 	int i;
 
-	assert(wrk->busyobj->body_status == BS_LENGTH);
+	assert(bo->body_status == BS_LENGTH);
 
 	if (cl < 0) {
-		return (FetchError(wrk->busyobj, "straight length field bogus"));
+		return (FetchError(bo, "straight length field bogus"));
 	} else if (cl == 0)
 		return (0);
 
-	i = wrk->busyobj->vfp->bytes(wrk, htc, cl);
+	i = bo->vfp->bytes(bo, htc, cl);
 	if (i <= 0)
-		return (FetchError(wrk->busyobj, "straight insufficient bytes"));
+		return (FetchError(bo, "straight insufficient bytes"));
 	return (0);
 }
 
@@ -248,14 +248,14 @@ fetch_straight(struct worker *wrk, struct http_conn *htc, ssize_t cl)
  */
 
 static int
-fetch_chunked(struct worker *wrk, struct http_conn *htc)
+fetch_chunked(struct busyobj *bo, struct http_conn *htc)
 {
 	int i;
 	char buf[20];		/* XXX: 20 is arbitrary */
 	unsigned u;
 	ssize_t cl;
 
-	assert(wrk->busyobj->body_status == BS_CHUNKED);
+	assert(bo->body_status == BS_CHUNKED);
 	do {
 		/* Skip leading whitespace */
 		do {
@@ -264,7 +264,7 @@ fetch_chunked(struct worker *wrk, struct http_conn *htc)
 		} while (vct_islws(buf[0]));
 
 		if (!vct_ishex(buf[0]))
-			return (FetchError(wrk->busyobj, "chunked header non-hex"));
+			return (FetchError(bo, "chunked header non-hex"));
 
 		/* Collect hex digits, skipping leading zeros */
 		for (u = 1; u < sizeof buf; u++) {
@@ -277,7 +277,7 @@ fetch_chunked(struct worker *wrk, struct http_conn *htc)
 		}
 
 		if (u >= sizeof buf)
-			return (FetchError(wrk->busyobj,"chunked header too long"));
+			return (FetchError(bo,"chunked header too long"));
 
 		/* Skip trailing white space */
 		while(vct_islws(buf[u]) && buf[u] != '\n')
@@ -285,14 +285,14 @@ fetch_chunked(struct worker *wrk, struct http_conn *htc)
 				return (-1);
 
 		if (buf[u] != '\n')
-			return (FetchError(wrk->busyobj,"chunked header no NL"));
+			return (FetchError(bo,"chunked header no NL"));
 
 		buf[u] = '\0';
 		cl = fetch_number(buf, 16);
 		if (cl < 0)
-			return (FetchError(wrk->busyobj,"chunked header number syntax"));
+			return (FetchError(bo,"chunked header number syntax"));
 
-		if (cl > 0 && wrk->busyobj->vfp->bytes(wrk, htc, cl) <= 0)
+		if (cl > 0 && bo->vfp->bytes(bo, htc, cl) <= 0)
 			return (-1);
 
 		i = HTC_Read(htc, buf, 1);
@@ -301,7 +301,7 @@ fetch_chunked(struct worker *wrk, struct http_conn *htc)
 		if (buf[0] == '\r' && HTC_Read( htc, buf, 1) <= 0)
 			return (-1);
 		if (buf[0] != '\n')
-			return (FetchError(wrk->busyobj,"chunked tail no NL"));
+			return (FetchError(bo,"chunked tail no NL"));
 	} while (cl > 0);
 	return (0);
 }
@@ -309,12 +309,12 @@ fetch_chunked(struct worker *wrk, struct http_conn *htc)
 /*--------------------------------------------------------------------*/
 
 static int
-fetch_eof(struct worker *wrk, struct http_conn *htc)
+fetch_eof(struct busyobj *bo, struct http_conn *htc)
 {
 	int i;
 
-	assert(wrk->busyobj->body_status == BS_EOF);
-	i = wrk->busyobj->vfp->bytes(wrk, htc, SSIZE_MAX);
+	assert(bo->body_status == BS_EOF);
+	i = bo->vfp->bytes(bo, htc, SSIZE_MAX);
 	if (i < 0)
 		return (-1);
 	return (0);
@@ -540,24 +540,24 @@ FetchBody(struct worker *wrk, struct object *obj)
 		break;
 	case BS_LENGTH:
 		cl = fetch_number(bo->h_content_length, 10);
-		bo->vfp->begin(wrk, cl > 0 ? cl : 0);
-		cls = fetch_straight(wrk, htc, cl);
+		bo->vfp->begin(bo, cl > 0 ? cl : 0);
+		cls = fetch_straight(bo, htc, cl);
 		mklen = 1;
-		if (bo->vfp->end(wrk))
+		if (bo->vfp->end(bo))
 			cls = -1;
 		break;
 	case BS_CHUNKED:
-		bo->vfp->begin(wrk, cl);
-		cls = fetch_chunked(wrk, htc);
+		bo->vfp->begin(bo, cl);
+		cls = fetch_chunked(bo, htc);
 		mklen = 1;
-		if (bo->vfp->end(wrk))
+		if (bo->vfp->end(bo))
 			cls = -1;
 		break;
 	case BS_EOF:
-		bo->vfp->begin(wrk, cl);
-		cls = fetch_eof(wrk, htc);
+		bo->vfp->begin(bo, cl);
+		cls = fetch_eof(bo, htc);
 		mklen = 1;
-		if (bo->vfp->end(wrk))
+		if (bo->vfp->end(bo))
 			cls = -1;
 		break;
 	case BS_ERROR:
@@ -576,7 +576,7 @@ FetchBody(struct worker *wrk, struct object *obj)
 	 * sitting on wrk->storage, we will always call vfp_nop_end()
 	 * to get it trimmed or thrown out if empty.
 	 */
-	AZ(vfp_nop_end(wrk));
+	AZ(vfp_nop_end(bo));
 
 	bo->fetch_obj = NULL;
 
diff --git a/bin/varnishd/cache/cache_gzip.c b/bin/varnishd/cache/cache_gzip.c
index 1dd7942..530d43b 100644
--- a/bin/varnishd/cache/cache_gzip.c
+++ b/bin/varnishd/cache/cache_gzip.c
@@ -428,19 +428,18 @@ VGZ_Destroy(struct vgz **vgp)
  * A VFP for gunzip'ing an object as we receive it from the backend
  */
 
-static void __match_proto__()
-vfp_gunzip_begin(struct worker *wrk, size_t estimate)
+static void __match_proto__(vfp_begin_f)
+vfp_gunzip_begin(struct busyobj *bo, size_t estimate)
 {
 	(void)estimate;
-	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	CHECK_OBJ_NOTNULL(wrk->busyobj, BUSYOBJ_MAGIC);
-	AZ(wrk->busyobj->vgz_rx);
-	wrk->busyobj->vgz_rx = VGZ_NewUngzip(wrk->vsl, "U F -");
-	XXXAZ(vgz_getmbuf(wrk->busyobj->vgz_rx));
+	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+	AZ(bo->vgz_rx);
+	bo->vgz_rx = VGZ_NewUngzip(bo->vsl, "U F -");
+	XXXAZ(vgz_getmbuf(bo->vgz_rx));
 }
 
-static int __match_proto__()
-vfp_gunzip_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
+static int __match_proto__(vfp_bytes_f)
+vfp_gunzip_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes)
 {
 	struct vgz *vg;
 	ssize_t l, wl;
@@ -448,10 +447,9 @@ vfp_gunzip_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
 	size_t dl;
 	const void *dp;
 
-	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	CHECK_OBJ_NOTNULL(wrk->busyobj, BUSYOBJ_MAGIC);
-	AZ(wrk->busyobj->fetch_failed);
-	vg = wrk->busyobj->vgz_rx;
+	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+	AZ(bo->fetch_failed);
+	vg = bo->vgz_rx;
 	CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
 	AZ(vg->vz.avail_in);
 	while (bytes > 0 || vg->vz.avail_in > 0) {
@@ -466,34 +464,32 @@ vfp_gunzip_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
 			bytes -= wl;
 		}
 
-		if (VGZ_ObufStorage(wrk->busyobj, vg))
+		if (VGZ_ObufStorage(bo, vg))
 			return(-1);
 		i = VGZ_Gunzip(vg, &dp, &dl);
 		if (i != VGZ_OK && i != VGZ_END)
-			return(FetchError(wrk->busyobj, "Gunzip data error"));
-		wrk->busyobj->fetch_obj->len += dl;
+			return(FetchError(bo, "Gunzip data error"));
+		bo->fetch_obj->len += dl;
 	}
 	assert(i == Z_OK || i == Z_STREAM_END);
 	return (1);
 }
 
-static int __match_proto__()
-vfp_gunzip_end(struct worker *wrk)
+static int __match_proto__(vfp_end_f)
+vfp_gunzip_end(struct busyobj *bo)
 {
 	struct vgz *vg;
 
-	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	CHECK_OBJ_NOTNULL(wrk->busyobj, BUSYOBJ_MAGIC);
-	vg = wrk->busyobj->vgz_rx;
-	wrk->busyobj->vgz_rx = NULL;
+	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+	vg = bo->vgz_rx;
+	bo->vgz_rx = NULL;
 	CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
-	if (wrk->busyobj->fetch_failed) {
+	if (bo->fetch_failed) {
 		(void)VGZ_Destroy(&vg);
 		return(0);
 	}
 	if (VGZ_Destroy(&vg) != VGZ_END)
-		return(FetchError(wrk->busyobj,
-		    "Gunzip error at the very end"));
+		return(FetchError(bo, "Gunzip error at the very end"));
 	return (0);
 }
 
@@ -509,20 +505,19 @@ struct vfp vfp_gunzip = {
  * A VFP for gzip'ing an object as we receive it from the backend
  */
 
-static void __match_proto__()
-vfp_gzip_begin(struct worker *wrk, size_t estimate)
+static void __match_proto__(vfp_begin_f)
+vfp_gzip_begin(struct busyobj *bo, size_t estimate)
 {
 	(void)estimate;
 
-	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	CHECK_OBJ_NOTNULL(wrk->busyobj, BUSYOBJ_MAGIC);
-	AZ(wrk->busyobj->vgz_rx);
-	wrk->busyobj->vgz_rx = VGZ_NewGzip(wrk->vsl, "G F -");
-	XXXAZ(vgz_getmbuf(wrk->busyobj->vgz_rx));
+	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+	AZ(bo->vgz_rx);
+	bo->vgz_rx = VGZ_NewGzip(bo->vsl, "G F -");
+	XXXAZ(vgz_getmbuf(bo->vgz_rx));
 }
 
-static int __match_proto__()
-vfp_gzip_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
+static int __match_proto__(vfp_bytes_f)
+vfp_gzip_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes)
 {
 	struct vgz *vg;
 	ssize_t l, wl;
@@ -530,10 +525,9 @@ vfp_gzip_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
 	size_t dl;
 	const void *dp;
 
-	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	CHECK_OBJ_NOTNULL(wrk->busyobj, BUSYOBJ_MAGIC);
-	AZ(wrk->busyobj->fetch_failed);
-	vg = wrk->busyobj->vgz_rx;
+	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+	AZ(bo->fetch_failed);
+	vg = bo->vgz_rx;
 	CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
 	AZ(vg->vz.avail_in);
 	while (bytes > 0 || !VGZ_IbufEmpty(vg)) {
@@ -547,42 +541,41 @@ vfp_gzip_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
 			VGZ_Ibuf(vg, vg->m_buf, wl);
 			bytes -= wl;
 		}
-		if (VGZ_ObufStorage(wrk->busyobj, vg))
+		if (VGZ_ObufStorage(bo, vg))
 			return(-1);
 		i = VGZ_Gzip(vg, &dp, &dl, VGZ_NORMAL);
 		assert(i == Z_OK);
-		wrk->busyobj->fetch_obj->len += dl;
+		bo->fetch_obj->len += dl;
 	}
 	return (1);
 }
 
-static int __match_proto__()
-vfp_gzip_end(struct worker *wrk)
+static int __match_proto__(vfp_end_f)
+vfp_gzip_end(struct busyobj *bo)
 {
 	struct vgz *vg;
 	size_t dl;
 	const void *dp;
 	int i;
 
-	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	CHECK_OBJ_NOTNULL(wrk->busyobj, BUSYOBJ_MAGIC);
-	vg = wrk->busyobj->vgz_rx;
+	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+	vg = bo->vgz_rx;
 	CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
-	wrk->busyobj->vgz_rx = NULL;
-	if (wrk->busyobj->fetch_failed) {
+	bo->vgz_rx = NULL;
+	if (bo->fetch_failed) {
 		(void)VGZ_Destroy(&vg);
 		return(0);
 	}
 	do {
 		VGZ_Ibuf(vg, "", 0);
-		if (VGZ_ObufStorage(wrk->busyobj, vg))
+		if (VGZ_ObufStorage(bo, vg))
 			return(-1);
 		i = VGZ_Gzip(vg, &dp, &dl, VGZ_FINISH);
-		wrk->busyobj->fetch_obj->len += dl;
+		bo->fetch_obj->len += dl;
 	} while (i != Z_STREAM_END);
-	VGZ_UpdateObj(vg, wrk->busyobj->fetch_obj);
+	VGZ_UpdateObj(vg, bo->fetch_obj);
 	if (VGZ_Destroy(&vg) != VGZ_END)
-		return(FetchError(wrk->busyobj, "Gzip error at the very end"));
+		return(FetchError(bo, "Gzip error at the very end"));
 	return (0);
 }
 
@@ -599,19 +592,18 @@ struct vfp vfp_gzip = {
  * collecting the magic bits while we're at it.
  */
 
-static void __match_proto__()
-vfp_testgzip_begin(struct worker *wrk, size_t estimate)
+static void __match_proto__(vfp_begin_f)
+vfp_testgzip_begin(struct busyobj *bo, size_t estimate)
 {
-	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	CHECK_OBJ_NOTNULL(wrk->busyobj, BUSYOBJ_MAGIC);
+	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
 	(void)estimate;
-	wrk->busyobj->vgz_rx = VGZ_NewUngzip(wrk->vsl, "u F -");
-	CHECK_OBJ_NOTNULL(wrk->busyobj->vgz_rx, VGZ_MAGIC);
-	XXXAZ(vgz_getmbuf(wrk->busyobj->vgz_rx));
+	bo->vgz_rx = VGZ_NewUngzip(bo->vsl, "u F -");
+	CHECK_OBJ_NOTNULL(bo->vgz_rx, VGZ_MAGIC);
+	XXXAZ(vgz_getmbuf(bo->vgz_rx));
 }
 
-static int __match_proto__()
-vfp_testgzip_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
+static int __match_proto__(vfp_bytes_f)
+vfp_testgzip_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes)
 {
 	struct vgz *vg;
 	ssize_t l, wl;
@@ -620,14 +612,13 @@ vfp_testgzip_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
 	const void *dp;
 	struct storage *st;
 
-	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	CHECK_OBJ_NOTNULL(wrk->busyobj, BUSYOBJ_MAGIC);
-	AZ(wrk->busyobj->fetch_failed);
-	vg = wrk->busyobj->vgz_rx;
+	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+	AZ(bo->fetch_failed);
+	vg = bo->vgz_rx;
 	CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
 	AZ(vg->vz.avail_in);
 	while (bytes > 0) {
-		st = FetchStorage(wrk->busyobj, 0);
+		st = FetchStorage(bo, 0);
 		if (st == NULL)
 			return(-1);
 		l = st->space - st->len;
@@ -639,16 +630,15 @@ vfp_testgzip_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
 		bytes -= wl;
 		VGZ_Ibuf(vg, st->ptr + st->len, wl);
 		st->len += wl;
-		wrk->busyobj->fetch_obj->len += wl;
+		bo->fetch_obj->len += wl;
 
 		while (!VGZ_IbufEmpty(vg)) {
 			VGZ_Obuf(vg, vg->m_buf, vg->m_sz);
 			i = VGZ_Gunzip(vg, &dp, &dl);
 			if (i == VGZ_END && !VGZ_IbufEmpty(vg))
-				return(FetchError(wrk->busyobj,
-				    "Junk after gzip data"));
+				return(FetchError(bo, "Junk after gzip data"));
 			if (i != VGZ_OK && i != VGZ_END)
-				return(FetchError2(wrk->busyobj,
+				return(FetchError2(bo,
 				    "Invalid Gzip data", vg->vz.msg));
 		}
 	}
@@ -656,24 +646,22 @@ vfp_testgzip_bytes(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
 	return (1);
 }
 
-static int __match_proto__()
-vfp_testgzip_end(struct worker *wrk)
+static int __match_proto__(vfp_end_f)
+vfp_testgzip_end(struct busyobj *bo)
 {
 	struct vgz *vg;
 
-	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	CHECK_OBJ_NOTNULL(wrk->busyobj, BUSYOBJ_MAGIC);
-	vg = wrk->busyobj->vgz_rx;
-	wrk->busyobj->vgz_rx = NULL;
+	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+	vg = bo->vgz_rx;
+	bo->vgz_rx = NULL;
 	CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
-	if (wrk->busyobj->fetch_failed) {
+	if (bo->fetch_failed) {
 		(void)VGZ_Destroy(&vg);
 		return(0);
 	}
-	VGZ_UpdateObj(vg, wrk->busyobj->fetch_obj);
+	VGZ_UpdateObj(vg, bo->fetch_obj);
 	if (VGZ_Destroy(&vg) != VGZ_END)
-		return(FetchError(wrk->busyobj,
-		    "TestGunzip error at the very end"));
+		return(FetchError(bo, "TestGunzip error at the very end"));
 	return (0);
 }
 



More information about the varnish-commit mailing list