From db549aa7f63621e1b81d32e59456303c5003b4b9 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Mon, 23 Aug 2021 15:34:12 -0700 Subject: verify-hashed-objects: add `jio verify hashed-objects` This is currently very hacky and unfinished, but does enough for some performance comparisons against a zstd-using journalctl --verify that has been hacked to return early after the first pass. It's currently rather leaky, the whole per-object-dispatch thingy is illuminating a thunk_h shortcoming and forcing addressing the issue... soon. --- src/jio.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/jio.c') diff --git a/src/jio.c b/src/jio.c index a2491ff..2730eac 100644 --- a/src/jio.c +++ b/src/jio.c @@ -24,6 +24,7 @@ #include "report-layout.h" #include "report-tail-waste.h" #include "report-usage.h" +#include "verify-hashed-objects.h" #include "upstream/journal-def.h" @@ -39,7 +40,7 @@ int main(int argc, char *argv[]) int r; if (argc < 2) { - printf("Usage: %s {help,reclaim,report} [subcommand-args]\n", argv[0]); + printf("Usage: %s {help,reclaim,report,verify} [subcommand-args]\n", argv[0]); return 0; } @@ -134,6 +135,22 @@ int main(int argc, char *argv[]) fprintf(stderr, "Unsupported report subcommand: \"%s\"\n", argv[2]); return 1; } + } else if (!strcmp(argv[1], "verify")) { + if (argc < 3) { + printf("Usage: %s verify {hashed-objects}\n", argv[0]); + return 0; + } + + if (!strcmp(argv[2], "hashed-objects")) { + r = jio_verify_hashed_objects(iou, argc, argv); + if (r < 0) { + fprintf(stderr, "failed to verify hashed objects: %s\n", strerror(-r)); + return 1; + } + } else { + fprintf(stderr, "Unsupported verify subcommand: \"%s\"\n", argv[2]); + return 1; + } } else if (!strcmp(argv[1], "version")) { puts("jio version " VERSION); return 0; -- cgit v1.2.3