analyze: systematically name verb entry point functions verb_xyz()

Some of the functions so far were named do_xyz(), others dump_xyz() and
even others test_xyz(). let's instead name them exactly like the verb
exposed in the command line, just prefixed with verb_
This commit is contained in:
Lennart Poettering
2022-02-21 17:22:23 +01:00
parent e82116e56b
commit ef38bedbf9
43 changed files with 63 additions and 63 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
#include "analyze-time-data.h"
#include "format-table.h"
int analyze_blame(int argc, char *argv[], void *userdata) {
int verb_blame(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
_cleanup_(unit_times_free_arrayp) UnitTimes *times = NULL;
_cleanup_(table_unrefp) Table *table = NULL;
+1 -1
View File
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int analyze_blame(int argc, char *argv[], void *userdata);
int verb_blame(int argc, char *argv[], void *userdata);
+1 -1
View File
@@ -122,7 +122,7 @@ static int test_calendar_one(usec_t n, const char *p) {
return table_print(table, NULL);
}
int test_calendar(int argc, char *argv[], void *userdata) {
int verb_calendar(int argc, char *argv[], void *userdata) {
int ret = 0, r;
char **p;
usec_t n;
+1 -1
View File
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int test_calendar(int argc, char *argv[], void *userdata);
int verb_calendar(int argc, char *argv[], void *userdata);
+1 -1
View File
@@ -6,7 +6,7 @@
#include "capability-util.h"
#include "format-table.h"
int dump_capabilities(int argc, char *argv[], void *userdata) {
int verb_capabilities(int argc, char *argv[], void *userdata) {
_cleanup_(table_unrefp) Table *table = NULL;
unsigned last_cap;
int r;
+1 -1
View File
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int dump_capabilities(int argc, char *argv[], void *userdata);
int verb_capabilities(int argc, char *argv[], void *userdata);
+1 -1
View File
@@ -9,7 +9,7 @@
#include "pretty-print.h"
#include "strv.h"
int cat_config(int argc, char *argv[], void *userdata) {
int verb_cat_config(int argc, char *argv[], void *userdata) {
char **arg, **list;
int r;
+1 -1
View File
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int cat_config(int argc, char *argv[], void *userdata);
int verb_cat_config(int argc, char *argv[], void *userdata);
+1 -1
View File
@@ -138,6 +138,6 @@ static int verify_conditions(char **lines, UnitFileScope scope, const char *unit
return r > 0 && q > 0 ? 0 : -EIO;
}
int do_condition(int argc, char *argv[], void *userdata) {
int verb_condition(int argc, char *argv[], void *userdata) {
return verify_conditions(strv_skip(argv, 1), arg_scope, arg_unit, arg_root);
}
+1 -1
View File
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int do_condition(int argc, char *argv[], void *userdata);
int verb_condition(int argc, char *argv[], void *userdata);
+1 -1
View File
@@ -195,7 +195,7 @@ static int list_dependencies(sd_bus *bus, const char *name) {
return list_dependencies_one(bus, name, 0, &units, 0);
}
int analyze_critical_chain(int argc, char *argv[], void *userdata) {
int verb_critical_chain(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
_cleanup_(unit_times_free_arrayp) UnitTimes *times = NULL;
Hashmap *h;
+1 -1
View File
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int analyze_critical_chain(int argc, char *argv[], void *userdata);
int verb_critical_chain(int argc, char *argv[], void *userdata);
+1 -1
View File
@@ -123,7 +123,7 @@ static int expand_patterns(sd_bus *bus, char **patterns, char ***ret) {
return 0;
}
int dot(int argc, char *argv[], void *userdata) {
int verb_dot(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
+1 -1
View File
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int dot(int argc, char *argv[], void *userdata);
int verb_dot(int argc, char *argv[], void *userdata);
+1 -1
View File
@@ -29,7 +29,7 @@ static int dump_fallback(sd_bus *bus) {
return 0;
}
int dump(int argc, char *argv[], void *userdata) {
int verb_dump(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
+1 -1
View File
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int dump(int argc, char *argv[], void *userdata);
int verb_dump(int argc, char *argv[], void *userdata);
+1 -1
View File
@@ -5,7 +5,7 @@
#include "exit-status.h"
#include "format-table.h"
int dump_exit_status(int argc, char *argv[], void *userdata) {
int verb_exit_status(int argc, char *argv[], void *userdata) {
_cleanup_(table_unrefp) Table *table = NULL;
int r;
+1 -1
View File
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int dump_exit_status(int argc, char *argv[], void *userdata);
int verb_exit_status(int argc, char *argv[], void *userdata);
+1 -1
View File
@@ -108,7 +108,7 @@ static void dump_filesystem_set(const FilesystemSet *set) {
}
}
int dump_filesystems(int argc, char *argv[], void *userdata) {
int verb_filesystems(int argc, char *argv[], void *userdata) {
bool first = true;
#if ! HAVE_LIBBPF
+1 -1
View File
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int dump_filesystems(int argc, char *argv[], void *userdata);
int verb_filesystems(int argc, char *argv[], void *userdata);
+1 -1
View File
@@ -128,7 +128,7 @@ static int analyze_elf(char **filenames, JsonFormatFlags json_flags) {
return 0;
}
int do_elf_inspection(int argc, char *argv[], void *userdata) {
int verb_elf_inspection(int argc, char *argv[], void *userdata) {
pager_open(arg_pager_flags);
return analyze_elf(strv_skip(argv, 1), arg_json_format_flags);
+1 -1
View File
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int do_elf_inspection(int argc, char *argv[], void *userdata);
int verb_elf_inspection(int argc, char *argv[], void *userdata);
+1 -1
View File
@@ -178,7 +178,7 @@ static int plot_unit_times(UnitTimes *u, double width, int y) {
return 1;
}
int analyze_plot(int argc, char *argv[], void *userdata) {
int verb_plot(int argc, char *argv[], void *userdata) {
_cleanup_(free_host_infop) HostInfo *host = NULL;
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
_cleanup_(unit_times_free_arrayp) UnitTimes *times = NULL;
+1 -1
View File
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int analyze_plot(int argc, char *argv[], void *userdata);
int verb_plot(int argc, char *argv[], void *userdata);
+1 -1
View File
@@ -2890,7 +2890,7 @@ static int analyze_security(sd_bus *bus,
return ret;
}
int do_security(int argc, char *argv[], void *userdata) {
int verb_security(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
_cleanup_(json_variant_unrefp) JsonVariant *policy = NULL;
int r;
+1 -1
View File
@@ -7,4 +7,4 @@ typedef enum AnalyzeSecurityFlags {
ANALYZE_SECURITY_ONLY_LONG_RUNNING = 1 << 2,
} AnalyzeSecurityFlags;
int do_security(int argc, char *argv[], void *userdata);
int verb_security(int argc, char *argv[], void *userdata);
+1 -1
View File
@@ -6,7 +6,7 @@
#include "bus-locator.h"
#include "parse-util.h"
int service_watchdogs(int argc, char *argv[], void *userdata) {
int verb_service_watchdogs(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
int b, r;
+1 -1
View File
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int service_watchdogs(int argc, char *argv[], void *userdata);
int verb_service_watchdogs(int argc, char *argv[], void *userdata);
+1 -1
View File
@@ -86,7 +86,7 @@ static void dump_syscall_filter(const SyscallFilterSet *set) {
printf(" %s%s%s\n", syscall[0] == '@' ? ansi_underline() : "", syscall, ansi_normal());
}
int dump_syscall_filters(int argc, char *argv[], void *userdata) {
int verb_syscall_filters(int argc, char *argv[], void *userdata) {
bool first = true;
pager_open(arg_pager_flags);
+1 -1
View File
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int dump_syscall_filters(int argc, char *argv[], void *userdata);
int verb_syscall_filters(int argc, char *argv[], void *userdata);
+1 -1
View File
@@ -4,7 +4,7 @@
#include "analyze-time.h"
#include "analyze-time-data.h"
int analyze_time(int argc, char *argv[], void *userdata) {
int verb_time(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
_cleanup_free_ char *buf = NULL;
int r;
+1 -1
View File
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int analyze_time(int argc, char *argv[], void *userdata);
int verb_time(int argc, char *argv[], void *userdata);
+1 -1
View File
@@ -8,7 +8,7 @@
#include "strv.h"
#include "terminal-util.h"
int dump_timespan(int argc, char *argv[], void *userdata) {
int verb_timespan(int argc, char *argv[], void *userdata) {
char **input_timespan;
STRV_FOREACH(input_timespan, strv_skip(argv, 1)) {
+1 -1
View File
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int dump_timespan(int argc, char *argv[], void *userdata);
int verb_timespan(int argc, char *argv[], void *userdata);
+1 -1
View File
@@ -78,7 +78,7 @@ static int test_timestamp_one(const char *p) {
return table_print(table, NULL);
}
int test_timestamp(int argc, char *argv[], void *userdata) {
int verb_timestamp(int argc, char *argv[], void *userdata) {
int ret = 0, r;
char **p;
+1 -1
View File
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int test_timestamp(int argc, char *argv[], void *userdata);
int verb_timestamp(int argc, char *argv[], void *userdata);
+1 -1
View File
@@ -15,7 +15,7 @@ static bool strv_fnmatch_strv_or_empty(char* const* patterns, char **strv, int f
return false;
}
int do_unit_files(int argc, char *argv[], void *userdata) {
int verb_unit_files(int argc, char *argv[], void *userdata) {
_cleanup_hashmap_free_ Hashmap *unit_ids = NULL, *unit_names = NULL;
_cleanup_(lookup_paths_free) LookupPaths lp = {};
char **patterns = strv_skip(argv, 1);
+1 -1
View File
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int do_unit_files(int argc, char *argv[], void *userdata);
int verb_unit_files(int argc, char *argv[], void *userdata);
+1 -1
View File
@@ -5,7 +5,7 @@
#include "path-lookup.h"
#include "strv.h"
int dump_unit_paths(int argc, char *argv[], void *userdata) {
int verb_unit_paths(int argc, char *argv[], void *userdata) {
_cleanup_(lookup_paths_free) LookupPaths paths = {};
int r;
char **p;
+1 -1
View File
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int dump_unit_paths(int argc, char *argv[], void *userdata);
int verb_unit_paths(int argc, char *argv[], void *userdata);
+1 -1
View File
@@ -54,7 +54,7 @@ static int process_aliases(char *argv[], char *tempdir, char ***ret) {
return 0;
}
int do_verify(int argc, char *argv[], void *userdata) {
int verb_verify(int argc, char *argv[], void *userdata) {
_cleanup_strv_free_ char **filenames = NULL;
_cleanup_(rm_rf_physical_and_freep) char *tempdir = NULL;
int r;
+1 -1
View File
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int do_verify(int argc, char *argv[], void *userdata);
int verb_verify(int argc, char *argv[], void *userdata);
+21 -21
View File
@@ -541,11 +541,11 @@ static int run(int argc, char *argv[]) {
static const Verb verbs[] = {
{ "help", VERB_ANY, VERB_ANY, 0, help },
{ "time", VERB_ANY, 1, VERB_DEFAULT, analyze_time },
{ "blame", VERB_ANY, 1, 0, analyze_blame },
{ "critical-chain", VERB_ANY, VERB_ANY, 0, analyze_critical_chain },
{ "plot", VERB_ANY, 1, 0, analyze_plot },
{ "dot", VERB_ANY, VERB_ANY, 0, dot },
{ "time", VERB_ANY, 1, VERB_DEFAULT, verb_time },
{ "blame", VERB_ANY, 1, 0, verb_blame },
{ "critical-chain", VERB_ANY, VERB_ANY, 0, verb_critical_chain },
{ "plot", VERB_ANY, 1, 0, verb_plot },
{ "dot", VERB_ANY, VERB_ANY, 0, verb_dot },
/* ↓ The following seven verbs are deprecated, from here … ↓ */
{ "log-level", VERB_ANY, 2, 0, verb_log_control },
{ "log-target", VERB_ANY, 2, 0, verb_log_control },
@@ -553,23 +553,23 @@ static int run(int argc, char *argv[]) {
{ "get-log-level", VERB_ANY, 1, 0, verb_log_control },
{ "set-log-target", 2, 2, 0, verb_log_control },
{ "get-log-target", VERB_ANY, 1, 0, verb_log_control },
{ "service-watchdogs", VERB_ANY, 2, 0, service_watchdogs },
{ "service-watchdogs", VERB_ANY, 2, 0, verb_service_watchdogs },
/* ↑ … until here ↑ */
{ "dump", VERB_ANY, 1, 0, dump },
{ "cat-config", 2, VERB_ANY, 0, cat_config },
{ "unit-files", VERB_ANY, VERB_ANY, 0, do_unit_files },
{ "unit-paths", 1, 1, 0, dump_unit_paths },
{ "exit-status", VERB_ANY, VERB_ANY, 0, dump_exit_status },
{ "syscall-filter", VERB_ANY, VERB_ANY, 0, dump_syscall_filters },
{ "capability", VERB_ANY, VERB_ANY, 0, dump_capabilities },
{ "filesystems", VERB_ANY, VERB_ANY, 0, dump_filesystems },
{ "condition", VERB_ANY, VERB_ANY, 0, do_condition },
{ "verify", 2, VERB_ANY, 0, do_verify },
{ "calendar", 2, VERB_ANY, 0, test_calendar },
{ "timestamp", 2, VERB_ANY, 0, test_timestamp },
{ "timespan", 2, VERB_ANY, 0, dump_timespan },
{ "security", VERB_ANY, VERB_ANY, 0, do_security },
{ "inspect-elf", 2, VERB_ANY, 0, do_elf_inspection },
{ "dump", VERB_ANY, 1, 0, verb_dump },
{ "cat-config", 2, VERB_ANY, 0, verb_cat_config },
{ "unit-files", VERB_ANY, VERB_ANY, 0, verb_unit_files },
{ "unit-paths", 1, 1, 0, verb_unit_paths },
{ "exit-status", VERB_ANY, VERB_ANY, 0, verb_exit_status },
{ "syscall-filter", VERB_ANY, VERB_ANY, 0, verb_syscall_filters },
{ "capability", VERB_ANY, VERB_ANY, 0, verb_capabilities },
{ "filesystems", VERB_ANY, VERB_ANY, 0, verb_filesystems },
{ "condition", VERB_ANY, VERB_ANY, 0, verb_condition },
{ "verify", 2, VERB_ANY, 0, verb_verify },
{ "calendar", 2, VERB_ANY, 0, verb_calendar },
{ "timestamp", 2, VERB_ANY, 0, verb_timestamp },
{ "timespan", 2, VERB_ANY, 0, verb_timespan },
{ "security", VERB_ANY, VERB_ANY, 0, verb_security },
{ "inspect-elf", 2, VERB_ANY, 0, verb_elf_inspection },
{}
};