From 61c3a9aa7a636ada2cedd5b6025d5c7ccc598c85 Mon Sep 17 00:00:00 2001 From: Gediminas Jakutis Date: Tue, 10 Mar 2020 10:15:53 +0200 Subject: bolt on data generation, kind of. Signed-off-by: Gediminas Jakutis --- src/io.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'src/io.c') diff --git a/src/io.c b/src/io.c index 04f53b1..b18cc00 100644 --- a/src/io.c +++ b/src/io.c @@ -1,3 +1,7 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ + +/* Copyright (C) 2020 Gediminas Jakutis */ + #include #include #include @@ -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; -- cgit v1.2.3