From ad1bc59382e3cda63ce507cd7f56fc2a201c11e9 Mon Sep 17 00:00:00 2001 From: Gediminas Jakutis Date: Tue, 25 Feb 2020 09:57:14 +0200 Subject: implement reading from dev-you-random for datagen. Signed-off-by: Gediminas Jakutis --- src/defs.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/defs.h (limited to 'src/defs.h') 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 +#include +#include + +/* 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 */ -- cgit v1.2.3