[master] f47db4177 Formalize flags which exist for req and bereq
Nils Goroll
nils.goroll at uplex.de
Mon Aug 29 16:40:07 UTC 2022
commit f47db4177de6f2e89e50ee87561a54297f64b190
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Mon Aug 29 18:33:32 2022 +0200
Formalize flags which exist for req and bereq
Motivated by and in preparation of #3826
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 251f1676a..b9be6f4a1 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -1144,8 +1144,8 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
WRONG("Wrong fetch mode");
}
- bo->is_hitpass = req->is_hitpass;
- bo->is_hitmiss = req->is_hitmiss;
+#define REQ_BEREQ_FLAG(l, r, w, d) bo->l = req->l;
+#include "tbl/req_bereq_flags.h"
VSLb(bo->vsl, SLT_Begin, "bereq %u %s", VXID(req->vsl->wid), how);
VSLbs(bo->vsl, SLT_VCL_use, TOSTRAND(VCL_Name(bo->vcl)));
diff --git a/include/Makefile.am b/include/Makefile.am
index 81d05d96e..76574fb20 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -27,6 +27,7 @@ nobase_pkginclude_HEADERS = \
tbl/oc_exp_flags.h \
tbl/oc_flags.h \
tbl/params.h \
+ tbl/req_bereq_flags.h \
tbl/req_flags.h \
tbl/sess_attr.h \
tbl/sess_close.h \
diff --git a/include/tbl/bereq_flags.h b/include/tbl/bereq_flags.h
index c7831fec4..31660035c 100644
--- a/include/tbl/bereq_flags.h
+++ b/include/tbl/bereq_flags.h
@@ -34,8 +34,9 @@
/* lower, vcl_r, vcl_w, doc */
BEREQ_FLAG(uncacheable, 0, 0, "") // also beresp
BEREQ_FLAG(is_bgfetch, 1, 0, "")
-BEREQ_FLAG(is_hitmiss, 1, 0, "")
-BEREQ_FLAG(is_hitpass, 1, 0, "")
+#define REQ_BEREQ_FLAG(lower, vcl_r, vcl_w, doc) \
+ BEREQ_FLAG(lower, vcl_r, vcl_w, doc)
+#include "tbl/req_bereq_flags.h"
#undef BEREQ_FLAG
/*lint -restore */
diff --git a/include/tbl/req_bereq_flags.h b/include/tbl/req_bereq_flags.h
new file mode 100644
index 000000000..36f868d2a
--- /dev/null
+++ b/include/tbl/req_bereq_flags.h
@@ -0,0 +1,39 @@
+/*-
+ * Copyright (c) 2015 Varnish Software AS
+ * All rights reserved.
+ *
+ * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/*lint -save -e525 -e539 */
+
+/* lower, vcl_r, vcl_w, doc */
+REQ_BEREQ_FLAG(is_hitmiss, 1, 0, "")
+REQ_BEREQ_FLAG(is_hitpass, 1, 0, "")
+#undef REQ_BEREQ_FLAG
+
+/*lint -restore */
diff --git a/include/tbl/req_flags.h b/include/tbl/req_flags.h
index 0c49540db..88eaff639 100644
--- a/include/tbl/req_flags.h
+++ b/include/tbl/req_flags.h
@@ -37,11 +37,12 @@ REQ_FLAG(hash_ignore_busy, 1, 1, "")
REQ_FLAG(hash_ignore_vary, 1, 1, "")
REQ_FLAG(hash_always_miss, 1, 1, "")
REQ_FLAG(is_hit, 0, 0, "")
-REQ_FLAG(is_hitmiss, 1, 0, "")
-REQ_FLAG(is_hitpass, 1, 0, "")
REQ_FLAG(waitinglist, 0, 0, "")
REQ_FLAG(want100cont, 0, 0, "")
REQ_FLAG(late100cont, 0, 0, "")
+#define REQ_BEREQ_FLAG(lower, vcl_r, vcl_w, doc) \
+ REQ_FLAG(lower, vcl_r, vcl_w, doc)
+#include "tbl/req_bereq_flags.h"
#undef REQ_FLAG
/*lint -restore */
More information about the varnish-commit
mailing list