* Dual LGPL v2.1/GPL v2 license.
*/
-#include <linux/module.h>
-#include <linux/types.h>
-#include "wrapper/vmalloc.h" /* for wrapper_vmalloc_sync_all() */
+#include <stdint.h>
+#include "ust/bitfield.h"
#include "ltt-events.h"
#include "ltt-tracer.h"
+#include "../libringbuffer/frontend_types.h"
struct metadata_packet_header {
uint32_t magic; /* 0x75D11D57 */
return 0;
}
-#include "wrapper/ringbuffer/api.h"
+#include "../libringbuffer/api.h"
static u64 client_ring_buffer_clock_read(struct channel *chan)
{
static void client_buffer_begin(struct lib_ring_buffer *buf, u64 tsc,
unsigned int subbuf_idx)
{
- struct channel *chan = buf->backend.chan;
+ struct channel *chan = shmp(buf->backend.chan);
struct metadata_packet_header *header =
(struct metadata_packet_header *)
lib_ring_buffer_offset_address(&buf->backend,
struct ltt_session *session = ltt_chan->session;
header->magic = TSDL_MAGIC_NUMBER;
- memcpy(header->uuid, session->uuid.b, sizeof(session->uuid));
+ memcpy(header->uuid, session->uuid, sizeof(session->uuid));
header->checksum = 0; /* 0 if unused */
header->content_size = 0xFFFFFFFF; /* in bits, for debugging */
header->packet_size = 0xFFFFFFFF; /* in bits, for debugging */
static void client_buffer_end(struct lib_ring_buffer *buf, u64 tsc,
unsigned int subbuf_idx, unsigned long data_size)
{
- struct channel *chan = buf->backend.chan;
+ struct channel *chan = shmp(buf->backend.chan);
struct metadata_packet_header *header =
(struct metadata_packet_header *)
lib_ring_buffer_offset_address(&buf->backend,
struct ltt_channel *ltt_chan, void *buf_addr,
size_t subbuf_size, size_t num_subbuf,
unsigned int switch_timer_interval,
- unsigned int read_timer_interval)
+ unsigned int read_timer_interval,
+ int *shmid)
{
return channel_create(&client_config, name, ltt_chan, buf_addr,
subbuf_size, num_subbuf, switch_timer_interval,
- read_timer_interval);
+ read_timer_interval, shmid);
}
static
unsigned long o_begin;
struct lib_ring_buffer *buf;
- buf = chan->backend.buf; /* Only for global buffer ! */
+ buf = shmp(chan->backend.buf); /* Only for global buffer ! */
o_begin = v_read(&client_config, &buf->offset);
if (subbuf_offset(o_begin, chan) != 0) {
return chan->backend.subbuf_size - subbuf_offset(o_begin, chan);
}
}
+#if 0
static
wait_queue_head_t *ltt_get_reader_wait_queue(struct channel *chan)
{
{
return &chan->hp_wait;
}
+#endif //0
static
int ltt_is_finalized(struct channel *chan)
static struct ltt_transport ltt_relay_transport = {
.name = "relay-" RING_BUFFER_MODE_TEMPLATE_STRING,
- .owner = THIS_MODULE,
.ops = {
.channel_create = _channel_create,
.channel_destroy = ltt_channel_destroy,
.event_commit = ltt_event_commit,
.event_write = ltt_event_write,
.packet_avail_size = ltt_packet_avail_size,
- .get_reader_wait_queue = ltt_get_reader_wait_queue,
- .get_hp_wait_queue = ltt_get_hp_wait_queue,
+ //.get_reader_wait_queue = ltt_get_reader_wait_queue,
+ //.get_hp_wait_queue = ltt_get_hp_wait_queue,
.is_finalized = ltt_is_finalized,
.is_disabled = ltt_is_disabled,
},
};
-static int __init ltt_ring_buffer_client_init(void)
+static
+void __attribute__((constructor)) ltt_ring_buffer_client_init(void)
{
- /*
- * This vmalloc sync all also takes care of the lib ring buffer
- * vmalloc'd module pages when it is built as a module into LTTng.
- */
- wrapper_vmalloc_sync_all();
- printk(KERN_INFO "LTT : ltt ring buffer metadata client init\n");
+ printf("LTT : ltt ring buffer client init\n");
ltt_transport_register(<t_relay_transport);
- return 0;
}
-module_init(ltt_ring_buffer_client_init);
-
-static void __exit ltt_ring_buffer_client_exit(void)
+static
+void __attribute__((destructor)) ltt_ring_buffer_client_exit(void)
{
- printk(KERN_INFO "LTT : ltt ring buffer metadata client exit\n");
+ printf("LTT : ltt ring buffer client exit\n");
ltt_transport_unregister(<t_relay_transport);
}
-
-module_exit(ltt_ring_buffer_client_exit);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("LTTng ring buffer " RING_BUFFER_MODE_TEMPLATE_STRING
- " client");