relayd: rename viewer_session_set_trace_chunk and hide it
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 12 Nov 2019 21:28:50 +0000 (16:28 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 12 Nov 2019 22:01:22 +0000 (17:01 -0500)
viewer_session_set_trace_chunk() is renamed to
viewer_session_set_trace_chunk_copy() as it creates a copy of the
source trace chunk before setting it on a viewer_session.

The function is also marked static as it is only needed within
the viewer-session.c TU.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-relayd/viewer-session.c
src/bin/lttng-relayd/viewer-session.h

index d394465ba1c51d3f1575ed7630c2f6dc4c942908..7a5bd6dca991e55d643477c58f763dbfc3e765be 100644 (file)
@@ -41,6 +41,28 @@ end:
        return vsession;
 }
 
+static int viewer_session_set_trace_chunk_copy(struct relay_viewer_session *vsession,
+               struct lttng_trace_chunk *relay_session_trace_chunk)
+{
+       int ret = 0;
+       struct lttng_trace_chunk *viewer_chunk;
+
+       assert(relay_session_trace_chunk);
+       assert(!vsession->current_trace_chunk);
+
+       DBG("Copying relay session's current trace chunk to the viewer session");
+       viewer_chunk = lttng_trace_chunk_copy(relay_session_trace_chunk);
+       if (!viewer_chunk) {
+               ERR("Failed to create a viewer trace chunk from the relay session's current chunk");
+               ret = -1;
+               goto end;
+       }
+
+       vsession->current_trace_chunk = viewer_chunk;
+end:
+       return ret;
+}
+
 /* The existence of session must be guaranteed by the caller. */
 enum lttng_viewer_attach_return_code viewer_session_attach(
                struct relay_viewer_session *vsession,
@@ -65,7 +87,7 @@ enum lttng_viewer_attach_return_code viewer_session_attach(
                assert(!vsession->current_trace_chunk);
                session->viewer_attached = true;
 
-               ret = viewer_session_set_trace_chunk(vsession,
+               ret = viewer_session_set_trace_chunk_copy(vsession,
                                session->current_trace_chunk);
                if (ret) {
                        /*
@@ -204,25 +226,3 @@ end:
        pthread_mutex_unlock(&session->lock);
        return found;
 }
-
-int viewer_session_set_trace_chunk(struct relay_viewer_session *vsession,
-               struct lttng_trace_chunk *relay_session_trace_chunk)
-{
-       int ret = 0;
-       struct lttng_trace_chunk *viewer_chunk;
-
-       assert(relay_session_trace_chunk);
-       assert(!vsession->current_trace_chunk);
-
-       DBG("Copying relay session's current trace chunk to the viewer session");
-       viewer_chunk = lttng_trace_chunk_copy(relay_session_trace_chunk);
-       if (!viewer_chunk) {
-               ERR("Failed to create a viewer trace chunk from the relay session's current chunk");
-               ret = -1;
-               goto end;
-       }
-
-       vsession->current_trace_chunk = viewer_chunk;
-end:
-       return ret;
-}
index 5c8b2e54d31ff07e93dd979a8f921b5fbaaed233..d573379261e91ee603e818f398034d4571eaa49e 100644 (file)
@@ -55,7 +55,5 @@ int viewer_session_is_attached(struct relay_viewer_session *vsession,
                struct relay_session *session);
 void viewer_session_close_one_session(struct relay_viewer_session *vsession,
                struct relay_session *session);
-int viewer_session_set_trace_chunk(struct relay_viewer_session *vsession,
-               struct lttng_trace_chunk *relay_session_trace_chunk);
 
 #endif /* _VIEWER_SESSION_H */
This page took 0.034622 seconds and 4 git commands to generate.