X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Ftrace-chunk-registry.h;h=5442d7997893eb744121d7661706d677fcbae127;hb=999af9c1150784f8676c6fce0764772d2314854a;hp=00dd7fcf0343ebd8a38aa50f8189fdb91bdb55eb;hpb=ab5be9fa2eb5ba9600a82cd18fd3cfcbac69169a;p=lttng-tools.git diff --git a/src/common/trace-chunk-registry.h b/src/common/trace-chunk-registry.h index 00dd7fcf0..5442d7997 100644 --- a/src/common/trace-chunk-registry.h +++ b/src/common/trace-chunk-registry.h @@ -31,7 +31,6 @@ struct lttng_trace_chunk_registry; * * Note that a trace chunk registry may only be accessed by an RCU thread. */ -LTTNG_HIDDEN struct lttng_trace_chunk_registry *lttng_trace_chunk_registry_create(void); /* @@ -39,7 +38,6 @@ struct lttng_trace_chunk_registry *lttng_trace_chunk_registry_create(void); * (i.e. all references to the trace chunks it contains must be released) before * it is destroyed. */ -LTTNG_HIDDEN void lttng_trace_chunk_registry_destroy( struct lttng_trace_chunk_registry *registry); @@ -56,10 +54,32 @@ void lttng_trace_chunk_registry_destroy( * * Returns an lttng_trace_chunk on success, NULL on error. */ -LTTNG_HIDDEN struct lttng_trace_chunk *lttng_trace_chunk_registry_publish_chunk( struct lttng_trace_chunk_registry *registry, uint64_t session_id, struct lttng_trace_chunk *chunk); +/* + * Adds the `previously_published` parameter which allows the caller + * to know if a trace chunk equivalent to `chunk` was previously published. + * + * The registry holds a reference to the published trace chunks it contains. + * Trace chunks automatically unpublish themselves from their registry on + * destruction. + * + * This information is necessary to drop the reference of newly published + * chunks when a user doesn't wish to explicitly maintain all references + * to a given trace chunk. + * + * For instance, the relay daemon doesn't need the registry to hold a + * reference since it controls the lifetime of its trace chunks. + * Conversely, the consumer daemons rely on the session daemon to inform + * them of the end of life of a trace chunk and the trace chunks don't + * belong to a specific top-level object: they are always retrieved from + * the registry by `id`. + */ +struct lttng_trace_chunk *lttng_trace_chunk_registry_publish_chunk( + struct lttng_trace_chunk_registry *registry, + uint64_t session_id, struct lttng_trace_chunk *chunk, + bool *previously_published); /* * Look-up a trace chunk by session_id and chunk_id. @@ -67,7 +87,6 @@ struct lttng_trace_chunk *lttng_trace_chunk_registry_publish_chunk( * * Returns an lttng_trace_chunk on success, NULL if the chunk does not exist. */ -LTTNG_HIDDEN struct lttng_trace_chunk * lttng_trace_chunk_registry_find_chunk( const struct lttng_trace_chunk_registry *registry, @@ -78,7 +97,6 @@ lttng_trace_chunk_registry_find_chunk( * * Returns 0 on success, a negative value on error. */ -LTTNG_HIDDEN int lttng_trace_chunk_registry_chunk_exists( const struct lttng_trace_chunk_registry *registry, uint64_t session_id, uint64_t chunk_id, bool *chunk_exists); @@ -89,13 +107,11 @@ int lttng_trace_chunk_registry_chunk_exists( * * Returns an lttng_trace_chunk on success, NULL if the chunk does not exist. */ -LTTNG_HIDDEN struct lttng_trace_chunk * lttng_trace_chunk_registry_find_anonymous_chunk( const struct lttng_trace_chunk_registry *registry, uint64_t session_id); -LTTNG_HIDDEN unsigned int lttng_trace_chunk_registry_put_each_chunk( const struct lttng_trace_chunk_registry *registry);