]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
analyze: move "condition" verb into analyze-condition.[ch]
authorLennart Poettering <lennart@poettering.net>
Mon, 21 Feb 2022 13:42:20 +0000 (14:42 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 21 Feb 2022 16:22:23 +0000 (17:22 +0100)
src/analyze/analyze-condition.c
src/analyze/analyze-condition.h
src/analyze/analyze.c
src/analyze/analyze.h

index e8b0fa978bc8d40a3fdd6fc4303ef77e2562be30..0343e69d8fab11dfea911173c15b4db8efc4fb68 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <stdlib.h>
 
+#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);
+}
index 9ebd205b6d64d178d506a51db972c1789a43a2a0..9cf62041946f9384df2825ec6e0c84a8a589e4d9 100644 (file)
@@ -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);
index cb4d8c7ca474c88a4fe1a4dd389a7378150e321e..1cb981feb681028947d19200bb32d40a6beb7469 100644 (file)
@@ -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;
index 9755f9df36da7aab470e90c7909aefb9e7c5d712..71a682cdc196d9bef968f75c4b1191b1a487d90d 100644 (file)
@@ -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;