[master] d00ca93 Put the loaded VCL name into the childs VCL_conf structure
Poul-Henning Kamp
phk at FreeBSD.org
Mon Mar 2 11:51:59 CET 2015
commit d00ca93a73904dda55637e7fac286ecb80c23628
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Mar 2 09:53:41 2015 +0000
Put the loaded VCL name into the childs VCL_conf structure
diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index 2522b81..cee97e8 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -47,7 +47,6 @@ struct vcls {
unsigned magic;
#define VVCLS_MAGIC 0x214188f2
VTAILQ_ENTRY(vcls) list;
- char *name;
void *dlh;
struct VCL_conf conf[1];
};
@@ -162,7 +161,7 @@ vcl_find(const char *name)
VTAILQ_FOREACH(vcl, &vcl_head, list) {
if (vcl->conf->discard)
continue;
- if (!strcmp(vcl->name, name))
+ if (!strcmp(vcl->conf->loaded_name, name))
return (vcl);
}
return (NULL);
@@ -202,6 +201,8 @@ VCL_Load(const char *fn, const char *name, struct cli *cli)
return (1);
}
memcpy(vcl->conf, cnf, sizeof *cnf);
+ vcl->conf->loaded_name = strdup(name);
+ XXXAN(vcl->conf->loaded_name);
if (vcl->conf->magic != VCL_CONF_MAGIC) {
VCLI_Out(cli, "Wrong VCL_CONF_MAGIC\n");
@@ -233,7 +234,6 @@ VCL_Load(const char *fn, const char *name, struct cli *cli)
return (1);
}
assert(hand == VCL_RET_OK);
- REPLACE(vcl->name, name);
VCLI_Out(cli, "Loaded \"%s\" as \"%s\"", fn , name);
VTAILQ_INSERT_TAIL(&vcl_head, vcl, list);
Lck_Lock(&vcl_mtx);
@@ -267,7 +267,7 @@ VCL_Nuke(struct vcls *vcl)
(void)vcl->conf->fini_func(&ctx);
assert(hand == VCL_RET_OK);
AZ(vcl->conf->event_vcl(&ctx, VCL_EVENT_FINI));
- free(vcl->name);
+ free(vcl->conf->loaded_name);
(void)dlclose(vcl->dlh);
FREE_OBJ(vcl);
VSC_C_main->n_vcl--;
@@ -308,7 +308,7 @@ ccf_config_list(struct cli *cli, const char * const *av, void *priv)
VCLI_Out(cli, "%-10s %6u %s\n",
flg,
vcl->conf->busy,
- vcl->name);
+ vcl->conf->loaded_name);
}
}
diff --git a/lib/libvcc/generate.py b/lib/libvcc/generate.py
index aafcfc0..438f9ad 100755
--- a/lib/libvcc/generate.py
+++ b/lib/libvcc/generate.py
@@ -988,6 +988,8 @@ struct VCL_conf {
unsigned magic;
#define VCL_CONF_MAGIC 0x7406c509 /* from /dev/random */
+ char *loaded_name;
+
struct director **director;
unsigned ndirector;
struct vrt_ref *ref;
More information about the varnish-commit
mailing list