Rename override to overwrite for config_load_session
[lttng-tools.git] / src / common / config / session-config.c
index 01b6d9c0e65066ae3fcfba47697fad748d88a3f0..d53ec0aa530ae88201932675c2bcb7e6b6dff719 100644 (file)
@@ -178,6 +178,9 @@ LTTNG_HIDDEN const char * const config_event_context_preemptible = "PREEMPTIBLE"
 LTTNG_HIDDEN const char * const config_event_context_need_reschedule = "NEED_RESCHEDULE";
 LTTNG_HIDDEN const char * const config_event_context_migratable = "MIGRATABLE";
 
+/* Deprecated symbols */
+const char * const config_element_perf;
+
 enum process_event_node_phase {
        CREATION = 0,
        ENABLE = 1,
@@ -1608,6 +1611,7 @@ int process_event_node(xmlNodePtr event_node, struct lttng_handle *handle,
                                goto end;
                        }
 
+                       free(filter_expression);
                        filter_expression = strdup((char *) content);
                        free(content);
                        if (!filter_expression) {
@@ -2391,7 +2395,7 @@ end:
 
 static
 int process_session_node(xmlNodePtr session_node, const char *session_name,
-               int override)
+               int overwrite)
 {
        int ret, started = -1, snapshot_mode = -1;
        uint64_t live_timer_interval = UINT64_MAX;
@@ -2566,7 +2570,7 @@ domain_init_error:
                goto error;
        }
 
-       if (override) {
+       if (overwrite) {
                /* Destroy session if it exists */
                ret = lttng_destroy_session((const char *) name);
                if (ret && ret != -LTTNG_ERR_SESS_NOT_FOUND) {
@@ -2661,7 +2665,7 @@ valid:
 
 static
 int load_session_from_file(const char *path, const char *session_name,
-       struct session_config_validation_ctx *validation_ctx, int override)
+       struct session_config_validation_ctx *validation_ctx, int overwrite)
 {
        int ret, session_found = !session_name;
        xmlDocPtr doc = NULL;
@@ -2703,7 +2707,7 @@ int load_session_from_file(const char *path, const char *session_name,
                session_node; session_node =
                        xmlNextElementSibling(session_node)) {
                ret = process_session_node(session_node,
-                       session_name, override);
+                       session_name, overwrite);
                if (session_name && ret == 0) {
                        /* Target session found and loaded */
                        session_found = 1;
@@ -2737,7 +2741,7 @@ struct dirent *alloc_dirent(const char *path)
 
 static
 int load_session_from_path(const char *path, const char *session_name,
-       struct session_config_validation_ctx *validation_ctx, int override)
+       struct session_config_validation_ctx *validation_ctx, int overwrite)
 {
        int ret, session_found = !session_name;
        DIR *directory = NULL;
@@ -2812,7 +2816,7 @@ int load_session_from_path(const char *path, const char *session_name,
                        file_path[path_len + file_name_len] = '\0';
 
                        ret = load_session_from_file(file_path, session_name,
-                               validation_ctx, override);
+                               validation_ctx, overwrite);
                        if (session_name && !ret) {
                                session_found = 1;
                                break;
@@ -2823,7 +2827,7 @@ int load_session_from_path(const char *path, const char *session_name,
                free(file_path);
        } else {
                ret = load_session_from_file(path, session_name,
-                       validation_ctx, override);
+                       validation_ctx, overwrite);
                if (ret) {
                        goto end;
                } else {
@@ -2838,7 +2842,7 @@ end:
                }
        }
 
-       if (session_found) {
+       if (session_found && !ret) {
                ret = 0;
        }
 
@@ -2881,7 +2885,7 @@ invalid:
 
 LTTNG_HIDDEN
 int config_load_session(const char *path, const char *session_name,
-               int override, unsigned int autoload)
+               int overwrite, unsigned int autoload)
 {
        int ret;
        bool session_loaded = false;
@@ -2935,7 +2939,7 @@ int config_load_session(const char *path, const char *session_name,
                        }
                        if (path_ptr) {
                                ret = load_session_from_path(path_ptr, session_name,
-                                               &validation_ctx, override);
+                                               &validation_ctx, overwrite);
                                if (ret && ret != -LTTNG_ERR_LOAD_SESSION_NOENT) {
                                        goto end;
                                }
@@ -2965,7 +2969,7 @@ int config_load_session(const char *path, const char *session_name,
 
                if (path_ptr) {
                        ret = load_session_from_path(path_ptr, session_name,
-                                       &validation_ctx, override);
+                                       &validation_ctx, overwrite);
                        if (!ret) {
                                session_loaded = true;
                        }
@@ -2990,7 +2994,7 @@ int config_load_session(const char *path, const char *session_name,
                }
 
                ret = load_session_from_path(path, session_name,
-                       &validation_ctx, override);
+                       &validation_ctx, overwrite);
        }
 end:
        fini_session_config_validation_ctx(&validation_ctx);
@@ -3008,3 +3012,9 @@ end:
        }
        return ret;
 }
+
+static
+void __attribute__((destructor)) session_config_exit(void)
+{
+       xmlCleanupParser();
+}
This page took 0.025876 seconds and 4 git commands to generate.