Cleanup: remove duplicated code in snapshot record command
[lttng-tools.git] / src / bin / lttng-sessiond / ust-app.c
index 4bee504969bae5685782f9198a939816692008cb..4cc21b42cab971bd954447b55023f941db077804 100644 (file)
@@ -1923,7 +1923,7 @@ error:
  * Lookup sesison wrapper.
  */
 static
-void __lookup_session_by_app(struct ltt_ust_session *usess,
+void __lookup_session_by_app(const struct ltt_ust_session *usess,
                        struct ust_app *app, struct lttng_ht_iter *iter)
 {
        /* Get right UST app session from app */
@@ -1935,7 +1935,7 @@ void __lookup_session_by_app(struct ltt_ust_session *usess,
  * id.
  */
 static struct ust_app_session *lookup_session_by_app(
-               struct ltt_ust_session *usess, struct ust_app *app)
+               const struct ltt_ust_session *usess, struct ust_app *app)
 {
        struct lttng_ht_iter iter;
        struct lttng_ht_node_u64 *node;
@@ -4399,36 +4399,6 @@ int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app)
                goto skip_setup;
        }
 
-       /* Create directories if consumer is LOCAL and has a path defined. */
-       if (usess->consumer->type == CONSUMER_DST_LOCAL &&
-                       usess->consumer->dst.session_root_path[0] != '\0') {
-               char tmp_path[LTTNG_PATH_MAX];
-
-               ret = snprintf(tmp_path, sizeof(tmp_path), "%s/%s%s",
-                               usess->consumer->dst.session_root_path,
-                               usess->consumer->chunk_path,
-                               usess->consumer->domain_subdir);
-               if (ret >= sizeof(tmp_path)) {
-                       ERR("Local destination path exceeds the maximal allowed length of %zu bytes (needs %i bytes) with path = \"%s%s%s\"",
-                                       sizeof(tmp_path), ret,
-                                       usess->consumer->dst.session_root_path,
-                                       usess->consumer->chunk_path,
-                                       usess->consumer->domain_subdir);
-                       goto error_unlock;
-               }
-
-               DBG("Creating directory path for local tracing: \"%s\"",
-                               tmp_path);
-               ret = run_as_mkdir_recursive(tmp_path, S_IRWXU | S_IRWXG,
-                               ua_sess->euid, ua_sess->egid);
-               if (ret < 0) {
-                       if (errno != EEXIST) {
-                               ERR("Trace directory creation error");
-                               goto error_unlock;
-                       }
-               }
-       }
-
        /*
         * Create the metadata for the application. This returns gracefully if a
         * metadata was already set for the session.
@@ -5904,8 +5874,9 @@ void ust_app_destroy(struct ust_app *app)
  *
  * Returns LTTNG_OK on success or a LTTNG_ERR error code.
  */
-enum lttng_error_code ust_app_snapshot_record(struct ltt_ust_session *usess,
-               struct snapshot_output *output, int wait,
+enum lttng_error_code ust_app_snapshot_record(
+               const struct ltt_ust_session *usess,
+               const struct snapshot_output *output, int wait,
                uint64_t nb_packets_per_stream)
 {
        int ret = 0;
@@ -6070,8 +6041,8 @@ error:
 /*
  * Return the size taken by one more packet per stream.
  */
-uint64_t ust_app_get_size_one_more_packet_per_stream(struct ltt_ust_session *usess,
-               uint64_t cur_nr_packets)
+uint64_t ust_app_get_size_one_more_packet_per_stream(
+               const struct ltt_ust_session *usess, uint64_t cur_nr_packets)
 {
        uint64_t tot_size = 0;
        struct ust_app *app;
This page took 0.024533 seconds and 4 git commands to generate.