Refactor so that ENGINE_NODE_WITH_CLEAR_TRACK_DATA_IS_VALID can be used outside of functions.
Signed-off-by: Han Zhou <hz...@ovn.org> Reviewed-by: Ales Musil <amu...@redhat.com> --- lib/inc-proc-eng.h | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/inc-proc-eng.h b/lib/inc-proc-eng.h index 5f515f1eaf50..c7e45e73972e 100644 --- a/lib/inc-proc-eng.h +++ b/lib/inc-proc-eng.h @@ -387,7 +387,7 @@ void engine_ovsdb_node_add_index(struct engine_node *, const char *name, struct ovsdb_idl_index *); /* Macro to define an engine node. */ -#define ENGINE_NODE_DEF(NAME, NAME_STR) \ +#define ENGINE_NODE_DEF(NAME, NAME_STR, CLEAR_TRACKED_DATA, IS_VALID) \ struct engine_node en_##NAME = { \ .name = NAME_STR, \ .data = NULL, \ @@ -395,21 +395,20 @@ 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 = NULL, \ - .clear_tracked_data = NULL, \ + .is_valid = IS_VALID, \ + .clear_tracked_data = CLEAR_TRACKED_DATA, \ }; -#define ENGINE_NODE_WITH_CLEAR_TRACK_DATA_IS_VALID(NAME, NAME_STR) \ - ENGINE_NODE(NAME, NAME_STR) \ - en_##NAME.clear_tracked_data = en_##NAME##_clear_tracked_data; \ - en_##NAME.is_valid = en_##NAME##_is_valid; - #define ENGINE_NODE(NAME, NAME_STR) \ - ENGINE_NODE_DEF(NAME, NAME_STR) + ENGINE_NODE_DEF(NAME, NAME_STR, NULL, NULL) #define ENGINE_NODE_WITH_CLEAR_TRACK_DATA(NAME, NAME_STR) \ - ENGINE_NODE(NAME, NAME_STR) \ - en_##NAME.clear_tracked_data = en_##NAME##_clear_tracked_data; + ENGINE_NODE_DEF(NAME, NAME_STR, en_##NAME##_clear_tracked_data, NULL) + +#define ENGINE_NODE_WITH_CLEAR_TRACK_DATA_IS_VALID(NAME, NAME_STR) \ + ENGINE_NODE_DEF(NAME, NAME_STR, \ + en_##NAME##_clear_tracked_data, \ + en_##NAME##_is_valid) /* Macro to define member functions of an engine node which represents * a table of OVSDB */ -- 2.30.2 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev