[master] a29d1e8c0 Shuffle things around

Poul-Henning Kamp phk at FreeBSD.org
Wed May 29 09:54:10 UTC 2019


commit a29d1e8c0ced3b9c714e648d82cd1e404f039268
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue May 28 11:40:18 2019 +0000

    Shuffle things around

diff --git a/bin/varnishd/cache/cache_vpi.c b/bin/varnishd/cache/cache_vpi.c
index ec35ad2c7..17ac4d1dc 100644
--- a/bin/varnishd/cache/cache_vpi.c
+++ b/bin/varnishd/cache/cache_vpi.c
@@ -92,7 +92,7 @@ VPI_vcl_select(VRT_CTX, VCL_VCL vcl)
 	CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC);
 
 	if (IS_TOPREQ(req) && req->vcl0 != NULL)
-		return;		// Illega, req-FSM will fail this later.
+		return;		// Illegal, req-FSM will fail this later.
 
 	VCL_TaskLeave(req->vcl, req->privs);
 	if (IS_TOPREQ(req)) {
diff --git a/bin/varnishd/mgt/mgt_symtab.c b/bin/varnishd/mgt/mgt_symtab.c
index e54274c8c..be80ec593 100644
--- a/bin/varnishd/mgt/mgt_symtab.c
+++ b/bin/varnishd/mgt/mgt_symtab.c
@@ -194,18 +194,6 @@ mgt_vcl_symtab_clean(struct vclprog *vp)
 
 /*--------------------------------------------------------------------*/
 
-void
-mgt_vcl_export_labels(struct vcc *vcc)
-{
-	struct vclprog *vp;
-	VTAILQ_FOREACH(vp, &vclhead, list) {
-		if (mcf_is_label(vp))
-			VCC_Predef(vcc, "VCL_VCL", vp->name);
-	}
-}
-
-/*--------------------------------------------------------------------*/
-
 static void
 mcf_vcl_vjsn_dump(struct cli *cli, const struct vjsn_val *vj, int indent)
 {
@@ -233,18 +221,29 @@ mcf_vcl_symtab(struct cli *cli, const char * const *av, void *priv)
 	(void)av;
 	(void)priv;
 	VTAILQ_FOREACH(vp, &vclhead, list) {
-		VCLI_Out(cli, "VCL: %s\n", vp->name);
-		VCLI_Out(cli, "  imports from:\n");
-		VTAILQ_FOREACH(vd, &vp->dfrom, lfrom) {
-			VCLI_Out(cli, "    %s\n", vd->to->name);
-			if (vd->vj)
-				mcf_vcl_vjsn_dump(cli, vd->vj, 6);
+		if (mcf_is_label(vp))
+			VCLI_Out(cli, "Label: %s\n", vp->name);
+		else
+			VCLI_Out(cli, "Vcl: %s\n", vp->name);
+		if (!VTAILQ_EMPTY(&vp->dfrom)) {
+			VCLI_Out(cli, "  imports from:\n");
+			VTAILQ_FOREACH(vd, &vp->dfrom, lfrom) {
+				VCLI_Out(cli, "    %s\n", vd->to->name);
+				if (vd->vj)
+					mcf_vcl_vjsn_dump(cli, vd->vj, 6);
+			}
+		}
+		if (!VTAILQ_EMPTY(&vp->dto)) {
+			VCLI_Out(cli, "  exports to:\n");
+			VTAILQ_FOREACH(vd, &vp->dto, lto) {
+				VCLI_Out(cli, "    %s\n", vd->from->name);
+				if (vd->vj)
+					mcf_vcl_vjsn_dump(cli, vd->vj, 6);
+			}
 		}
-		VCLI_Out(cli, "  exports to:\n");
-		VTAILQ_FOREACH(vd, &vp->dto, lto) {
-			VCLI_Out(cli, "    %s\n", vd->from->name);
-			if (vd->vj)
-				mcf_vcl_vjsn_dump(cli, vd->vj, 6);
+		if (vp->symtab != NULL) {
+			VCLI_Out(cli, "  symtab:\n");
+			mcf_vcl_vjsn_dump(cli, vp->symtab->value, 4);
 		}
 	}
 }
diff --git a/bin/varnishd/mgt/mgt_vcc.c b/bin/varnishd/mgt/mgt_vcc.c
index 5316ab299..58b4ec152 100644
--- a/bin/varnishd/mgt/mgt_vcc.c
+++ b/bin/varnishd/mgt/mgt_vcc.c
@@ -88,6 +88,7 @@ static void v_matchproto_(vsub_func_f)
 run_vcc(void *priv)
 {
 	struct vsb *sb = NULL;
+	struct vclprog *vpg;
 	struct vcc_priv *vp;
 	struct vcc *vcc;
 	struct stevedore *stv;
@@ -108,7 +109,9 @@ run_vcc(void *priv)
 	VCC_Unsafe_Path(vcc, mgt_vcc_unsafe_path);
 	STV_Foreach(stv)
 		VCC_Predef(vcc, "VCL_STEVEDORE", stv->ident);
-	mgt_vcl_export_labels(vcc);
+	VTAILQ_FOREACH(vpg, &vclhead, list)
+		if (mcf_is_label(vpg))
+			VCC_Predef(vcc, "VCL_VCL", vpg->name);
 	i = VCC_Compile(vcc, &sb, vp->vclsrc, vp->vclsrcfile,
 	    VGC_SRC, VGC_SYM);
 	if (VSB_len(sb))
diff --git a/bin/varnishd/mgt/mgt_vcl.h b/bin/varnishd/mgt/mgt_vcl.h
index 1c25c656e..e6a32fc8d 100644
--- a/bin/varnishd/mgt/mgt_vcl.h
+++ b/bin/varnishd/mgt/mgt_vcl.h
@@ -83,7 +83,6 @@ struct vcldep *mgt_vcl_dep_add(struct vclprog *vp_from, struct vclprog *vp_to);
 int mcf_is_label(const struct vclprog *vp);
 
 void mgt_vcl_symtab_clean(struct vclprog *vp);
-void mgt_vcl_export_labels(struct vcc *vcc);
 void mgt_vcl_symtab(struct vclprog *vp, const char *input);
 void mcf_vcl_symtab(struct cli *cli, const char * const *av, void *priv);
 


More information about the varnish-commit mailing list