summaryrefslogtreecommitdiffstats
path: root/libnetdata/arrayalloc/arrayalloc.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-08-12 07:26:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-08-12 07:26:11 +0000
commit3c315f0fff93aa072472abc10815963ac0035268 (patch)
treea95f6a96e0e7bd139c010f8dc60b40e5b3062a99 /libnetdata/arrayalloc/arrayalloc.h
parentAdding upstream version 1.35.1. (diff)
downloadnetdata-upstream/1.36.0.tar.xz
netdata-upstream/1.36.0.zip
Adding upstream version 1.36.0.upstream/1.36.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libnetdata/arrayalloc/arrayalloc.h')
-rw-r--r--libnetdata/arrayalloc/arrayalloc.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/libnetdata/arrayalloc/arrayalloc.h b/libnetdata/arrayalloc/arrayalloc.h
new file mode 100644
index 000000000..e0e9e7f9f
--- /dev/null
+++ b/libnetdata/arrayalloc/arrayalloc.h
@@ -0,0 +1,35 @@
+
+#ifndef ARRAYALLOC_H
+#define ARRAYALLOC_H 1
+
+#include "../libnetdata.h"
+
+typedef struct arrayalloc {
+ size_t element_size;
+ size_t elements;
+ const char *filename;
+ char **cache_dir;
+ bool use_mmap;
+
+ // private members - do not touch
+ struct {
+ bool mmap;
+ bool lockless;
+ bool initialized;
+ size_t element_size;
+ size_t page_ptr_offset;
+ size_t file_number;
+ size_t natural_page_size;
+ size_t allocation_multiplier;
+ size_t max_alloc_size;
+ netdata_mutex_t mutex;
+ struct arrayalloc_page *first_page;
+ struct arrayalloc_page *last_page;
+ } internal;
+} ARAL;
+
+extern ARAL *arrayalloc_create(size_t element_size, size_t elements, const char *filename, char **cache_dir);
+extern void *arrayalloc_mallocz(ARAL *ar);
+extern void arrayalloc_freez(ARAL *ar, void *ptr);
+
+#endif // ARRAYALLOC_H