[master] d54e1ec Pass a busyobj * to the VCL methods

Poul-Henning Kamp phk at varnish-cache.org
Mon Apr 22 08:52:27 CEST 2013


commit d54e1ec9c12fcb787f3b0198f15d9c64e32d28a5
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Apr 22 06:37:42 2013 +0000

    Pass a busyobj * to the VCL methods

diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index a86bff7..502e1b7 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -191,7 +191,7 @@ VCL_Load(const char *fn, const char *name, struct cli *cli)
 	REPLACE(vcl->name, name);
 	VCLI_Out(cli, "Loaded \"%s\" as \"%s\"", fn , name);
 	VTAILQ_INSERT_TAIL(&vcl_head, vcl, list);
-	(void)vcl->conf->init_func(NULL, NULL, NULL);
+	(void)vcl->conf->init_func(NULL, NULL, NULL, NULL);
 	Lck_Lock(&vcl_mtx);
 	if (vcl_active == NULL)
 		vcl_active = vcl;
@@ -215,7 +215,7 @@ VCL_Nuke(struct vcls *vcl)
 	assert(vcl->conf->discard);
 	assert(vcl->conf->busy == 0);
 	VTAILQ_REMOVE(&vcl_head, vcl, list);
-	(void)vcl->conf->fini_func(NULL, NULL, NULL);
+	(void)vcl->conf->fini_func(NULL, NULL, NULL, NULL);
 	vcl->conf->fini_vcl(NULL);
 	free(vcl->name);
 	(void)dlclose(vcl->dlh);
@@ -340,20 +340,21 @@ VCL_##func##_method(struct worker *wrk, struct req *req, struct ws *ws)	\
 {									\
 	char *aws;							\
 									\
+	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);				\
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);				\
 	CHECK_OBJ_NOTNULL(req->sp, SESS_MAGIC);				\
 	AN(req->sp);							\
-	aws = WS_Snapshot(req->wrk->aws);				\
+	aws = WS_Snapshot(wrk->aws);					\
 	req->handling = 0;						\
 	req->cur_method = VCL_MET_ ## upper;				\
 	VSLb(req->vsl, SLT_VCL_call, "%s", #func);			\
-	(void)req->vcl->func##_func(wrk, req, ws);			\
+	(void)req->vcl->func##_func(wrk, req, NULL, ws);		\
 	VSLb(req->vsl, SLT_VCL_return, "%s",				\
 	    VCL_Return_Name(req->handling));				\
 	req->cur_method = 0;						\
 	assert((1U << req->handling) & bitmap);				\
 	assert(!((1U << req->handling) & ~bitmap));			\
-	WS_Reset(req->wrk->aws, aws);					\
+	WS_Reset(wrk->aws, aws);					\
 }
 
 #include "tbl/vcl_returns.h"
diff --git a/lib/libvcl/generate.py b/lib/libvcl/generate.py
index 9b64cb9..f8c506b 100755
--- a/lib/libvcl/generate.py
+++ b/lib/libvcl/generate.py
@@ -745,13 +745,15 @@ file_header(fo)
 fo.write("""
 struct sess;
 struct req;
+struct busyobj;
 struct ws;
 struct cli;
 struct worker;
 
 typedef int vcl_init_f(struct cli *);
 typedef void vcl_fini_f(struct cli *);
-typedef int vcl_func_f(struct worker *, struct req *, struct ws *);
+typedef int vcl_func_f(struct worker *, struct req *, struct busyobj *,
+    struct ws *);
 """)
 
 
diff --git a/lib/libvcl/vcc_compile.c b/lib/libvcl/vcc_compile.c
index 99c5878..30a71cb 100644
--- a/lib/libvcl/vcc_compile.c
+++ b/lib/libvcl/vcc_compile.c
@@ -694,7 +694,7 @@ vcc_CompileSource(const struct vcc *tl0, struct vsb *sb, struct source *sp)
 		Fc(tl, 1, "\nstatic int __match_proto__(vcl_func_f)\n");
 		Fc(tl, 1,
 		    "VGC_function_%s(struct worker *wrk,"
-		    " struct req *req, struct ws *ws)\n",
+		    " struct req *req, struct busyobj *bo, struct ws *ws)\n",
 		    method_tab[i].name);
 		AZ(VSB_finish(tl->fm[i]));
 		Fc(tl, 1, "{\n");



More information about the varnish-commit mailing list