[master] 303f560 Eliminate ws argument from VCL_bla_method() functions.

Poul-Henning Kamp phk at FreeBSD.org
Thu May 14 11:43:27 CEST 2015


commit 303f56092cb010ffa9596a11de77771d4ad6810d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu May 14 08:53:45 2015 +0000

    Eliminate ws argument from VCL_bla_method() functions.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 565a4bb..e51fbb4 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -1086,7 +1086,7 @@ const char *VCL_Method_Name(unsigned);
 
 #define VCL_MET_MAC(l,u,b) \
     void VCL_##l##_method(struct VCL_conf *, struct worker *, struct req *, \
-	struct busyobj *bo, struct ws *);
+	struct busyobj *bo);
 #include "tbl/vcl_returns.h"
 #undef VCL_MET_MAC
 
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index c36722c..24df6f6 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -274,7 +274,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
 
 	http_PrintfHeader(bo->bereq, "X-Varnish: %u", VXID(bo->vsl->wid));
 
-	VCL_backend_fetch_method(bo->vcl, wrk, NULL, bo, bo->bereq->ws);
+	VCL_backend_fetch_method(bo->vcl, wrk, NULL, bo);
 
 	bo->uncacheable = bo->do_pass;
 	if (wrk->handling == VCL_RET_ABANDON)
@@ -426,7 +426,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
 	bo->vfc->http = bo->beresp;
 	bo->vfc->esi_req = bo->bereq;
 
-	VCL_backend_response_method(bo->vcl, wrk, NULL, bo, bo->beresp->ws);
+	VCL_backend_response_method(bo->vcl, wrk, NULL, bo);
 
 	if (wrk->handling == VCL_RET_ABANDON) {
 		bo->doclose = SC_RESP_CLOSE;
@@ -796,7 +796,7 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
 	bo->fetch_objcore->exp.grace = 0;
 	bo->fetch_objcore->exp.keep = 0;
 
-	VCL_backend_error_method(bo->vcl, wrk, NULL, bo, bo->bereq->ws);
+	VCL_backend_error_method(bo->vcl, wrk, NULL, bo);
 
 	AZ(VSB_finish(bo->synth_body));
 
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 590b5d7..8e48880 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -133,7 +133,7 @@ cnt_deliver(struct worker *wrk, struct req *req)
 	    !RFC2616_Req_Gzip(req->http))
 		RFC2616_Weaken_Etag(req->resp);
 
-	VCL_deliver_method(req->vcl, wrk, req, NULL, req->http->ws);
+	VCL_deliver_method(req->vcl, wrk, req, NULL);
 	VSLb_ts_req(req, "Process", W_TIM_real(wrk));
 
 	/* Stop the insanity before it turns "Hotel California" on us */
@@ -235,7 +235,7 @@ cnt_synth(struct worker *wrk, struct req *req)
 	req->synth_body = VSB_new_auto();
 	AN(req->synth_body);
 
-	VCL_synth_method(req->vcl, wrk, req, NULL, req->http->ws);
+	VCL_synth_method(req->vcl, wrk, req, NULL);
 
 	http_Unset(h, H_Content_Length);
 
@@ -388,7 +388,7 @@ cnt_lookup(struct worker *wrk, struct req *req)
 
 	VSLb(req->vsl, SLT_Hit, "%u", ObjGetXID(wrk, req->objcore));
 
-	VCL_hit_method(req->vcl, wrk, req, NULL, req->http->ws);
+	VCL_hit_method(req->vcl, wrk, req, NULL);
 
 	switch (wrk->handling) {
 	case VCL_RET_DELIVER:
@@ -463,7 +463,7 @@ cnt_miss(struct worker *wrk, struct req *req)
 	CHECK_OBJ_NOTNULL(req->vcl, VCL_CONF_MAGIC);
 	CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC);
 
-	VCL_miss_method(req->vcl, wrk, req, NULL, req->http->ws);
+	VCL_miss_method(req->vcl, wrk, req, NULL);
 	switch (wrk->handling) {
 	case VCL_RET_FETCH:
 		wrk->stats->cache_miss++;
@@ -504,7 +504,7 @@ cnt_pass(struct worker *wrk, struct req *req)
 	CHECK_OBJ_NOTNULL(req->vcl, VCL_CONF_MAGIC);
 	AZ(req->objcore);
 
-	VCL_pass_method(req->vcl, wrk, req, NULL, req->http->ws);
+	VCL_pass_method(req->vcl, wrk, req, NULL);
 	switch (wrk->handling) {
 	case VCL_RET_SYNTH:
 		req->req_step = R_STP_SYNTH;
@@ -550,7 +550,7 @@ cnt_pipe(struct worker *wrk, struct req *req)
 	http_PrintfHeader(bo->bereq, "X-Varnish: %u", VXID(req->vsl->wid));
 	http_SetHeader(bo->bereq, "Connection: close");
 
-	VCL_pipe_method(req->vcl, wrk, req, bo, req->http->ws);
+	VCL_pipe_method(req->vcl, wrk, req, bo);
 
 	if (wrk->handling == VCL_RET_SYNTH)
 		INCOMPL();
@@ -651,7 +651,7 @@ cnt_recv(struct worker *wrk, struct req *req)
 
 	http_CollectHdr(req->http, H_Cache_Control);
 
-	VCL_recv_method(req->vcl, wrk, req, NULL, req->http->ws);
+	VCL_recv_method(req->vcl, wrk, req, NULL);
 
 	/* Attempts to cache req.body may fail */
 	if (req->req_body_status == REQ_BODY_FAIL) {
@@ -674,7 +674,7 @@ cnt_recv(struct worker *wrk, struct req *req)
 
 	req->sha256ctx = &sha256ctx;	/* so HSH_AddString() can find it */
 	SHA256_Init(req->sha256ctx);
-	VCL_hash_method(req->vcl, wrk, req, NULL, req->http->ws);
+	VCL_hash_method(req->vcl, wrk, req, NULL);
 	assert(wrk->handling == VCL_RET_LOOKUP);
 	SHA256_Final(req->digest, req->sha256ctx);
 	req->sha256ctx = NULL;
@@ -743,7 +743,7 @@ cnt_purge(struct worker *wrk, struct req *req)
 
 	AZ(HSH_DerefObjCore(wrk, &boc));
 
-	VCL_purge_method(req->vcl, wrk, req, NULL, req->http->ws);
+	VCL_purge_method(req->vcl, wrk, req, NULL);
 	switch (wrk->handling) {
 	case VCL_RET_RESTART:
 		req->req_step = R_STP_RESTART;
diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index a5a7da4..ac051d1 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -461,7 +461,7 @@ ccf_config_show(struct cli *cli, const char * const *av, void *priv)
 
 static void
 vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
-    struct ws *ws, unsigned method, vcl_func_f *func)
+    unsigned method, vcl_func_f *func)
 {
 	char *aws;
 	struct vsl_log *vsl = NULL;
@@ -478,6 +478,7 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
 		ctx.http_resp = req->resp;
 		ctx.req = req;
 		ctx.now = req->t_prev;
+		ctx.ws = req->ws;
 	}
 	if (bo != NULL) {
 		CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
@@ -487,9 +488,9 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
 		ctx.http_beresp = bo->beresp;
 		ctx.bo = bo;
 		ctx.now = bo->t_prev;
+		ctx.ws = bo->ws;
 	}
 	assert(ctx.now != 0);
-	ctx.ws = ws;
 	ctx.vsl = vsl;
 	ctx.method = method;
 	ctx.handling = &wrk->handling;
@@ -513,12 +514,12 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
 #define VCL_MET_MAC(func, upper, bitmap)				\
 void									\
 VCL_##func##_method(struct VCL_conf *vcl, struct worker *wrk,		\
-     struct req *req, struct busyobj *bo, struct ws *ws)		\
+     struct req *req, struct busyobj *bo)				\
 {									\
 									\
 	CHECK_OBJ_NOTNULL(vcl, VCL_CONF_MAGIC);				\
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);				\
-	vcl_call_method(wrk, req, bo, ws, VCL_MET_ ## upper,		\
+	vcl_call_method(wrk, req, bo, VCL_MET_ ## upper,		\
 	    vcl->func##_func);						\
 	AN((1U << wrk->handling) & bitmap);				\
 }



More information about the varnish-commit mailing list