[master] 8afbf7f63 tabularize bereq flags (only bereq.is_bgfetch for now)

Nils Goroll nils.goroll at uplex.de
Thu Nov 12 16:31:11 UTC 2020


commit 8afbf7f6310662b73ca88505ea41cd2ecad74bd2
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Nov 12 17:17:53 2020 +0100

    tabularize bereq flags (only bereq.is_bgfetch for now)

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index b8dbd1303..e4c77ee07 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -399,7 +399,7 @@ struct busyobj {
 
 	struct pool_task	fetch_task[1];
 
-#define BO_FLAG(l, r, w, f, d) unsigned	l:1;
+#define BO_FLAG(l, r, rr, rw, f, d) unsigned	l:1;
 #include "tbl/bo_flags.h"
 
 	/* Timeouts */
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index c0443ebed..409f536d5 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -390,7 +390,7 @@ pan_busyobj(struct vsb *vsb, const struct busyobj *bo)
 	VSB_cat(vsb, "flags = {");
 	p = "";
 /*lint -save -esym(438,p) -e539 */
-#define BO_FLAG(l, r, w, f, d)					\
+#define BO_FLAG(l, r, rr, rw, f, d)				\
 	if (bo->l) { VSB_printf(vsb, "%s" #l, p); p = ", "; }
 #include "tbl/bo_flags.h"
 /*lint -restore */
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index b9165d96b..4a1e50860 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -230,9 +230,20 @@ VRT_r_beresp_##field(VRT_CTX)						\
 	return (ctx->bo->field);					\
 }
 
-#define BO_FLAG(l, r, w, f, d)			\
-	VBERESPR##r(l, #l, f)			\
-	VBERESPW##w(l, #l, f)
+#define VBEREQR0(field, str, fltchk)
+#define VBEREQR1(field, str, fltchk)					\
+VCL_BOOL								\
+VRT_r_bereq_##field(VRT_CTX)						\
+{									\
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);				\
+	CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);			\
+	return (ctx->bo->field);					\
+}
+
+#define BO_FLAG(l, r, rr, rw, f, d)		\
+	VBEREQR##r(l, #l, f)			\
+	VBERESPR##rr(l, #l, f)			\
+	VBERESPW##rw(l, #l, f)
 #include "tbl/bo_flags.h"
 
 #undef VBERESPWF0
@@ -246,14 +257,6 @@ VRT_r_beresp_##field(VRT_CTX)						\
 #undef VBERESPR1
 /*--------------------------------------------------------------------*/
 
-VCL_BOOL
-VRT_r_bereq_is_bgfetch(VRT_CTX)
-{
-	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
-	CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
-	return (ctx->bo->is_bgfetch);
-}
-
 VCL_BOOL
 VRT_r_bereq_uncacheable(VRT_CTX)
 {
diff --git a/include/tbl/bo_flags.h b/include/tbl/bo_flags.h
index 9d26d6a97..e96e21a86 100644
--- a/include/tbl/bo_flags.h
+++ b/include/tbl/bo_flags.h
@@ -34,15 +34,15 @@
 /*
  * filters: whether this flag determines beresp.filters default
  *
- * lower, vcl_r, vcl_w, filters, doc */
-BO_FLAG(do_esi,		1, 1, 1, "")
-BO_FLAG(do_gzip,	1, 1, 1, "")
-BO_FLAG(do_gunzip,	1, 1, 1, "")
-BO_FLAG(do_stream,	1, 1, 0, "")
-BO_FLAG(do_pass,	0, 0, 0, "")
-BO_FLAG(uncacheable,	0, 0, 0, "")
-BO_FLAG(was_304,	1, 0, 0, "")
-BO_FLAG(is_bgfetch,	0, 0, 0, "")
+ * lower, vcl_r, vcl_beresp_r, vcl_beresp_w, filters, doc */
+BO_FLAG(do_esi,		0, 1, 1, 1, "")
+BO_FLAG(do_gzip,	0, 1, 1, 1, "")
+BO_FLAG(do_gunzip,	0, 1, 1, 1, "")
+BO_FLAG(do_stream,	0, 1, 1, 0, "")
+BO_FLAG(do_pass,	0, 0, 0, 0, "")
+BO_FLAG(uncacheable,	0, 0, 0, 0, "")
+BO_FLAG(was_304,	0, 1, 0, 0, "")
+BO_FLAG(is_bgfetch,	1, 0, 0, 0, "")
 #undef BO_FLAG
 
 /*lint -restore */


More information about the varnish-commit mailing list