common trace-chunk: introduce lttng_trace_chunk_get_name_overridden
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 12 Dec 2019 16:38:13 +0000 (11:38 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 19 Dec 2019 22:45:54 +0000 (17:45 -0500)
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 <mathieu.desnoyers@efficios.com>
Change-Id: Ied8bcbb5202826e68a5d6b54130f29f203948794
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/trace-chunk.c
src/common/trace-chunk.h

index 8a450c547017ac3dd85bac29fde8a893db229d40..c549f46b33c855334814355ef8a6e37f6cacadf2 100644 (file)
@@ -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)
 {
index 202a20ae2ebca328b39a859c492dd48a106137cc..7135b01939fdbe50b1544a4d5bf6b347378986ce 100644 (file)
@@ -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);
This page took 0.027622 seconds and 4 git commands to generate.