@@ -3,7 +3,8 @@ libtraceevent(3)
NAME
----
-kbuffer_alloc, kbuffer_dup, kbuffer_free, kbuffer_load_subbuffer, kbuffer_subbuffer_size, kbuffer_start_of_data - Creating of kbuffer element to parse
+kbuffer_alloc, kbuffer_dup, kbuffer_free, kbuffer_load_subbuffer, kbuffer_subbuffer,
+kbuffer_subbuffer_size, kbuffer_start_of_data - Creating of kbuffer element to parse
the Linux kernel tracing ring buffer
SYNOPSIS
@@ -33,6 +34,7 @@ void *kbuffer_free*(struct kbuffer pass:[*]_kbuf_);
int *kbuffer_load_subbuffer*(struct kbuffer pass:[*]_kbuf_, void pass:[*]_subbuffer_);
int *kbuffer_subbuffer_size*(struct kbuffer pass:[*]_kbuf);
int *kbuffer_start_of_data*(struct kbuffer pass:[*]_kbuf_);
+void pass:[*]*kbuffer_subbuffer*(struct kbuffer pass:[*]_kbuf);
--
DESCRIPTION
@@ -79,6 +81,10 @@ on the sub-buffer. It does not return the size of the sub-buffer itself.
The *kbuffer_start_of_data()* function returns the offset of where the actual
data load of the sub-buffer begins.
+The *kbuffer_subbuffer()* function returns the pointer to the currently loaded
+subbuffer. That is, the last subbuffer that was loaded by *kbuffer_load_subbuffer()*.
+If no subbuffer was loaded NULL is returned.
+
RETURN VALUE
------------
*kbuffer_alloc()* returns an allocated kbuffer descriptor or NULL on error.
@@ -92,6 +98,9 @@ of the last event is located.
*kbuffer_start_of_data()* returns the offset of where the data begins on the
sub-buffer loaded in _kbuf_.
+*kbuffer_subbuffer()* returns the last loaded subbuffer to _kbuf_ that was loaded
+by *kbuffer_load_subbuffer()* or NULL if none was loaded.
+
EXAMPLE
-------
[source,c]
@@ -185,6 +185,7 @@ kbuffer parsing:
void *kbuffer_free*(struct kbuffer pass:[*]_kbuf_);
int *kbuffer_load_subbuffer*(struct kbuffer pass:[*]_kbuf_, void pass:[*]_subbuffer_);
int *kbuffer_subbuffer_size*(struct kbuffer pass:[*]_kbuf);
+ void pass:[*]*kbuffer_subbuffer*(struct kbuffer pass:[*]_kbuf);
int *kbuffer_start_of_data*(struct kbuffer pass:[*]_kbuf_);
unsigned long long *kbuffer_timestamp*(struct kbuffer pass:[*]_kbuf_);
unsigned long long *kbuffer_subbuf_timestamp*(struct kbuffer pass:[*]_kbuf_, void pass:[*]_subbuf_);
@@ -52,6 +52,7 @@ int kbuffer_curr_size(struct kbuffer *kbuf);
int kbuffer_event_size(struct kbuffer *kbuf);
int kbuffer_missed_events(struct kbuffer *kbuf);
int kbuffer_subbuffer_size(struct kbuffer *kbuf);
+void *kbuffer_subbuffer(struct kbuffer *kbuf);
void kbuffer_set_old_format(struct kbuffer *kbuf);
int kbuffer_start_of_data(struct kbuffer *kbuf);
@@ -747,6 +747,17 @@ int kbuffer_subbuffer_size(struct kbuffer *kbuf)
return kbuf->size;
}
+/**
+ * kbuffer_subbuffer - the currently loaded subbuffer
+ * @kbuf: The kbuffer to read from
+ *
+ * Returns the currently loaded subbuffer.
+ */
+void *kbuffer_subbuffer(struct kbuffer *kbuf)
+{
+ return kbuf->subbuffer;
+}
+
/**
* kbuffer_curr_index - Return the index of the record
* @kbuf: The kbuffer to read from