From 70deec767a134ca0c6440a365510d8cf557a82a7 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 17 May 2022 16:30:44 +0200 Subject: [PATCH] DEV: coccinelle: add endp_flags.cocci This one turns the various forms of "endp->flags value" to their se_fl_(cs) equivalent. That's basically the same as the previous one except that it acts on the stream endpoint itself instead of the conn_stream. --- dev/coccinelle/endp_flags.cocci | 76 +++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 dev/coccinelle/endp_flags.cocci diff --git a/dev/coccinelle/endp_flags.cocci b/dev/coccinelle/endp_flags.cocci new file mode 100644 index 0000000000000..fceda27024ea9 --- /dev/null +++ b/dev/coccinelle/endp_flags.cocci @@ -0,0 +1,76 @@ +@@ +struct cs_endpoint *endp; +expression e; +@@ +( +- (endp->flags & (e)) ++ se_fl_test(endp, e) +| +- (endp->flags & e) ++ se_fl_test(endp, e) +| +- endp->flags & (e) ++ se_fl_test(endp, e) +| +- endp->flags & e ++ se_fl_test(endp, e) +) + +@@ +struct cs_endpoint *endp; +expression e; +@@ +( +- endp->flags |= (e) ++ se_fl_set(endp, e) +| +- endp->flags |= e ++ se_fl_set(endp, e) +) + +@@ +struct cs_endpoint *endp; +expression e; +@@ +( +- endp->flags &= ~(e) ++ se_fl_clr(endp, e) +| +- endp->flags &= (e) ++ se_fl_clr(endp, ~e) +| +- endp->flags &= ~e ++ se_fl_clr(endp, e) +| +- endp->flags &= e ++ se_fl_clr(endp, ~e) +) + +@@ +struct cs_endpoint *endp; +@@ +- endp->flags = 0 ++ se_fl_zero(endp) + +@@ +struct cs_endpoint *endp; +expression e; +@@ +( +- endp->flags = (e) ++ se_fl_setall(endp, e) +| +- endp->flags = e ++ se_fl_setall(endp, e) +) + +@@ +struct cs_endpoint *endp; +@@ +( +- (endp->flags) ++ se_fl_get(endp) +| +- endp->flags ++ se_fl_get(endp) +)