From: Jérémie Galarneau Date: Tue, 26 Jan 2021 21:14:33 +0000 (-0500) Subject: sessiond: clean-up: trigger to unregister can be 'const' X-Git-Tag: v2.13.0-rc1~367 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ac16173e318279dee29504820e3c2ad8ea597712;p=lttng-tools.git sessiond: clean-up: trigger to unregister can be 'const' Signed-off-by: Jérémie Galarneau Change-Id: Ic2a731b36467f898402ff5e19e329e5734e2da69 --- diff --git a/src/bin/lttng-sessiond/notification-thread-commands.c b/src/bin/lttng-sessiond/notification-thread-commands.c index 7d47b7745..7cbd5d509 100644 --- a/src/bin/lttng-sessiond/notification-thread-commands.c +++ b/src/bin/lttng-sessiond/notification-thread-commands.c @@ -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) { diff --git a/src/bin/lttng-sessiond/notification-thread-commands.h b/src/bin/lttng-sessiond/notification-thread-commands.h index 0f76ee5a6..50751a94d 100644 --- a/src/bin/lttng-sessiond/notification-thread-commands.h +++ b/src/bin/lttng-sessiond/notification-thread-commands.h @@ -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, diff --git a/src/bin/lttng-sessiond/notification-thread-events.c b/src/bin/lttng-sessiond/notification-thread-events.c index 212746faa..1a71131f0 100644 --- a/src/bin/lttng-sessiond/notification-thread-events.c +++ b/src/bin/lttng-sessiond/notification-thread-events.c @@ -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: