diff options
author | 2020-03-10 10:15:53 +0200 | |
---|---|---|
committer | 2020-03-10 10:15:53 +0200 | |
commit | 61c3a9aa7a636ada2cedd5b6025d5c7ccc598c85 (patch) | |
tree | 6732e0e6847cc860c98bb9bfa7e5a5619d3504e2 /src/io.c | |
parent | 9eb76eda865dc4f82fd53223e5c557f707b569b9 (diff) | |
download | algos-ld1-61c3a9aa7a636ada2cedd5b6025d5c7ccc598c85.tar.gz algos-ld1-61c3a9aa7a636ada2cedd5b6025d5c7ccc598c85.tar.bz2 algos-ld1-61c3a9aa7a636ada2cedd5b6025d5c7ccc598c85.zip |
bolt on data generation, kind of.
Signed-off-by: Gediminas Jakutis <gediminas@varciai.lt>
Diffstat (limited to 'src/io.c')
-rw-r--r-- | src/io.c | 28 |
1 files changed, 9 insertions, 19 deletions
@@ -1,3 +1,7 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ + +/* Copyright (C) 2020 Gediminas Jakutis */ + #include <sys/types.h> #include <sys/stat.h> #include <linux/limits.h> @@ -11,6 +15,7 @@ #include "io.h" #include "defs.h" #include "datagen.h" +#include "cache.h" static int stream_open_in(struct stream * const in, const struct settings * const s); static int stream_open_out(struct stream * const in, const struct settings * const s); @@ -74,25 +79,6 @@ early_err: return ret; } -int stream_get(struct stream *in, size_t idx, struct entry_l *data, int tag) -{ - int ret = 0; - - ret = in->get(in, idx, data, tag); - - return ret; -} - -int stream_put(struct stream *in, size_t idx, struct entry_l *data, int tag) -{ - int ret = 0; - - ret = in->put(in, idx, data, tag); - - return ret; -} - - static int stream_open_out(struct stream * const in, const struct settings * const s) { struct stat st; @@ -133,6 +119,10 @@ static int stream_open_in(struct stream * const in, const struct settings * cons in->n = st.st_size / s->stride; in->fd = open(in->name, O_RDONLY | O_NOATIME); try(in->fd < 0, err, errno); /* TODO: err msg */ + if (in->cached) { + cache_create(in, s); + cache_populate(in); + } err: return ret; |