trigger: implement is_equal
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Tue, 24 Mar 2020 15:32:08 +0000 (11:32 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 9 Nov 2020 20:44:52 +0000 (15:44 -0500)
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I646c13e7fb26fda66b888ce90253e87567b2cab8

include/lttng/trigger/trigger-internal.h
src/bin/lttng-sessiond/notification-thread-events.c
src/common/trigger.c

index a554a31e536131a16d48f4e00088297f6ffe69d9..6d05b6d1d3ed38b2f789e30f731d6ec6d6a18276 100644 (file)
@@ -61,6 +61,10 @@ const struct lttng_action *lttng_trigger_get_const_action(
 LTTNG_HIDDEN
 bool lttng_trigger_validate(struct lttng_trigger *trigger);
 
 LTTNG_HIDDEN
 bool lttng_trigger_validate(struct lttng_trigger *trigger);
 
+LTTNG_HIDDEN
+bool lttng_trigger_is_equal(
+               const struct lttng_trigger *a, const struct lttng_trigger *b);
+
 LTTNG_HIDDEN
 void lttng_trigger_get(struct lttng_trigger *trigger);
 
 LTTNG_HIDDEN
 void lttng_trigger_get(struct lttng_trigger *trigger);
 
index 9e9a83888d81dac23e933c686846d0b8572b0e3a..e52e4bd979cbe9108a599522a1eca74e848e541d 100644 (file)
@@ -27,6 +27,7 @@
 #include <lttng/condition/session-consumed-size-internal.h>
 #include <lttng/condition/session-rotation-internal.h>
 #include <lttng/notification/channel-internal.h>
 #include <lttng/condition/session-consumed-size-internal.h>
 #include <lttng/condition/session-rotation-internal.h>
 #include <lttng/notification/channel-internal.h>
+#include <lttng/trigger/trigger-internal.h>
 
 #include <time.h>
 #include <unistd.h>
 
 #include <time.h>
 #include <unistd.h>
index 5ae84f3d9e8f6ef28cb6323cd8b83c62101291f8..e6849fccfa52789a022de29b4344f2ead73fbffd 100644 (file)
@@ -263,6 +263,29 @@ end:
        return ret;
 }
 
        return ret;
 }
 
+LTTNG_HIDDEN
+bool lttng_trigger_is_equal(
+               const struct lttng_trigger *a, const struct lttng_trigger *b)
+{
+       /*
+        * Name is not taken into account since it is cosmetic only.
+        */
+       if (!lttng_condition_is_equal(a->condition, b->condition)) {
+               return false;
+       }
+
+       if (!lttng_action_is_equal(a->action, b->action)) {
+               return false;
+       }
+
+       if (!lttng_credentials_is_equal(lttng_trigger_get_credentials(a),
+                       lttng_trigger_get_credentials(b))) {
+               return false;
+       }
+
+       return true;
+}
+
 LTTNG_HIDDEN
 void lttng_trigger_get(struct lttng_trigger *trigger)
 {
 LTTNG_HIDDEN
 void lttng_trigger_get(struct lttng_trigger *trigger)
 {
This page took 0.038338 seconds and 4 git commands to generate.