From e34749ef3e83e155e4e6ed4cc6034c81305c3896 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Fri, 17 Sep 2010 14:37:27 -0400 Subject: trace-cmd: Add ref counter to record Add tracecmd_record_ref() to let an application up the reference to a record to be used at a later moment. This makes sure the record is not freed by the calling function. Signed-off-by: Steven Rostedt --- trace-cmd.h | 1 + trace-input.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/trace-cmd.h b/trace-cmd.h index b2586bf..b77b8e6 100644 --- a/trace-cmd.h +++ b/trace-cmd.h @@ -54,6 +54,7 @@ enum { #define TS_SHIFT 27 #endif +void tracecmd_record_ref(struct record *record); void free_record(struct record *record); struct tracecmd_input; diff --git a/trace-input.c b/trace-input.c index 7db5577..1c79843 100644 --- a/trace-input.c +++ b/trace-input.c @@ -675,6 +675,11 @@ void free_record(struct record *record) __free_record(record); } +void tracecmd_record_ref(struct record *record) +{ + record->ref_count++; +} + static void free_next(struct tracecmd_input *handle, int cpu) { struct record *record = handle->cpu_data[cpu].next; -- cgit v1.2.2