[master] af675ec Replace the newly added busyobj argument with vrt_ctx.

Poul-Henning Kamp phk at varnish-cache.org
Tue Apr 30 13:12:31 CEST 2013


commit af675ec65a47aa31da8abda5cf5e0cdaf32dafaa
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Apr 30 11:11:50 2013 +0000

    Replace the newly added busyobj argument with vrt_ctx.
    
    This actually makes some of the macro-expansions in cache_vrt_var.c
    simpler and saner...

diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index cb7f095..aa2aec7 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -220,7 +220,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(&ctx, NULL, NULL, NULL);
+	(void)vcl->conf->init_func(&ctx, NULL, NULL);
 	Lck_Lock(&vcl_mtx);
 	if (vcl_active == NULL)
 		vcl_active = vcl;
@@ -247,7 +247,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(&ctx, NULL, NULL, NULL);
+	(void)vcl->conf->fini_func(&ctx, NULL, NULL);
 	vcl->conf->fini_vcl(NULL);
 	free(vcl->name);
 	(void)dlclose(vcl->dlh);
@@ -391,6 +391,7 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
 		ctx.vcl = req->vcl;
 		ctx.http_req = req->http;
 		ctx.http_resp = req->resp;
+		ctx.req = req;
 		if (req->obj)
 			ctx.http_obj = req->obj->http;
 	}
@@ -412,6 +413,7 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
 		ctx.vcl = bo->vcl;
 		ctx.http_bereq = bo->bereq;
 		ctx.http_beresp = bo->beresp;
+		ctx.bo = bo;
 	}
 	ctx.ws = ws;
 	aws = WS_Snapshot(wrk->aws);
@@ -419,7 +421,7 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
 	wrk->cur_method = method;
 	AN(vsl);
 	VSLb(vsl, SLT_VCL_call, "%s", VCL_Method_Name(method));
-	(void)func(&ctx, wrk, req, bo);
+	(void)func(&ctx, wrk, req);
 	VSLb(vsl, SLT_VCL_return, "%s", VCL_Return_Name(wrk->handling));
 	wrk->cur_method = 0;
 	WS_Reset(wrk->aws, aws);
diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index 58b7df1..b221f22 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -393,11 +393,12 @@ VRT_BOOL_string(unsigned val)
  */
 
 void
-VRT_l_beresp_saintmode(const struct busyobj *bo, double a)
+VRT_l_beresp_saintmode(const struct vrt_ctx *ctx, double a)
 {
 
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
 	if (a > 0.)
-		VBE_AddTrouble(bo, a + VTIM_real());
+		VBE_AddTrouble(ctx->bo, a + VTIM_real());
 }
 
 /*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index 605f44f..6fe06e6 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -37,6 +37,7 @@
 #include "common/heritage.h"
 
 #include "cache_backend.h"
+#include "vrt.h"
 #include "vrt_obj.h"
 #include "vtcp.h"
 #include "vtim.h"
@@ -61,86 +62,82 @@ vrt_do_string(const struct http *hp, int fld,
 	va_end(ap);
 }
 
-#define VRT_DO_HDR(obj, hdr, http, fld)				\
-void								\
-VRT_l_##obj##_##hdr(const struct CPAR *px, const char *p, ...)	\
-{								\
-	va_list ap;						\
-								\
-	CHECK_OBJ_NOTNULL(px, CMAGIC);				\
-	va_start(ap, p);					\
-	vrt_do_string(http, fld, #obj "." #hdr, p, ap);		\
-	va_end(ap);						\
-}								\
-								\
-const char *							\
-VRT_r_##obj##_##hdr(const struct CPAR *px)			\
-{								\
-	CHECK_OBJ_NOTNULL(px, CMAGIC);				\
-	CHECK_OBJ_NOTNULL(http, HTTP_MAGIC);			\
-	return (http->hd[fld].b);				\
+#define VRT_DO_HDR(obj, hdr, fld)					\
+void									\
+VRT_l_##obj##_##hdr(const struct vrt_ctx *ctx, const char *p, ...)	\
+{									\
+	va_list ap;							\
+									\
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);				\
+	va_start(ap, p);						\
+	vrt_do_string(ctx->http_##obj, fld, #obj "." #hdr, p, ap);	\
+	va_end(ap);							\
+}									\
+									\
+const char *								\
+VRT_r_##obj##_##hdr(const struct vrt_ctx *ctx)				\
+{									\
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);				\
+	CHECK_OBJ_NOTNULL(ctx->http_##obj, HTTP_MAGIC);			\
+	return (ctx->http_##obj->hd[fld].b);				\
 }
 
-#define VRT_DO_STATUS(obj, http)				\
-void								\
-VRT_l_##obj##_status(const struct CPAR *px, long num)		\
-{								\
-								\
-	CHECK_OBJ_NOTNULL(px, CMAGIC);				\
-	assert(num >= 100 && num <= 999);			\
-	http->status = (uint16_t)num;				\
-}								\
-								\
-long								\
-VRT_r_##obj##_status(const struct CPAR *px)			\
-{								\
-								\
-	CHECK_OBJ_NOTNULL(px, CMAGIC);				\
-	return(http->status);					\
-}
-
-#define CPAR req
-#define CMAGIC REQ_MAGIC
-VRT_DO_HDR(req,    method,	px->http,	HTTP_HDR_METHOD)
-VRT_DO_HDR(req,    request,	px->http,	HTTP_HDR_METHOD)
-VRT_DO_HDR(req,    url,		px->http,	HTTP_HDR_URL)
-VRT_DO_HDR(req,    proto,	px->http,	HTTP_HDR_PROTO)
-VRT_DO_HDR(obj,    proto,	px->obj->http,	HTTP_HDR_PROTO)
-VRT_DO_HDR(obj,    response,	px->obj->http,	HTTP_HDR_RESPONSE)
-VRT_DO_STATUS(obj,		px->obj->http)
-VRT_DO_HDR(resp,   proto,	px->resp,	HTTP_HDR_PROTO)
-VRT_DO_HDR(resp,   response,	px->resp,	HTTP_HDR_RESPONSE)
-VRT_DO_STATUS(resp,		px->resp)
-#undef CPAR
-#undef CMAGIC
-
-#define CPAR busyobj
-#define CMAGIC BUSYOBJ_MAGIC
-VRT_DO_HDR(bereq,  method,	px->bereq,	HTTP_HDR_METHOD)
-VRT_DO_HDR(bereq,  request,	px->bereq,	HTTP_HDR_METHOD)
-VRT_DO_HDR(bereq,  url,		px->bereq,	HTTP_HDR_URL)
-VRT_DO_HDR(bereq,  proto,	px->bereq,	HTTP_HDR_PROTO)
-VRT_DO_HDR(beresp, proto,	px->beresp,	HTTP_HDR_PROTO)
-VRT_DO_HDR(beresp, response,	px->beresp,	HTTP_HDR_RESPONSE)
-VRT_DO_STATUS(beresp,		px->beresp)
-#undef CPAR
-#undef CMAGIC
+#define VRT_DO_STATUS(obj)						\
+void									\
+VRT_l_##obj##_status(const struct vrt_ctx *ctx, long num)		\
+{									\
+									\
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);				\
+	CHECK_OBJ_NOTNULL(ctx->http_##obj, HTTP_MAGIC);			\
+	assert(num >= 100 && num <= 999);				\
+	ctx->http_##obj->status = (uint16_t)num;			\
+}									\
+									\
+long									\
+VRT_r_##obj##_status(const struct vrt_ctx *ctx)				\
+{									\
+									\
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);				\
+	CHECK_OBJ_NOTNULL(ctx->http_##obj, HTTP_MAGIC);			\
+	return(ctx->http_##obj->status);				\
+}
+
+VRT_DO_HDR(req,    method,	HTTP_HDR_METHOD)
+VRT_DO_HDR(req,    request,	HTTP_HDR_METHOD)
+VRT_DO_HDR(req,    url,		HTTP_HDR_URL)
+VRT_DO_HDR(req,    proto,	HTTP_HDR_PROTO)
+VRT_DO_HDR(obj,    proto,	HTTP_HDR_PROTO)
+VRT_DO_HDR(obj,    response,	HTTP_HDR_RESPONSE)
+VRT_DO_STATUS(obj)
+VRT_DO_HDR(resp,   proto,	HTTP_HDR_PROTO)
+VRT_DO_HDR(resp,   response,	HTTP_HDR_RESPONSE)
+VRT_DO_STATUS(resp)
+
+VRT_DO_HDR(bereq,  method,	HTTP_HDR_METHOD)
+VRT_DO_HDR(bereq,  request,	HTTP_HDR_METHOD)
+VRT_DO_HDR(bereq,  url,		HTTP_HDR_URL)
+VRT_DO_HDR(bereq,  proto,	HTTP_HDR_PROTO)
+VRT_DO_HDR(beresp, proto,	HTTP_HDR_PROTO)
+VRT_DO_HDR(beresp, response,	HTTP_HDR_RESPONSE)
+VRT_DO_STATUS(beresp)
 
 /*--------------------------------------------------------------------*/
 
 #define VBERESP(dir, type, onm, field)					\
 void									\
-VRT_l_##dir##_##onm(struct busyobj *bo, type a)				\
+VRT_l_##dir##_##onm(const struct vrt_ctx *ctx, type a)			\
 {									\
-	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);				\
-	bo->field = a;							\
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);				\
+	CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);			\
+	ctx->bo->field = a;						\
 }									\
 									\
 type									\
-VRT_r_##dir##_##onm(const struct busyobj *bo)				\
+VRT_r_##dir##_##onm(const struct vrt_ctx *ctx)				\
 {									\
-	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);				\
-	return (bo->field);						\
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);				\
+	CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);			\
+	return (ctx->bo->field);					\
 }
 
 VBERESP(beresp, unsigned, do_esi,	do_esi)
@@ -179,19 +176,21 @@ VRT_l_client_identity(struct req *req, const char *str, ...)
 
 #define BEREQ_TIMEOUT(which)					\
 void								\
-VRT_l_bereq_##which(struct busyobj *bo, double num)		\
+VRT_l_bereq_##which(const struct vrt_ctx *ctx, double num)	\
 {								\
 								\
-	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);			\
-	bo->which = (num > 0.0 ? num : 0.0);			\
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);			\
+	CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);		\
+	ctx->bo->which = (num > 0.0 ? num : 0.0);		\
 }								\
 								\
 double								\
-VRT_r_bereq_##which(const struct busyobj *bo)			\
+VRT_r_bereq_##which(const struct vrt_ctx *ctx)			\
 {								\
 								\
-	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);			\
-	return (bo->which);					\
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);			\
+	CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);		\
+	return (ctx->bo->which);				\
 }
 
 BEREQ_TIMEOUT(connect_timeout)
@@ -201,53 +200,58 @@ BEREQ_TIMEOUT(between_bytes_timeout)
 /*--------------------------------------------------------------------*/
 
 const char *
-VRT_r_beresp_backend_name(const struct busyobj *bo)
+VRT_r_beresp_backend_name(const struct vrt_ctx *ctx)
 {
 
-	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
-	CHECK_OBJ_NOTNULL(bo->vbc, VBC_MAGIC);
-	return(bo->vbc->backend->vcl_name);
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
+	CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
+	CHECK_OBJ_NOTNULL(ctx->bo->vbc, VBC_MAGIC);
+	return(ctx->bo->vbc->backend->vcl_name);
 }
 
 struct sockaddr_storage *
-VRT_r_beresp_backend_ip(const struct busyobj *bo)
+VRT_r_beresp_backend_ip(const struct vrt_ctx *ctx)
 {
 
-	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
-	CHECK_OBJ_NOTNULL(bo->vbc, VBC_MAGIC);
-	return(bo->vbc->addr);
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
+	CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
+	CHECK_OBJ_NOTNULL(ctx->bo->vbc, VBC_MAGIC);
+	return(ctx->bo->vbc->addr);
 }
 
 long
-VRT_r_beresp_backend_port(const struct busyobj *bo)
+VRT_r_beresp_backend_port(const struct vrt_ctx *ctx)
 {
 
-	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
-	CHECK_OBJ_NOTNULL(bo->vbc, VBC_MAGIC);
-	return (VTCP_port(bo->vbc->addr));
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
+	CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
+	CHECK_OBJ_NOTNULL(ctx->bo->vbc, VBC_MAGIC);
+	return (VTCP_port(ctx->bo->vbc->addr));
 }
 
 const char *
-VRT_r_beresp_storage(const struct busyobj *bo)
+VRT_r_beresp_storage(const struct vrt_ctx *ctx)
 {
-	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
-	if (bo->storage_hint != NULL)
-		return (bo->storage_hint);
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
+	CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
+	if (ctx->bo->storage_hint != NULL)
+		return (ctx->bo->storage_hint);
 	else
 		return (NULL);
 }
 
 void
-VRT_l_beresp_storage(struct busyobj *bo, const char *str, ...)
+VRT_l_beresp_storage(const struct vrt_ctx *ctx, const char *str, ...)
 {
 	va_list ap;
 	char *b;
 
-	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
+	CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
 	va_start(ap, str);
-	b = VRT_String(bo->ws, NULL, str, ap);
+	b = VRT_String(ctx->bo->ws, NULL, str, ap);	// XXX: ctx->ws ?
 	va_end(ap);
-	bo->storage_hint = b;
+	ctx->bo->storage_hint = b;
 }
 
 /*--------------------------------------------------------------------*/
@@ -285,30 +289,33 @@ VRT_r_req_backend_healthy(const struct req *req)
 /*--------------------------------------------------------------------*/
 
 void
-VRT_l_bereq_backend(struct busyobj *bo, struct director *be)
+VRT_l_bereq_backend(const struct vrt_ctx *ctx, struct director *be)
 {
 
-	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
-	AN(bo->director);
-	bo->director = be;
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
+	CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
+	AN(ctx->bo->director);
+	ctx->bo->director = be;
 }
 
 struct director *
-VRT_r_bereq_backend(const struct busyobj *bo)
+VRT_r_bereq_backend(const struct vrt_ctx *ctx)
 {
 
-	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
-	AN(bo->director);
-	return (bo->director);
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
+	CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
+	AN(ctx->bo->director);
+	return (ctx->bo->director);
 }
 
 unsigned
-VRT_r_bereq_backend_healthy(const struct busyobj *bo)
+VRT_r_bereq_backend_healthy(const struct vrt_ctx *ctx)
 {
 
-	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
-	CHECK_OBJ_NOTNULL(bo->director, DIRECTOR_MAGIC);
-	return (VDI_Healthy(bo->director, bo->digest));
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
+	CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
+	CHECK_OBJ_NOTNULL(ctx->bo->director, DIRECTOR_MAGIC);
+	return (VDI_Healthy(ctx->bo->director, ctx->bo->digest));
 }
 
 /*--------------------------------------------------------------------*/
@@ -369,10 +376,10 @@ VRT_r_req_restarts(const struct req *req)
 #define VRT_DO_EXP(which, exp, fld, offset, extra)		\
 								\
 void								\
-VRT_l_##which##_##fld(struct CPAR *px, double a)		\
+VRT_l_##which##_##fld(const struct vrt_ctx *ctx, double a)	\
 {								\
 								\
-	CHECK_OBJ_NOTNULL(px, CMAGIC);				\
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);			\
 	if (a > 0.)						\
 		a += offset;					\
 	EXP_Set_##fld(&exp, a);					\
@@ -380,10 +387,10 @@ VRT_l_##which##_##fld(struct CPAR *px, double a)		\
 }								\
 								\
 double								\
-VRT_r_##which##_##fld(const struct CPAR *px)			\
+VRT_r_##which##_##fld(const struct vrt_ctx *ctx)		\
 {								\
 								\
-	CHECK_OBJ_NOTNULL(px, CMAGIC);				\
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);			\
 	return(EXP_Get_##fld(&exp) - offset);			\
 }
 
@@ -397,38 +404,33 @@ vrt_wsp_exp(struct vsl_log *vsl, unsigned xid, double now, const struct exp *e)
 	    xid, e->ttl - dt, e->grace, e->keep, now, e->age + dt);
 }
 
-#define CPAR req
-#define CMAGIC REQ_MAGIC
-VRT_DO_EXP(req, px->exp, ttl, 0, )
-VRT_DO_EXP(req, px->exp, grace, 0, )
-VRT_DO_EXP(req, px->exp, keep, 0, )
-
-VRT_DO_EXP(obj, px->obj->exp, grace, 0,
-   EXP_Rearm(px->obj);
-   vrt_wsp_exp(px->vsl, px->obj->vxid, px->t_req, &px->obj->exp);)
-VRT_DO_EXP(obj, px->obj->exp, ttl,
-   (px->t_req - px->obj->exp.entered),
-   EXP_Rearm(px->obj);
-   vrt_wsp_exp(px->vsl, px->obj->vxid, px->t_req, &px->obj->exp);)
-VRT_DO_EXP(obj, px->obj->exp, keep, 0,
-   EXP_Rearm(px->obj);
-   vrt_wsp_exp(px->vsl, px->obj->vxid, px->t_req, &px->obj->exp);)
-#undef CPAR
-#undef CMAGIC
-
-#define CPAR busyobj
-#define CMAGIC BUSYOBJ_MAGIC
-VRT_DO_EXP(beresp, px->exp, grace, 0,
-   vrt_wsp_exp(px->vsl, px->vsl->wid & VSL_IDENTMASK,
-	px->exp.entered, &px->exp);)
-VRT_DO_EXP(beresp, px->exp, ttl, 0,
-   vrt_wsp_exp(px->vsl, px->vsl->wid & VSL_IDENTMASK,
-	px->exp.entered, &px->exp);)
-VRT_DO_EXP(beresp, px->exp, keep, 0,
-   vrt_wsp_exp(px->vsl, px->vsl->wid & VSL_IDENTMASK,
-	px->exp.entered, &px->exp);)
-#undef CPAR
-#undef CMAGIC
+VRT_DO_EXP(req, ctx->req->exp, ttl, 0, )
+VRT_DO_EXP(req, ctx->req->exp, grace, 0, )
+VRT_DO_EXP(req, ctx->req->exp, keep, 0, )
+
+VRT_DO_EXP(obj, ctx->req->obj->exp, grace, 0,
+   EXP_Rearm(ctx->req->obj);
+   vrt_wsp_exp(ctx->vsl, ctx->req->obj->vxid,
+	ctx->req->t_req, &ctx->req->obj->exp);)
+VRT_DO_EXP(obj, ctx->req->obj->exp, ttl,
+   (ctx->req->t_req - ctx->req->obj->exp.entered),
+   EXP_Rearm(ctx->req->obj);
+   vrt_wsp_exp(ctx->vsl, ctx->req->obj->vxid,
+	ctx->req->t_req, &ctx->req->obj->exp);)
+VRT_DO_EXP(obj, ctx->req->obj->exp, keep, 0,
+   EXP_Rearm(ctx->req->obj);
+   vrt_wsp_exp(ctx->vsl, ctx->req->obj->vxid,
+	ctx->req->t_req, &ctx->req->obj->exp);)
+
+VRT_DO_EXP(beresp, ctx->bo->exp, grace, 0,
+   vrt_wsp_exp(ctx->vsl, ctx->vsl->wid & VSL_IDENTMASK,
+	ctx->bo->exp.entered, &ctx->bo->exp);)
+VRT_DO_EXP(beresp, ctx->bo->exp, ttl, 0,
+   vrt_wsp_exp(ctx->vsl, ctx->vsl->wid & VSL_IDENTMASK,
+	ctx->bo->exp.entered, &ctx->bo->exp);)
+VRT_DO_EXP(beresp, ctx->bo->exp, keep, 0,
+   vrt_wsp_exp(ctx->vsl, ctx->vsl->wid & VSL_IDENTMASK,
+	ctx->bo->exp.entered, &ctx->bo->exp);)
 
 /*--------------------------------------------------------------------
  * req.xid
diff --git a/lib/libvcl/generate.py b/lib/libvcl/generate.py
index 6ef580b..d4b53fd 100755
--- a/lib/libvcl/generate.py
+++ b/lib/libvcl/generate.py
@@ -141,25 +141,25 @@ sp_variables = (
 		'STRING',
 		( 'client',),
 		( 'client',),
-		'cR'
+		'C'
 	),
 	('req.request',
 		'STRING',
 		( 'client',),
 		( 'client',),
-		'cR'
+		'C'
 	),
 	('req.url',
 		'STRING',
 		( 'client',),
 		( 'client',),
-		'cR'
+		'C'
 	),
 	('req.proto',
 		'STRING',
 		( 'client',),
 		( 'client',),
-		'cR'
+		'C'
 	),
 	('req.http.',
 		'HEADER',
@@ -183,19 +183,19 @@ sp_variables = (
 		'DURATION',
 		( 'client',),
 		( 'client',),
-		'R'
+		'C'
 	),
 	('req.grace',
 		'DURATION',
 		( 'client',),
 		( 'client',),
-		'R'
+		'C'
 	),
 	('req.keep',
 		'DURATION',
 		( 'client',),
 		( 'client',),
-		'R'
+		'C'
 	),
 	('req.xid',
 		'STRING',
@@ -243,37 +243,37 @@ sp_variables = (
 		'BACKEND',
 		( 'backend', ),
 		( 'backend', ),
-		'B'
+		'C'
 	),
 	('bereq.backend.healthy',
 		'BOOL',
 		( 'backend', ),
 		( ),
-		'B'
+		'C'
 	),
 	('bereq.method',
 		'STRING',
 		( 'pipe', 'backend_fetch', 'pass', 'miss', 'backend_response',),
 		( 'pipe', 'backend_fetch', 'pass', 'miss', 'backend_response',),
-		'cB'
+		'C'
 	),
 	('bereq.request',
 		'STRING',
 		( 'pipe', 'backend_fetch', 'pass', 'miss', 'backend_response',),
 		( 'pipe', 'backend_fetch', 'pass', 'miss', 'backend_response',),
-		'cB'
+		'C'
 	),
 	('bereq.url',
 		'STRING',
 		( 'pipe', 'backend_fetch', 'pass', 'miss', 'backend_response',),
 		( 'pipe', 'backend_fetch', 'pass', 'miss', 'backend_response',),
-		'cB'
+		'C'
 	),
 	('bereq.proto',
 		'STRING',
 		( 'pipe', 'backend_fetch', 'pass', 'miss', 'backend_response',),
 		( 'pipe', 'backend_fetch', 'pass', 'miss', 'backend_response',),
-		'cB'
+		'C'
 	),
 	('bereq.http.',
 		'HEADER',
@@ -285,43 +285,43 @@ sp_variables = (
 		'DURATION',
 		( 'pipe', 'backend_fetch', 'pass', 'miss',),
 		( 'pipe', 'backend_fetch', 'pass', 'miss',),
-		'B'
+		'C'
 	),
 	('bereq.first_byte_timeout',
 		'DURATION',
 		( 'backend_fetch', 'pass', 'miss',),
 		( 'backend_fetch', 'pass', 'miss',),
-		'B'
+		'C'
 	),
 	('bereq.between_bytes_timeout',
 		'DURATION',
 		( 'backend_fetch', 'pass', 'miss',),
 		( 'backend_fetch', 'pass', 'miss',),
-		'B'
+		'C'
 	),
 	('beresp.proto',
 		'STRING',
 		( 'backend_response',),
 		( 'backend_response',),
-		'cB'
+		'C'
 	),
 	('beresp.saintmode',
 		'DURATION',
 		( ),
 		( 'backend_response',),
-		'cB'
+		'C'
 	),
 	('beresp.status',
 		'INT',
 		( 'backend_response',),
 		( 'backend_response',),
-		'cB'
+		'C'
 	),
 	('beresp.response',
 		'STRING',
 		( 'backend_response',),
 		( 'backend_response',),
-		'cB'
+		'C'
 	),
 	('beresp.http.',
 		'HEADER',
@@ -333,97 +333,97 @@ sp_variables = (
 		'BOOL',
 		( 'backend_response',),
 		( 'backend_response',),
-		'B'
+		'C'
 	),
 	('beresp.do_stream',
 		'BOOL',
 		( 'backend_response',),
 		( 'backend_response',),
-		'B'
+		'C'
 	),
 	('beresp.do_gzip',
 		'BOOL',
 		( 'backend_response',),
 		( 'backend_response',),
-		'B'
+		'C'
 	),
 	('beresp.do_gunzip',
 		'BOOL',
 		( 'backend_response',),
 		( 'backend_response',),
-		'B'
+		'C'
 	),
 	('beresp.do_pass',
 		'BOOL',
 		( 'backend_response',),
 		( 'backend_response',),
-		'B'
+		'C'
 	),
 	('beresp.uncacheable',
 		'BOOL',
 		( 'backend_response',),
 		( 'backend_response',),
-		'B'
+		'C'
 	),
 	('beresp.ttl',
 		'DURATION',
 		( 'backend_response',),
 		( 'backend_response',),
-		'B'
+		'C'
 	),
 	('beresp.grace',
 		'DURATION',
 		( 'backend_response',),
 		( 'backend_response',),
-		'B'
+		'C'
 	),
 	('beresp.keep',
 		'DURATION',
 		( 'backend_response',),
 		( 'backend_response',),
-		'B'
+		'C'
 	),
 	('beresp.backend.name',
 		'STRING',
 		( 'backend_response',),
 		( ),
-		'cB'
+		'C'
 	),
 	('beresp.backend.ip',
 		'IP',
 		( 'backend_response',),
 		( ),
-		'cB'
+		'C'
 	),
 	('beresp.backend.port',
 		'INT',
 		( 'backend_response',),
 		( ),
-		'cB'
+		'C'
 	),
 	('beresp.storage',
 		'STRING',
 		( 'backend_response',),
 		( 'backend_response',),
-		'B'
+		'C'
 	),
 	('obj.proto',
 		'STRING',
 		( 'lookup', 'error',),
 		( 'lookup', 'error',),
-		'cR'
+		'C'
 	),
 	('obj.status',
 		'INT',
 		( 'error',),
 		( 'error',),
-		'cR'
+		'C'
 	),
 	('obj.response',
 		'STRING',
 		( 'error',),
 		( 'error',),
-		'cR'
+		'C'
 	),
 	('obj.hits',
 		'INT',
@@ -441,19 +441,19 @@ sp_variables = (
 		'DURATION',
 		( 'lookup', 'error',),
 		( 'lookup', 'error',),
-		'R'
+		'C'
 	),
 	('obj.grace',
 		'DURATION',
 		( 'lookup', 'error',),
 		( 'lookup', 'error',),
-		'R'
+		'C'
 	),
 	('obj.keep',
 		'DURATION',
 		( 'lookup', 'error',),
 		( 'lookup', 'error',),
-		'R'
+		'C'
 	),
 	('obj.lastuse',
 		'DURATION',
@@ -471,19 +471,19 @@ sp_variables = (
 		'STRING',
 		( 'deliver',),
 		( 'deliver',),
-		'cR'
+		'C'
 	),
 	('resp.status',
 		'INT',
 		( 'deliver',),
 		( 'deliver',),
-		'cR'
+		'C'
 	),
 	('resp.response',
 		'STRING',
 		( 'deliver',),
 		( 'deliver',),
-		'cR'
+		'C'
 	),
 	('resp.http.',
 		'HEADER',
@@ -774,7 +774,7 @@ struct worker;
 
 typedef int vcl_init_f(struct cli *);
 typedef void vcl_fini_f(struct cli *);
-typedef int vcl_func_f(const struct vrt_ctx *ctx, struct worker *, struct req *, struct busyobj *);
+typedef int vcl_func_f(const struct vrt_ctx *ctx, struct worker *, struct req *);
 """)
 
 
@@ -885,15 +885,11 @@ def mk_proto(c, r=False):
 		elif i == "c":
 			pass
 		elif i == "C":
-			s += "const struct vrt_ctx *"
+			s += " const struct vrt_ctx *"
 		elif i == "R":
 			if r:
 				s += " const"
 			s += " struct req *"
-		elif i == "B":
-			if r:
-				s += " const"
-			s += " struct busyobj *"
 		else:
 			print("Unknown args-spec char '%s'" % i)
 			exit(1)
@@ -909,8 +905,8 @@ def mk_args(c, r=False):
 			continue;
 		elif i == "R":
 			s += "req"
-		elif i == "B":
-			s += "bo"
+		elif i == "C":
+			s += "ctx"
 		else:
 			print("Unknown args-spec char '%s'" % i)
 			exit(1)



More information about the varnish-commit mailing list