[master] ff82e01a9 Give VDP_Push() a vdp_ctx argument instead of req

Poul-Henning Kamp phk at FreeBSD.org
Mon Oct 26 20:07:10 UTC 2020


commit ff82e01a93a2f424e6356523846e25a66a528232
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Oct 26 19:58:44 2020 +0000

    Give VDP_Push() a vdp_ctx argument instead of req

diff --git a/bin/varnishd/cache/cache_deliver_proc.c b/bin/varnishd/cache/cache_deliver_proc.c
index a8951305c..c1fe1ad9a 100644
--- a/bin/varnishd/cache/cache_deliver_proc.c
+++ b/bin/varnishd/cache/cache_deliver_proc.c
@@ -81,7 +81,6 @@ VDP_bytes(struct vdp_ctx *vdx, enum vdp_action act, const void *ptr, ssize_t len
 	struct vdp_entry *vdpe;
 
 	CHECK_OBJ_NOTNULL(vdx, VDP_CTX_MAGIC);
-	CHECK_OBJ_NOTNULL(vdx->req, REQ_MAGIC);
 	if (vdx->retval)
 		return (vdx->retval);
 	vdpe = vdx->nxt;
@@ -110,13 +109,12 @@ VDP_bytes(struct vdp_ctx *vdx, enum vdp_action act, const void *ptr, ssize_t len
 }
 
 int
-VDP_Push(struct req *req, const struct vdp *vdp, void *priv)
+VDP_Push(struct vdp_ctx *vdc, struct ws *ws, const struct vdp *vdp, void *priv)
 {
 	struct vdp_entry *vdpe;
-	struct vdp_ctx *vdc;
 
-	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
-	vdc = req->vdc;
+	CHECK_OBJ_NOTNULL(vdc, VDP_CTX_MAGIC);
+	AN(ws);
 	AN(vdp);
 	AN(vdp->name);
 	AN(vdp->bytes);
@@ -125,9 +123,9 @@ VDP_Push(struct req *req, const struct vdp *vdp, void *priv)
 		return (vdc->retval);
 
 	if (DO_DEBUG(DBG_PROCESSORS))
-		VSLb(req->vsl, SLT_Debug, "VDP_push(%s)", vdp->name);
+		VSLb(vdc->vsl, SLT_Debug, "VDP_push(%s)", vdp->name);
 
-	vdpe = WS_Alloc(req->ws, sizeof *vdpe);
+	vdpe = WS_Alloc(ws, sizeof *vdpe);
 	if (vdpe == NULL) {
 		AZ(vdc->retval);
 		vdc->retval = -1;
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index 242cd19dc..d7030cc35 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -860,14 +860,14 @@ ved_deliver(struct req *req, struct boc *boc, int wantbody)
 
 		INIT_OBJ(foo, VED_FOO_MAGIC);
 		foo->ecx = ecx;
-		i = VDP_Push(req, &ved_gzgz, foo);
+		i = VDP_Push(req->vdc, req->ws, &ved_gzgz, foo);
 
 	} else if (ecx->isgzip && !i) {
 		/* Non-Gzip'ed include in gzip'ed parent */
-		i = VDP_Push(req, &ved_pretend_gz, ecx);
+		i = VDP_Push(req->vdc, req->ws, &ved_pretend_gz, ecx);
 	} else {
 		/* Anything else goes straight through */
-		i = VDP_Push(req, &ved_ved, ecx);
+		i = VDP_Push(req->vdc, req->ws, &ved_ved, ecx);
 	}
 
 	if (i == 0) {
diff --git a/bin/varnishd/cache/cache_filter.h b/bin/varnishd/cache/cache_filter.h
index e83706951..60a2a53c1 100644
--- a/bin/varnishd/cache/cache_filter.h
+++ b/bin/varnishd/cache/cache_filter.h
@@ -159,6 +159,6 @@ uint64_t VDP_Close(struct req *req);
 int VDP_DeliverObj(struct vdp_ctx *vdc, struct objcore *oc);
 
 int VDP_bytes(struct vdp_ctx *, enum vdp_action act, const void *ptr, ssize_t len);
-int VDP_Push(struct req *, const struct vdp *, void *priv);
+int VDP_Push(struct vdp_ctx *, struct ws *, const struct vdp *, void *priv);
 void VRT_AddVDP(VRT_CTX, const struct vdp *);
 void VRT_RemoveVDP(VRT_CTX, const struct vdp *);
diff --git a/bin/varnishd/cache/cache_vrt_filter.c b/bin/varnishd/cache/cache_vrt_filter.c
index 54002bec4..485915c11 100644
--- a/bin/varnishd/cache/cache_vrt_filter.c
+++ b/bin/varnishd/cache/cache_vrt_filter.c
@@ -238,7 +238,7 @@ VCL_StackVDP(struct req *req, const struct vcl *vcl, const char *fl)
 			    "Filter '...%s' not found", fl);
 			return (-1);
 		}
-		if (VDP_Push(req, vp->vdp, NULL))
+		if (VDP_Push(req->vdc, req->ws, vp->vdp, NULL))
 			return (-1);
 	}
 }
diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c
index 03e52514f..aad32808f 100644
--- a/bin/varnishd/http1/cache_http1_deliver.c
+++ b/bin/varnishd/http1/cache_http1_deliver.c
@@ -114,7 +114,7 @@ V1D_Deliver(struct req *req, struct boc *boc, int sendbody)
 				req->doclose = SC_TX_EOF;
 			}
 		}
-		if (VDP_Push(req, &v1d_vdp, NULL)) {
+		if (VDP_Push(req->vdc, req->ws, &v1d_vdp, NULL)) {
 			v1d_error(req, "workspace_thread overflow");
 			AZ(req->wrk->v1l);
 			return;
diff --git a/bin/varnishd/http2/cache_http2_deliver.c b/bin/varnishd/http2/cache_http2_deliver.c
index 729fd6bec..3e257f151 100644
--- a/bin/varnishd/http2/cache_http2_deliver.c
+++ b/bin/varnishd/http2/cache_http2_deliver.c
@@ -334,7 +334,7 @@ h2_deliver(struct req *req, struct boc *boc, int sendbody)
 
 	/* XXX someone into H2 please add appropriate error handling */
 	if (sendbody) {
-		if (!VDP_Push(req, &h2_vdp, NULL))
+		if (!VDP_Push(req->vdc, req->ws, &h2_vdp, NULL))
 			(void)VDP_DeliverObj(req->vdc, req->objcore);
 	}
 


More information about the varnish-commit mailing list