diff options
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; |