From: Mathieu Desnoyers Date: Thu, 12 Dec 2019 16:38:13 +0000 (-0500) Subject: common trace-chunk: introduce lttng_trace_chunk_get_name_overridden X-Git-Tag: v2.12.0-rc1~137 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=0e2d816a62eccd0d159ec254e87ff80a7e6cf1bb;p=lttng-tools.git common trace-chunk: introduce lttng_trace_chunk_get_name_overridden While it is possible to query whether the name of a chunk is overridden through lttng_trace_chunk_get_name(), using it requires a lot of code to deal with an unused name string when all that is needed is to check whether the name is overridden. In preparation for the new "path" handling needed for the clear feature introduce this lttng_trace_chunk_get_name_overridden() API to allow checking whether name is overridden in a succint way. Signed-off-by: Mathieu Desnoyers Change-Id: Ied8bcbb5202826e68a5d6b54130f29f203948794 Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/trace-chunk.c b/src/common/trace-chunk.c index 8a450c547..c549f46b3 100644 --- a/src/common/trace-chunk.c +++ b/src/common/trace-chunk.c @@ -483,6 +483,17 @@ end: return status; } +LTTNG_HIDDEN +bool lttng_trace_chunk_get_name_overridden(struct lttng_trace_chunk *chunk) +{ + bool name_overridden; + + pthread_mutex_lock(&chunk->lock); + name_overridden = chunk->name_overridden; + pthread_mutex_unlock(&chunk->lock); + return name_overridden; +} + static bool is_valid_chunk_name(const char *name) { diff --git a/src/common/trace-chunk.h b/src/common/trace-chunk.h index 202a20ae2..7135b0193 100644 --- a/src/common/trace-chunk.h +++ b/src/common/trace-chunk.h @@ -116,6 +116,9 @@ enum lttng_trace_chunk_status lttng_trace_chunk_get_name( struct lttng_trace_chunk *chunk, const char **name, bool *name_overridden); +LTTNG_HIDDEN +bool lttng_trace_chunk_get_name_overridden(struct lttng_trace_chunk *chunk); + LTTNG_HIDDEN enum lttng_trace_chunk_status lttng_trace_chunk_override_name( struct lttng_trace_chunk *chunk, const char *name);