* Dual LGPL v2.1/GPL v2 license.
*/
-#include <linux/module.h>
-#include <linux/types.h>
-#include "lib/bitfield.h"
-#include "wrapper/vmalloc.h" /* for wrapper_vmalloc_sync_all() */
-#include "wrapper/trace-clock.h"
-#include "ltt-events.h"
+#include <stdint.h>
+#include <ust/lttng-events.h>
+#include "ust/bitfield.h"
+#include "ust/clock.h"
#include "ltt-tracer.h"
-#include "wrapper/ringbuffer/frontend_types.h"
+#include "../libringbuffer/frontend_types.h"
/*
* Keep the natural field alignment for _each field_ within this structure if
}
break;
default:
+ padding = 0;
WARN_ON_ONCE(1);
}
offset += ctx_get_size(offset, event->ctx);
return offset - orig_offset;
}
-#include "wrapper/ringbuffer/api.h"
+#include "../libringbuffer/api.h"
-extern
+static
void ltt_write_event_header_slow(const struct lib_ring_buffer_config *config,
struct lib_ring_buffer_ctx *ctx,
uint32_t event_id);
WARN_ON_ONCE(1);
}
- ctx_record(ctx, ltt_chan, event->ctx);
ctx_record(ctx, ltt_chan, ltt_chan->ctx);
+ ctx_record(ctx, ltt_chan, event->ctx);
return;
ltt_write_event_header_slow(config, ctx, event_id);
}
+static
void ltt_write_event_header_slow(const struct lib_ring_buffer_config *config,
struct lib_ring_buffer_ctx *ctx,
uint32_t event_id)
default:
WARN_ON_ONCE(1);
}
- ctx_record(ctx, ltt_chan, event->ctx);
ctx_record(ctx, ltt_chan, ltt_chan->ctx);
+ ctx_record(ctx, ltt_chan, event->ctx);
}
static const struct lib_ring_buffer_config client_config;
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 packet_header *header =
(struct packet_header *)
lib_ring_buffer_offset_address(&buf->backend,
struct ltt_session *session = ltt_chan->session;
header->magic = CTF_MAGIC_NUMBER;
- memcpy(header->uuid, session->uuid.b, sizeof(session->uuid));
+ memcpy(header->uuid, session->uuid, sizeof(session->uuid));
header->stream_id = ltt_chan->id;
header->ctx.timestamp_begin = tsc;
header->ctx.timestamp_end = 0;
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 packet_header *header =
(struct packet_header *)
lib_ring_buffer_offset_address(&buf->backend,
};
static
-struct channel *_channel_create(const char *name,
+struct shm_handle *_channel_create(const char *name,
struct ltt_channel *ltt_chan, void *buf_addr,
size_t subbuf_size, size_t num_subbuf,
unsigned int switch_timer_interval,
}
static
-void ltt_channel_destroy(struct channel *chan)
+void ltt_channel_destroy(struct shm_handle *handle)
{
- channel_destroy(chan);
+ channel_destroy(handle);
}
static
lib_ring_buffer_write(&client_config, ctx, src, len);
}
+#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 = NULL, /* Would be racy anyway */
- .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 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 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");