1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-01 08:58:29 +03:00

analyze: move "condition" verb into analyze-condition.[ch]

This commit is contained in:
Lennart Poettering 2022-02-21 14:42:20 +01:00
parent f2562398ea
commit e82116e56b
4 changed files with 9 additions and 9 deletions

View 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);
}

View 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);

View 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;

View 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;