From 8727126551b6a3ac407705878cb5b7978aaeceec Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Mon, 13 Feb 2023 11:23:47 +0100 Subject: [PATCH] Use .obs extension for ovni binary streams --- include/ovni.h | 2 ++ src/emu/trace.c | 2 +- src/rt/ovni.c | 8 ++++---- test/unit/cpu.c | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/ovni.h b/include/ovni.h index 3034ab5..b7bcb47 100644 --- a/include/ovni.h +++ b/include/ovni.h @@ -31,6 +31,8 @@ typedef struct json_value_t JSON_Value; #define OVNI_STREAM_VERSION 1 #define OVNI_MODEL_VERSION "O1 V1 T1 M1 D1 K1 61" +#define OVNI_STREAM_EXT ".obs" + /* Follow https://semver.org rules for versioning */ #define OVNI_LIB_VERSION "1.0.0" diff --git a/src/emu/trace.c b/src/emu/trace.c index 4826a93..3d51c89 100644 --- a/src/emu/trace.c +++ b/src/emu/trace.c @@ -75,7 +75,7 @@ cb_nftw(const char *fpath, const struct stat *sb, if (typeflag != FTW_F) return 0; - if (!has_suffix(fpath, ".ovnistream")) + if (!has_suffix(fpath, OVNI_STREAM_EXT)) return 0; return load_stream(cur_trace, fpath); diff --git a/src/rt/ovni.c b/src/rt/ovni.c index 7c97f26..c9fbb84 100644 --- a/src/rt/ovni.c +++ b/src/rt/ovni.c @@ -61,12 +61,12 @@ create_trace_stream(void) { char path[PATH_MAX]; - int written = snprintf(path, PATH_MAX, "%s/thread.%d.ovnistream", - rproc.procdir, rthread.tid); + int written = snprintf(path, PATH_MAX, "%s/thread.%d%s", + rproc.procdir, rthread.tid, OVNI_STREAM_EXT); if (written >= PATH_MAX) - die("thread trace path too long: %s/thread.%d.ovnistream\n", - rproc.procdir, rthread.tid); + die("thread trace path too long: %s/thread.%d%s\n", + rproc.procdir, rthread.tid, OVNI_STREAM_EXT); rthread.streamfd = open(path, O_WRONLY | O_CREAT, 0644); diff --git a/test/unit/cpu.c b/test/unit/cpu.c index f9b789d..f1e0979 100644 --- a/test/unit/cpu.c +++ b/test/unit/cpu.c @@ -29,7 +29,7 @@ test_oversubscription(void) struct thread th0, th1; - if (thread_init_begin(&th0, &proc, "loom.0/proc.0/thread.0.ovnistream") != 0) + if (thread_init_begin(&th0, &proc, "loom.0/proc.0/thread.0.obs") != 0) die("thread_init_begin failed"); thread_set_gindex(&th0, 0); @@ -37,7 +37,7 @@ test_oversubscription(void) if (thread_init_end(&th0) != 0) die("thread_init_end failed"); - if (thread_init_begin(&th1, &proc, "loom.1/proc.1/thread.1.ovnistream") != 0) + if (thread_init_begin(&th1, &proc, "loom.1/proc.1/thread.1.obs") != 0) die("thread_init_begin failed"); thread_set_gindex(&th1, 1);