summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c71
1 files changed, 14 insertions, 57 deletions
diff --git a/src/main.c b/src/main.c
index c482f36..0122a3d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -20,21 +20,14 @@ static struct settings settings = {0, 0, 0, NULL, NULL, mode_normal, array, cach
static int parseargs(int argc, char **argv, struct settings * settings);
static int load_io_functions(struct settings const * const s, struct stream * const in);
static void printhelp(const char * const name);
-static struct entry_l *stub_getnext(struct stream * const restrict in);
-static int stub_put(struct stream * const restrict in, struct entry_l const * const data);
-static int stub_split(struct stream * const in, struct stream * const a, struct stream * const b);
static const struct stream stream_blank = {
.n = 0, .type = stream_invalid, .fd = -1, .settings = &settings,
- .name = NULL, .index = 0, .cnode = NULL, .cache = NULL,
- .get_next_element_direct = stub_getnext,
- .get_next_element_cache = stub_getnext,
- .place_next_element_direct = stub_put,
- .place_next_element_cache = stub_put, .split = stub_split };
+ .name = NULL, .index = 0, .cnode = NULL, .cache = NULL };
static struct stream file_in = stream_blank;
static struct stream file_out = stream_blank;
-static struct stream file_tmp;
+static struct stream file_tmp = stream_blank;
static struct rin_bench_result bongholio;
@@ -47,7 +40,6 @@ int main(int argc, char **argv)
file_in.type = stream_in;
file_out.type = stream_out;
- file_tmp.type = stream_outlite;
try_s((ret = parseargs(argc, argv, &settings)), early_out);
@@ -93,7 +85,6 @@ int main(int argc, char **argv)
rin_info("system: %lus %3lums %3luµs", bongholio.system.tv_sec, bongholio.system.tv_usec / 1000, bongholio.system.tv_usec % 1000);
rin_info("user: %lus %3lums %3luµs", bongholio.user.tv_sec, bongholio.user.tv_usec / 1000, bongholio.user.tv_usec % 1000);
rin_info("total: %lus %3lums %3luµs", bongholio.total.tv_sec, bongholio.total.tv_usec / 1000, bongholio.total.tv_usec % 1000);
-
try_s((ret = cache_transfer(&file_tmp, &file_out)), out);
}
@@ -203,23 +194,25 @@ static int load_io_functions(struct settings const * const s, struct stream * co
if (in->settings->access == cached) {
if (in->type == stream_randread) { /* data generation streams only support data generation and not much else */
if (s->format == array) {
- in->get_next_element_direct = gen_get_array;
- in->place_next_element_cache = cached_put_array;
+ in->get = gen_get_array;
+ in->put = cached_put_array;
} else { /* if (s->format == list */
- in->get_next_element_direct = gen_get_list;
- in->place_next_element_cache = cached_put_list;
+ in->get = gen_get_list;
+ in->put = cached_put_list;
}
} else {
if (s->format == array) {
- in->get_next_element_cache = cached_get_array;
- in->place_next_element_cache = cached_put_array;
- in->split = cache_block_split;
+ in->get = cached_get_array;
+ in->put = cached_put_array;
+ in->split = cache_split;
in->rewind = cache_rewind;
+ in->copy = cache_block_copy;
} else { /* if (s->format == list */
- in->get_next_element_cache = cached_get_list;
- in->place_next_element_cache = cached_put_list;
- in->split = cache_list_split;
+ in->get = cached_get_list;
+ in->put = cached_put_list;
+ in->split = cache_split;
in->rewind = cache_rewind;
+ in->copy = cache_list_copy;
}
}
} else {
@@ -251,39 +244,3 @@ static void printhelp(const char * const name)
name);
return;
}
-
-static struct entry_l *stub_getnext(struct stream * const restrict in)
-{
- struct entry_l *ret = NULL;
-
- (void) in;
-
- rin_warn("stub!");
-
- return ret;
-}
-
-static int stub_put(struct stream * const restrict in, struct entry_l const * const data)
-{
- int ret = ENOSYS;
-
- (void) in;
- (void) data;
-
- rin_warn("stub!");
-
- return ret;
-}
-
-static int stub_split(struct stream * const in, struct stream * const a, struct stream * const b)
-{
- int ret = ENOSYS;
-
- (void) in;
- (void) a;
- (void) b;
-
- rin_warn("stub!");
-
- return ret;
-}