[lttng-dev] [PATCH babeltrace] Add bt_stream_pos to bt_trace_descriptor

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Tue May 28 13:28:24 EDT 2013


* Jérémie Galarneau (jeremie.galarneau at efficios.com) wrote:
> This is intended to provide a generic way to access the bt_stream_pos API
> without having to make assumptions about the output format's descriptor layout.
> 
> Renamed format-internal.h to trace-descriptor-internal.h to make it more
> representative of the interface it really contains.
> 
> Signed-off-by: Jérémie Galarneau <jeremie.galarneau at efficios.com>
[...]
> --- /dev/null
> +++ b/include/babeltrace/trace-descriptor.h
> @@ -0,0 +1,53 @@
> +#ifndef _BABELTRACE_TRACE_DESCRIPTOR_H
> +#define _BABELTRACE_TRACE_DESCRIPTOR_H
> +
> +/*
> + * BabelTrace
> + *
> + * Trace Descriptor Header
> + *
> + * Copyright 2013 EfficiOS Inc. and Linux Foundation
> + *
> + * Author: Jérémie Galarneau <jeremie.galarneau at efficios.com>
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a copy
> + * of this software and associated documentation files (the "Software"), to deal
> + * in the Software without restriction, including without limitation the rights
> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> + * copies of the Software, and to permit persons to whom the Software is
> + * furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> + * SOFTWARE.
> + */
> +
> +#include <glib.h>

babeltrace/trace-descriptor.h is part of the public API. We don't want
to expose glib dependency unless utterly necessary.

> +
> +struct bt_trace_descriptor;
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +/*
> + * bt_trace_descriptor_get_stream_pos: Get the stream_pos array associated
> + * with descriptor's trace
> + *
> + * Return: Array of pointers to struct bt_stream_pos
> + */
> +extern const GPtrArray *bt_trace_descriptor_get_stream_pos(
> +	const struct bt_trace_descriptor *descriptor);

Rather than just doing a "getter" to an internal structure, we should
provide an appropriate API that abstracts this.

Thanks,

Mathieu

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list