From: ylamarre@efficios.com (Yannick Lamarre)
Subject: [lttng-dev] [RFC PATCH lttng-tools 09/18] Integrate serialized communication in lttng-ctl and sessiond
Date: Thu, 18 Apr 2019 12:18:41 -0400 [thread overview]
Message-ID: <20190418161850.1536-10-ylamarre@efficios.com> (raw)
In-Reply-To: <20190418161850.1536-1-ylamarre@efficios.com>
lttng-ctl and lttng-sessiond use serialized communication for
messages using lttng_channel.
Signed-off-by: Yannick Lamarre <ylamarre at efficios.com>
---
src/bin/lttng-sessiond/client.c | 9 ++++++---
src/common/sessiond-comm/sessiond-comm.h | 4 ++--
src/lib/lttng-ctl/lttng-ctl.c | 24 ++++--------------------
3 files changed, 12 insertions(+), 25 deletions(-)
diff --git a/src/bin/lttng-sessiond/client.c b/src/bin/lttng-sessiond/client.c
index a889529a..0e36e5ad 100644
--- a/src/bin/lttng-sessiond/client.c
+++ b/src/bin/lttng-sessiond/client.c
@@ -1182,10 +1182,13 @@ error_add_context:
}
case LTTNG_ENABLE_CHANNEL:
{
- cmd_ctx->lsm->u.channel.chan.attr.extended.ptr =
- (struct lttng_channel_extended *) &cmd_ctx->lsm->u.channel.extended;
+ struct lttng_channel channel;
+ struct lttng_channel_extended extended;
+ lttng_channel_extended_deserialize(&extended, &cmd_ctx->lsm->u.channel.extended);
+ lttng_channel_deserialize(&channel, &cmd_ctx->lsm->u.channel.chan);
+ channel.attr.extended.ptr = &extended;
ret = cmd_enable_channel(cmd_ctx->session, &cmd_ctx->lsm->domain,
- &cmd_ctx->lsm->u.channel.chan,
+ &channel,
kernel_poll_pipe[1]);
break;
}
diff --git a/src/common/sessiond-comm/sessiond-comm.h b/src/common/sessiond-comm/sessiond-comm.h
index 23e82c8a..d0905f9e 100644
--- a/src/common/sessiond-comm/sessiond-comm.h
+++ b/src/common/sessiond-comm/sessiond-comm.h
@@ -402,9 +402,9 @@ struct lttcomm_session_msg {
} LTTNG_PACKED disable;
/* Create channel */
struct {
- struct lttng_channel chan LTTNG_PACKED;
+ struct lttng_channel_serialized chan;
/* struct lttng_channel_extended is already packed. */
- struct lttng_channel_extended extended;
+ struct lttng_channel_extended_serialized extended;
} LTTNG_PACKED channel;
/* Context */
struct {
diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c
index 165fef4d..789534c8 100644
--- a/src/lib/lttng-ctl/lttng-ctl.c
+++ b/src/lib/lttng-ctl/lttng-ctl.c
@@ -1527,34 +1527,18 @@ int lttng_enable_channel(struct lttng_handle *handle,
}
memset(&lsm, 0, sizeof(lsm));
- memcpy(&lsm.u.channel.chan, in_chan, sizeof(lsm.u.channel.chan));
- lsm.u.channel.chan.attr.extended.ptr = NULL;
-
if (!in_chan->attr.extended.ptr) {
- struct lttng_channel *channel;
- struct lttng_channel_extended *extended;
-
- channel = lttng_channel_create(&handle->domain);
- if (!channel) {
- return -LTTNG_ERR_NOMEM;
- }
-
- /*
- * Create a new channel in order to use default extended
- * attribute values.
- */
- extended = (struct lttng_channel_extended *)
- channel->attr.extended.ptr;
- memcpy(&lsm.u.channel.extended, extended, sizeof(*extended));
- lttng_channel_destroy(channel);
+ init_serialized_extended_channel(&handle->domain, &lsm.u.channel.extended);
} else {
struct lttng_channel_extended *extended;
extended = (struct lttng_channel_extended *)
in_chan->attr.extended.ptr;
- memcpy(&lsm.u.channel.extended, extended, sizeof(*extended));
+ lttng_channel_extended_serialize(&lsm.u.channel.extended, extended);
}
+ lttng_channel_serialize(&lsm.u.channel.chan, in_chan);
+
/*
* Verify that the amount of memory required to create the requested
* buffer is available on the system at the moment.
--
2.11.0
next prev parent reply other threads:[~2019-04-18 16:18 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-18 16:18 [lttng-dev] [RFC PATCH lttng-tools 00/18] Improvements in sessiond-comm Yannick Lamarre
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 01/18] Fix: Use platform-independant types in sessiond to consumerd communication Yannick Lamarre
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 02/18] Clean-up: Switch enum fields in lttcomm_consumer_msg Yannick Lamarre
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 03/18] Clean-up: Switch enum fields in lttcomm_consumer_status_msg Yannick Lamarre
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 04/18] Clean-up: Switch enum fields in lttcomm_consumer_status_channel Yannick Lamarre
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 05/18] Clean-up: Remove unused structure Yannick Lamarre
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 06/18] Clean-up: Removed deprecated field Yannick Lamarre
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 07/18] Add serialized versions of lttng_channel structs Yannick Lamarre
2019-04-18 19:38 ` Mathieu Desnoyers
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 08/18] Add serdes functions for lttng_channel Yannick Lamarre
2019-04-18 19:32 ` Mathieu Desnoyers
2019-04-18 16:18 ` Yannick Lamarre [this message]
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 10/18] Add serialized versions of lttng_event_context structs Yannick Lamarre
2019-04-18 19:41 ` Mathieu Desnoyers
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 11/18] Add serdes functions for lttng_event_context Yannick Lamarre
2019-04-18 19:42 ` Mathieu Desnoyers
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 12/18] Integrate serialized communication in lttng-ctl and sessiond Yannick Lamarre
2019-04-18 19:44 ` Mathieu Desnoyers
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 13/18] Add serialized versions of lttng_event structs Yannick Lamarre
2019-04-18 19:45 ` Mathieu Desnoyers
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 14/18] Add serdes functions for lttng_event_context Yannick Lamarre
2019-04-18 19:46 ` Mathieu Desnoyers
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 15/18] Integrate serialized communication in lttng-ctl and sessiond Yannick Lamarre
2019-04-18 19:49 ` Mathieu Desnoyers
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 16/18] Add serialized versions of lttng_event structs Yannick Lamarre
2019-04-18 19:50 ` Mathieu Desnoyers
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 17/18] Add serdes functions for lttng_snapshot_output Yannick Lamarre
2019-04-18 19:52 ` Mathieu Desnoyers
2019-04-18 16:18 ` [lttng-dev] [RFC PATCH lttng-tools 18/18] Integrate serialized communication in lttng-ctl and sessiond Yannick Lamarre
2019-04-18 19:58 ` Mathieu Desnoyers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190418161850.1536-10-ylamarre@efficios.com \
--to=ylamarre@efficios.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox