Commit c72cfed7 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make the VCL reference in vrt_ctx point to our internal

housekeeping rather than the compile config structure.
parent 08fe2b87
......@@ -308,9 +308,9 @@ VRT_init_vbe(VRT_CTX, struct director **dp, const struct vrt_backend *vrt)
AN(dp);
AZ(*dp);
CHECK_OBJ_NOTNULL(vrt, VRT_BACKEND_MAGIC);
CHECK_OBJ_NOTNULL(ctx->vcl, VCL_CONF_MAGIC);
AN(ctx->vcl);
be = VBE_AddBackend(ctx->vcl->loaded_name, vrt);
be = VBE_AddBackend(ctx, vrt);
AN(be);
ALLOC_OBJ(d, DIRECTOR_MAGIC);
XXXAN(d);
......
......@@ -39,6 +39,7 @@
struct vbp_target;
struct vbc;
struct vrt_ctx;
struct vrt_backend_probe;
struct tcp_pool;
......@@ -105,7 +106,8 @@ struct vbc {
/* cache_backend_cfg.c */
unsigned VBE_Healthy(const struct backend *b, double *changed);
struct backend *VBE_AddBackend(const char *vcl, const struct vrt_backend *vb);
struct backend *VBE_AddBackend(const struct vrt_ctx *,
const struct vrt_backend *);
void VBE_DeleteBackend(struct backend *);
/* cache_backend_poll.c */
......
......@@ -76,11 +76,13 @@ VBE_DeleteBackend(struct backend *b)
*/
struct backend *
VBE_AddBackend(const char *vcl, const struct vrt_backend *vb)
VBE_AddBackend(const struct vrt_ctx *ctx, const struct vrt_backend *vb)
{
struct backend *b;
char buf[128];
struct vcl *vcl;
vcl = ctx->vcl;
AN(vb->vcl_name);
assert(vb->ipv4_suckaddr != NULL || vb->ipv6_suckaddr != NULL);
......@@ -89,7 +91,7 @@ VBE_AddBackend(const char *vcl, const struct vrt_backend *vb)
XXXAN(b);
Lck_New(&b->mtx, lck_backend);
bprintf(buf, "%s.%s", vcl, vb->vcl_name);
bprintf(buf, "%s.%s", VCL_Name(vcl), vb->vcl_name);
REPLACE(b->display_name, buf);
b->vcl_name = vb->vcl_name;
......
......@@ -262,6 +262,20 @@ VCL_Name(const struct vcl *vcc)
/*--------------------------------------------------------------------*/
void
VRT_count(VRT_CTX, unsigned u)
{
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(ctx->vcl, VCL_MAGIC);
assert(u < ctx->vcl->conf->nref);
if (ctx->vsl != NULL)
VSLb(ctx->vsl, SLT_VCL_trace, "%u %u.%u", u,
ctx->vcl->conf->ref[u].line, ctx->vcl->conf->ref[u].pos);
}
/*--------------------------------------------------------------------*/
static struct vcl *
vcl_find(const char *name)
{
......@@ -332,7 +346,7 @@ VCL_Load(struct cli *cli, const char *name, const char *fn, const char *state)
INIT_OBJ(&ctx, VRT_CTX_MAGIC);
ctx.method = VCL_MET_INIT;
ctx.handling = &hand;
ctx.vcl = vcl->conf;
ctx.vcl = vcl;
VSB_clear(vsb);
ctx.msg = vsb;
......@@ -380,7 +394,7 @@ VCL_Nuke(struct vcl *vcl)
VTAILQ_REMOVE(&vcl_head, vcl, list);
ctx.method = VCL_MET_FINI;
ctx.handling = &hand;
ctx.vcl = vcl->conf;
ctx.vcl = vcl;
AZ(vcl->conf->event_vcl(&ctx, VCL_EVENT_DISCARD));
free(vcl->conf->loaded_name);
VCL_Close(&vcl);
......@@ -569,8 +583,9 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
if (req != NULL) {
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
CHECK_OBJ_NOTNULL(req->sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(req->vcl, VCL_MAGIC);
vsl = req->vsl;
ctx.vcl = req->vcl->conf;
ctx.vcl = req->vcl;
ctx.http_req = req->http;
ctx.http_req_top = req->top->http;
ctx.http_resp = req->resp;
......@@ -580,8 +595,9 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
}
if (bo != NULL) {
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
CHECK_OBJ_NOTNULL(bo->vcl, VCL_MAGIC);
vsl = bo->vsl;
ctx.vcl = bo->vcl->conf;
ctx.vcl = bo->vcl;
ctx.http_bereq = bo->bereq;
ctx.http_beresp = bo->beresp;
ctx.bo = bo;
......
......@@ -64,18 +64,6 @@ VRT_error(VRT_CTX, unsigned code, const char *reason)
/*--------------------------------------------------------------------*/
void
VRT_count(VRT_CTX, unsigned u)
{
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
if (ctx->vsl != NULL)
VSLb(ctx->vsl, SLT_VCL_trace, "%u %u.%u", u,
ctx->vcl->ref[u].line, ctx->vcl->ref[u].pos);
}
/*--------------------------------------------------------------------*/
void
VRT_acl_log(VRT_CTX, const char *msg)
{
......
......@@ -43,7 +43,7 @@ struct vrt_priv {
#define VRT_PRIV_MAGIC 0x24157a52
VTAILQ_ENTRY(vrt_priv) list;
struct vmod_priv priv[1];
const struct VCL_conf *vcl;
const struct vcl *vcl;
uintptr_t id;
uintptr_t vmod_id;
};
......
......@@ -49,16 +49,17 @@
/***********************************************************************/
struct req;
struct VCL_conf;
struct busyobj;
struct vsl_log;
struct http;
struct ws;
struct vsb;
struct director;
struct VCL_conf;
struct http;
struct req;
struct suckaddr;
struct vcl;
struct vmod;
struct vsb;
struct vsl_log;
struct ws;
/***********************************************************************
* This is the central definition of the mapping from VCL types to
......@@ -95,7 +96,7 @@ struct vrt_ctx {
struct vsb *msg; // Only in ...init()
struct vsl_log *vsl;
struct VCL_conf *vcl;
struct vcl *vcl;
struct ws *ws;
struct req *req;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment