Change arguments name

This commit is contained in:
toninov 2025-08-01 14:46:27 +02:00
parent 13d4e5b548
commit 6859277be6
No known key found for this signature in database
2 changed files with 10 additions and 11 deletions

View file

@ -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;

View file

@ -51,8 +51,8 @@ const char *argp_program_bug_address = "<bugs@shufflecake.net>";
#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: