Add a hashing function for session rotation conditions
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 17 Aug 2018 17:26:01 +0000 (13:26 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 24 Aug 2018 01:15:03 +0000 (21:15 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/notification-thread-events.c

index bddede988e3edb6b5f8fa98613892c542f503b9d..d04d3c2c1b89791f15a7adebfa2f0da474756c98 100644 (file)
@@ -414,6 +414,21 @@ unsigned long lttng_condition_session_consumed_size_hash(
        return hash;
 }
 
+static
+unsigned long lttng_condition_session_rotation_hash(
+       const struct lttng_condition *_condition)
+{
+       unsigned long hash, condition_type;
+       struct lttng_condition_session_rotation *condition;
+
+       condition = container_of(_condition,
+                       struct lttng_condition_session_rotation, parent);
+       condition_type = (unsigned long) condition->parent.type;
+       hash = hash_key_ulong((void *) condition_type, lttng_ht_seed);
+       assert(condition->session_name);
+       hash ^= hash_key_str(condition->session_name, lttng_ht_seed);
+       return hash;
+}
 
 /*
  * The lttng_condition hashing code is kept in this file (rather than
@@ -429,6 +444,9 @@ unsigned long lttng_condition_hash(const struct lttng_condition *condition)
                return lttng_condition_buffer_usage_hash(condition);
        case LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE:
                return lttng_condition_session_consumed_size_hash(condition);
+       case LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING:
+       case LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED:
+               return lttng_condition_session_rotation_hash(condition);
        default:
                ERR("[notification-thread] Unexpected condition type caught");
                abort();
This page took 0.028112 seconds and 4 git commands to generate.