1 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
3 * lttng-ring-buffer-client.h
5 * LTTng lib ring buffer client template.
7 * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 #include <linux/module.h>
11 #include <linux/types.h>
12 #include <lttng/bitfield.h>
13 #include <wrapper/vmalloc.h> /* for wrapper_vmalloc_sync_mappings() */
14 #include <wrapper/trace-clock.h>
15 #include <lttng/events.h>
16 #include <lttng/tracer.h>
17 #include <ringbuffer/frontend_types.h>
19 #define LTTNG_COMPACT_EVENT_BITS 5
20 #define LTTNG_COMPACT_TSC_BITS 27
22 static struct lttng_transport lttng_relay_transport
;
25 * Keep the natural field alignment for _each field_ within this structure if
26 * you ever add/remove a field from this header. Packed attribute is not used
27 * because gcc generates poor code on at least powerpc and mips. Don't ever
28 * let gcc add padding between the structure elements.
30 * The guarantee we have with timestamps is that all the events in a
31 * packet are included (inclusive) within the begin/end timestamps of
32 * the packet. Another guarantee we have is that the "timestamp begin",
33 * as well as the event timestamps, are monotonically increasing (never
34 * decrease) when moving forward in a stream (physically). But this
35 * guarantee does not apply to "timestamp end", because it is sampled at
36 * commit time, which is not ordered with respect to space reservation.
39 struct packet_header
{
40 /* Trace packet header */
43 * contains endianness information.
47 uint64_t stream_instance_id
;
50 /* Stream packet context */
51 uint64_t timestamp_begin
; /* Cycle count at subbuffer start */
52 uint64_t timestamp_end
; /* Cycle count at subbuffer end */
53 uint64_t content_size
; /* Size of data in subbuffer */
54 uint64_t packet_size
; /* Subbuffer size (include padding) */
55 uint64_t packet_seq_num
; /* Packet sequence number */
56 unsigned long events_discarded
; /*
57 * Events lost in this subbuffer since
58 * the beginning of the trace.
61 uint32_t cpu_id
; /* CPU id associated with stream */
62 uint8_t header_end
; /* End of header */
66 struct lttng_client_ctx
{
67 size_t packet_context_len
;
68 size_t event_context_len
;
71 static inline notrace u64
lib_ring_buffer_clock_read(struct channel
*chan
)
73 return trace_clock_read64();
77 size_t ctx_get_aligned_size(size_t offset
, struct lttng_ctx
*ctx
,
80 size_t orig_offset
= offset
;
84 offset
+= lib_ring_buffer_align(offset
, ctx
->largest_align
);
86 return offset
- orig_offset
;
90 void ctx_get_struct_size(struct lttng_ctx
*ctx
, size_t *ctx_len
,
91 struct lttng_channel
*chan
, struct lib_ring_buffer_ctx
*bufctx
)
100 for (i
= 0; i
< ctx
->nr_fields
; i
++) {
101 if (ctx
->fields
[i
].get_size
)
102 offset
+= ctx
->fields
[i
].get_size(offset
);
103 if (ctx
->fields
[i
].get_size_arg
)
104 offset
+= ctx
->fields
[i
].get_size_arg(offset
,
105 &ctx
->fields
[i
], bufctx
, chan
);
111 void ctx_record(struct lib_ring_buffer_ctx
*bufctx
,
112 struct lttng_channel
*chan
,
113 struct lttng_ctx
*ctx
)
119 lib_ring_buffer_align_ctx(bufctx
, ctx
->largest_align
);
120 for (i
= 0; i
< ctx
->nr_fields
; i
++)
121 ctx
->fields
[i
].record(&ctx
->fields
[i
], bufctx
, chan
);
125 * record_header_size - Calculate the header size and padding necessary.
126 * @config: ring buffer instance configuration
128 * @offset: offset in the write buffer
129 * @pre_header_padding: padding to add before the header (output)
130 * @ctx: reservation context
132 * Returns the event header size (including padding).
134 * The payload must itself determine its own alignment from the biggest type it
138 size_t record_header_size(const struct lib_ring_buffer_config
*config
,
139 struct channel
*chan
, size_t offset
,
140 size_t *pre_header_padding
,
141 struct lib_ring_buffer_ctx
*ctx
,
142 struct lttng_client_ctx
*client_ctx
)
144 struct lttng_channel
*lttng_chan
= channel_get_private(chan
);
145 struct lttng_probe_ctx
*lttng_probe_ctx
= ctx
->priv
;
146 struct lttng_event
*event
= lttng_probe_ctx
->event
;
147 size_t orig_offset
= offset
;
150 switch (lttng_chan
->header_type
) {
151 case 1: /* compact */
152 padding
= lib_ring_buffer_align(offset
, lttng_alignof(uint32_t));
154 if (!(ctx
->rflags
& (RING_BUFFER_RFLAG_FULL_TSC
| LTTNG_RFLAG_EXTENDED
))) {
155 offset
+= sizeof(uint32_t); /* id and timestamp */
157 /* Minimum space taken by LTTNG_COMPACT_EVENT_BITS id */
158 offset
+= (LTTNG_COMPACT_EVENT_BITS
+ CHAR_BIT
- 1) / CHAR_BIT
;
159 /* Align extended struct on largest member */
160 offset
+= lib_ring_buffer_align(offset
, lttng_alignof(uint64_t));
161 offset
+= sizeof(uint32_t); /* id */
162 offset
+= lib_ring_buffer_align(offset
, lttng_alignof(uint64_t));
163 offset
+= sizeof(uint64_t); /* timestamp */
167 padding
= lib_ring_buffer_align(offset
, lttng_alignof(uint16_t));
169 offset
+= sizeof(uint16_t);
170 if (!(ctx
->rflags
& (RING_BUFFER_RFLAG_FULL_TSC
| LTTNG_RFLAG_EXTENDED
))) {
171 offset
+= lib_ring_buffer_align(offset
, lttng_alignof(uint32_t));
172 offset
+= sizeof(uint32_t); /* timestamp */
174 /* Align extended struct on largest member */
175 offset
+= lib_ring_buffer_align(offset
, lttng_alignof(uint64_t));
176 offset
+= sizeof(uint32_t); /* id */
177 offset
+= lib_ring_buffer_align(offset
, lttng_alignof(uint64_t));
178 offset
+= sizeof(uint64_t); /* timestamp */
185 offset
+= ctx_get_aligned_size(offset
, lttng_chan
->ctx
,
186 client_ctx
->packet_context_len
);
187 offset
+= ctx_get_aligned_size(offset
, event
->ctx
,
188 client_ctx
->event_context_len
);
190 *pre_header_padding
= padding
;
191 return offset
- orig_offset
;
194 #include <ringbuffer/api.h>
197 void lttng_write_event_header_slow(const struct lib_ring_buffer_config
*config
,
198 struct lib_ring_buffer_ctx
*ctx
,
202 * lttng_write_event_header
204 * Writes the event header to the offset (already aligned on 32-bits).
206 * @config: ring buffer instance configuration
207 * @ctx: reservation context
208 * @event_id: event ID
211 void lttng_write_event_header(const struct lib_ring_buffer_config
*config
,
212 struct lib_ring_buffer_ctx
*ctx
,
215 struct lttng_channel
*lttng_chan
= channel_get_private(ctx
->chan
);
216 struct lttng_probe_ctx
*lttng_probe_ctx
= ctx
->priv
;
217 struct lttng_event
*event
= lttng_probe_ctx
->event
;
219 if (unlikely(ctx
->rflags
))
222 switch (lttng_chan
->header_type
) {
223 case 1: /* compact */
225 uint32_t id_time
= 0;
227 bt_bitfield_write(&id_time
, uint32_t,
229 LTTNG_COMPACT_EVENT_BITS
,
231 bt_bitfield_write(&id_time
, uint32_t,
232 LTTNG_COMPACT_EVENT_BITS
,
233 LTTNG_COMPACT_TSC_BITS
,
235 lib_ring_buffer_write(config
, ctx
, &id_time
, sizeof(id_time
));
240 uint32_t timestamp
= (uint32_t) ctx
->tsc
;
241 uint16_t id
= event_id
;
243 lib_ring_buffer_write(config
, ctx
, &id
, sizeof(id
));
244 lib_ring_buffer_align_ctx(ctx
, lttng_alignof(uint32_t));
245 lib_ring_buffer_write(config
, ctx
, ×tamp
, sizeof(timestamp
));
252 ctx_record(ctx
, lttng_chan
, lttng_chan
->ctx
);
253 ctx_record(ctx
, lttng_chan
, event
->ctx
);
254 lib_ring_buffer_align_ctx(ctx
, ctx
->largest_align
);
259 lttng_write_event_header_slow(config
, ctx
, event_id
);
263 void lttng_write_event_header_slow(const struct lib_ring_buffer_config
*config
,
264 struct lib_ring_buffer_ctx
*ctx
,
267 struct lttng_channel
*lttng_chan
= channel_get_private(ctx
->chan
);
268 struct lttng_probe_ctx
*lttng_probe_ctx
= ctx
->priv
;
269 struct lttng_event
*event
= lttng_probe_ctx
->event
;
271 switch (lttng_chan
->header_type
) {
272 case 1: /* compact */
273 if (!(ctx
->rflags
& (RING_BUFFER_RFLAG_FULL_TSC
| LTTNG_RFLAG_EXTENDED
))) {
274 uint32_t id_time
= 0;
276 bt_bitfield_write(&id_time
, uint32_t,
278 LTTNG_COMPACT_EVENT_BITS
,
280 bt_bitfield_write(&id_time
, uint32_t,
281 LTTNG_COMPACT_EVENT_BITS
,
282 LTTNG_COMPACT_TSC_BITS
, ctx
->tsc
);
283 lib_ring_buffer_write(config
, ctx
, &id_time
, sizeof(id_time
));
286 uint64_t timestamp
= ctx
->tsc
;
288 bt_bitfield_write(&id
, uint8_t,
290 LTTNG_COMPACT_EVENT_BITS
,
292 lib_ring_buffer_write(config
, ctx
, &id
, sizeof(id
));
293 /* Align extended struct on largest member */
294 lib_ring_buffer_align_ctx(ctx
, lttng_alignof(uint64_t));
295 lib_ring_buffer_write(config
, ctx
, &event_id
, sizeof(event_id
));
296 lib_ring_buffer_align_ctx(ctx
, lttng_alignof(uint64_t));
297 lib_ring_buffer_write(config
, ctx
, ×tamp
, sizeof(timestamp
));
302 if (!(ctx
->rflags
& (RING_BUFFER_RFLAG_FULL_TSC
| LTTNG_RFLAG_EXTENDED
))) {
303 uint32_t timestamp
= (uint32_t) ctx
->tsc
;
304 uint16_t id
= event_id
;
306 lib_ring_buffer_write(config
, ctx
, &id
, sizeof(id
));
307 lib_ring_buffer_align_ctx(ctx
, lttng_alignof(uint32_t));
308 lib_ring_buffer_write(config
, ctx
, ×tamp
, sizeof(timestamp
));
311 uint64_t timestamp
= ctx
->tsc
;
313 lib_ring_buffer_write(config
, ctx
, &id
, sizeof(id
));
314 /* Align extended struct on largest member */
315 lib_ring_buffer_align_ctx(ctx
, lttng_alignof(uint64_t));
316 lib_ring_buffer_write(config
, ctx
, &event_id
, sizeof(event_id
));
317 lib_ring_buffer_align_ctx(ctx
, lttng_alignof(uint64_t));
318 lib_ring_buffer_write(config
, ctx
, ×tamp
, sizeof(timestamp
));
325 ctx_record(ctx
, lttng_chan
, lttng_chan
->ctx
);
326 ctx_record(ctx
, lttng_chan
, event
->ctx
);
327 lib_ring_buffer_align_ctx(ctx
, ctx
->largest_align
);
330 static const struct lib_ring_buffer_config client_config
;
332 static u64
client_ring_buffer_clock_read(struct channel
*chan
)
334 return lib_ring_buffer_clock_read(chan
);
338 size_t client_record_header_size(const struct lib_ring_buffer_config
*config
,
339 struct channel
*chan
, size_t offset
,
340 size_t *pre_header_padding
,
341 struct lib_ring_buffer_ctx
*ctx
,
344 return record_header_size(config
, chan
, offset
,
345 pre_header_padding
, ctx
, client_ctx
);
349 * client_packet_header_size - called on buffer-switch to a new sub-buffer
351 * Return header size without padding after the structure. Don't use packed
352 * structure because gcc generates inefficient code on some architectures
355 static size_t client_packet_header_size(void)
357 return offsetof(struct packet_header
, ctx
.header_end
);
360 static void client_buffer_begin(struct lib_ring_buffer
*buf
, u64 tsc
,
361 unsigned int subbuf_idx
)
363 struct channel
*chan
= buf
->backend
.chan
;
364 struct packet_header
*header
=
365 (struct packet_header
*)
366 lib_ring_buffer_offset_address(&buf
->backend
,
367 subbuf_idx
* chan
->backend
.subbuf_size
);
368 struct lttng_channel
*lttng_chan
= channel_get_private(chan
);
369 struct lttng_session
*session
= lttng_chan
->session
;
371 header
->magic
= CTF_MAGIC_NUMBER
;
372 memcpy(header
->uuid
, session
->uuid
.b
, sizeof(session
->uuid
));
373 header
->stream_id
= lttng_chan
->id
;
374 header
->stream_instance_id
= buf
->backend
.cpu
;
375 header
->ctx
.timestamp_begin
= tsc
;
376 header
->ctx
.timestamp_end
= 0;
377 header
->ctx
.content_size
= ~0ULL; /* for debugging */
378 header
->ctx
.packet_size
= ~0ULL;
379 header
->ctx
.packet_seq_num
= chan
->backend
.num_subbuf
* \
380 buf
->backend
.buf_cnt
[subbuf_idx
].seq_cnt
+ \
382 header
->ctx
.events_discarded
= 0;
383 header
->ctx
.cpu_id
= buf
->backend
.cpu
;
387 * offset is assumed to never be 0 here : never deliver a completely empty
388 * subbuffer. data_size is between 1 and subbuf_size.
390 static void client_buffer_end(struct lib_ring_buffer
*buf
, u64 tsc
,
391 unsigned int subbuf_idx
, unsigned long data_size
)
393 struct channel
*chan
= buf
->backend
.chan
;
394 struct packet_header
*header
=
395 (struct packet_header
*)
396 lib_ring_buffer_offset_address(&buf
->backend
,
397 subbuf_idx
* chan
->backend
.subbuf_size
);
398 unsigned long records_lost
= 0;
400 header
->ctx
.timestamp_end
= tsc
;
401 header
->ctx
.content_size
=
402 (uint64_t) data_size
* CHAR_BIT
; /* in bits */
403 header
->ctx
.packet_size
=
404 (uint64_t) PAGE_ALIGN(data_size
) * CHAR_BIT
; /* in bits */
405 records_lost
+= lib_ring_buffer_get_records_lost_full(&client_config
, buf
);
406 records_lost
+= lib_ring_buffer_get_records_lost_wrap(&client_config
, buf
);
407 records_lost
+= lib_ring_buffer_get_records_lost_big(&client_config
, buf
);
408 header
->ctx
.events_discarded
= records_lost
;
411 static int client_buffer_create(struct lib_ring_buffer
*buf
, void *priv
,
412 int cpu
, const char *name
)
417 static void client_buffer_finalize(struct lib_ring_buffer
*buf
, void *priv
, int cpu
)
421 static struct packet_header
*client_packet_header(
422 const struct lib_ring_buffer_config
*config
,
423 struct lib_ring_buffer
*buf
)
425 return lib_ring_buffer_read_offset_address(&buf
->backend
, 0);
428 static int client_timestamp_begin(const struct lib_ring_buffer_config
*config
,
429 struct lib_ring_buffer
*buf
,
430 uint64_t *timestamp_begin
)
432 struct packet_header
*header
= client_packet_header(config
, buf
);
433 *timestamp_begin
= header
->ctx
.timestamp_begin
;
438 static int client_timestamp_end(const struct lib_ring_buffer_config
*config
,
439 struct lib_ring_buffer
*buf
,
440 uint64_t *timestamp_end
)
442 struct packet_header
*header
= client_packet_header(config
, buf
);
443 *timestamp_end
= header
->ctx
.timestamp_end
;
448 static int client_events_discarded(const struct lib_ring_buffer_config
*config
,
449 struct lib_ring_buffer
*buf
,
450 uint64_t *events_discarded
)
452 struct packet_header
*header
= client_packet_header(config
, buf
);
453 *events_discarded
= header
->ctx
.events_discarded
;
458 static int client_content_size(const struct lib_ring_buffer_config
*config
,
459 struct lib_ring_buffer
*buf
,
460 uint64_t *content_size
)
462 struct packet_header
*header
= client_packet_header(config
, buf
);
463 *content_size
= header
->ctx
.content_size
;
468 static int client_packet_size(const struct lib_ring_buffer_config
*config
,
469 struct lib_ring_buffer
*buf
,
470 uint64_t *packet_size
)
472 struct packet_header
*header
= client_packet_header(config
, buf
);
473 *packet_size
= header
->ctx
.packet_size
;
478 static int client_stream_id(const struct lib_ring_buffer_config
*config
,
479 struct lib_ring_buffer
*buf
,
482 struct channel
*chan
= buf
->backend
.chan
;
483 struct lttng_channel
*lttng_chan
= channel_get_private(chan
);
485 *stream_id
= lttng_chan
->id
;
489 static int client_current_timestamp(const struct lib_ring_buffer_config
*config
,
490 struct lib_ring_buffer
*bufb
,
493 *ts
= config
->cb
.ring_buffer_clock_read(bufb
->backend
.chan
);
498 static int client_sequence_number(const struct lib_ring_buffer_config
*config
,
499 struct lib_ring_buffer
*buf
,
502 struct packet_header
*header
= client_packet_header(config
, buf
);
504 *seq
= header
->ctx
.packet_seq_num
;
510 int client_instance_id(const struct lib_ring_buffer_config
*config
,
511 struct lib_ring_buffer
*buf
,
514 *id
= buf
->backend
.cpu
;
519 static const struct lib_ring_buffer_config client_config
= {
520 .cb
.ring_buffer_clock_read
= client_ring_buffer_clock_read
,
521 .cb
.record_header_size
= client_record_header_size
,
522 .cb
.subbuffer_header_size
= client_packet_header_size
,
523 .cb
.buffer_begin
= client_buffer_begin
,
524 .cb
.buffer_end
= client_buffer_end
,
525 .cb
.buffer_create
= client_buffer_create
,
526 .cb
.buffer_finalize
= client_buffer_finalize
,
528 .tsc_bits
= LTTNG_COMPACT_TSC_BITS
,
529 .alloc
= RING_BUFFER_ALLOC_PER_CPU
,
530 .sync
= RING_BUFFER_SYNC_PER_CPU
,
531 .mode
= RING_BUFFER_MODE_TEMPLATE
,
532 .backend
= RING_BUFFER_PAGE
,
533 .output
= RING_BUFFER_OUTPUT_TEMPLATE
,
534 .oops
= RING_BUFFER_OOPS_CONSISTENCY
,
535 .ipi
= RING_BUFFER_IPI_BARRIER
,
536 .wakeup
= RING_BUFFER_WAKEUP_BY_TIMER
,
540 void release_priv_ops(void *priv_ops
)
542 module_put(THIS_MODULE
);
546 void lttng_channel_destroy(struct channel
*chan
)
548 channel_destroy(chan
);
552 struct channel
*_channel_create(const char *name
,
553 struct lttng_channel
*lttng_chan
, void *buf_addr
,
554 size_t subbuf_size
, size_t num_subbuf
,
555 unsigned int switch_timer_interval
,
556 unsigned int read_timer_interval
)
558 struct channel
*chan
;
560 chan
= channel_create(&client_config
, name
, lttng_chan
, buf_addr
,
561 subbuf_size
, num_subbuf
, switch_timer_interval
,
562 read_timer_interval
);
565 * Ensure this module is not unloaded before we finish
566 * using lttng_relay_transport.ops.
568 if (!try_module_get(THIS_MODULE
)) {
569 printk(KERN_WARNING
"LTT : Can't lock transport module.\n");
572 chan
->backend
.priv_ops
= <tng_relay_transport
.ops
;
573 chan
->backend
.release_priv_ops
= release_priv_ops
;
578 lttng_channel_destroy(chan
);
583 struct lib_ring_buffer
*lttng_buffer_read_open(struct channel
*chan
)
585 struct lib_ring_buffer
*buf
;
588 for_each_channel_cpu(cpu
, chan
) {
589 buf
= channel_get_ring_buffer(&client_config
, chan
, cpu
);
590 if (!lib_ring_buffer_open_read(buf
))
597 int lttng_buffer_has_read_closed_stream(struct channel
*chan
)
599 struct lib_ring_buffer
*buf
;
602 for_each_channel_cpu(cpu
, chan
) {
603 buf
= channel_get_ring_buffer(&client_config
, chan
, cpu
);
604 if (!atomic_long_read(&buf
->active_readers
))
611 void lttng_buffer_read_close(struct lib_ring_buffer
*buf
)
613 lib_ring_buffer_release_read(buf
);
617 int lttng_event_reserve(struct lib_ring_buffer_ctx
*ctx
,
620 struct lttng_channel
*lttng_chan
= channel_get_private(ctx
->chan
);
621 struct lttng_probe_ctx
*lttng_probe_ctx
= ctx
->priv
;
622 struct lttng_event
*event
= lttng_probe_ctx
->event
;
623 struct lttng_client_ctx client_ctx
;
626 cpu
= lib_ring_buffer_get_cpu(&client_config
);
627 if (unlikely(cpu
< 0))
631 /* Compute internal size of context structures. */
632 ctx_get_struct_size(lttng_chan
->ctx
, &client_ctx
.packet_context_len
, lttng_chan
, ctx
);
633 ctx_get_struct_size(event
->ctx
, &client_ctx
.event_context_len
, lttng_chan
, ctx
);
635 switch (lttng_chan
->header_type
) {
636 case 1: /* compact */
638 ctx
->rflags
|= LTTNG_RFLAG_EXTENDED
;
641 if (event_id
> 65534)
642 ctx
->rflags
|= LTTNG_RFLAG_EXTENDED
;
648 ret
= lib_ring_buffer_reserve(&client_config
, ctx
, &client_ctx
);
651 lib_ring_buffer_backend_get_pages(&client_config
, ctx
,
652 &ctx
->backend_pages
);
653 lttng_write_event_header(&client_config
, ctx
, event_id
);
656 lib_ring_buffer_put_cpu(&client_config
);
661 void lttng_event_commit(struct lib_ring_buffer_ctx
*ctx
)
663 lib_ring_buffer_commit(&client_config
, ctx
);
664 lib_ring_buffer_put_cpu(&client_config
);
668 void lttng_event_write(struct lib_ring_buffer_ctx
*ctx
, const void *src
,
671 lib_ring_buffer_write(&client_config
, ctx
, src
, len
);
675 void lttng_event_write_from_user(struct lib_ring_buffer_ctx
*ctx
,
676 const void __user
*src
, size_t len
)
678 lib_ring_buffer_copy_from_user_inatomic(&client_config
, ctx
, src
, len
);
682 void lttng_event_memset(struct lib_ring_buffer_ctx
*ctx
,
685 lib_ring_buffer_memset(&client_config
, ctx
, c
, len
);
689 void lttng_event_strcpy(struct lib_ring_buffer_ctx
*ctx
, const char *src
,
692 lib_ring_buffer_strcpy(&client_config
, ctx
, src
, len
, '#');
696 void lttng_event_strcpy_from_user(struct lib_ring_buffer_ctx
*ctx
,
697 const char __user
*src
, size_t len
)
699 lib_ring_buffer_strcpy_from_user_inatomic(&client_config
, ctx
, src
,
704 wait_queue_head_t
*lttng_get_writer_buf_wait_queue(struct channel
*chan
, int cpu
)
706 struct lib_ring_buffer
*buf
= channel_get_ring_buffer(&client_config
,
708 return &buf
->write_wait
;
712 wait_queue_head_t
*lttng_get_hp_wait_queue(struct channel
*chan
)
714 return &chan
->hp_wait
;
718 int lttng_is_finalized(struct channel
*chan
)
720 return lib_ring_buffer_channel_is_finalized(chan
);
724 int lttng_is_disabled(struct channel
*chan
)
726 return lib_ring_buffer_channel_is_disabled(chan
);
729 static struct lttng_transport lttng_relay_transport
= {
730 .name
= "relay-" RING_BUFFER_MODE_TEMPLATE_STRING
,
731 .owner
= THIS_MODULE
,
733 .channel_create
= _channel_create
,
734 .channel_destroy
= lttng_channel_destroy
,
735 .buffer_read_open
= lttng_buffer_read_open
,
736 .buffer_has_read_closed_stream
=
737 lttng_buffer_has_read_closed_stream
,
738 .buffer_read_close
= lttng_buffer_read_close
,
739 .event_reserve
= lttng_event_reserve
,
740 .event_commit
= lttng_event_commit
,
741 .event_write
= lttng_event_write
,
742 .event_write_from_user
= lttng_event_write_from_user
,
743 .event_memset
= lttng_event_memset
,
744 .event_strcpy
= lttng_event_strcpy
,
745 .event_strcpy_from_user
= lttng_event_strcpy_from_user
,
746 .packet_avail_size
= NULL
, /* Would be racy anyway */
747 .get_writer_buf_wait_queue
= lttng_get_writer_buf_wait_queue
,
748 .get_hp_wait_queue
= lttng_get_hp_wait_queue
,
749 .is_finalized
= lttng_is_finalized
,
750 .is_disabled
= lttng_is_disabled
,
751 .timestamp_begin
= client_timestamp_begin
,
752 .timestamp_end
= client_timestamp_end
,
753 .events_discarded
= client_events_discarded
,
754 .content_size
= client_content_size
,
755 .packet_size
= client_packet_size
,
756 .stream_id
= client_stream_id
,
757 .current_timestamp
= client_current_timestamp
,
758 .sequence_number
= client_sequence_number
,
759 .instance_id
= client_instance_id
,
763 static int __init
lttng_ring_buffer_client_init(void)
766 * This vmalloc sync all also takes care of the lib ring buffer
767 * vmalloc'd module pages when it is built as a module into LTTng.
769 wrapper_vmalloc_sync_mappings();
770 lttng_transport_register(<tng_relay_transport
);
774 module_init(lttng_ring_buffer_client_init
);
776 static void __exit
lttng_ring_buffer_client_exit(void)
778 lttng_transport_unregister(<tng_relay_transport
);
781 module_exit(lttng_ring_buffer_client_exit
);
783 MODULE_LICENSE("GPL and additional rights");
784 MODULE_AUTHOR("Mathieu Desnoyers <mathieu.desnoyers@efficios.com>");
785 MODULE_DESCRIPTION("LTTng ring buffer " RING_BUFFER_MODE_TEMPLATE_STRING
787 MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION
) "."
788 __stringify(LTTNG_MODULES_MINOR_VERSION
) "."
789 __stringify(LTTNG_MODULES_PATCHLEVEL_VERSION
)
790 LTTNG_MODULES_EXTRAVERSION
);