Since those structs are only transferred across unix sockets, endianness
is kept in host order.

Signed-off-by: Yannick Lamarre <ylama...@efficios.com>
---
Fixed spelling errors

 src/common/sessiond-comm/sessiond-comm.c | 42 ++++++++++++++++++++++++++++++++
 src/common/sessiond-comm/sessiond-comm.h |  1 +
 2 files changed, 43 insertions(+)

diff --git a/src/common/sessiond-comm/sessiond-comm.c 
b/src/common/sessiond-comm/sessiond-comm.c
index f1f0ebdf..26b2d66d 100644
--- a/src/common/sessiond-comm/sessiond-comm.c
+++ b/src/common/sessiond-comm/sessiond-comm.c
@@ -76,6 +76,48 @@ static const char *lttcomm_readable_code[] = {
 
 static unsigned long network_timeout;
 
+LTTNG_HIDDEN
+int lttng_event_perf_counter_ctx_serialize(struct 
lttng_event_perf_counter_ctx_serialized *dst,
+               const struct lttng_event_perf_counter_ctx *src)
+{
+       assert(src && dst);
+       dst->type = src->type;
+       dst->config = src->config;
+       memcpy(&dst->name, &src->name, LTTNG_SYMBOL_NAME_LEN);
+       return 0;
+}
+
+LTTNG_HIDDEN
+int lttng_event_perf_counter_ctx_deserialize(struct 
lttng_event_perf_counter_ctx *dst,
+               const struct lttng_event_perf_counter_ctx_serialized *src)
+{
+       assert(src && dst);
+       dst->type = src->type;
+       dst->config = src->config;
+       memcpy(&dst->name, &src->name, LTTNG_SYMBOL_NAME_LEN);
+       return 0;
+}
+
+LTTNG_HIDDEN
+int lttng_event_context_serialize(struct lttng_event_context_serialized *dst,
+               const struct lttng_event_context *src)
+{
+       assert(src && dst);
+       dst->ctx = (uint32_t) src->ctx;
+       lttng_event_perf_counter_ctx_serialize(&dst->perf_counter, 
&src->u.perf_counter);
+       return 0;
+}
+
+LTTNG_HIDDEN
+int lttng_event_context_deserialize(struct lttng_event_context *dst,
+               const struct lttng_event_context_serialized *src)
+{
+       assert(src && dst);
+       dst->ctx = (enum lttng_event_context_type) src->ctx;
+       lttng_event_perf_counter_ctx_deserialize(&dst->u.perf_counter, 
&src->perf_counter);
+       return 0;
+}
+
 int init_serialized_extended_channel(struct lttng_domain *domain, struct
                lttng_channel_extended_serialized *extended)
 {
diff --git a/src/common/sessiond-comm/sessiond-comm.h 
b/src/common/sessiond-comm/sessiond-comm.h
index f87b9098..3455a4ea 100644
--- a/src/common/sessiond-comm/sessiond-comm.h
+++ b/src/common/sessiond-comm/sessiond-comm.h
@@ -31,6 +31,7 @@
 #include <lttng/snapshot-internal.h>
 #include <lttng/save-internal.h>
 #include <lttng/channel-internal.h>
+#include <lttng/event-internal.h>
 #include <lttng/trigger/trigger-internal.h>
 #include <lttng/rotate-internal.h>
 #include <common/compat/socket.h>
-- 
2.11.0

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Reply via email to