libtraceevent: Rename kbuffer_create() to tep_kbuffer()
PATCH 1/1 libtraceevent: Rename kbuffer_create() to tep_kbuffer()
From: "Steven Rostedt (Google)" <[email protected]>
Instead of adding a dependency of tep_handle to the kbuffer code, as kbuffer should not reference the tep_handle, instead, it makes much more sense to return a kbuffer descriptor from an existing tep_handle from the tep interface.
Rename kbuffer_create() to tep_kbuffer().
Signed-off-by Steven Rostedt (Google) <[email protected]>
--- Documentation/libtraceevent-handle.txt | 9 ++++++++- Documentation/libtraceevent.txt | 1 + include/traceevent/event-parse.h | 2 ++ include/traceevent/kbuffer.h | 2 -- src/parse-utils.c | 7 ++++--- 5 files changed, 15 insertions(+), 6 deletions(-)
Documentation/libtraceevent-handle.txt +8 -1
@@ -3,7 +3,7 @@ libtraceevent(3) NAME ---- -tep_alloc, tep_free,tep_ref, tep_unref,tep_get_ref - Create, destroy, manage +tep_alloc, tep_free,tep_ref, tep_unref,tep_get_ref, tep_kbuffer - Create, destroy, manage references of trace event parser context. SYNOPSIS
@@ -40,6 +40,10 @@ it had used are cleaned up. The *tep_ref_get()* functions gets the current references of the _tep_ handler. +The *tep_kbuffer()* function allocates a kbuffer descriptor that can be used to +parse raw data that is represented by the _tep_ handle descriptor. It must be freed +with *kbuf_free(3)*. + RETURN VALUE ------------ *tep_alloc()* returns a pointer to a newly created tep_handle structure.
@@ -48,6 +52,9 @@ NULL is returned in case there is not enough free memory to allocate it. *tep_ref_get()* returns the current references of _tep_. If _tep_ is NULL, 0 is returned. +*tep_kbuffer()* returns a kbuffer descriptor that can parse the raw data that +represents the tep handle. Must be freed with *kbuf_free(3)*. + EXAMPLE ------- [source,c]
Documentation/libtraceevent.txt +1 -0
@@ -31,6 +31,7 @@ Management of tep handler data structure and access of its members: int *tep_get_header_timestamp_size*(struct tep_handle pass:[*]_tep_); bool *tep_is_old_format*(struct tep_handle pass:[*]_tep_); int *tep_strerror*(struct tep_handle pass:[*]_tep_, enum tep_errno _errnum_, char pass:[*]_buf_, size_t _buflen_); + struct kbuffer pass:[*]*tep_kbuffer*(struct tep_handle pass:[*]:_tep_); Register / unregister APIs: int *tep_register_function*(struct tep_handle pass:[*]_tep_, char pass:[*]_name_, unsigned long long _addr_, char pass:[*]_mod_);
include/traceevent/event-parse.h +2 -0
@@ -601,6 +601,8 @@ void tep_ref(struct tep_handle *tep);void tep_unref (struct tep_handle *tep);int tep_get_ref (struct tep_handle *tep); +struct kbuffer *tep_kbuffer (struct tep_handle *tep); +/* for debugging */ void tep_print_funcs (struct tep_handle *tep);void tep_print_printk (struct tep_handle *tep);
include/traceevent/kbuffer.h +0 -2
@@ -29,10 +29,8 @@ enum { };struct kbuffer ; -struct tep_handle ;struct kbuffer *kbuffer_alloc (enum kbuffer_long_size size,enum kbuffer_endian endian); -struct kbuffer *kbuffer_create (struct tep_handle *tep);void kbuffer_free (struct kbuffer *kbuf);int kbuffer_load_subbuffer (struct kbuffer *kbuf,void *subbuffer);void *kbuffer_read_event (struct kbuffer *kbuf,unsigned long long *ts);
src/parse-utils.c +4 -3
@@ -125,12 +125,13 @@ void __weak __vpr_stat(const char *fmt, va_list ap)void vpr_stat (const char *fmt,va_list ap) __attribute__((weak,alias ("__vpr_stat" )));/** -* kbuffer_create - create and allocate a new kbuffer -* @tep: the data to get the long size and endianess from +* tep_kbuffer - return an allocated kbuffer that can be used for the tep handle +* @tep: the handle that will work with the kbuffer descriptor * * Allocates and returns a new kbuffer. +* The return must be freed by kbuffer_free(); */ -struct kbuffer *kbuffer_create (struct tep_handle *tep) +struct kbuffer *tep_kbuffer (struct tep_handle *tep) {enum kbuffer_endian endian;int long_size;
Signature · 1 line
2.35.1