diff options
author | Steven Rostedt (Google) <rostedt@goodmis.org> | 2022-12-08 15:53:25 -0500 |
---|---|---|
committer | Steven Rostedt (Google) <rostedt@goodmis.org> | 2022-12-08 19:38:02 -0500 |
commit | 6e637fba207d4b4cedafdff1795bad84d0b7e0a6 (patch) | |
tree | 4cfb65aa83dfd6a5d3b93dc170c31b4d37872ad0 | |
parent | f5a6c92721af5cbd129556f6e9ab0aadf48f8650 (diff) | |
download | libtraceevent-6e637fba207d4b4cedafdff1795bad84d0b7e0a6.tar.gz |
libtraceevent: Rename kbuffer_create() to tep_kbuffer()
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().
Link: https://lore.kernel.org/linux-trace-devel/20221208155325.50bde2ea@gandalf.local.home
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r-- | Documentation/libtraceevent-handle.txt | 9 | ||||
-rw-r--r-- | Documentation/libtraceevent.txt | 1 | ||||
-rw-r--r-- | include/traceevent/event-parse.h | 2 | ||||
-rw-r--r-- | include/traceevent/kbuffer.h | 2 | ||||
-rw-r--r-- | src/parse-utils.c | 7 |
5 files changed, 15 insertions, 6 deletions
diff --git a/Documentation/libtraceevent-handle.txt b/Documentation/libtraceevent-handle.txt index 0d6afda..64528eb 100644 --- a/Documentation/libtraceevent-handle.txt +++ b/Documentation/libtraceevent-handle.txt @@ -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] diff --git a/Documentation/libtraceevent.txt b/Documentation/libtraceevent.txt index 67e9645..488e689 100644 --- a/Documentation/libtraceevent.txt +++ b/Documentation/libtraceevent.txt @@ -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_); diff --git a/include/traceevent/event-parse.h b/include/traceevent/event-parse.h index df30766..3be98b0 100644 --- a/include/traceevent/event-parse.h +++ b/include/traceevent/event-parse.h @@ -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); diff --git a/include/traceevent/kbuffer.h b/include/traceevent/kbuffer.h index c8983a0..a2b5220 100644 --- a/include/traceevent/kbuffer.h +++ b/include/traceevent/kbuffer.h @@ -27,10 +27,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); diff --git a/src/parse-utils.c b/src/parse-utils.c index ffa6c58..9c38e1e 100644 --- a/src/parse-utils.c +++ b/src/parse-utils.c @@ -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; |