On Wed, 13 Dec 2023 01:35:16 +0100
Alexander Graf [off-list ref] wrote:
quoted
The trace_array is the structure that represents each tracing instance. And
it already has a name field. And if you can get the associated ring buffer
from that too.
struct trace_array *tr;
tr->array_buffer.buffer
tr->name
When you do: mkdir /sys/kernel/tracing/instance/foo
You create a new trace_array instance where tr->name = "foo" and allocates
the buffer for it as well.
The name in the ring buffer is pretty much just a copy of the trace
array name. I use it to reconstruct which buffer we're actually
referring to inside __ring_buffer_alloc().
No, I rather not tie the ring buffer to the trace_array.
I'm all ears for alternative suggestions. I suppose we could pass tr as
argument to ring_buffer_alloc() instead of the name?
I'll have to spend some time (that I don't currently have :-( ) on looking
at this more. I really don't like the copying of the name into the ring
buffer allocation, as it may be an unneeded burden to maintain, not to
mention the duplicate field.
-- Steve