Fix: use condition's type to compute its hash
[lttng-tools.git] / src / bin / lttng-sessiond / notification-thread-events.c
index 98757737dbfd2d13357d62f0c2a20a5b45683163..e55c0668ad46449324abab34b491f239cb26e7ce 100644 (file)
@@ -294,12 +294,15 @@ static
 unsigned long lttng_condition_buffer_usage_hash(
        const struct lttng_condition *_condition)
 {
-       unsigned long hash = 0;
+       unsigned long hash;
+       unsigned long condition_type;
        struct lttng_condition_buffer_usage *condition;
 
        condition = container_of(_condition,
                        struct lttng_condition_buffer_usage, parent);
 
+       condition_type = (unsigned long) condition->parent.type;
+       hash = hash_key_ulong((void *) condition_type, lttng_ht_seed);
        if (condition->session_name) {
                hash ^= hash_key_str(condition->session_name, lttng_ht_seed);
        }
@@ -329,13 +332,16 @@ static
 unsigned long lttng_condition_session_consumed_size_hash(
        const struct lttng_condition *_condition)
 {
-       unsigned long hash = 0;
+       unsigned long hash;
+       unsigned long condition_type =
+                       (unsigned long) LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE;
        struct lttng_condition_session_consumed_size *condition;
        uint64_t val;
 
        condition = container_of(_condition,
                        struct lttng_condition_session_consumed_size, parent);
 
+       hash = hash_key_ulong((void *) condition_type, lttng_ht_seed);
        if (condition->session_name) {
                hash ^= hash_key_str(condition->session_name, lttng_ht_seed);
        }
@@ -344,6 +350,7 @@ unsigned long lttng_condition_session_consumed_size_hash(
        return hash;
 }
 
+
 /*
  * The lttng_condition hashing code is kept in this file (rather than
  * condition.c) since it makes use of GPLv2 code (hashtable utils), which we
This page took 0.032409 seconds and 4 git commands to generate.