[master] c1caa6650 Add NO_VXID macro replace all trivial 0s

Poul-Henning Kamp phk at FreeBSD.org
Mon Oct 10 09:40:07 UTC 2022


commit c1caa665098a8ef6b97d5184c6bee9cbba689266
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Oct 10 08:49:54 2022 +0000

    Add NO_VXID macro replace all trivial 0s

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 5c690df8f..450772696 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -690,6 +690,7 @@ extern const char H__Reason[];
 #define http_range_at(str, tok, l)	http_tok_at(str, #tok, l)
 
 /* cache_main.c */
+#define NO_VXID (0U)
 #define VXID(u) ((u) & VSL_IDENTMASK)
 uint32_t VXID_Get(const struct worker *, uint32_t marker);
 extern pthread_key_t witness_key;
diff --git a/bin/varnishd/cache/cache_backend_probe.c b/bin/varnishd/cache/cache_backend_probe.c
index 97e652702..594dc7627 100644
--- a/bin/varnishd/cache/cache_backend_probe.c
+++ b/bin/varnishd/cache/cache_backend_probe.c
@@ -179,7 +179,8 @@ VBP_Update_Backend(struct vbp_target *vt)
 	vt->backend->sick = i;
 
 	AN(vt->backend->vcl_name);
-	VSL(SLT_Backend_health, 0, "%s %s %s %s %u %u %u %.6f %.6f \"%s\"",
+	VSL(SLT_Backend_health, NO_VXID,
+	    "%s %s %s %s %u %u %u %.6f %.6f \"%s\"",
 	    vt->backend->vcl_name, chg ? "Went" : "Still",
 	    i ? "sick" : "healthy", bits,
 	    vt->good, vt->threshold, vt->window,
diff --git a/bin/varnishd/cache/cache_cli.c b/bin/varnishd/cache/cache_cli.c
index b261d6bcb..e5006f8de 100644
--- a/bin/varnishd/cache/cache_cli.c
+++ b/bin/varnishd/cache/cache_cli.c
@@ -75,7 +75,7 @@ cli_cb_before(const struct cli *cli)
 {
 
 	ASSERT_CLI();
-	VSL(SLT_CLI, 0, "Rd %s", VSB_data(cli->cmd));
+	VSL(SLT_CLI, NO_VXID, "Rd %s", VSB_data(cli->cmd));
 	VCL_Poll();
 	Lck_Lock(&cli_mtx);
 }
@@ -86,7 +86,7 @@ cli_cb_after(const struct cli *cli)
 
 	ASSERT_CLI();
 	Lck_Unlock(&cli_mtx);
-	VSL(SLT_CLI, 0, "Wr %03u %zd %s",
+	VSL(SLT_CLI, NO_VXID, "Wr %03u %zd %s",
 	    cli->result, VSB_len(cli->sb), VSB_data(cli->sb));
 }
 
@@ -109,7 +109,7 @@ CLI_Run(void)
 	do {
 		i = VCLS_Poll(cache_cls, cli, -1);
 	} while (i == 0);
-	VSL(SLT_CLI, 0, "EOF on CLI connection, worker stops");
+	VSL(SLT_CLI, NO_VXID, "EOF on CLI connection, worker stops");
 }
 
 /*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index 5aa84a117..21a40a05f 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -241,7 +241,7 @@ EXP_Rearm(struct objcore *oc, vtim_real now,
 
 	when = EXP_WHEN(oc);
 
-	VSL(SLT_ExpKill, 0, "EXP_Rearm p=%p E=%.6f e=%.6f f=0x%x", oc,
+	VSL(SLT_ExpKill, NO_VXID, "EXP_Rearm p=%p E=%.6f e=%.6f f=0x%x", oc,
 	    oc->timer_when, when, oc->flags);
 
 	if (when < oc->t_origin || when < oc->timer_when) {
diff --git a/bin/varnishd/cache/cache_lck.c b/bin/varnishd/cache/cache_lck.c
index 6615897eb..46a1f100c 100644
--- a/bin/varnishd/cache/cache_lck.c
+++ b/bin/varnishd/cache/cache_lck.c
@@ -81,7 +81,7 @@ Lck_Witness_Lock(const struct ilck *il, const char *p, int l, const char *try)
 	bprintf(t, "%d", l);
 	strcat(q, t);
 	if (emit)
-		VSL(SLT_Witness, 0, "%s", q);
+		VSL(SLT_Witness, NO_VXID, "%s", q);
 }
 
 static void
@@ -98,7 +98,7 @@ Lck_Witness_Unlock(const struct ilck *il)
 	else
 		*r++ = '\0';
 	if (memcmp(r, il->w, strlen(il->w)))
-		VSL(SLT_Witness, 0, "Unlock %s @ %s <%s>", il->w, r, q);
+		VSL(SLT_Witness, NO_VXID, "Unlock %s @ %s <%s>", il->w, r, q);
 	else
 		*r = '\0';
 }
diff --git a/bin/varnishd/cache/cache_pool.c b/bin/varnishd/cache/cache_pool.c
index a71e0a770..5740c4eb6 100644
--- a/bin/varnishd/cache/cache_pool.c
+++ b/bin/varnishd/cache/cache_pool.c
@@ -207,7 +207,7 @@ pool_poolherder(void *priv)
 				nwq--;
 			Lck_Unlock(&pool_mtx);
 			if (!pp->die) {
-				VSL(SLT_Debug, 0, "XXX Kill Pool %p", pp);
+				VSL(SLT_Debug, NO_VXID, "XXX Kill Pool %p", pp);
 				pp->die = 1;
 				VCA_DestroyPool(pp);
 				AZ(pthread_cond_signal(&pp->herder_cond));
diff --git a/bin/varnishd/cache/cache_vpi.c b/bin/varnishd/cache/cache_vpi.c
index 3b21037fb..0d8e792bf 100644
--- a/bin/varnishd/cache/cache_vpi.c
+++ b/bin/varnishd/cache/cache_vpi.c
@@ -75,7 +75,7 @@ VPI_count(VRT_CTX, unsigned u)
 		    ctx->vcl->loaded_name, u, ctx->vcl->conf->ref[u].source,
 		    ctx->vcl->conf->ref[u].line, ctx->vcl->conf->ref[u].pos);
 	else
-		VSL(SLT_VCL_trace, 0, "%s %u %u.%u.%u",
+		VSL(SLT_VCL_trace, NO_VXID, "%s %u %u.%u.%u",
 		    ctx->vcl->loaded_name, u, ctx->vcl->conf->ref[u].source,
 		    ctx->vcl->conf->ref[u].line, ctx->vcl->conf->ref[u].pos);
 }
diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index f6c427ad1..3b9350f6d 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -125,7 +125,7 @@ VPI_acl_log(VRT_CTX, const char *msg)
 	if (ctx->vsl != NULL)
 		VSLbs(ctx->vsl, SLT_VCL_acl, TOSTRAND(msg));
 	else
-		VSL(SLT_VCL_acl, 0, "%s", msg);
+		VSL(SLT_VCL_acl, NO_VXID, "%s", msg);
 }
 
 int
diff --git a/bin/varnishd/cache/cache_wrk.c b/bin/varnishd/cache/cache_wrk.c
index b008f95ae..7c2bd8036 100644
--- a/bin/varnishd/cache/cache_wrk.c
+++ b/bin/varnishd/cache/cache_wrk.c
@@ -152,12 +152,12 @@ WRK_Thread(struct pool *qp, size_t stacksize, unsigned thread_workspace)
 	VPI_wrk_init(w, vpi, sizeof vpi);
 	AN(w->vpi);
 
-	VSL(SLT_WorkThread, 0, "%p start", w);
+	VSL(SLT_WorkThread, NO_VXID, "%p start", w);
 
 	Pool_Work_Thread(qp, w);
 	AZ(w->pool);
 
-	VSL(SLT_WorkThread, 0, "%p end", w);
+	VSL(SLT_WorkThread, NO_VXID, "%p end", w);
 	if (w->wpriv->vcl != NULL)
 		VCL_Rel(&w->wpriv->vcl);
 	AZ(pthread_cond_destroy(&w->cond));
@@ -313,7 +313,7 @@ Pool_Task(struct pool *pp, struct pool_task *task, enum task_prio prio)
 		retval = reqpoolfail & 1;
 		reqpoolfail >>= 1;
 		if (retval) {
-			VSL(SLT_Debug, 0,
+			VSL(SLT_Debug, NO_VXID,
 			    "Failing due to reqpoolfail (next= 0x%jx)",
 			    reqpoolfail);
 			return (retval);
@@ -549,7 +549,7 @@ pool_breed(struct pool *qp)
 	errno = pthread_create(&tp, &tp_attr, pool_thread, pi);
 	if (errno) {
 		FREE_OBJ(pi);
-		VSL(SLT_Debug, 0, "Create worker thread failed %d %s",
+		VSL(SLT_Debug, NO_VXID, "Create worker thread failed %d %s",
 		    errno, VAS_errtxt(errno));
 		Lck_Lock(&pool_mtx);
 		VSC_C_main->threads_failed++;
@@ -626,7 +626,7 @@ pool_herder(void *priv)
 			dq = pp->ndequeued;
 			dqt = VTIM_mono();
 		} else if (VTIM_mono() - dqt > cache_param->wthread_watchdog) {
-			VSL(SLT_Error, 0,
+			VSL(SLT_Error, NO_VXID,
 			    "Pool Herder: Queue does not move ql=%u dt=%f",
 			    pp->lqueue, VTIM_mono() - dqt);
 			WRONG("Worker Pool Queue does not move");
@@ -756,7 +756,7 @@ WRK_Log(enum VSL_tag_e tag, const char *fmt, ...)
 	if (wrk != NULL && wrk->vsl != NULL)
 		VSLbv(wrk->vsl, tag, fmt, ap);
 	else
-		VSLv(tag, 0, fmt, ap);
+		VSLv(tag, NO_VXID, fmt, ap);
 	va_end(ap);
 }
 
diff --git a/bin/varnishd/proxy/cache_proxy_proto.c b/bin/varnishd/proxy/cache_proxy_proto.c
index 036a314e7..b36ae0f6b 100644
--- a/bin/varnishd/proxy/cache_proxy_proto.c
+++ b/bin/varnishd/proxy/cache_proxy_proto.c
@@ -765,7 +765,7 @@ VPX_Send_Proxy(int fd, int version, const struct sess *sp)
 	VSB_quote(vsb2, VSB_data(vsb), VSB_len(vsb),
 	    version == 2 ? VSB_QUOTE_HEX : 0);
 	AZ(VSB_finish(vsb2));
-	VSL(SLT_Debug, 0, "PROXY_HDR %s", VSB_data(vsb2));
+	VSL(SLT_Debug, NO_VXID, "PROXY_HDR %s", VSB_data(vsb2));
 	VSB_destroy(&vsb2);
 	VSB_fini(vsb);
 	return (r);
diff --git a/bin/varnishd/waiter/cache_waiter_poll.c b/bin/varnishd/waiter/cache_waiter_poll.c
index c3a7f9b78..545914814 100644
--- a/bin/varnishd/waiter/cache_waiter_poll.c
+++ b/bin/varnishd/waiter/cache_waiter_poll.c
@@ -75,7 +75,7 @@ vwp_extend_pollspace(struct vwp *vwp)
 	else
 		inc = (1<<16);
 
-	VSL(SLT_Debug, 0, "Acceptor poll space increased by %zu to %zu",
+	VSL(SLT_Debug, NO_VXID, "Acceptor poll space increased by %zu to %zu",
 	    inc, vwp->npoll + inc);
 
 	vwp->pollfd = realloc(vwp->pollfd,
diff --git a/vmod/vmod_debug.c b/vmod/vmod_debug.c
index 414b58667..f1e2d35cd 100644
--- a/vmod/vmod_debug.c
+++ b/vmod/vmod_debug.c
@@ -386,7 +386,7 @@ obj_cb(struct worker *wrk, void *priv, struct objcore *oc, unsigned event)
 	}
 
 	/* We cannot trust %p to be 0x... format as expected by m00021.vtc */
-	VSL(SLT_Debug, 0, "Object Event: %s 0x%jx", what,
+	VSL(SLT_Debug, NO_VXID, "Object Event: %s 0x%jx", what,
 	    (intmax_t)(uintptr_t)oc);
 }
 
@@ -400,7 +400,7 @@ xyzzy_register_obj_events(VRT_CTX, struct vmod_priv *priv)
 	AZ(priv_vcl->obj_cb);
 	priv_vcl->obj_cb = ObjSubscribeEvents(obj_cb, priv_vcl,
 		OEV_INSERT|OEV_EXPIRE);
-	VSL(SLT_Debug, 0, "Subscribed to Object Events");
+	VSL(SLT_Debug, NO_VXID, "Subscribed to Object Events");
 }
 
 VCL_VOID v_matchproto_(td_debug_fail)
@@ -529,7 +529,7 @@ event_warm(VRT_CTX, const struct vmod_priv *priv)
 	const char *vcl_name = VCL_Name(ctx->vcl);
 
 	// Using VSLs for coverage
-	VSLs(SLT_Debug, 0, TOSTRANDS(2, vcl_name, ": VCL_EVENT_WARM"));
+	VSLs(SLT_Debug, NO_VXID, TOSTRANDS(2, vcl_name, ": VCL_EVENT_WARM"));
 
 	AN(ctx->msg);
 	if (cache_param->max_esi_depth == 42) {
@@ -590,7 +590,7 @@ event_cold(VRT_CTX, const struct vmod_priv *priv)
 
 	CAST_OBJ_NOTNULL(priv_vcl, priv->priv, PRIV_VCL_MAGIC);
 
-	VSL(SLT_Debug, 0, "%s: VCL_EVENT_COLD", VCL_Name(ctx->vcl));
+	VSL(SLT_Debug, NO_VXID, "%s: VCL_EVENT_COLD", VCL_Name(ctx->vcl));
 
 	VRT_DelDirector(&priv_vcl->be);
 
@@ -833,7 +833,7 @@ mylog(struct vsl_log *vsl, enum VSL_tag_e tag,  const char *fmt, ...)
 	if (vsl != NULL)
 		VSLbv(vsl, tag, fmt, ap);
 	else
-		VSLv(tag, 0, fmt, ap);
+		VSLv(tag, NO_VXID, fmt, ap);
 	va_end(ap);
 }
 
diff --git a/vmod/vmod_directors_shard_dir.c b/vmod/vmod_directors_shard_dir.c
index 9b82722d1..f587cd19c 100644
--- a/vmod/vmod_directors_shard_dir.c
+++ b/vmod/vmod_directors_shard_dir.c
@@ -86,7 +86,7 @@ sharddir_log(struct vsl_log *vsl, enum VSL_tag_e tag,  const char *fmt, ...)
 	if (vsl != NULL)
 		VSLbv(vsl, tag, fmt, ap);
 	else
-		VSLv(tag, 0, fmt, ap);
+		VSLv(tag, NO_VXID, fmt, ap);
 	va_end(ap);
 }
 
diff --git a/vmod/vmod_directors_shard_dir.h b/vmod/vmod_directors_shard_dir.h
index 47a66b92a..d3cc52998 100644
--- a/vmod/vmod_directors_shard_dir.h
+++ b/vmod/vmod_directors_shard_dir.h
@@ -89,7 +89,7 @@ sharddir_backend(const struct sharddir *shardd, unsigned id)
 #define SHDBG(flag, shardd, ...)					\
 	do {								\
 		if ((shardd)->debug_flags & (flag))			\
-			VSL(SLT_Debug, 0, "vmod_directors: shard: "	\
+			VSL(SLT_Debug, NO_VXID, "vmod_directors: shard: " \
 			    __VA_ARGS__);				\
 	} while (0)
 
diff --git a/vmod/vmod_std.c b/vmod/vmod_std.c
index 78a288d57..14932b0ef 100644
--- a/vmod/vmod_std.c
+++ b/vmod/vmod_std.c
@@ -149,7 +149,7 @@ vmod_log(VRT_CTX, VCL_STRANDS s)
 	if (ctx->vsl != NULL)
 		VSLbs(ctx->vsl, SLT_VCL_Log, s);
 	else
-		VSLs(SLT_VCL_Log, 0, s);
+		VSLs(SLT_VCL_Log, NO_VXID, s);
 }
 
 /* XXX use vsyslog() ? */


More information about the varnish-commit mailing list