@@ -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]
@@ -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_);
@@ -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);
@@ -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);
@@ -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;