From eb6297012d56773571acaeebfe453e2fed623eeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sun, 16 Aug 2026 14:39:07 +0200 Subject: [PATCH] systemd-storage-block: 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 block device backed storage provider" to the imperative "Expose local block devices as storage volumes.", following the man page and consistent with the other commands. --- src/storage/storage-block.c | 36 ++++++------------- .../units/TEST-74-AUX-UTILS.introspect-cli.sh | 1 + 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/src/storage/storage-block.c b/src/storage/storage-block.c index b33bf9ce40..363fad66da 100644 --- a/src/storage/storage-block.c +++ b/src/storage/storage-block.c @@ -13,18 +13,22 @@ #include "device-util.h" #include "errno-util.h" #include "fd-util.h" -#include "format-table.h" #include "hashmap.h" -#include "help-util.h" #include "json-util.h" #include "log.h" #include "main-func.h" -#include "options.h" #include "path-util.h" #include "storage-util.h" #include "strv.h" #include "varlink-io.systemd.StorageProvider.h" #include "varlink-util.h" +#include "verbs.h" + +COMMAND( + "systemd-storage-block\0", + "Expose local block devices as storage volumes.", + .man_pages = "systemd-storage-block.8\0", +); static int block_device_pick_name( const BlockDevice *d, @@ -382,27 +386,6 @@ static int vl_server(void) { return 0; } -static int help(void) { - int r; - - help_cmdline("[OPTIONS...]"); - help_abstract("Simple block device 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-block", "8"); - return 0; -} - static int parse_argv(int argc, char *argv[]) { assert(argc >= 0); assert(argv); @@ -412,10 +395,13 @@ static int parse_argv(int argc, char *argv[]) { switch (c) { OPTION_COMMON_HELP: - return help(); + return command_print_help("systemd-storage-block"); OPTION_COMMON_VERSION: return version(); + + 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 cc1009b079..85bb2e0e62 100755 --- a/test/units/TEST-74-AUX-UTILS.introspect-cli.sh +++ b/test/units/TEST-74-AUX-UTILS.introspect-cli.sh @@ -51,6 +51,7 @@ INTROSPECTABLE=( systemd-socket-activate systemd-socket-proxyd systemd-stdio-bridge + systemd-storage-block systemd-tty-ask-password-agent systemd-veritysetup timedatectl