SoW-2020-0002: Trace Hit Counters: trigger error reporting integration
[lttng-tools.git] / src / common / actions / snapshot-session.c
index 9e8e43577492b3f4d5bd0f3610fb529d7c37299a..7576838650609b245f25f202ca491b3084797d50 100644 (file)
@@ -9,8 +9,8 @@
 #include <common/error.h>
 #include <common/macros.h>
 #include <common/snapshot.h>
-#include <common/sessiond-comm/payload.h>
-#include <common/sessiond-comm/payload-view.h>
+#include <common/payload.h>
+#include <common/payload-view.h>
 #include <lttng/action/action-internal.h>
 #include <lttng/action/snapshot-session-internal.h>
 #include <lttng/action/snapshot-session.h>
@@ -19,7 +19,7 @@
 #include <inttypes.h>
 
 #define IS_SNAPSHOT_SESSION_ACTION(action) \
-       (lttng_action_get_type_const(action) == LTTNG_ACTION_TYPE_SNAPSHOT_SESSION)
+       (lttng_action_get_type(action) == LTTNG_ACTION_TYPE_SNAPSHOT_SESSION)
 
 struct lttng_action_snapshot_session {
        struct lttng_action parent;
@@ -124,16 +124,9 @@ end:
        return is_equal;
 }
 
-static size_t serialize_strlen(const char *s)
+static size_t serialize_strlen(const char *str)
 {
-
-       size_t len = 0;
-
-       if (s) {
-               len = strlen(s) + 1;
-       }
-
-       return len;
+       return str ? strlen(str) + 1 : 0;
 }
 
 static int lttng_action_snapshot_session_serialize(
@@ -148,7 +141,6 @@ static int lttng_action_snapshot_session_serialize(
        assert(payload);
 
        size_before_comm = payload->buffer.size;
-       size_before_comm = size_before_comm + sizeof(comm);
 
        action_snapshot_session = action_snapshot_session_from_action(action);
        comm.session_name_len =
@@ -258,7 +250,7 @@ ssize_t lttng_action_snapshot_session_create_from_payload(
                                comm->snapshot_output_len);
 
                if (!snapshot_output_buffer_view.buffer.data) {
-                       fprintf(stderr, "Failed to create buffer view for snapshot output.\n");
+                       ERR("Failed to create buffer view for snapshot output.");
                        goto error;
                }
 
@@ -267,8 +259,7 @@ ssize_t lttng_action_snapshot_session_create_from_payload(
                                                &snapshot_output_buffer_view,
                                                &snapshot_output);
                if (snapshot_output_consumed_len != comm->snapshot_output_len) {
-                       fprintf(stderr,
-                                       "Failed to deserialize snapshot output object: "
+                       ERR("Failed to deserialize snapshot output object: "
                                        "consumed-len: %zd, expected-len: %" PRIu32,
                                        snapshot_output_consumed_len,
                                        comm->snapshot_output_len);
This page took 0.02455 seconds and 5 git commands to generate.