Refactor ENGINE_NODE() macro to not assign function pointers. This
allows ENGINE_NODE() to be used outside functions, creating an
engine_node with global scope (but can be statically defined within a file).
This allows more flexibility in how the I-P engine can be used as
engine nodes can be defined. Allow this is not explicitly required for
I-P it does allow for a cleaner code base as the node definitions can
be kept together outside any functions.

Additional function pointers (e.g. is_valid(), clear_tracked_data()),
may be assigned later, if required.

Signed-off-by: Mark Gray <mark.d.g...@redhat.com>
---
 controller/ovn-controller.c | 2 +-
 lib/inc-proc-eng.h          | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
index 4202f32ccaf6..48121ccce082 100644
--- a/controller/ovn-controller.c
+++ b/controller/ovn-controller.c
@@ -3219,7 +3219,7 @@ main(int argc, char *argv[])
     stopwatch_create(BFD_RUN_STOPWATCH_NAME, SW_MS);
 
     /* Define inc-proc-engine nodes. */
-    ENGINE_NODE_CUSTOM_WITH_CLEAR_TRACK_DATA(ct_zones, "ct_zones");
+    ENGINE_NODE_CUSTOM_WITH_CLEAR_TRACK_DATA_IS_VALID(ct_zones, "ct_zones");
     ENGINE_NODE_WITH_CLEAR_TRACK_DATA(runtime_data, "runtime_data");
     ENGINE_NODE(non_vif_data, "non_vif_data");
     ENGINE_NODE(mff_ovn_geneve, "mff_ovn_geneve");
diff --git a/lib/inc-proc-eng.h b/lib/inc-proc-eng.h
index 859b30a71c86..1ccae559dff6 100644
--- a/lib/inc-proc-eng.h
+++ b/lib/inc-proc-eng.h
@@ -295,19 +295,19 @@ void engine_ovsdb_node_add_index(struct engine_node *, 
const char *name,
         .init = en_##NAME##_init, \
         .run = en_##NAME##_run, \
         .cleanup = en_##NAME##_cleanup, \
-        .is_valid = en_##NAME##_is_valid, \
+        .is_valid = NULL, \
         .clear_tracked_data = NULL, \
     };
 
 #define ENGINE_NODE_CUSTOM_DATA(NAME, NAME_STR) \
     ENGINE_NODE_DEF(NAME, NAME_STR)
 
-#define ENGINE_NODE_CUSTOM_WITH_CLEAR_TRACK_DATA(NAME, NAME_STR) \
+#define ENGINE_NODE_CUSTOM_WITH_CLEAR_TRACK_DATA_IS_VALID(NAME, NAME_STR) \
     ENGINE_NODE_CUSTOM_DATA(NAME, NAME_STR) \
-    en_##NAME.clear_tracked_data = en_##NAME##_clear_tracked_data;
+    en_##NAME.clear_tracked_data = en_##NAME##_clear_tracked_data; \
+    en_##NAME.is_valid = en_##NAME##_is_valid;
 
 #define ENGINE_NODE(NAME, NAME_STR) \
-    static bool (*en_##NAME##_is_valid)(struct engine_node *node) = NULL; \
     ENGINE_NODE_DEF(NAME, NAME_STR)
 
 #define ENGINE_NODE_WITH_CLEAR_TRACK_DATA(NAME, NAME_STR) \
-- 
2.27.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to