*
*/
-#include <common/hashtable/utils.h>
-#include <common/hashtable/hashtable.h>
+#include "condition-internal.hpp"
+#include <common/hashtable/hashtable.hpp>
+#include <common/hashtable/utils.hpp>
+
+#include <lttng/condition/buffer-usage-internal.hpp>
+#include <lttng/condition/condition-internal.hpp>
#include <lttng/condition/condition.h>
-#include <lttng/condition/condition-internal.h>
-#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/event-rule-matches-internal.h>
+#include <lttng/condition/event-rule-matches-internal.hpp>
#include <lttng/condition/event-rule-matches.h>
-#include <lttng/event-rule/event-rule-internal.h>
-#include <lttng/condition/event-rule-matches-internal.h>
-#include "condition-internal.h"
+#include <lttng/condition/session-consumed-size-internal.hpp>
+#include <lttng/condition/session-rotation-internal.hpp>
+#include <lttng/event-rule/event-rule-internal.hpp>
-static
-unsigned long lttng_condition_buffer_usage_hash(
- const struct lttng_condition *_condition)
+static unsigned long lttng_condition_buffer_usage_hash(const struct lttng_condition *_condition)
{
unsigned long hash;
unsigned long condition_type;
struct lttng_condition_buffer_usage *condition;
- condition = container_of(_condition,
- struct lttng_condition_buffer_usage, parent);
+ condition = lttng::utils::container_of(_condition, <tng_condition_buffer_usage::parent);
condition_type = (unsigned long) condition->parent.type;
hash = hash_key_ulong((void *) condition_type, lttng_ht_seed);
hash ^= hash_key_str(condition->channel_name, lttng_ht_seed);
}
if (condition->domain.set) {
- hash ^= hash_key_ulong(
- (void *) condition->domain.type,
- lttng_ht_seed);
+ hash ^= hash_key_ulong((void *) condition->domain.type, lttng_ht_seed);
}
if (condition->threshold_ratio.set) {
hash ^= hash_key_u64(&condition->threshold_ratio.value, lttng_ht_seed);
return hash;
}
-static
-unsigned long lttng_condition_session_consumed_size_hash(
- const struct lttng_condition *_condition)
+static unsigned long
+lttng_condition_session_consumed_size_hash(const struct lttng_condition *_condition)
{
unsigned long hash;
- unsigned long condition_type =
- (unsigned long) LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE;
+ 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);
+ condition = lttng::utils::container_of(_condition,
+ <tng_condition_session_consumed_size::parent);
hash = hash_key_ulong((void *) condition_type, lttng_ht_seed);
if (condition->session_name) {
return hash;
}
-static
-unsigned long lttng_condition_session_rotation_hash(
- const struct lttng_condition *_condition)
+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 =
+ lttng::utils::container_of(_condition, <tng_condition_session_rotation::parent);
condition_type = (unsigned long) condition->parent.type;
hash = hash_key_ulong((void *) condition_type, lttng_ht_seed);
LTTNG_ASSERT(condition->session_name);
return hash;
}
-static unsigned long lttng_condition_event_rule_matches_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_event_rule_matches_get_rule(
- condition, &event_rule);
+ condition_status = lttng_condition_event_rule_matches_get_rule(condition, &event_rule);
LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
hash = hash_key_ulong((void *) condition_type, lttng_ht_seed);
{
int ret;
struct lttng_payload copy_buffer;
- struct lttng_condition *copy = NULL;
+ struct lttng_condition *copy = nullptr;
lttng_payload_init(©_buffer);
{
struct lttng_payload_view view =
- lttng_payload_view_from_payload(
- ©_buffer, 0, -1);
+ lttng_payload_view_from_payload(©_buffer, 0, -1);
- ret = lttng_condition_create_from_payload(
- &view, ©);
+ ret = lttng_condition_create_from_payload(&view, ©);
if (ret < 0) {
- copy = NULL;
+ copy = nullptr;
goto end;
}
}