lttng add-trigger: remove support for conditions other than event-rule-matches
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 15 Apr 2021 11:49:16 +0000 (07:49 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 22 Apr 2021 05:13:09 +0000 (01:13 -0400)
We initially only want to support the event-rule-matches condition, so
remove any trace of the other ones. They'll be added later as needed.

Change-Id: I66b79bea89257187865ebf599ef0341279629ec6
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng/commands/add_trigger.c

index b1ec6dd4780b11008a9583765b7ade979207e7d0..570ba4cf6de2da4e478c7aa49201558cc0da59b2 100644 (file)
@@ -1194,151 +1194,6 @@ end:
        return c;
 }
 
-static
-struct lttng_condition *handle_condition_session_consumed_size(int *argc, const char ***argv)
-{
-       struct lttng_condition *cond = NULL;
-       struct argpar_state *state = NULL;
-       struct argpar_item *item = NULL;
-       const char *threshold_arg = NULL;
-       const char *session_name_arg = NULL;
-       uint64_t threshold;
-       char *error = NULL;
-       enum lttng_condition_status condition_status;
-
-       state = argpar_state_create(*argc, *argv, event_rule_opt_descrs);
-       if (!state) {
-               ERR("Failed to allocate an argpar state.");
-               goto error;
-       }
-
-       while (true) {
-               enum argpar_state_parse_next_status status;
-
-               ARGPAR_ITEM_DESTROY_AND_RESET(item);
-               status = argpar_state_parse_next(state, &item, &error);
-               if (status == ARGPAR_STATE_PARSE_NEXT_STATUS_ERROR) {
-                       ERR("%s", error);
-                       goto error;
-               } else if (status == ARGPAR_STATE_PARSE_NEXT_STATUS_ERROR_UNKNOWN_OPT) {
-                       /* Just stop parsing here. */
-                       break;
-               } else if (status == ARGPAR_STATE_PARSE_NEXT_STATUS_END) {
-                       break;
-               }
-
-               assert(status == ARGPAR_STATE_PARSE_NEXT_STATUS_OK);
-
-               if (item->type == ARGPAR_ITEM_TYPE_OPT) {
-                       const struct argpar_item_opt *item_opt =
-                                       (const struct argpar_item_opt *) item;
-
-                       switch (item_opt->descr->id) {
-                       default:
-                               abort();
-                       }
-               } else {
-                       const struct argpar_item_non_opt *item_non_opt;
-
-                       assert(item->type == ARGPAR_ITEM_TYPE_NON_OPT);
-
-                       item_non_opt = (const struct argpar_item_non_opt *) item;
-
-                       switch (item_non_opt->non_opt_index) {
-                       case 0:
-                               session_name_arg = item_non_opt->arg;
-                               break;
-                       case 1:
-                               threshold_arg = item_non_opt->arg;
-                               break;
-                       default:
-                               ERR("Unexpected argument `%s`.",
-                                               item_non_opt->arg);
-                               goto error;
-                       }
-               }
-       }
-
-       *argc -= argpar_state_get_ingested_orig_args(state);
-       *argv += argpar_state_get_ingested_orig_args(state);
-
-       if (!session_name_arg) {
-               ERR("Missing session name argument.");
-               goto error;
-       }
-
-       if (!threshold_arg) {
-               ERR("Missing threshold argument.");
-               goto error;
-       }
-
-       if (utils_parse_size_suffix(threshold_arg, &threshold) != 0) {
-               ERR("Failed to parse `%s` as a size.", threshold_arg);
-               goto error;
-       }
-
-       cond = lttng_condition_session_consumed_size_create();
-       if (!cond) {
-               ERR("Failed to allocate a session consumed size condition.");
-               goto error;
-       }
-
-       condition_status = lttng_condition_session_consumed_size_set_session_name(
-               cond, session_name_arg);
-       if (condition_status != LTTNG_CONDITION_STATUS_OK) {
-               ERR("Failed to set session consumed size condition's session name to '%s'.",
-                               session_name_arg);
-               goto error;
-       }
-
-       condition_status = lttng_condition_session_consumed_size_set_threshold(
-                       cond, threshold);
-       if (condition_status != LTTNG_CONDITION_STATUS_OK) {
-               ERR("Failed to set session consumed size condition threshold.");
-               goto error;
-       }
-
-       goto end;
-
-error:
-       lttng_condition_destroy(cond);
-       cond = NULL;
-
-end:
-       argpar_state_destroy(state);
-       argpar_item_destroy(item);
-       free(error);
-       return cond;
-}
-
-static
-struct lttng_condition *handle_condition_buffer_usage_high(int *argc, const char ***argv)
-{
-       ERR("High buffer usage threshold conditions are unsupported for the moment.");
-       return NULL;
-}
-
-static
-struct lttng_condition *handle_condition_buffer_usage_low(int *argc, const char ***argv)
-{
-       ERR("Low buffer usage threshold conditions are unsupported for the moment.");
-       return NULL;
-}
-
-static
-struct lttng_condition *handle_condition_session_rotation_ongoing(int *argc, const char ***argv)
-{
-       ERR("Session rotation ongoing conditions are unsupported for the moment.");
-       return NULL;
-}
-
-static
-struct lttng_condition *handle_condition_session_rotation_completed(int *argc, const char ***argv)
-{
-       ERR("Session rotation completed conditions are unsupported for the moment.");
-       return NULL;
-}
-
 struct condition_descr {
        const char *name;
        struct lttng_condition *(*handler) (int *argc, const char ***argv);
@@ -1347,11 +1202,6 @@ struct condition_descr {
 static const
 struct condition_descr condition_descrs[] = {
        { "event-rule-matches", handle_condition_event },
-       { "on-session-consumed-size", handle_condition_session_consumed_size },
-       { "on-buffer-usage-high", handle_condition_buffer_usage_high },
-       { "on-buffer-usage-low", handle_condition_buffer_usage_low },
-       { "on-session-rotation-ongoing", handle_condition_session_rotation_ongoing },
-       { "on-session-rotation-completed", handle_condition_session_rotation_completed },
 };
 
 static
This page took 0.036269 seconds and 4 git commands to generate.