Use lttng_ prefixed namespace for lttng prio heap
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 25 May 2011 18:52:29 +0000 (14:52 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 25 May 2011 18:52:29 +0000 (14:52 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lib/Makefile
lib/prio_heap/lttng_prio_heap.c [new file with mode: 0644]
lib/prio_heap/lttng_prio_heap.h [new file with mode: 0644]
lib/prio_heap/prio_heap.c [deleted file]
lib/prio_heap/prio_heap.h [deleted file]
lib/ringbuffer/frontend_internal.h
lib/ringbuffer/frontend_types.h
lib/ringbuffer/ring_buffer_iterator.c
wrapper/prio_heap.h [deleted file]

index 12af70c4d94f567b891a482ba3ed9f9b20892b3b..9fa49efc9b7037766e326bb87bc4497175c436dd 100644 (file)
@@ -7,4 +7,4 @@ lib-ring-buffer-objs := \
        ringbuffer/ring_buffer_vfs.o \
        ringbuffer/ring_buffer_splice.o \
        ringbuffer/ring_buffer_mmap.o \
-       prio_heap/prio_heap.o
+       prio_heap/lttng_prio_heap.o
diff --git a/lib/prio_heap/lttng_prio_heap.c b/lib/prio_heap/lttng_prio_heap.c
new file mode 100644 (file)
index 0000000..5bbd079
--- /dev/null
@@ -0,0 +1,206 @@
+/*
+ * lttng_prio_heap.c
+ *
+ * Priority heap containing pointers. Based on CLRS, chapter 6.
+ *
+ * Copyright 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ */
+
+#include <linux/slab.h>
+#include "lttng_prio_heap.h"
+
+#ifdef DEBUG_HEAP
+void lttng_check_heap(const struct lttng_ptr_heap *heap)
+{
+       size_t i;
+
+       if (!heap->len)
+               return;
+
+       for (i = 1; i < heap->len; i++)
+               WARN_ON_ONCE(!heap->gt(heap->ptrs[i], heap->ptrs[0]));
+}
+#endif
+
+static
+size_t parent(size_t i)
+{
+       return (i -1) >> 1;
+}
+
+static
+size_t left(size_t i)
+{
+       return (i << 1) + 1;
+}
+
+static
+size_t right(size_t i)
+{
+       return (i << 1) + 2;
+}
+
+/*
+ * Copy of heap->ptrs pointer is invalid after heap_grow.
+ */
+static
+int heap_grow(struct lttng_ptr_heap *heap, size_t new_len)
+{
+       void **new_ptrs;
+
+       if (heap->alloc_len >= new_len)
+               return 0;
+
+       heap->alloc_len = max_t(size_t, new_len, heap->alloc_len << 1);
+       new_ptrs = kmalloc(heap->alloc_len * sizeof(void *), heap->gfpmask);
+       if (!new_ptrs)
+               return -ENOMEM;
+       if (heap->ptrs)
+               memcpy(new_ptrs, heap->ptrs, heap->len * sizeof(void *));
+       kfree(heap->ptrs);
+       heap->ptrs = new_ptrs;
+       return 0;
+}
+
+static
+int heap_set_len(struct lttng_ptr_heap *heap, size_t new_len)
+{
+       int ret;
+
+       ret = heap_grow(heap, new_len);
+       if (ret)
+               return ret;
+       heap->len = new_len;
+       return 0;
+}
+
+int lttng_heap_init(struct lttng_ptr_heap *heap, size_t alloc_len,
+             gfp_t gfpmask, int gt(void *a, void *b))
+{
+       heap->ptrs = NULL;
+       heap->len = 0;
+       heap->alloc_len = 0;
+       heap->gt = gt;
+       /*
+        * Minimum size allocated is 1 entry to ensure memory allocation
+        * never fails within heap_replace_max.
+        */
+       return heap_grow(heap, max_t(size_t, 1, alloc_len));
+}
+
+void lttng_heap_free(struct lttng_ptr_heap *heap)
+{
+       kfree(heap->ptrs);
+}
+
+static void heapify(struct lttng_ptr_heap *heap, size_t i)
+{
+       void **ptrs = heap->ptrs;
+       size_t l, r, largest;
+
+       for (;;) {
+               void *tmp;
+
+               l = left(i);
+               r = right(i);
+               if (l < heap->len && heap->gt(ptrs[l], ptrs[i]))
+                       largest = l;
+               else
+                       largest = i;
+               if (r < heap->len && heap->gt(ptrs[r], ptrs[largest]))
+                       largest = r;
+               if (largest == i)
+                       break;
+               tmp = ptrs[i];
+               ptrs[i] = ptrs[largest];
+               ptrs[largest] = tmp;
+               i = largest;
+       }
+       lttng_check_heap(heap);
+}
+
+void *lttng_heap_replace_max(struct lttng_ptr_heap *heap, void *p)
+{
+       void *res;
+
+       if (!heap->len) {
+               (void) heap_set_len(heap, 1);
+               heap->ptrs[0] = p;
+               lttng_check_heap(heap);
+               return NULL;
+       }
+
+       /* Replace the current max and heapify */
+       res = heap->ptrs[0];
+       heap->ptrs[0] = p;
+       heapify(heap, 0);
+       return res;
+}
+
+int lttng_heap_insert(struct lttng_ptr_heap *heap, void *p)
+{
+       void **ptrs;
+       size_t pos;
+       int ret;
+
+       ret = heap_set_len(heap, heap->len + 1);
+       if (ret)
+               return ret;
+       ptrs = heap->ptrs;
+       pos = heap->len - 1;
+       while (pos > 0 && heap->gt(p, ptrs[parent(pos)])) {
+               /* Move parent down until we find the right spot */
+               ptrs[pos] = ptrs[parent(pos)];
+               pos = parent(pos);
+       }
+       ptrs[pos] = p;
+       lttng_check_heap(heap);
+       return 0;
+}
+
+void *lttng_heap_remove(struct lttng_ptr_heap *heap)
+{
+       switch (heap->len) {
+       case 0:
+               return NULL;
+       case 1:
+               (void) heap_set_len(heap, 0);
+               return heap->ptrs[0];
+       }
+       /* Shrink, replace the current max by previous last entry and heapify */
+       heap_set_len(heap, heap->len - 1);
+       /* len changed. previous last entry is at heap->len */
+       return lttng_heap_replace_max(heap, heap->ptrs[heap->len]);
+}
+
+void *lttng_heap_cherrypick(struct lttng_ptr_heap *heap, void *p)
+{
+       size_t pos, len = heap->len;
+
+       for (pos = 0; pos < len; pos++)
+               if (heap->ptrs[pos] == p)
+                       goto found;
+       return NULL;
+found:
+       if (heap->len == 1) {
+               (void) heap_set_len(heap, 0);
+               lttng_check_heap(heap);
+               return heap->ptrs[0];
+       }
+       /* Replace p with previous last entry and heapify. */
+       heap_set_len(heap, heap->len - 1);
+       /* len changed. previous last entry is at heap->len */
+       heap->ptrs[pos] = heap->ptrs[heap->len];
+       heapify(heap, pos);
+       return p;
+}
diff --git a/lib/prio_heap/lttng_prio_heap.h b/lib/prio_heap/lttng_prio_heap.h
new file mode 100644 (file)
index 0000000..ea8dbb8
--- /dev/null
@@ -0,0 +1,117 @@
+#ifndef _LTTNG_PRIO_HEAP_H
+#define _LTTNG_PRIO_HEAP_H
+
+/*
+ * lttng_prio_heap.h
+ *
+ * Priority heap containing pointers. Based on CLRS, chapter 6.
+ *
+ * Copyright 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ */
+
+#include <linux/gfp.h>
+
+struct lttng_ptr_heap {
+       size_t len, alloc_len;
+       void **ptrs;
+       int (*gt)(void *a, void *b);
+       gfp_t gfpmask;
+};
+
+#ifdef DEBUG_HEAP
+void lttng_check_heap(const struct lttng_ptr_heap *heap);
+#else
+static inline
+void lttng_check_heap(const struct lttng_ptr_heap *heap)
+{
+}
+#endif
+
+/**
+ * lttng_heap_maximum - return the largest element in the heap
+ * @heap: the heap to be operated on
+ *
+ * Returns the largest element in the heap, without performing any modification
+ * to the heap structure. Returns NULL if the heap is empty.
+ */
+static inline void *lttng_heap_maximum(const struct lttng_ptr_heap *heap)
+{
+       lttng_check_heap(heap);
+       return heap->len ? heap->ptrs[0] : NULL;
+}
+
+/**
+ * lttng_heap_init - initialize the heap
+ * @heap: the heap to initialize
+ * @alloc_len: number of elements initially allocated
+ * @gfp: allocation flags
+ * @gt: function to compare the elements
+ *
+ * Returns -ENOMEM if out of memory.
+ */
+extern int lttng_heap_init(struct lttng_ptr_heap *heap,
+                    size_t alloc_len, gfp_t gfpmask,
+                    int gt(void *a, void *b));
+
+/**
+ * lttng_heap_free - free the heap
+ * @heap: the heap to free
+ */
+extern void lttng_heap_free(struct lttng_ptr_heap *heap);
+
+/**
+ * lttng_heap_insert - insert an element into the heap
+ * @heap: the heap to be operated on
+ * @p: the element to add
+ *
+ * Insert an element into the heap.
+ *
+ * Returns -ENOMEM if out of memory.
+ */
+extern int lttng_heap_insert(struct lttng_ptr_heap *heap, void *p);
+
+/**
+ * lttng_heap_remove - remove the largest element from the heap
+ * @heap: the heap to be operated on
+ *
+ * Returns the largest element in the heap. It removes this element from the
+ * heap. Returns NULL if the heap is empty.
+ */
+extern void *lttng_heap_remove(struct lttng_ptr_heap *heap);
+
+/**
+ * lttng_heap_cherrypick - remove a given element from the heap
+ * @heap: the heap to be operated on
+ * @p: the element
+ *
+ * Remove the given element from the heap. Return the element if present, else
+ * return NULL. This algorithm has a complexity of O(n), which is higher than
+ * O(log(n)) provided by the rest of this API.
+ */
+extern void *lttng_heap_cherrypick(struct lttng_ptr_heap *heap, void *p);
+
+/**
+ * lttng_heap_replace_max - replace the the largest element from the heap
+ * @heap: the heap to be operated on
+ * @p: the pointer to be inserted as topmost element replacement
+ *
+ * Returns the largest element in the heap. It removes this element from the
+ * heap. The heap is rebalanced only once after the insertion. Returns NULL if
+ * the heap is empty.
+ *
+ * This is the equivalent of calling heap_remove() and then heap_insert(), but
+ * it only rebalances the heap once. It never allocates memory.
+ */
+extern void *lttng_heap_replace_max(struct lttng_ptr_heap *heap, void *p);
+
+#endif /* _LTTNG_PRIO_HEAP_H */
diff --git a/lib/prio_heap/prio_heap.c b/lib/prio_heap/prio_heap.c
deleted file mode 100644 (file)
index f6b8158..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * prio_heap.c
- *
- * Priority heap containing pointers. Based on CLRS, chapter 6.
- *
- * Copyright 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- */
-
-#include <linux/slab.h>
-#include "prio_heap.h"
-
-#ifdef DEBUG_HEAP
-void check_heap(const struct ptr_heap *heap)
-{
-       size_t i;
-
-       if (!heap->len)
-               return;
-
-       for (i = 1; i < heap->len; i++)
-               WARN_ON_ONCE(!heap->gt(heap->ptrs[i], heap->ptrs[0]));
-}
-#endif
-
-static
-size_t parent(size_t i)
-{
-       return (i -1) >> 1;
-}
-
-static
-size_t left(size_t i)
-{
-       return (i << 1) + 1;
-}
-
-static
-size_t right(size_t i)
-{
-       return (i << 1) + 2;
-}
-
-/*
- * Copy of heap->ptrs pointer is invalid after heap_grow.
- */
-static
-int heap_grow(struct ptr_heap *heap, size_t new_len)
-{
-       void **new_ptrs;
-
-       if (heap->alloc_len >= new_len)
-               return 0;
-
-       heap->alloc_len = max_t(size_t, new_len, heap->alloc_len << 1);
-       new_ptrs = kmalloc(heap->alloc_len * sizeof(void *), heap->gfpmask);
-       if (!new_ptrs)
-               return -ENOMEM;
-       if (heap->ptrs)
-               memcpy(new_ptrs, heap->ptrs, heap->len * sizeof(void *));
-       kfree(heap->ptrs);
-       heap->ptrs = new_ptrs;
-       return 0;
-}
-
-static
-int heap_set_len(struct ptr_heap *heap, size_t new_len)
-{
-       int ret;
-
-       ret = heap_grow(heap, new_len);
-       if (ret)
-               return ret;
-       heap->len = new_len;
-       return 0;
-}
-
-int heap_init(struct ptr_heap *heap, size_t alloc_len,
-             gfp_t gfpmask, int gt(void *a, void *b))
-{
-       heap->ptrs = NULL;
-       heap->len = 0;
-       heap->alloc_len = 0;
-       heap->gt = gt;
-       /*
-        * Minimum size allocated is 1 entry to ensure memory allocation
-        * never fails within heap_replace_max.
-        */
-       return heap_grow(heap, max_t(size_t, 1, alloc_len));
-}
-
-void heap_free(struct ptr_heap *heap)
-{
-       kfree(heap->ptrs);
-}
-
-static void heapify(struct ptr_heap *heap, size_t i)
-{
-       void **ptrs = heap->ptrs;
-       size_t l, r, largest;
-
-       for (;;) {
-               void *tmp;
-
-               l = left(i);
-               r = right(i);
-               if (l < heap->len && heap->gt(ptrs[l], ptrs[i]))
-                       largest = l;
-               else
-                       largest = i;
-               if (r < heap->len && heap->gt(ptrs[r], ptrs[largest]))
-                       largest = r;
-               if (largest == i)
-                       break;
-               tmp = ptrs[i];
-               ptrs[i] = ptrs[largest];
-               ptrs[largest] = tmp;
-               i = largest;
-       }
-       check_heap(heap);
-}
-
-void *heap_replace_max(struct ptr_heap *heap, void *p)
-{
-       void *res;
-
-       if (!heap->len) {
-               (void) heap_set_len(heap, 1);
-               heap->ptrs[0] = p;
-               check_heap(heap);
-               return NULL;
-       }
-
-       /* Replace the current max and heapify */
-       res = heap->ptrs[0];
-       heap->ptrs[0] = p;
-       heapify(heap, 0);
-       return res;
-}
-
-int heap_insert(struct ptr_heap *heap, void *p)
-{
-       void **ptrs;
-       size_t pos;
-       int ret;
-
-       ret = heap_set_len(heap, heap->len + 1);
-       if (ret)
-               return ret;
-       ptrs = heap->ptrs;
-       pos = heap->len - 1;
-       while (pos > 0 && heap->gt(p, ptrs[parent(pos)])) {
-               /* Move parent down until we find the right spot */
-               ptrs[pos] = ptrs[parent(pos)];
-               pos = parent(pos);
-       }
-       ptrs[pos] = p;
-       check_heap(heap);
-       return 0;
-}
-
-void *heap_remove(struct ptr_heap *heap)
-{
-       switch (heap->len) {
-       case 0:
-               return NULL;
-       case 1:
-               (void) heap_set_len(heap, 0);
-               return heap->ptrs[0];
-       }
-       /* Shrink, replace the current max by previous last entry and heapify */
-       heap_set_len(heap, heap->len - 1);
-       /* len changed. previous last entry is at heap->len */
-       return heap_replace_max(heap, heap->ptrs[heap->len]);
-}
-
-void *heap_cherrypick(struct ptr_heap *heap, void *p)
-{
-       size_t pos, len = heap->len;
-
-       for (pos = 0; pos < len; pos++)
-               if (heap->ptrs[pos] == p)
-                       goto found;
-       return NULL;
-found:
-       if (heap->len == 1) {
-               (void) heap_set_len(heap, 0);
-               check_heap(heap);
-               return heap->ptrs[0];
-       }
-       /* Replace p with previous last entry and heapify. */
-       heap_set_len(heap, heap->len - 1);
-       /* len changed. previous last entry is at heap->len */
-       heap->ptrs[pos] = heap->ptrs[heap->len];
-       heapify(heap, pos);
-       return p;
-}
diff --git a/lib/prio_heap/prio_heap.h b/lib/prio_heap/prio_heap.h
deleted file mode 100644 (file)
index 2b55adf..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-#ifndef _LTTNG_PRIO_HEAP_H
-#define _LTTNG_PRIO_HEAP_H
-
-/*
- * prio_heap.h
- *
- * Priority heap containing pointers. Based on CLRS, chapter 6.
- *
- * Copyright 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- */
-
-#include <linux/gfp.h>
-
-struct ptr_heap {
-       size_t len, alloc_len;
-       void **ptrs;
-       int (*gt)(void *a, void *b);
-       gfp_t gfpmask;
-};
-
-#ifdef DEBUG_HEAP
-void check_heap(const struct ptr_heap *heap);
-#else
-static inline
-void check_heap(const struct ptr_heap *heap)
-{
-}
-#endif
-
-/**
- * heap_maximum - return the largest element in the heap
- * @heap: the heap to be operated on
- *
- * Returns the largest element in the heap, without performing any modification
- * to the heap structure. Returns NULL if the heap is empty.
- */
-static inline void *heap_maximum(const struct ptr_heap *heap)
-{
-       check_heap(heap);
-       return heap->len ? heap->ptrs[0] : NULL;
-}
-
-/**
- * heap_init - initialize the heap
- * @heap: the heap to initialize
- * @alloc_len: number of elements initially allocated
- * @gfp: allocation flags
- * @gt: function to compare the elements
- *
- * Returns -ENOMEM if out of memory.
- */
-extern int heap_init(struct ptr_heap *heap,
-                    size_t alloc_len, gfp_t gfpmask,
-                    int gt(void *a, void *b));
-
-/**
- * heap_free - free the heap
- * @heap: the heap to free
- */
-extern void heap_free(struct ptr_heap *heap);
-
-/**
- * heap_insert - insert an element into the heap
- * @heap: the heap to be operated on
- * @p: the element to add
- *
- * Insert an element into the heap.
- *
- * Returns -ENOMEM if out of memory.
- */
-extern int heap_insert(struct ptr_heap *heap, void *p);
-
-/**
- * heap_remove - remove the largest element from the heap
- * @heap: the heap to be operated on
- *
- * Returns the largest element in the heap. It removes this element from the
- * heap. Returns NULL if the heap is empty.
- */
-extern void *heap_remove(struct ptr_heap *heap);
-
-/**
- * heap_cherrypick - remove a given element from the heap
- * @heap: the heap to be operated on
- * @p: the element
- *
- * Remove the given element from the heap. Return the element if present, else
- * return NULL. This algorithm has a complexity of O(n), which is higher than
- * O(log(n)) provided by the rest of this API.
- */
-extern void *heap_cherrypick(struct ptr_heap *heap, void *p);
-
-/**
- * heap_replace_max - replace the the largest element from the heap
- * @heap: the heap to be operated on
- * @p: the pointer to be inserted as topmost element replacement
- *
- * Returns the largest element in the heap. It removes this element from the
- * heap. The heap is rebalanced only once after the insertion. Returns NULL if
- * the heap is empty.
- *
- * This is the equivalent of calling heap_remove() and then heap_insert(), but
- * it only rebalances the heap once. It never allocates memory.
- */
-extern void *heap_replace_max(struct ptr_heap *heap, void *p);
-
-#endif /* _LTTNG_PRIO_HEAP_H */
index 281aafd7e4f2bb5227771e17cb7c779af723a460..3bd5721eb261df7d26199d8ce5c35470a779127f 100644 (file)
@@ -19,7 +19,7 @@
 #include "../../wrapper/ringbuffer/config.h"
 #include "../../wrapper/ringbuffer/backend_types.h"
 #include "../../wrapper/ringbuffer/frontend_types.h"
-#include "../../wrapper/prio_heap.h"   /* For per-CPU read-side iterator */
+#include "../../lib/prio_heap/lttng_prio_heap.h"       /* For per-CPU read-side iterator */
 
 /* Buffer offset macros */
 
index e8c4c5ce8a4f5dd89da66cce76d5c8af7e66e356..1a3187e64d5653bec97bbaf581606ca4186f13e2 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/kref.h>
 #include "../../wrapper/ringbuffer/config.h"
 #include "../../wrapper/ringbuffer/backend_types.h"
-#include "../../wrapper/prio_heap.h"   /* For per-CPU read-side iterator */
+#include "../../lib/prio_heap/lttng_prio_heap.h"       /* For per-CPU read-side iterator */
 
 /*
  * A switch is done during tracing or as a final flush after tracing (so it
@@ -30,7 +30,7 @@ enum switch_mode { SWITCH_ACTIVE, SWITCH_FLUSH };
 /* channel-level read-side iterator */
 struct channel_iter {
        /* Prio heap of buffers. Lowest timestamps at the top. */
-       struct ptr_heap heap;           /* Heap of struct lib_ring_buffer ptrs */
+       struct lttng_ptr_heap heap;     /* Heap of struct lib_ring_buffer ptrs */
        struct list_head empty_head;    /* Empty buffers linked-list head */
        int read_open;                  /* Opened for reading ? */
        u64 last_qs;                    /* Last quiescent state timestamp */
index 1e60f2c43c104150ee6a6d85516763b77d0a647c..df8d485ab92af72953049a115b0ac074a038aebb 100644 (file)
@@ -120,7 +120,7 @@ static
 void lib_ring_buffer_get_empty_buf_records(const struct lib_ring_buffer_config *config,
                                           struct channel *chan)
 {
-       struct ptr_heap *heap = &chan->iter.heap;
+       struct lttng_ptr_heap *heap = &chan->iter.heap;
        struct lib_ring_buffer *buf, *tmp;
        ssize_t len;
 
@@ -155,7 +155,7 @@ void lib_ring_buffer_get_empty_buf_records(const struct lib_ring_buffer_config *
                         */
                        CHAN_WARN_ON(chan, len < 0);
                        list_del(&buf->iter.empty_node);
-                       CHAN_WARN_ON(chan, heap_insert(heap, buf));
+                       CHAN_WARN_ON(chan, lttng_heap_insert(heap, buf));
                }
        }
 }
@@ -227,7 +227,7 @@ ssize_t channel_get_next_record(struct channel *chan,
 {
        const struct lib_ring_buffer_config *config = chan->backend.config;
        struct lib_ring_buffer *buf;
-       struct ptr_heap *heap;
+       struct lttng_ptr_heap *heap;
        ssize_t len;
 
        if (config->alloc == RING_BUFFER_ALLOC_GLOBAL) {
@@ -240,7 +240,7 @@ ssize_t channel_get_next_record(struct channel *chan,
        /*
         * get next record for topmost buffer.
         */
-       buf = heap_maximum(heap);
+       buf = lttng_heap_maximum(heap);
        if (buf) {
                len = lib_ring_buffer_get_next_record(chan, buf);
                /*
@@ -252,7 +252,7 @@ ssize_t channel_get_next_record(struct channel *chan,
                        buf->iter.timestamp = 0;
                        list_add(&buf->iter.empty_node, &chan->iter.empty_head);
                        /* Remove topmost buffer from the heap */
-                       CHAN_WARN_ON(chan, heap_remove(heap) != buf);
+                       CHAN_WARN_ON(chan, lttng_heap_remove(heap) != buf);
                        break;
                case -ENODATA:
                        /*
@@ -260,7 +260,7 @@ ssize_t channel_get_next_record(struct channel *chan,
                         * don't add to list of empty buffer, because it has no
                         * more data to provide, ever.
                         */
-                       CHAN_WARN_ON(chan, heap_remove(heap) != buf);
+                       CHAN_WARN_ON(chan, lttng_heap_remove(heap) != buf);
                        break;
                case -EBUSY:
                        CHAN_WARN_ON(chan, 1);
@@ -269,15 +269,15 @@ ssize_t channel_get_next_record(struct channel *chan,
                        /*
                         * Reinsert buffer into the heap. Note that heap can be
                         * partially empty, so we need to use
-                        * heap_replace_max().
+                        * lttng_heap_replace_max().
                         */
                        CHAN_WARN_ON(chan, len < 0);
-                       CHAN_WARN_ON(chan, heap_replace_max(heap, buf) != buf);
+                       CHAN_WARN_ON(chan, lttng_heap_replace_max(heap, buf) != buf);
                        break;
                }
        }
 
-       buf = heap_maximum(heap);
+       buf = lttng_heap_maximum(heap);
        if (!buf || buf->iter.timestamp > chan->iter.last_qs) {
                /*
                 * Deal with buffers previously showing no data.
@@ -287,7 +287,7 @@ ssize_t channel_get_next_record(struct channel *chan,
                lib_ring_buffer_wait_for_qs(config, chan);
        }
 
-       *ret_buf = buf = heap_maximum(heap);
+       *ret_buf = buf = lttng_heap_maximum(heap);
        if (buf) {
                /*
                 * If this warning triggers, you probably need to check your
@@ -376,7 +376,7 @@ int channel_iterator_init(struct channel *chan)
                int cpu, ret;
 
                INIT_LIST_HEAD(&chan->iter.empty_head);
-               ret = heap_init(&chan->iter.heap,
+               ret = lttng_heap_init(&chan->iter.heap,
                                num_possible_cpus(),
                                GFP_KERNEL, buf_is_higher);
                if (ret)
@@ -426,7 +426,7 @@ void channel_iterator_free(struct channel *chan)
        const struct lib_ring_buffer_config *config = chan->backend.config;
 
        if (config->alloc == RING_BUFFER_ALLOC_PER_CPU)
-               heap_free(&chan->iter.heap);
+               lttng_heap_free(&chan->iter.heap);
 }
 
 int lib_ring_buffer_iterator_open(struct lib_ring_buffer *buf)
@@ -514,7 +514,7 @@ void lib_ring_buffer_iterator_reset(struct lib_ring_buffer *buf)
                lib_ring_buffer_put_next_subbuf(buf);
        buf->iter.state = ITER_GET_SUBBUF;
        /* Remove from heap (if present). */
-       if (heap_cherrypick(&chan->iter.heap, buf))
+       if (lttng_heap_cherrypick(&chan->iter.heap, buf))
                list_add(&buf->iter.empty_node, &chan->iter.empty_head);
        buf->iter.timestamp = 0;
        buf->iter.header_len = 0;
@@ -532,7 +532,7 @@ void channel_iterator_reset(struct channel *chan)
        int cpu;
 
        /* Empty heap, put into empty_head */
-       while ((buf = heap_remove(&chan->iter.heap)) != NULL)
+       while ((buf = lttng_heap_remove(&chan->iter.heap)) != NULL)
                list_add(&buf->iter.empty_node, &chan->iter.empty_head);
 
        for_each_channel_cpu(cpu, chan) {
@@ -573,7 +573,7 @@ ssize_t channel_ring_buffer_file_read(struct file *filp,
                        read_offset = *ppos;
                        if (config->alloc == RING_BUFFER_ALLOC_PER_CPU
                            && fusionmerge)
-                               buf = heap_maximum(&chan->iter.heap);
+                               buf = lttng_heap_maximum(&chan->iter.heap);
                        CHAN_WARN_ON(chan, !buf);
                        goto skip_get_next;
                }
diff --git a/wrapper/prio_heap.h b/wrapper/prio_heap.h
deleted file mode 100644 (file)
index b61f458..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include "../lib/prio_heap/prio_heap.h"
This page took 0.03618 seconds and 4 git commands to generate.