summaryrefslogtreecommitdiffstats
path: root/src/defs.h
diff options
context:
space:
mode:
authorGravatar Gediminas Jakutis <gediminas@varciai.lt> 2020-02-25 09:57:14 +0200
committerGravatar Gediminas Jakutis <gediminas@varciai.lt> 2020-02-25 09:57:14 +0200
commitad1bc59382e3cda63ce507cd7f56fc2a201c11e9 (patch)
treef57c6c7c672eb2e62bc9ba61a9f32265b4abf8a8 /src/defs.h
parent1bcfe887515845678f8f648c6dfecffd01813b0f (diff)
downloadalgos-ld1-ad1bc59382e3cda63ce507cd7f56fc2a201c11e9.tar.gz
algos-ld1-ad1bc59382e3cda63ce507cd7f56fc2a201c11e9.tar.bz2
algos-ld1-ad1bc59382e3cda63ce507cd7f56fc2a201c11e9.zip
implement reading from dev-you-random for datagen.
Signed-off-by: Gediminas Jakutis <gediminas@varciai.lt>
Diffstat (limited to 'src/defs.h')
-rw-r--r--src/defs.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/defs.h b/src/defs.h
new file mode 100644
index 0000000..b06e181
--- /dev/null
+++ b/src/defs.h
@@ -0,0 +1,46 @@
+#ifndef ALGOS_DEFS_H_INCLUDED
+#define ALGOS_DEFS_H_INCLUDED
+
+#include <stddef.h>
+#include <stdint.h>
+#include <sys/types.h>
+
+/* for array implementation */
+struct entry {
+ uint64_t val;
+};
+
+/* for linked list implementation */
+struct entry_l {
+ struct entry;
+ uint32_t next; /* """pointer""" to the next element. */
+ uint32_t prev; /* """pointer""" to the previous element. */
+};
+
+enum opmode {
+ mode_normal,
+ mode_fetch,
+ mode_generate
+};
+
+struct stream {
+ size_t n;
+ ssize_t prev_idx;
+ int fd;
+ int out;
+ char *name;
+};
+
+struct settings {
+ size_t ss;
+ size_t to;
+ size_t stride;
+ char *filein;
+ char *fileout;
+ unsigned int flags;
+ enum opmode opmode;
+ int (*get)(struct stream, size_t, struct entry_l *, int);
+ int (*put)(struct stream, size_t, struct entry_l *, int);
+};
+
+#endif /* ALGOS_DEFS_H_INCLUDED */