[master] 9d32fa37c Replace VDP->fini()'s req arg with vdp_ctx.

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


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

    Replace VDP->fini()'s req arg with vdp_ctx.

diff --git a/bin/varnishd/cache/cache_deliver_proc.c b/bin/varnishd/cache/cache_deliver_proc.c
index 5cf465866..30e573d93 100644
--- a/bin/varnishd/cache/cache_deliver_proc.c
+++ b/bin/varnishd/cache/cache_deliver_proc.c
@@ -160,7 +160,7 @@ VDP_Close(struct req *req)
 		if (vdpe != NULL) {
 			CHECK_OBJ(vdpe, VDP_ENTRY_MAGIC);
 			if (vdpe->vdp->fini != NULL)
-				AZ(vdpe->vdp->fini(req, &vdpe->priv));
+				AZ(vdpe->vdp->fini(vdc, &vdpe->priv));
 			AZ(vdpe->priv);
 			VTAILQ_REMOVE(&vdc->vdp, vdpe, list);
 		}
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index 4548b5a51..decd0162d 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -286,11 +286,11 @@ ved_vdp_esi_init(struct req *req, void **priv)
 }
 
 static int v_matchproto_(vdp_fini_f)
-ved_vdp_esi_fini(struct req *req, void **priv)
+ved_vdp_esi_fini(struct vdp_ctx *vdc, void **priv)
 {
 	struct ecx *ecx;
 
-	(void)req;
+	(void)vdc;
 	AN(priv);
 	CAST_OBJ_NOTNULL(ecx, *priv, ECX_MAGIC);
 	FREE_OBJ(ecx);
@@ -500,9 +500,9 @@ ved_bytes(struct ecx *ecx, enum vdp_action act,
  */
 
 static int v_matchproto_(vdp_fini_f)
-ved_pretend_gzip_fini(struct req *req, void **priv)
+ved_pretend_gzip_fini(struct vdp_ctx *vdc, void **priv)
 {
-	(void)req;
+	(void)vdc;
 	*priv = NULL;
 	return (0);
 }
@@ -755,13 +755,13 @@ ved_gzgz_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
 }
 
 static int v_matchproto_(vdp_fini_f)
-ved_gzgz_fini(struct req *req, void **priv)
+ved_gzgz_fini(struct vdp_ctx *vdc, void **priv)
 {
 	uint32_t icrc;
 	uint32_t ilen;
 	struct ved_foo *foo;
 
-	(void)req;
+	(void)vdc;
 	CAST_OBJ_NOTNULL(foo, *priv, VED_FOO_MAGIC);
 	*priv = NULL;
 
@@ -793,9 +793,9 @@ static const struct vdp ved_gzgz = {
  */
 
 static int v_matchproto_(vdp_fini_f)
-ved_vdp_fini(struct req *req, void **priv)
+ved_vdp_fini(struct vdp_ctx *vdc, void **priv)
 {
-	(void)req;
+	(void)vdc;
 	*priv = NULL;
 	return (0);
 }
diff --git a/bin/varnishd/cache/cache_filter.h b/bin/varnishd/cache/cache_filter.h
index fbf9b76ad..cf837df5a 100644
--- a/bin/varnishd/cache/cache_filter.h
+++ b/bin/varnishd/cache/cache_filter.h
@@ -112,7 +112,7 @@ typedef int vdp_init_f(struct req *, void **priv);
 
 struct vdp_ctx;
 
-typedef int vdp_fini_f(struct req *, void **priv);
+typedef int vdp_fini_f(struct vdp_ctx *, void **priv);
 typedef int vdp_bytes_f(struct vdp_ctx *, enum vdp_action, void **priv,
     const void *ptr, ssize_t len);
 
diff --git a/bin/varnishd/cache/cache_gzip.c b/bin/varnishd/cache/cache_gzip.c
index 47dad1e52..67bbc69f2 100644
--- a/bin/varnishd/cache/cache_gzip.c
+++ b/bin/varnishd/cache/cache_gzip.c
@@ -341,11 +341,11 @@ vdp_gunzip_init(struct req *req, void **priv)
 }
 
 static int v_matchproto_(vdp_fini_f)
-vdp_gunzip_fini(struct req *req, void **priv)
+vdp_gunzip_fini(struct vdp_ctx *vdc, void **priv)
 {
 	struct vgz *vg;
 
-	(void)req;
+	(void)vdc;
 	CAST_OBJ_NOTNULL(vg, *priv, VGZ_MAGIC);
 	AN(vg->m_buf);
 	(void)VGZ_Destroy(&vg);
diff --git a/bin/varnishd/cache/cache_range.c b/bin/varnishd/cache/cache_range.c
index fe9943718..a5516ae7d 100644
--- a/bin/varnishd/cache/cache_range.c
+++ b/bin/varnishd/cache/cache_range.c
@@ -48,14 +48,15 @@ struct vrg_priv {
 };
 
 static int v_matchproto_(vdp_fini_f)
-vrg_range_fini(struct req *req, void **priv)
+vrg_range_fini(struct vdp_ctx *vdc, void **priv)
 {
 	struct vrg_priv *vrg_priv;
 
-	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+	CHECK_OBJ_NOTNULL(vdc, VDP_CTX_MAGIC);
+	CHECK_OBJ_NOTNULL(vdc->req, REQ_MAGIC);
 	CAST_OBJ_NOTNULL(vrg_priv, *priv, VRG_PRIV_MAGIC);
 	if (vrg_priv->range_off < vrg_priv->range_high)
-		Req_Fail(req, SC_RANGE_SHORT);
+		Req_Fail(vdc->req, SC_RANGE_SHORT);
 	*priv = NULL;	/* struct on ws, no need to free */
 	return (0);
 }
diff --git a/bin/varnishd/http2/cache_http2_deliver.c b/bin/varnishd/http2/cache_http2_deliver.c
index 1ebfd3253..8bdbdc50d 100644
--- a/bin/varnishd/http2/cache_http2_deliver.c
+++ b/bin/varnishd/http2/cache_http2_deliver.c
@@ -83,18 +83,19 @@ h2_init(struct req *req, void **priv)
 }
 
 static int v_matchproto_(vdp_fini_f)
-h2_fini(struct req *req, void **priv)
+h2_fini(struct vdp_ctx *vdc, void **priv)
 {
 	struct h2_req *r2;
 
-	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+	CHECK_OBJ_NOTNULL(vdc, VDP_CTX_MAGIC);
+	CHECK_OBJ_NOTNULL(vdc->wrk, WORKER_MAGIC);
 	TAKE_OBJ_NOTNULL(r2, priv, H2_REQ_MAGIC);
 
 	if (r2->error)
 		return (0);
 
-	H2_Send_Get(req->wrk, r2->h2sess, r2);
-	H2_Send(req->wrk, r2, H2_F_DATA, H2FF_DATA_END_STREAM, 0, "", NULL);
+	H2_Send_Get(vdc->wrk, r2->h2sess, r2);
+	H2_Send(vdc->wrk, r2, H2_F_DATA, H2FF_DATA_END_STREAM, 0, "", NULL);
 	H2_Send_Rel(r2->h2sess, r2);
 	return (0);
 }
diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c
index 65ce4bed5..aacebc4d9 100644
--- a/lib/libvmod_debug/vmod_debug.c
+++ b/lib/libvmod_debug/vmod_debug.c
@@ -150,9 +150,9 @@ xyzzy_rot13_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
 }
 
 static int v_matchproto_(vdp_fini_f)
-xyzzy_rot13_fini(struct req *req, void **priv)
+xyzzy_rot13_fini(struct vdp_ctx *vdc, void **priv)
 {
-	(void)req;
+	(void)vdc;
 	AN(priv);
 	free(*priv);
 	*priv = NULL;
@@ -187,9 +187,9 @@ xyzzy_pedantic_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
 }
 
 static int v_matchproto_(vdp_fini_f)
-xyzzy_pedantic_fini(struct req *req, void **priv)
+xyzzy_pedantic_fini(struct vdp_ctx *vdc, void **priv)
 {
-	(void) req;
+	(void) vdc;
 	assert (*priv == end_marker);
 	*priv = NULL;
 	return (0);


More information about the varnish-commit mailing list