sessiond: clean-up: trigger to unregister can be 'const'
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 26 Jan 2021 21:14:33 +0000 (16:14 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 28 Jan 2021 23:08:04 +0000 (18:08 -0500)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ic2a731b36467f898402ff5e19e329e5734e2da69

src/bin/lttng-sessiond/notification-thread-commands.c
src/bin/lttng-sessiond/notification-thread-commands.h
src/bin/lttng-sessiond/notification-thread-events.c

index 7d47b77459d3aa4f149e2df52e5b4aa81c6ceb07..7cbd5d509a81a5e1167c8ae00250fd45831cceb0 100644 (file)
@@ -122,7 +122,7 @@ enum lttng_error_code notification_thread_command_register_trigger(
 
        cmd.type = NOTIFICATION_COMMAND_TYPE_REGISTER_TRIGGER;
        lttng_trigger_get(trigger);
-       cmd.parameters.trigger = trigger;
+       cmd.parameters.register_trigger.trigger = trigger;
 
        ret = run_command_wait(handle, &cmd);
        if (ret) {
@@ -136,7 +136,7 @@ end:
 
 enum lttng_error_code notification_thread_command_unregister_trigger(
                struct notification_thread_handle *handle,
-               struct lttng_trigger *trigger)
+               const struct lttng_trigger *trigger)
 {
        int ret;
        enum lttng_error_code ret_code;
@@ -145,7 +145,7 @@ enum lttng_error_code notification_thread_command_unregister_trigger(
        init_notification_thread_command(&cmd);
 
        cmd.type = NOTIFICATION_COMMAND_TYPE_UNREGISTER_TRIGGER;
-       cmd.parameters.trigger = trigger;
+       cmd.parameters.unregister_trigger.trigger = trigger;
 
        ret = run_command_wait(handle, &cmd);
        if (ret) {
index 0f76ee5a60f520bccb4c6b699b1be89a396e35fc..50751a94d1ed4dc3c6cf6f2a4c68e55d6d4abf12 100644 (file)
@@ -39,8 +39,14 @@ struct notification_thread_command {
 
        enum notification_thread_command_type type;
        union {
-               /* Register/Unregister trigger. */
-               struct lttng_trigger *trigger;
+               /* Register trigger. */
+               struct {
+                       struct lttng_trigger *trigger;
+               } register_trigger;
+               /* Unregister trigger. */
+               struct {
+                       const struct lttng_trigger *trigger;
+               } unregister_trigger;
                /* Add channel. */
                struct {
                        struct {
@@ -102,7 +108,7 @@ enum lttng_error_code notification_thread_command_register_trigger(
 
 enum lttng_error_code notification_thread_command_unregister_trigger(
                struct notification_thread_handle *handle,
-               struct lttng_trigger *trigger);
+               const struct lttng_trigger *trigger);
 
 enum lttng_error_code notification_thread_command_add_channel(
                struct notification_thread_handle *handle,
index 212746faa1c7a50d67e3006f868908222a00d22c..1a71131f0f90d398c37468db093372a3449120e8 100644 (file)
@@ -2670,7 +2670,7 @@ void free_notification_trigger_tokens_ht_element_rcu(struct rcu_head *node)
 static
 int handle_notification_thread_command_unregister_trigger(
                struct notification_thread_state *state,
-               struct lttng_trigger *trigger,
+               const struct lttng_trigger *trigger,
                enum lttng_error_code *_cmd_reply)
 {
        struct cds_lfht_iter iter;
@@ -2678,7 +2678,7 @@ int handle_notification_thread_command_unregister_trigger(
        struct lttng_channel_trigger_list *trigger_list;
        struct notification_client_list *client_list;
        struct lttng_trigger_ht_element *trigger_ht_element = NULL;
-       struct lttng_condition *condition = lttng_trigger_get_condition(
+       const struct lttng_condition *condition = lttng_trigger_get_const_condition(
                        trigger);
        enum lttng_error_code cmd_reply;
 
@@ -2792,14 +2792,15 @@ int handle_notification_thread_command(
        switch (cmd->type) {
        case NOTIFICATION_COMMAND_TYPE_REGISTER_TRIGGER:
                DBG("[notification-thread] Received register trigger command");
-               ret = handle_notification_thread_command_register_trigger(
-                               state, cmd->parameters.trigger,
+               ret = handle_notification_thread_command_register_trigger(state,
+                               cmd->parameters.register_trigger.trigger,
                                &cmd->reply_code);
                break;
        case NOTIFICATION_COMMAND_TYPE_UNREGISTER_TRIGGER:
                DBG("[notification-thread] Received unregister trigger command");
                ret = handle_notification_thread_command_unregister_trigger(
-                               state, cmd->parameters.trigger,
+                               state,
+                               cmd->parameters.unregister_trigger.trigger,
                                &cmd->reply_code);
                break;
        case NOTIFICATION_COMMAND_TYPE_ADD_CHANNEL:
This page took 0.040437 seconds and 4 git commands to generate.