Cleanup: src.ctf.lttng-live: move function declarations around
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 14 Nov 2019 02:13:07 +0000 (21:13 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 15 Nov 2019 21:10:12 +0000 (16:10 -0500)
* Remove declarations of `lttng_live_remove_stream_iterator()` and
`lttng_live_add_stream_iterator()` functions as they are not used.

* Move `lttng_live_need_new_streams()` function to viewer-connection.c
as it's only used in this file.

* Move declaration of `lttng_live_create_viewer_session()` to
viewer-connection.h

* Namespace `lttng_live_session` related functions with the
`lttng_live_session_` prefix.

* Rename `lttng_live_borrow_trace()` function to
`lttng_live_session_borrow_or_create_trace_by_id()`

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ie18423e9a39b4ac1e04642f381a9f59831c34abe
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2386
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
src/plugins/ctf/lttng-live/data-stream.c
src/plugins/ctf/lttng-live/lttng-live.c
src/plugins/ctf/lttng-live/lttng-live.h
src/plugins/ctf/lttng-live/metadata.c
src/plugins/ctf/lttng-live/viewer-connection.c
src/plugins/ctf/lttng-live/viewer-connection.h

index 79f6c3fa97cd540cbebfd1f80323c23836ef38df..903cbf73d448da12f9d5959b14a0984e6c6a6cbf 100644 (file)
@@ -230,7 +230,7 @@ struct lttng_live_stream_iterator *lttng_live_stream_iterator_create(
 
        stream_iter->log_level = log_level;
        stream_iter->self_comp = self_comp;
-       trace = lttng_live_borrow_trace(session, ctf_trace_id);
+       trace = lttng_live_session_borrow_or_create_trace_by_id(session, ctf_trace_id);
        if (!trace) {
                BT_COMP_LOGE_APPEND_CAUSE(self_comp,
                        "Failed to borrow CTF trace.");
index 078fe94d787289cdea05249946aa194f48172205..77dd590d237f64b013b8fcbf4367c8f8ee4d7380 100644 (file)
@@ -133,7 +133,7 @@ end:
 }
 
 static
-struct lttng_live_trace *lttng_live_find_trace(struct lttng_live_session *session,
+struct lttng_live_trace *lttng_live_session_borrow_trace_by_id(struct lttng_live_session *session,
                uint64_t trace_id)
 {
        uint64_t trace_idx;
@@ -208,12 +208,12 @@ end:
 }
 
 BT_HIDDEN
-struct lttng_live_trace *lttng_live_borrow_trace(
+struct lttng_live_trace *lttng_live_session_borrow_or_create_trace_by_id(
                struct lttng_live_session *session, uint64_t trace_id)
 {
        struct lttng_live_trace *trace;
 
-       trace = lttng_live_find_trace(session, trace_id);
+       trace = lttng_live_session_borrow_trace_by_id(session, trace_id);
        if (trace) {
                goto end;
        }
@@ -285,7 +285,7 @@ void lttng_live_destroy_session(struct lttng_live_session *session)
                "session-id=%"PRIu64", session-name=\"%s\"",
                session->id, session->session_name->str);
        if (session->id != -1ULL) {
-               if (lttng_live_detach_session(session)) {
+               if (lttng_live_session_detach(session)) {
                        if (!lttng_live_graph_is_canceled(
                                        session->lttng_live_msg_iter)) {
                                /* Old relayd cannot detach sessions. */
@@ -460,7 +460,7 @@ enum lttng_live_iterator_status lttng_live_get_session(
 
        if (!session->attached) {
                enum lttng_live_viewer_status attach_status =
-                       lttng_live_attach_session(session,
+                       lttng_live_session_attach(session,
                                lttng_live_msg_iter->self_msg_iter);
                if (attach_status != LTTNG_LIVE_VIEWER_STATUS_OK) {
                        if (lttng_live_graph_is_canceled(lttng_live_msg_iter)) {
@@ -481,7 +481,7 @@ enum lttng_live_iterator_status lttng_live_get_session(
                }
        }
 
-       status = lttng_live_get_new_streams(session,
+       status = lttng_live_session_get_new_streams(session,
                lttng_live_msg_iter->self_msg_iter);
        if (status != LTTNG_LIVE_ITERATOR_STATUS_OK &&
                        status != LTTNG_LIVE_ITERATOR_STATUS_END) {
@@ -517,19 +517,6 @@ end:
        return status;
 }
 
-BT_HIDDEN
-void lttng_live_need_new_streams(struct lttng_live_msg_iter *lttng_live_msg_iter)
-{
-       uint64_t session_idx;
-
-       for (session_idx = 0; session_idx < lttng_live_msg_iter->sessions->len;
-                       session_idx++) {
-               struct lttng_live_session *session =
-                       g_ptr_array_index(lttng_live_msg_iter->sessions, session_idx);
-               session->new_streams_needed = true;
-       }
-}
-
 static
 void lttng_live_force_new_streams_and_metadata(struct lttng_live_msg_iter *lttng_live_msg_iter)
 {
index 58131f8208640668134a9e9f2ea68fff0cbff817..ad01c7ddab760693e7cb0b7b2f084ac6d41d9948 100644 (file)
@@ -306,20 +306,20 @@ bt_component_class_message_iterator_initialize_method_status lttng_live_msg_iter
 
 void lttng_live_msg_iter_finalize(bt_self_message_iterator *it);
 
-enum lttng_live_viewer_status lttng_live_create_viewer_session(
-               struct lttng_live_msg_iter *lttng_live_msg_iter);
-
-enum lttng_live_viewer_status lttng_live_attach_session(
+enum lttng_live_viewer_status lttng_live_session_attach(
                struct lttng_live_session *session,
                bt_self_message_iterator *self_msg_iter);
 
-enum lttng_live_viewer_status lttng_live_detach_session(
+enum lttng_live_viewer_status lttng_live_session_detach(
                struct lttng_live_session *session);
 
-enum lttng_live_iterator_status lttng_live_get_new_streams(
+enum lttng_live_iterator_status lttng_live_session_get_new_streams(
                struct lttng_live_session *session,
                bt_self_message_iterator *self_msg_iter);
 
+struct lttng_live_trace *lttng_live_session_borrow_or_create_trace_by_id(
+               struct lttng_live_session *session, uint64_t trace_id);
+
 int lttng_live_add_session(struct lttng_live_msg_iter *lttng_live_msg_iter,
                uint64_t session_id,
                const char *hostname,
@@ -344,14 +344,6 @@ enum ctf_msg_iter_medium_status lttng_live_get_stream_bytes(
                struct lttng_live_msg_iter *lttng_live_msg_iter,
                struct lttng_live_stream_iterator *stream, uint8_t *buf,
                uint64_t offset, uint64_t req_len, uint64_t *recv_len);
-void lttng_live_add_stream_iterator(struct lttng_live_msg_iter *lttng_live_msg_iter,
-               struct lttng_live_stream_iterator *stream_iter);
-void lttng_live_remove_stream_iterator(struct lttng_live_msg_iter *lttng_live_msg_iter,
-               struct lttng_live_stream_iterator *stream_iter);
-
-struct lttng_live_trace *lttng_live_borrow_trace(
-               struct lttng_live_session *session, uint64_t trace_id);
-void lttng_live_need_new_streams(struct lttng_live_msg_iter *lttng_live_msg_iter);
 
 bool lttng_live_graph_is_canceled(struct lttng_live_msg_iter *msg_iter);
 
index 175b8071f0238098788d842b99ba3823e2a189b9..d1e3ae02a3b7ca7b1b0a58b06f50fd76ea62bc01 100644 (file)
@@ -350,7 +350,8 @@ int lttng_live_metadata_create_stream(struct lttng_live_session *session,
                        "Failed to create CTF metadata decoder");
                goto error;
        }
-       trace = lttng_live_borrow_trace(session, ctf_trace_id);
+       trace = lttng_live_session_borrow_or_create_trace_by_id(session,
+               ctf_trace_id);
        if (!trace) {
                BT_COMP_LOGE_APPEND_CAUSE(self_comp,
                        "Failed to borrow trace");
index 0f1ddba959cb2d423e47eaad3aefdbed36d87bdc..0a3f5018435982d28f653959f93754ed0ff234d4 100644 (file)
@@ -412,7 +412,7 @@ end:
 
 static
 enum lttng_live_viewer_status lttng_live_connect_viewer(
-       struct live_viewer_connection *viewer_connection)
+               struct live_viewer_connection *viewer_connection)
 {
        struct hostent *host;
        struct sockaddr_in server_addr;
@@ -1057,7 +1057,7 @@ end:
 }
 
 BT_HIDDEN
-enum lttng_live_viewer_status lttng_live_attach_session(
+enum lttng_live_viewer_status lttng_live_session_attach(
                struct lttng_live_session *session,
                bt_self_message_iterator *self_msg_iter)
 {
@@ -1159,7 +1159,7 @@ end:
 }
 
 BT_HIDDEN
-enum lttng_live_viewer_status lttng_live_detach_session(
+enum lttng_live_viewer_status lttng_live_session_detach(
                struct lttng_live_session *session)
 {
        struct lttng_viewer_cmd cmd;
@@ -1377,6 +1377,19 @@ void lttng_index_to_packet_index(struct lttng_viewer_index *lindex,
        pindex->events_discarded = be64toh(lindex->events_discarded);
 }
 
+static
+void lttng_live_need_new_streams(struct lttng_live_msg_iter *lttng_live_msg_iter)
+{
+       uint64_t session_idx;
+
+       for (session_idx = 0; session_idx < lttng_live_msg_iter->sessions->len;
+                       session_idx++) {
+               struct lttng_live_session *session =
+                       g_ptr_array_index(lttng_live_msg_iter->sessions, session_idx);
+               session->new_streams_needed = true;
+       }
+}
+
 BT_HIDDEN
 enum lttng_live_iterator_status lttng_live_get_next_index(
                struct lttng_live_msg_iter *lttng_live_msg_iter,
@@ -1633,7 +1646,7 @@ end:
  * Request new streams for a session.
  */
 BT_HIDDEN
-enum lttng_live_iterator_status lttng_live_get_new_streams(
+enum lttng_live_iterator_status lttng_live_session_get_new_streams(
                struct lttng_live_session *session,
                bt_self_message_iterator *self_msg_iter)
 {
index 39f6a210f27b8233165843f57107fbe3fe601774..224b1846cbf83b7c1e96bb65f9a75c4d47bb1b2f 100644 (file)
@@ -116,6 +116,9 @@ enum lttng_live_viewer_status live_viewer_connection_create(
 void live_viewer_connection_destroy(
                struct live_viewer_connection *conn);
 
+enum lttng_live_viewer_status lttng_live_create_viewer_session(
+               struct lttng_live_msg_iter *lttng_live_msg_iter);
+
 bt_component_class_query_method_status live_viewer_connection_list_sessions(
                struct live_viewer_connection *viewer_connection,
                const bt_value **user_result);
This page took 0.03183 seconds and 4 git commands to generate.