From a8393880b8f7a203b004f3667ebc57941e9048a9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Fri, 17 Aug 2018 13:26:01 -0400 Subject: [PATCH] Add a hashing function for session rotation conditions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- .../notification-thread-events.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/bin/lttng-sessiond/notification-thread-events.c b/src/bin/lttng-sessiond/notification-thread-events.c index bddede988..d04d3c2c1 100644 --- a/src/bin/lttng-sessiond/notification-thread-events.c +++ b/src/bin/lttng-sessiond/notification-thread-events.c @@ -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(); -- 2.34.1