Clean-up: sessiond: return an lttng_error_code from list_triggers
[lttng-tools.git] / src / bin / lttng-sessiond / condition-internal.c
index 50bb6cb1ae89bd340eb4ccc740ea1f539c59ef60..8afb4ea1c667e43052762f83a11675aaf2dc34cf 100644 (file)
 #include <lttng/condition/buffer-usage-internal.h>
 #include <lttng/condition/session-consumed-size-internal.h>
 #include <lttng/condition/session-rotation-internal.h>
-#include <lttng/condition/on-event-internal.h>
-#include <lttng/condition/on-event.h>
+#include <lttng/condition/event-rule-matches-internal.h>
+#include <lttng/condition/event-rule-matches.h>
 #include <lttng/event-rule/event-rule-internal.h>
-#include <lttng/condition/on-event-internal.h>
+#include <lttng/condition/event-rule-matches-internal.h>
 #include "condition-internal.h"
 
 static
@@ -44,10 +44,7 @@ unsigned long lttng_condition_buffer_usage_hash(
                                lttng_ht_seed);
        }
        if (condition->threshold_ratio.set) {
-               uint64_t val;
-
-               val = condition->threshold_ratio.value * (double) UINT32_MAX;
-               hash ^= hash_key_u64(&val, lttng_ht_seed);
+               hash ^= hash_key_u64(&condition->threshold_ratio.value, lttng_ht_seed);
        } else if (condition->threshold_bytes.set) {
                uint64_t val;
 
@@ -95,17 +92,16 @@ unsigned long lttng_condition_session_rotation_hash(
        return hash;
 }
 
-static
-unsigned long lttng_condition_on_event_hash(
-       const struct lttng_condition *condition)
+static unsigned long lttng_condition_event_rule_matches_hash(
+               const struct lttng_condition *condition)
 {
        unsigned long hash, condition_type;
        enum lttng_condition_status condition_status;
        const struct lttng_event_rule *event_rule;
 
        condition_type = (unsigned long) condition->type;
-       condition_status = lttng_condition_on_event_get_rule(condition,
-                       &event_rule);
+       condition_status = lttng_condition_event_rule_matches_get_rule(
+                       condition, &event_rule);
        assert(condition_status == LTTNG_CONDITION_STATUS_OK);
 
        hash = hash_key_ulong((void *) condition_type, lttng_ht_seed);
@@ -128,10 +124,9 @@ unsigned long lttng_condition_hash(const struct lttng_condition *condition)
        case LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING:
        case LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED:
                return lttng_condition_session_rotation_hash(condition);
-       case LTTNG_CONDITION_TYPE_ON_EVENT:
-               return lttng_condition_on_event_hash(condition);
+       case LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES:
+               return lttng_condition_event_rule_matches_hash(condition);
        default:
-               //ERR("[notification-thread] Unexpected condition type caught");
                abort();
        }
 }
This page took 0.025451 seconds and 4 git commands to generate.