[master] 3c22a6162 Prefix VSM lines which add segments with a '+'

Poul-Henning Kamp phk at FreeBSD.org
Thu Aug 1 07:40:10 UTC 2019


commit 3c22a61625b5eda186aa8c90178c086e8b003f55
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Jul 31 19:55:42 2019 +0000

    Prefix VSM lines which add segments with a '+'

diff --git a/bin/varnishd/common/common_vsmw.c b/bin/varnishd/common/common_vsmw.c
index 498045d4e..8e22756f0 100644
--- a/bin/varnishd/common/common_vsmw.c
+++ b/bin/varnishd/common/common_vsmw.c
@@ -132,7 +132,7 @@ vsmw_fmt_index(const struct vsmw *vsmw, const struct vsmwseg *seg)
 
 	CHECK_OBJ_NOTNULL(vsmw, VSMW_MAGIC);
 	CHECK_OBJ_NOTNULL(seg, VSMWSEG_MAGIC);
-	VSB_printf(vsmw->vsb, "%s %zu %zu %s %s\n",
+	VSB_printf(vsmw->vsb, "+ %s %zu %zu %s %s\n",
 	    seg->cluster->fn,
 	    seg->off,
 	    seg->len,
diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c
index 364ad3aee..51f9ccdf1 100644
--- a/lib/libvarnishapi/vsm.c
+++ b/lib/libvarnishapi/vsm.c
@@ -459,7 +459,7 @@ vsm_vlu_plus(struct vsm *vd, struct vsm_set *vs, const char *line)
 	int ac;
 	struct vsm_seg *vg2;
 
-	av = VAV_Parse(line, &ac, 0);
+	av = VAV_Parse(line + 1, &ac, 0);
 
 	if (av[0] != NULL || ac < 4 || ac > 6) {
 		(void)(vsm_diag(vd,
@@ -508,14 +508,19 @@ vsm_vlu_func(void *priv, const char *line)
 	CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
 	AN(line);
 
-	if (line[0] == '#') {
+	switch (line[0]) {
+	case '#':
 		i = vsm_vlu_hash(vd, vs, line);
 		VTAILQ_FOREACH(vs->vg, &vs->segs, list)
 			vs->vg->flags &= ~VSM_FLAG_MARKSCAN;
 		if (!(vs->retval & VSM_MGT_RESTARTED))
 			vs->vg = VTAILQ_FIRST(&vs->segs);
-	} else {
+		break;
+	case '+':
 		i = vsm_vlu_plus(vd, vs, line);
+		break;
+	default:
+		break;
 	}
 	return (i);
 }


More information about the varnish-commit mailing list