Build fix: missing initializer for member 'payload'
[lttng-tools.git] / src / bin / lttng-sessiond / notification-thread-events.cpp
index d6c0d813550a21398a8e6e1987e4f2d437697c83..3c33ee79f5bafecc47d0509a42ccd387ee203607 100644 (file)
@@ -225,8 +225,8 @@ int match_client_id(struct cds_lfht_node *node, const void *key)
 {
        /* This double-cast is intended to supress pointer-to-cast warning. */
        const notification_client_id id = *((notification_client_id *) key);
-       const struct notification_client *client = caa_container_of(
-                       node, struct notification_client, client_id_ht_node);
+       const struct notification_client *client = lttng::utils::container_of(
+                       node, &notification_client::client_id_ht_node);
 
        return client->id == id;
 }
@@ -325,8 +325,8 @@ static
 int match_session(struct cds_lfht_node *node, const void *key)
 {
        const char *name = (const char *) key;
-       struct session_info *session_info = caa_container_of(
-               node, struct session_info, sessions_ht_node);
+       struct session_info *session_info = lttng::utils::container_of(
+               node, &session_info::sessions_ht_node);
 
        return !strcmp(session_info->name, name);
 }
@@ -493,7 +493,7 @@ enum lttng_object_type get_condition_binding_object(
 static
 void free_channel_info_rcu(struct rcu_head *node)
 {
-       free(caa_container_of(node, struct channel_info, rcu_node));
+       free(lttng::utils::container_of(node, &channel_info::rcu_node));
 }
 
 static
@@ -517,7 +517,7 @@ void channel_info_destroy(struct channel_info *channel_info)
 static
 void free_session_info_rcu(struct rcu_head *node)
 {
-       free(caa_container_of(node, struct session_info, rcu_node));
+       free(lttng::utils::container_of(node, &session_info::rcu_node));
 }
 
 /* Don't call directly, use the ref-counting mechanism. */
@@ -672,7 +672,7 @@ static
 void notification_client_list_release(struct urcu_ref *list_ref)
 {
        struct notification_client_list *list =
-                       container_of(list_ref, typeof(*list), ref);
+                       lttng::utils::container_of(list_ref, &notification_client_list::ref);
        struct notification_client_list_element *client_list_element, *tmp;
 
        lttng_condition_put(list->condition);
@@ -816,8 +816,8 @@ struct notification_client_list *get_client_list_from_condition(
                        &iter);
        node = cds_lfht_iter_get_node(&iter);
        if (node) {
-               list = container_of(node, struct notification_client_list,
-                               notification_trigger_clients_ht_node);
+               list = lttng::utils::container_of(node,
+                               &notification_client_list::notification_trigger_clients_ht_node);
                list = notification_client_list_get(list) ? list : NULL;
        }
 
@@ -1284,7 +1284,7 @@ end:
 static
 void free_notification_client_rcu(struct rcu_head *node)
 {
-       free(caa_container_of(node, struct notification_client, rcu_node));
+       free(lttng::utils::container_of(node, &notification_client::rcu_node));
 }
 
 static
@@ -3748,14 +3748,14 @@ int client_send_command_reply(struct notification_client *client,
        struct lttng_notification_channel_command_reply reply = {
                .status = (int8_t) status,
        };
-       struct lttng_notification_channel_message msg = {
-               .type = (int8_t) LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_COMMAND_REPLY,
-               .size = sizeof(reply),
-               .fds = 0,
-       };
+       struct lttng_notification_channel_message msg;
        char buffer[sizeof(msg) + sizeof(reply)];
        enum client_transmission_status transmission_status;
 
+       msg.type = (int8_t) LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_COMMAND_REPLY;
+       msg.size = sizeof(reply);
+       msg.fds = 0;
+
        memcpy(buffer, &msg, sizeof(msg));
        memcpy(buffer + sizeof(msg), &reply, sizeof(reply));
        DBG("Send command reply (%i)", (int) status);
@@ -3853,15 +3853,15 @@ int client_handle_message_handshake(struct notification_client *client,
                        .major = LTTNG_NOTIFICATION_CHANNEL_VERSION_MAJOR,
                        .minor = LTTNG_NOTIFICATION_CHANNEL_VERSION_MINOR,
        };
-       const struct lttng_notification_channel_message msg_header = {
-                       .type = LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_HANDSHAKE,
-                       .size = sizeof(handshake_reply),
-                       .fds = 0,
-       };
+       struct lttng_notification_channel_message msg_header;
        enum lttng_notification_channel_status status =
                        LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
        char send_buffer[sizeof(msg_header) + sizeof(handshake_reply)];
 
+       msg_header.type = LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_HANDSHAKE;
+       msg_header.size = sizeof(handshake_reply);
+       msg_header.fds = 0;
+
        memcpy(send_buffer, &msg_header, sizeof(msg_header));
        memcpy(send_buffer + sizeof(msg_header), &handshake_reply,
                        sizeof(handshake_reply));
@@ -4207,9 +4207,8 @@ bool evaluate_buffer_usage_condition(const struct lttng_condition *condition,
        bool result = false;
        uint64_t threshold;
        enum lttng_condition_type condition_type;
-       const struct lttng_condition_buffer_usage *use_condition = container_of(
-                       condition, struct lttng_condition_buffer_usage,
-                       parent);
+       const struct lttng_condition_buffer_usage *use_condition = lttng::utils::container_of(
+                       condition, &lttng_condition_buffer_usage::parent);
 
        if (use_condition->threshold_bytes.set) {
                threshold = use_condition->threshold_bytes.value;
@@ -4265,9 +4264,8 @@ bool evaluate_session_consumed_size_condition(
 {
        uint64_t threshold;
        const struct lttng_condition_session_consumed_size *size_condition =
-                       container_of(condition,
-                               struct lttng_condition_session_consumed_size,
-                               parent);
+                       lttng::utils::container_of(condition,
+                               &lttng_condition_session_consumed_size::parent);
 
        threshold = size_condition->consumed_threshold_bytes.value;
        DBG("Session consumed size condition being evaluated: threshold = %" PRIu64 ", current size = %" PRIu64,
@@ -4365,11 +4363,11 @@ static
 int client_notification_overflow(struct notification_client *client)
 {
        int ret = 0;
-       const struct lttng_notification_channel_message msg = {
-               .type = (int8_t) LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION_DROPPED,
-               .size = 0,
-               .fds = 0,
-       };
+       struct lttng_notification_channel_message msg;
+
+       msg.type = (int8_t) LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION_DROPPED;
+       msg.size = 0;
+       msg.fds = 0;
 
        ASSERT_LOCKED(client->lock);
 
@@ -4471,16 +4469,16 @@ int notification_client_list_send_evaluation(
                .trigger = (struct lttng_trigger *) trigger,
                .evaluation = (struct lttng_evaluation *) evaluation,
        };
-       struct lttng_notification_channel_message msg_header = {
-               .type = (int8_t) LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION,
-               .size = 0,
-               .fds = 0,
-       };
+       struct lttng_notification_channel_message msg_header;
        const struct lttng_credentials *trigger_creds =
                        lttng_trigger_get_credentials(trigger);
 
        lttng_payload_init(&msg_payload);
 
+       msg_header.type = (int8_t) LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION;
+       msg_header.size = 0;
+       msg_header.fds = 0;
+
        ret = lttng_dynamic_buffer_append(&msg_payload.buffer, &msg_header,
                        sizeof(msg_header));
        if (ret) {
@@ -4750,10 +4748,9 @@ int dispatch_one_event_notifier_notification(struct notification_thread_state *s
        }
 
        evaluation = lttng_evaluation_event_rule_matches_create(
-                       container_of(lttng_trigger_get_const_condition(
+                       lttng::utils::container_of(lttng_trigger_get_const_condition(
                                                     element->trigger),
-                                       struct lttng_condition_event_rule_matches,
-                                       parent),
+                                       &lttng_condition_event_rule_matches::parent),
                        notification->capture_buffer,
                        notification->capture_buf_size, false);
 
This page took 0.026556 seconds and 4 git commands to generate.