From: Mathieu Desnoyers Date: Mon, 9 Dec 2019 14:56:27 +0000 (-0500) Subject: relayd tracefile array: add tracefile_array_reset X-Git-Tag: v2.12.0-rc1~148 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=c31a80928a509b70882bf6d81cb81acb639e263b;p=lttng-tools.git relayd tracefile array: add tracefile_array_reset Required by clear feature. Signed-off-by: Mathieu Desnoyers Change-Id: I58893eb3fffbec5d39e7bf11a6d118fe23ec4496 Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-relayd/tracefile-array.c b/src/bin/lttng-relayd/tracefile-array.c index 3d62317ac..a52ccd550 100644 --- a/src/bin/lttng-relayd/tracefile-array.c +++ b/src/bin/lttng-relayd/tracefile-array.c @@ -62,6 +62,22 @@ void tracefile_array_destroy(struct tracefile_array *tfa) free(tfa); } +void tracefile_array_reset(struct tracefile_array *tfa) +{ + size_t count, i; + + count = tfa->count; + for (i = 0; i < count; i++) { + tfa->tf[i].seq_head = -1ULL; + tfa->tf[i].seq_tail = -1ULL; + } + tfa->seq_head = -1ULL; + tfa->seq_tail = -1ULL; + tfa->file_head_read = 0; + tfa->file_head_write = 0; + tfa->file_tail = 0; +} + void tracefile_array_file_rotate(struct tracefile_array *tfa, enum tracefile_rotate_type type) { diff --git a/src/bin/lttng-relayd/tracefile-array.h b/src/bin/lttng-relayd/tracefile-array.h index 04d9123d0..53b32d9f5 100644 --- a/src/bin/lttng-relayd/tracefile-array.h +++ b/src/bin/lttng-relayd/tracefile-array.h @@ -65,6 +65,7 @@ void tracefile_array_destroy(struct tracefile_array *tfa); void tracefile_array_file_rotate(struct tracefile_array *tfa, enum tracefile_rotate_type type); void tracefile_array_commit_seq(struct tracefile_array *tfa); +void tracefile_array_reset(struct tracefile_array *tfa); uint64_t tracefile_array_get_read_file_index_head(struct tracefile_array *tfa); /* May return -1ULL in the case where we have not received any indexes yet. */