summaryrefslogtreecommitdiff
path: root/lib/lfsr.h
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2012-11-26 08:43:47 +0100
committerJens Axboe <axboe@kernel.dk>2012-11-26 08:43:47 +0100
commit8055e41d0ecc54770a2653427532b3e2c5fabdad (patch)
treef6f2b77f586a4dc890e3fce6565ae3c13a7fc146 /lib/lfsr.h
parent2ab9e98b300c35d3b7807f74d404ce3c5de33fb3 (diff)
downloadfio-8055e41d0ecc54770a2653427532b3e2c5fabdad.tar.gz
fio-8055e41d0ecc54770a2653427532b3e2c5fabdad.tar.bz2
Add LFSR generator
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'lib/lfsr.h')
-rw-r--r--lib/lfsr.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/lfsr.h b/lib/lfsr.h
new file mode 100644
index 00000000..0de9ea8e
--- /dev/null
+++ b/lib/lfsr.h
@@ -0,0 +1,24 @@
+#ifndef FIO_LFSR_H
+#define FIO_LFSR_H
+
+#include <inttypes.h>
+
+#define FIO_MAX_TAPS 8
+
+struct lfsr_taps {
+ unsigned int length;
+ unsigned int taps[FIO_MAX_TAPS];
+};
+
+
+struct fio_lfsr {
+ uint64_t last_val;
+ uint64_t max_val;
+ uint64_t num_vals;
+ struct lfsr_taps taps;
+};
+
+int lfsr_next(struct fio_lfsr *fl, uint64_t *off);
+int lfsr_init(struct fio_lfsr *fl, uint64_t size);
+
+#endif