From de4804f0da0a11b7c0841dd00a72f640b7c61bde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sun, 16 Aug 2026 14:39:35 +0200 Subject: [PATCH] systemd-storage-fs: convert to VERB_COMMAND and add --introspect-cli The custom help() is replaced by a COMMAND() description, and --introspect-cli is added. The abstract is changed from the noun phrase "Simple file system backed storage provider" to the imperative "Expose regular files and directories as storage volumes.", following the man page and consistent with the other commands. --- src/storage/storage-fs.c | 36 ++++++------------- .../units/TEST-74-AUX-UTILS.introspect-cli.sh | 1 + 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/src/storage/storage-fs.c b/src/storage/storage-fs.c index 5b2bc415fb..ef0cc7b66c 100644 --- a/src/storage/storage-fs.c +++ b/src/storage/storage-fs.c @@ -18,14 +18,11 @@ #include "device-util.h" #include "errno-util.h" #include "fd-util.h" -#include "format-table.h" #include "fs-util.h" #include "hashmap.h" -#include "help-util.h" #include "log.h" #include "main-func.h" #include "mount-util.h" -#include "options.h" #include "path-lookup.h" #include "path-util.h" #include "recurse-dir.h" @@ -37,9 +34,16 @@ #include "uid-classification.h" #include "varlink-io.systemd.StorageProvider.h" #include "varlink-util.h" +#include "verbs.h" static RuntimeScope arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; +COMMAND( + "systemd-storage-fs\0", + "Expose regular files and directories as storage volumes.", + .man_pages = "systemd-storage-fs.8\0", +); + /* For now we maintain a simple, compiled-in list of templates. One of those days we might want to move these * into configurable drop-in files on disk. */ typedef enum Template { @@ -742,27 +746,6 @@ static int vl_server(void) { return 0; } -static int help(void) { - int r; - - help_cmdline("[OPTIONS...]"); - help_abstract("Simple file system backed storage provider"); - - _cleanup_(table_unrefp) Table *options = NULL; - r = option_parser_get_help_table(&options); - if (r < 0) - return r; - - help_section("Options"); - - r = table_print_or_warn(options); - if (r < 0) - return r; - - help_man_page_reference("systemd-storage-fs", "8"); - return 0; -} - static int parse_argv(int argc, char *argv[]) { assert(argc >= 0); assert(argv); @@ -772,7 +755,7 @@ static int parse_argv(int argc, char *argv[]) { switch (c) { OPTION_COMMON_HELP: - return help(); + return command_print_help("systemd-storage-fs"); OPTION_COMMON_VERSION: return version(); @@ -784,6 +767,9 @@ static int parse_argv(int argc, char *argv[]) { OPTION_COMMON_USER: arg_runtime_scope = RUNTIME_SCOPE_USER; break; + + OPTION_COMMON_INTROSPECT_CLI: + return introspect_cli(SD_JSON_FORMAT_OFF); } if (option_parser_get_n_args(&opts) > 0) diff --git a/test/units/TEST-74-AUX-UTILS.introspect-cli.sh b/test/units/TEST-74-AUX-UTILS.introspect-cli.sh index 85bb2e0e62..365c93b49b 100755 --- a/test/units/TEST-74-AUX-UTILS.introspect-cli.sh +++ b/test/units/TEST-74-AUX-UTILS.introspect-cli.sh @@ -52,6 +52,7 @@ INTROSPECTABLE=( systemd-socket-proxyd systemd-stdio-bridge systemd-storage-block + systemd-storage-fs systemd-tty-ask-password-agent systemd-veritysetup timedatectl