From 6859277be6900a84df9f2f5cb17bf16fa137de6d Mon Sep 17 00:00:00 2001 From: toninov Date: Fri, 1 Aug 2025 14:46:27 +0200 Subject: [PATCH] Change arguments name --- shufflecake-userland/include/commands.h | 2 +- shufflecake-userland/src/cli/dispatch.c | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/shufflecake-userland/include/commands.h b/shufflecake-userland/include/commands.h index d2c5667..b3350f8 100644 --- a/shufflecake-userland/include/commands.h +++ b/shufflecake-userland/include/commands.h @@ -74,8 +74,8 @@ typedef struct char *pwd; size_t pwd_len; /* Optional performance flags */ - bool use_write_queue; bool use_read_queue; + bool use_write_queue; } sflc_cmd_OpenArgs; diff --git a/shufflecake-userland/src/cli/dispatch.c b/shufflecake-userland/src/cli/dispatch.c index d933094..e2b16ca 100644 --- a/shufflecake-userland/src/cli/dispatch.c +++ b/shufflecake-userland/src/cli/dispatch.c @@ -51,8 +51,8 @@ const char *argp_program_bug_address = ""; #define SFLC_OPT_NUMVOLS_KEY 'n' // Positive and printable: also serves as short command-line option #define SFLC_OPT_SKIPRAND_KEY (-'r') // Negative, because we don't want a short option available for this #define SFLC_OPT_LEGACY_KEY (-'l') -#define SFLC_OPT_USE_WRITEQUEUE (-'t') // As in, *to* the device #define SFLC_OPT_USE_READQUEUE (-'f') // As in, *from* the device +#define SFLC_OPT_USE_WRITEQUEUE (-'t') // As in, *to* the device /***************************************************** @@ -73,8 +73,8 @@ struct sflc_cli_arguments { int sflc_mode; int num_volumes; bool skip_randfill; - bool use_write_queue; bool use_read_queue; + bool use_write_queue; }; @@ -123,11 +123,10 @@ static struct argp_option options[] = { "Skip pre-overwriting block device with random data, only valid with `init'. Faster but less secure. Use only for debugging or testing."}, {"legacy", SFLC_OPT_LEGACY_KEY, 0, 0, "Use the old (pre-v0.5.0) Shufflecake format. Only valid with `init` and `open'. This mode is less secure and error-prone, use of this option is not recommended, it is provided for backward-compatibility only. This mode is going to be deprecated in the future."}, - {"use_write_queue", SFLC_OPT_USE_WRITEQUEUE, 0, 0, - "Handle WRITE request in workqueues, rather than in the calling context. Only valid with `open'. This is benchmarked to be slower on SSDs, but could help with latency on HDDs."}, - {"use_read_queue", SFLC_OPT_USE_READQUEUE, 0, 0, + {"use-read-queue", SFLC_OPT_USE_READQUEUE, 0, 0, "Handle READ request in workqueues, rather than in the calling context. Only valid with `open'. This is benchmarked to be slower on SSDs, but could help with latency on HDDs."}, - + {"use-write-queue", SFLC_OPT_USE_WRITEQUEUE, 0, 0, + "Handle WRITE request in workqueues, rather than in the calling context. Only valid with `open'. This is benchmarked to be slower on SSDs, but could help with latency on HDDs."}, {0} }; @@ -182,7 +181,7 @@ int sflc_cli_dispatch(int argc, char **argv) { } /* Check options consistency */ if ((args.use_read_queue || args.use_write_queue) && args.act != SFLC_ACT_OPEN) { - printf("Error: --use_write_queue and --use_read_queue are only valid in `open`"); + printf("Error: --use-read-queue and --use-write-queue are only valid in `open`"); return EINVAL; } @@ -261,12 +260,12 @@ static error_t _parseArgpKey(int key, char *arg, struct argp_state *state) { case SFLC_OPT_SKIPRAND_KEY: args->skip_randfill = true; break; - case SFLC_OPT_USE_WRITEQUEUE: - args->use_write_queue = true; - break; case SFLC_OPT_USE_READQUEUE: args->use_read_queue = true; break; + case SFLC_OPT_USE_WRITEQUEUE: + args->use_write_queue = true; + break; /* End of arg list */ case ARGP_KEY_END: