Add license info about lib/ringbuffer/ring_buffer_mmap.c being GPLv2
[lttng-modules.git] / ltt-ring-buffer-metadata-client.h
index a687b7050adfa94a3049b0f56e301a8c81611355..65509f8475a9d87f2a9279103c9d2f326aa9106f 100644 (file)
@@ -23,6 +23,8 @@ struct metadata_packet_header {
        uint8_t  compression_scheme;    /* 0 if unused */
        uint8_t  encryption_scheme;     /* 0 if unused */
        uint8_t  checksum_scheme;       /* 0 if unused */
+       uint8_t  major;                 /* CTF spec major version number */
+       uint8_t  minor;                 /* CTF spec minor version number */
        uint8_t  header_end[0];
 };
 
@@ -94,6 +96,8 @@ static void client_buffer_begin(struct lib_ring_buffer *buf, u64 tsc,
        header->compression_scheme = 0; /* 0 if unused */
        header->encryption_scheme = 0;  /* 0 if unused */
        header->checksum_scheme = 0;    /* 0 if unused */
+       header->major = CTF_SPEC_MAJOR;
+       header->minor = CTF_SPEC_MINOR;
 }
 
 /*
@@ -142,7 +146,7 @@ static const struct lib_ring_buffer_config client_config = {
        .sync = RING_BUFFER_SYNC_GLOBAL,
        .mode = RING_BUFFER_MODE_TEMPLATE,
        .backend = RING_BUFFER_PAGE,
-       .output = RING_BUFFER_SPLICE,
+       .output = RING_BUFFER_OUTPUT_TEMPLATE,
        .oops = RING_BUFFER_OOPS_CONSISTENCY,
        .ipi = RING_BUFFER_IPI_BARRIER,
        .wakeup = RING_BUFFER_WAKEUP_BY_TIMER,
@@ -177,6 +181,20 @@ struct lib_ring_buffer *ltt_buffer_read_open(struct channel *chan)
        return NULL;
 }
 
+static
+int ltt_buffer_has_read_closed_stream(struct channel *chan)
+{
+       struct lib_ring_buffer *buf;
+       int cpu;
+
+       for_each_channel_cpu(cpu, chan) {
+               buf = channel_get_ring_buffer(&client_config, chan, cpu);
+               if (!atomic_long_read(&buf->active_readers))
+                       return 1;
+       }
+       return 0;
+}
+
 static
 void ltt_buffer_read_close(struct lib_ring_buffer *buf)
 {
@@ -237,6 +255,12 @@ int ltt_is_finalized(struct channel *chan)
        return lib_ring_buffer_channel_is_finalized(chan);
 }
 
+static
+int ltt_is_disabled(struct channel *chan)
+{
+       return lib_ring_buffer_channel_is_disabled(chan);
+}
+
 static struct ltt_transport ltt_relay_transport = {
        .name = "relay-" RING_BUFFER_MODE_TEMPLATE_STRING,
        .owner = THIS_MODULE,
@@ -244,6 +268,8 @@ static struct ltt_transport ltt_relay_transport = {
                .channel_create = _channel_create,
                .channel_destroy = ltt_channel_destroy,
                .buffer_read_open = ltt_buffer_read_open,
+               .buffer_has_read_closed_stream =
+                       ltt_buffer_has_read_closed_stream,
                .buffer_read_close = ltt_buffer_read_close,
                .event_reserve = ltt_event_reserve,
                .event_commit = ltt_event_commit,
@@ -252,6 +278,7 @@ static struct ltt_transport ltt_relay_transport = {
                .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,
        },
 };
 
@@ -262,7 +289,6 @@ static int __init ltt_ring_buffer_client_init(void)
         * 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");
        ltt_transport_register(&ltt_relay_transport);
        return 0;
 }
@@ -271,7 +297,6 @@ module_init(ltt_ring_buffer_client_init);
 
 static void __exit ltt_ring_buffer_client_exit(void)
 {
-       printk(KERN_INFO "LTT : ltt ring buffer metadata client exit\n");
        ltt_transport_unregister(&ltt_relay_transport);
 }
 
This page took 0.025586 seconds and 4 git commands to generate.