From: Lennart Poettering Date: Mon, 21 Feb 2022 13:42:20 +0000 (+0100) Subject: analyze: move "condition" verb into analyze-condition.[ch] X-Git-Tag: v251-rc1~249^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e82116e56bc3f3311f0ab9702a906393cb87e175;p=thirdparty%2Fsystemd.git analyze: move "condition" verb into analyze-condition.[ch] --- diff --git a/src/analyze/analyze-condition.c b/src/analyze/analyze-condition.c index e8b0fa978bc..0343e69d8fa 100644 --- a/src/analyze/analyze-condition.c +++ b/src/analyze/analyze-condition.c @@ -2,6 +2,7 @@ #include +#include "analyze.h" #include "analyze-condition.h" #include "analyze-verify-util.h" #include "condition.h" @@ -73,7 +74,7 @@ static int log_helper(void *userdata, int level, int error, const char *file, in return r; } -int verify_conditions(char **lines, UnitFileScope scope, const char *unit, const char *root) { +static int verify_conditions(char **lines, UnitFileScope scope, const char *unit, const char *root) { _cleanup_(manager_freep) Manager *m = NULL; Unit *u; int r, q = 1; @@ -136,3 +137,7 @@ int verify_conditions(char **lines, UnitFileScope scope, const char *unit, const return r > 0 && q > 0 ? 0 : -EIO; } + +int do_condition(int argc, char *argv[], void *userdata) { + return verify_conditions(strv_skip(argv, 1), arg_scope, arg_unit, arg_root); +} diff --git a/src/analyze/analyze-condition.h b/src/analyze/analyze-condition.h index 9ebd205b6d6..9cf62041946 100644 --- a/src/analyze/analyze-condition.h +++ b/src/analyze/analyze-condition.h @@ -1,6 +1,4 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "install.h" - -int verify_conditions(char **lines, UnitFileScope scope, const char *unit, const char *root); +int do_condition(int argc, char *argv[], void *userdata); diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c index cb4d8c7ca47..1cb981feb68 100644 --- a/src/analyze/analyze.c +++ b/src/analyze/analyze.c @@ -100,7 +100,7 @@ bool arg_offline = false; unsigned arg_threshold = 100; unsigned arg_iterations = 1; usec_t arg_base_time = USEC_INFINITY; -static char *arg_unit = NULL; +char *arg_unit = NULL; JsonFormatFlags arg_json_format_flags = JSON_FORMAT_OFF; bool arg_quiet = false; char *arg_profile = NULL; @@ -163,10 +163,6 @@ void time_parsing_hint(const char *p, bool calendar, bool timestamp, bool timesp "Use 'systemd-analyze timespan \"%s\"' instead?", p); } -static int do_condition(int argc, char *argv[], void *userdata) { - return verify_conditions(strv_skip(argv, 1), arg_scope, arg_unit, arg_root); -} - static int help(int argc, char *argv[], void *userdata) { _cleanup_free_ char *link = NULL, *dot_link = NULL; int r; diff --git a/src/analyze/analyze.h b/src/analyze/analyze.h index 9755f9df36d..71a682cdc19 100644 --- a/src/analyze/analyze.h +++ b/src/analyze/analyze.h @@ -32,6 +32,7 @@ extern bool arg_offline; extern unsigned arg_threshold; extern unsigned arg_iterations; extern usec_t arg_base_time; +extern char *arg_unit; extern JsonFormatFlags arg_json_format_flags; extern bool arg_quiet; extern char *arg_profile;