[master] c3909ca Export the VCL labels to the VCC
Poul-Henning Kamp
phk at FreeBSD.org
Tue Aug 16 11:20:15 CEST 2016
commit c3909ca6f76244b122c95fe626dd3424d8d21b3e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Aug 16 06:57:25 2016 +0000
Export the VCL labels to the VCC
diff --git a/bin/varnishd/mgt/mgt.h b/bin/varnishd/mgt/mgt.h
index 929e130..29ada85 100644
--- a/bin/varnishd/mgt/mgt.h
+++ b/bin/varnishd/mgt/mgt.h
@@ -35,6 +35,7 @@
struct cli;
struct parspec;
+struct vcc;
extern struct vev_base *mgt_evb;
extern unsigned d_flag;
@@ -176,6 +177,7 @@ void mgt_vcl_init(void);
void mgt_vcc_startup(struct cli *, const char *b_arg, const char *f_arg,
const char *vclsrc, int Cflag);
int mgt_push_vcls_and_start(struct cli *, unsigned *status, char **p);
+void mgt_vcl_export_labels(struct vcc *);
int mgt_has_vcl(void);
extern char *mgt_cc_cmd;
extern const char *mgt_vcl_path;
diff --git a/bin/varnishd/mgt/mgt_vcc.c b/bin/varnishd/mgt/mgt_vcc.c
index 22a8842..36dbbd4 100644
--- a/bin/varnishd/mgt/mgt_vcc.c
+++ b/bin/varnishd/mgt/mgt_vcc.c
@@ -105,6 +105,7 @@ run_vcc(void *priv)
VCC_Unsafe_Path(vcc, mgt_vcc_unsafe_path);
VTAILQ_FOREACH(stv, &stv_stevedores, list)
VCC_Predef(vcc, "VCL_STEVEDORE", stv->ident);
+ mgt_vcl_export_labels(vcc);
VCC_Predef(vcc, "VCL_STEVEDORE", stv_transient->ident);
csrc = VCC_Compile(vcc, &sb, vp->vclsrc, vp->vclsrcfile);
AZ(VSB_finish(sb));
diff --git a/bin/varnishd/mgt/mgt_vcl.c b/bin/varnishd/mgt/mgt_vcl.c
index df11959..245fa54 100644
--- a/bin/varnishd/mgt/mgt_vcl.c
+++ b/bin/varnishd/mgt/mgt_vcl.c
@@ -40,6 +40,7 @@
#include "mgt/mgt.h"
+#include "libvcc.h"
#include "vcli_serve.h"
#include "vev.h"
#include "vtim.h"
@@ -306,6 +307,16 @@ mgt_vcc_startup(struct cli *cli, const char *b_arg, const char *f_arg,
/*--------------------------------------------------------------------*/
+void
+mgt_vcl_export_labels(struct vcc *vcc)
+{
+ struct vclprog *vp;
+ VTAILQ_FOREACH(vp, &vclhead, list)
+ VCC_Predef(vcc, "VCL_VCL", vp->name);
+}
+
+/*--------------------------------------------------------------------*/
+
int
mgt_push_vcls_and_start(struct cli *cli, unsigned *status, char **p)
{
diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c
index 8c3bf24..574d844 100644
--- a/lib/libvcc/vcc_compile.c
+++ b/lib/libvcc/vcc_compile.c
@@ -814,6 +814,10 @@ VCC_Unsafe_Path(struct vcc *vcc, unsigned u)
void
VCC_Predef(struct vcc *vcc, const char *type, const char *name)
{
- AZ(strcmp(type, "VCL_STEVEDORE"));
- vcc_stevedore(vcc, name);
+ if (!strcmp(type, "VCL_STEVEDORE"))
+ vcc_stevedore(vcc, name);
+ else if (!strcmp(type, "VCL_VCL"))
+ return;
+ else
+ WRONG("Unknown VCC predef type");
}
More information about the varnish-commit
mailing list