[lttng-dev] [RFC PATCH lttng-tools 08/18] Add serdes functions for lttng_channel
Mathieu Desnoyers
mathieu.desnoyers at efficios.com
Thu Apr 18 15:32:30 EDT 2019
----- On Apr 18, 2019, at 12:18 PM, Yannick Lamarre ylamarre at efficios.com wrote:
> Since those structs are only transfered across unix sockets, endianess
transfered -> transferred
[...]
>
> +int init_serialized_extended_channel(struct lttng_domain *domain, struct
> + lttng_channel_extended_serialized *extended)
> +{
> + assert(domain && extended);
> + switch (domain->type) {
> + case LTTNG_DOMAIN_KERNEL:
> + extended->monitor_timer_interval =
> + DEFAULT_KERNEL_CHANNEL_MONITOR_TIMER;
> + extended->blocking_timeout =
> + DEFAULT_KERNEL_CHANNEL_BLOCKING_TIMEOUT;
> + break;
> + case LTTNG_DOMAIN_UST:
> + switch (domain->buf_type) {
> + case LTTNG_BUFFER_PER_UID:
> + extended->monitor_timer_interval =
> + DEFAULT_UST_UID_CHANNEL_MONITOR_TIMER;
> + extended->blocking_timeout =
> + DEFAULT_UST_UID_CHANNEL_BLOCKING_TIMEOUT;
> + break;
> + case LTTNG_BUFFER_PER_PID:
> + default:
> + extended->monitor_timer_interval =
> + DEFAULT_UST_PID_CHANNEL_MONITOR_TIMER;
> + extended->blocking_timeout =
> + DEFAULT_UST_PID_CHANNEL_BLOCKING_TIMEOUT;
> + break;
> + }
missing break here.
> + default:
> + /* Default behavior: leave set to 0. */
> + break;
> + }
> +
> + return 0;
> +}
> +
[...]
> +LTTNG_HIDDEN
> +int lttng_channel_serialize(struct lttng_channel_serialized *dst,
> + const struct lttng_channel *src)
> +{
> + assert(src && dst);
> + struct lttng_channel_attr_serialized *dst_attr = &dst->attr;
> + const struct lttng_channel_attr *src_attr = &src->attr;
in our coding style, all code follows declarations. So here:
struct lttng_channel_attr_serialized *dst_attr;
const struct lttng_channel_attr *src_attr;
assert(src && dst);
dst_attr = &dst->attr;
src_attr = &src->attr;
(same applies elsewhere)
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list