[master] dfaa97033 Move the initialization arguments from VDP_DeliverObj() to VDP_init()

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


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

    Move the initialization arguments from VDP_DeliverObj() to VDP_init()

diff --git a/bin/varnishd/cache/cache_deliver_proc.c b/bin/varnishd/cache/cache_deliver_proc.c
index 30e573d93..65bcc6ff6 100644
--- a/bin/varnishd/cache/cache_deliver_proc.c
+++ b/bin/varnishd/cache/cache_deliver_proc.c
@@ -35,10 +35,19 @@
 #include "cache_filter.h"
 
 void
-VDP_Init(struct vdp_ctx *vdx)
+VDP_Init(struct vdp_ctx *vdc, struct worker *wrk, struct vsl_log *vsl,
+    struct req *req)
 {
-	INIT_OBJ(vdx, VDP_CTX_MAGIC);
-	VTAILQ_INIT(&vdx->vdp);
+	AN(vdc);
+	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
+	AN(vsl);
+	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+
+	INIT_OBJ(vdc, VDP_CTX_MAGIC);
+	VTAILQ_INIT(&vdc->vdp);
+	vdc->wrk = wrk;
+	vdc->vsl = vsl;
+	vdc->req = req;
 }
 
 /* VDP_bytes
@@ -184,21 +193,16 @@ vdp_objiterator(void *priv, unsigned flush, const void *ptr, ssize_t len)
 }
 
 
-int VDP_DeliverObj(struct vdp_ctx *vdc, struct objcore *oc, struct worker *wrk,
-    struct vsl_log *vsl, struct req *req)
+int VDP_DeliverObj(struct vdp_ctx *vdc, struct objcore *oc)
 {
 	int r, final;
 
 	CHECK_OBJ_NOTNULL(vdc, VDP_CTX_MAGIC);
 	CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
-	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	AN(vsl);
-	CHECK_OBJ_ORNULL(req, REQ_MAGIC);
-	vdc->vsl = vsl;
-	vdc->wrk = wrk;
-	vdc->req = req;
+	CHECK_OBJ_NOTNULL(vdc->wrk, WORKER_MAGIC);
+	AN(vdc->vsl);
 	final = oc->flags & (OC_F_PRIVATE | OC_F_HFM | OC_F_HFP) ? 1 : 0;
-	r = ObjIterate(wrk, oc, vdc, vdp_objiterator, final);
+	r = ObjIterate(vdc->wrk, oc, vdc, vdp_objiterator, final);
 	if (r == 0)
 		r = VDP_bytes(vdc, VDP_END, NULL, 0);
 	if (r < 0)
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index decd0162d..43ebe9bf0 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -865,8 +865,7 @@ ved_deliver(struct req *req, struct boc *boc, int wantbody)
 	}
 
 	if (i == 0) {
-		i = VDP_DeliverObj(
-		    req->vdc, req->objcore, req->wrk, req->vsl, req);
+		i = VDP_DeliverObj(req->vdc, req->objcore);
 	} else {
 		VSLb(req->vsl, SLT_Error, "Failure to push ESI processors");
 		req->doclose = SC_OVERLOAD;
diff --git a/bin/varnishd/cache/cache_filter.h b/bin/varnishd/cache/cache_filter.h
index cf837df5a..4ab1ca74e 100644
--- a/bin/varnishd/cache/cache_filter.h
+++ b/bin/varnishd/cache/cache_filter.h
@@ -152,11 +152,12 @@ extern const struct vdp VDP_gunzip;
 extern const struct vdp VDP_esi;
 extern const struct vdp VDP_range;
 
+void VDP_Init(struct vdp_ctx *vdx, struct worker *wrk, struct vsl_log *vsl,
+    struct req *req);
+
 uint64_t VDP_Close(struct req *req);
-int VDP_DeliverObj(struct vdp_ctx *vdc, struct objcore *oc, struct worker *wrk,
-    struct vsl_log *vsl, struct req *req);
+int VDP_DeliverObj(struct vdp_ctx *vdc, struct objcore *oc);
 
-void VDP_Init(struct vdp_ctx *vdx);
 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);
 void VRT_AddVDP(VRT_CTX, const struct vdp *);
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 9ad804dea..2bf6c485f 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -425,7 +425,7 @@ cnt_transmit(struct worker *wrk, struct req *req)
 		sendbody = 1;
 	}
 
-	VDP_Init(req->vdc);
+	VDP_Init(req->vdc, req->wrk, req->vsl, req);
 	if (req->filter_list == NULL)
 		req->filter_list = resp_Get_Filter_List(req);
 	if (req->filter_list == NULL ||
diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c
index ec8826168..03e52514f 100644
--- a/bin/varnishd/http1/cache_http1_deliver.c
+++ b/bin/varnishd/http1/cache_http1_deliver.c
@@ -149,8 +149,7 @@ V1D_Deliver(struct req *req, struct boc *boc, int sendbody)
 			(void)V1L_Flush(req->wrk);
 		if (chunked)
 			V1L_Chunked(req->wrk);
-		err = VDP_DeliverObj(
-		    req->vdc, req->objcore, req->wrk, req->vsl, req);
+		err = VDP_DeliverObj(req->vdc, req->objcore);
 		if (!err && chunked)
 			V1L_EndChunk(req->wrk);
 	}
diff --git a/bin/varnishd/http2/cache_http2_deliver.c b/bin/varnishd/http2/cache_http2_deliver.c
index 8bdbdc50d..4ead4dcd3 100644
--- a/bin/varnishd/http2/cache_http2_deliver.c
+++ b/bin/varnishd/http2/cache_http2_deliver.c
@@ -333,8 +333,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))
-			(void)VDP_DeliverObj(
-			     req->vdc, req->objcore, req->wrk, req->vsl, req);
+			(void)VDP_DeliverObj(req->vdc, req->objcore);
 	}
 
 	AZ(req->wrk->v1l);


More information about the varnish-commit mailing list