analyze: Clean up includes

Split out of #37344.
This commit is contained in:
Daan De Meyer
2025-05-22 03:06:46 +09:00
committed by Yu Watanabe
parent bcb9e72b6b
commit 4bde87437a
39 changed files with 165 additions and 86 deletions
+5
View File
@@ -2,7 +2,12 @@
#include "analyze.h"
#include "analyze-architectures.h"
#include "ansi-color.h"
#include "architecture.h"
#include "format-table.h"
#include "log.h"
#include "string-util.h"
#include "strv.h"
static int add_arch(Table *t, Architecture a) {
const char *c, *color;
+5 -1
View File
@@ -1,9 +1,13 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "sd-bus.h"
#include "analyze.h"
#include "analyze-blame.h"
#include "analyze-time-data.h"
#include "bus-util.h"
#include "format-table.h"
#include "runtime-scope.h"
int verb_blame(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
@@ -65,5 +69,5 @@ int verb_blame(int argc, char *argv[], void *userdata) {
if (r < 0)
return r;
return EXIT_SUCCESS;
return 0;
}
+6 -1
View File
@@ -3,9 +3,14 @@
#include "alloc-util.h"
#include "analyze.h"
#include "analyze-calendar.h"
#include "ansi-color.h"
#include "calendarspec.h"
#include "errno-util.h"
#include "format-table.h"
#include "terminal-util.h"
#include "log.h"
#include "string-util.h"
#include "strv.h"
#include "time-util.h"
static int test_calendar_one(usec_t n, const char *p) {
_cleanup_(calendar_spec_freep) CalendarSpec *spec = NULL;
+2 -1
View File
@@ -5,6 +5,7 @@
#include "cap-list.h"
#include "capability-util.h"
#include "format-table.h"
#include "log.h"
#include "parse-util.h"
static int table_add_capability(Table *table, int c) {
@@ -83,5 +84,5 @@ int verb_capabilities(int argc, char *argv[], void *userdata) {
if (r < 0)
return log_error_errno(r, "Failed to output table: %m");
return EXIT_SUCCESS;
return 0;
}
+3 -2
View File
@@ -2,8 +2,9 @@
#include "analyze.h"
#include "analyze-cat-config.h"
#include "conf-files.h"
#include "constants.h"
#include "log.h"
#include "pager.h"
#include "path-util.h"
#include "pretty-print.h"
#include "strv.h"
@@ -38,5 +39,5 @@ int verb_cat_config(int argc, char *argv[], void *userdata) {
return r;
}
return EXIT_SUCCESS;
return 0;
}
+4 -1
View File
@@ -5,16 +5,19 @@
#include "alloc-util.h"
#include "analyze.h"
#include "analyze-chid.h"
#include "ansi-color.h"
#include "chid-fundamental.h"
#include "device-util.h"
#include "dirent-util.h"
#include "edid-fundamental.h"
#include "efi-api.h"
#include "errno-util.h"
#include "escape.h"
#include "fd-util.h"
#include "fileio.h"
#include "format-table.h"
#include "glyph-util.h"
#include "parse-util.h"
#include "string-util.h"
#include "strv.h"
#include "utf8.h"
#include "virt.h"
-2
View File
@@ -5,9 +5,7 @@
#include "analyze-compare-versions.h"
#include "compare-operator.h"
#include "log.h"
#include "macro.h"
#include "string-util.h"
#include "strv.h"
int verb_compare_versions(int argc, char *argv[], void *userdata) {
const char *v1 = ASSERT_PTR(argv[1]), *v2 = ASSERT_PTR(argv[argc-1]);
+3 -1
View File
@@ -6,9 +6,11 @@
#include "analyze-condition.h"
#include "analyze-verify-util.h"
#include "condition.h"
#include "conf-parser.h"
#include "load-fragment.h"
#include "manager.h"
#include "service.h"
#include "string-util.h"
#include "strv.h"
static int parse_condition(Unit *u, const char *line) {
assert(u);
+10 -3
View File
@@ -1,17 +1,24 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "sd-bus.h"
#include "alloc-util.h"
#include "analyze.h"
#include "analyze-critical-chain.h"
#include "analyze-time-data.h"
#include "ansi-color.h"
#include "bus-error.h"
#include "copy.h"
#include "path-util.h"
#include "bus-util.h"
#include "glyph-util.h"
#include "hashmap.h"
#include "log.h"
#include "pager.h"
#include "runtime-scope.h"
#include "sort-util.h"
#include "special.h"
#include "static-destruct.h"
#include "strv.h"
#include "terminal-util.h"
#include "time-util.h"
static Hashmap *unit_times_hashmap = NULL;
STATIC_DESTRUCTOR_REGISTER(unit_times_hashmap, hashmap_freep);
+7
View File
@@ -1,12 +1,19 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "sd-bus.h"
#include "alloc-util.h"
#include "analyze.h"
#include "analyze-dot.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "bus-unit-util.h"
#include "bus-util.h"
#include "glob-util.h"
#include "log.h"
#include "runtime-scope.h"
#include "string-util.h"
#include "strv.h"
#include "terminal-util.h"
static int graph_one_property(
+4
View File
@@ -8,6 +8,10 @@
#include "bus-locator.h"
#include "bus-message-util.h"
#include "bus-util.h"
#include "pager.h"
#include "runtime-scope.h"
#include "strv.h"
#include "unit-name.h"
static int dump_string(sd_bus *bus) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
+3 -1
View File
@@ -4,6 +4,8 @@
#include "analyze-exit-status.h"
#include "exit-status.h"
#include "format-table.h"
#include "log.h"
#include "strv.h"
int verb_exit_status(int argc, char *argv[], void *userdata) {
_cleanup_(table_unrefp) Table *table = NULL;
@@ -51,5 +53,5 @@ int verb_exit_status(int argc, char *argv[], void *userdata) {
if (r < 0)
return log_error_errno(r, "Failed to output table: %m");
return EXIT_SUCCESS;
return 0;
}
+8
View File
@@ -1,12 +1,20 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sys/sysmacros.h>
#include "sd-bus.h"
#include "alloc-util.h"
#include "analyze.h"
#include "analyze-fdstore.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "bus-util.h"
#include "fd-util.h"
#include "format-table.h"
#include "runtime-scope.h"
#include "strv.h"
#include "unit-name.h"
static int dump_fdstore(sd_bus *bus, const char *arg) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
-2
View File
@@ -1,5 +1,3 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "sd-bus.h"
int verb_fdstore(int argc, char *argv[], void *userdata);
+7 -1
View File
@@ -1,13 +1,19 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdio.h>
#include "alloc-util.h"
#include "analyze.h"
#include "analyze-filesystems.h"
#include "ansi-color.h"
#include "fileio.h"
#include "filesystems.h"
#include "log.h"
#include "nulstr-util.h"
#include "pager.h"
#include "set.h"
#include "string-util.h"
#include "strv.h"
#include "terminal-util.h"
static int load_available_kernel_filesystems(Set **ret) {
_cleanup_set_free_ Set *filesystems = NULL;
+2 -1
View File
@@ -3,9 +3,10 @@
#include "alloc-util.h"
#include "analyze.h"
#include "analyze-image-policy.h"
#include "ansi-color.h"
#include "format-table.h"
#include "image-policy.h"
#include "terminal-util.h"
#include "string-util.h"
static int table_add_designator_line(Table *table, PartitionDesignator d, PartitionPolicyFlags f) {
_cleanup_free_ char *q = NULL;
+1 -3
View File
@@ -7,12 +7,10 @@
#include "analyze-inspect-elf.h"
#include "chase.h"
#include "elf-util.h"
#include "errno-util.h"
#include "fd-util.h"
#include "format-table.h"
#include "format-util.h"
#include "json-util.h"
#include "path-util.h"
#include "string-util.h"
#include "strv.h"
static int analyze_elf(char **filenames, sd_json_format_flags_t json_flags) {
+5 -1
View File
@@ -1,7 +1,11 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "sd-bus.h"
#include "analyze.h"
#include "analyze-log-control.h"
#include "bus-util.h"
#include "runtime-scope.h"
#include "verb-log-control.h"
int verb_log_control(int argc, char *argv[], void *userdata) {
@@ -18,5 +22,5 @@ int verb_log_control(int argc, char *argv[], void *userdata) {
if (r < 0)
return r;
return EXIT_SUCCESS;
return 0;
}
+5 -1
View File
@@ -7,6 +7,10 @@
#include "bus-error.h"
#include "bus-internal.h"
#include "bus-message-util.h"
#include "bus-util.h"
#include "log.h"
#include "pager.h"
#include "strv.h"
static int dump_malloc_info(sd_bus *bus, char *service) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
@@ -61,5 +65,5 @@ int verb_malloc(int argc, char *argv[], void *userdata) {
return r;
}
return EXIT_SUCCESS;
return 0;
}
+5 -1
View File
@@ -1,12 +1,16 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <unistd.h>
#include "alloc-util.h"
#include "analyze.h"
#include "analyze-pcrs.h"
#include "ansi-color.h"
#include "fileio.h"
#include "format-table.h"
#include "hexdecoct.h"
#include "terminal-util.h"
#include "log.h"
#include "strv.h"
#include "tpm2-util.h"
static int get_pcr_alg(const char **ret) {
+6
View File
@@ -1,15 +1,21 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "sd-bus.h"
#include "alloc-util.h"
#include "analyze.h"
#include "analyze-plot.h"
#include "analyze-time-data.h"
#include "bus-error.h"
#include "bus-map-properties.h"
#include "bus-util.h"
#include "format-table.h"
#include "os-util.h"
#include "runtime-scope.h"
#include "sort-util.h"
#include "string-util.h"
#include "strv.h"
#include "time-util.h"
#include "unit-def.h"
#include "version.h"
+4 -6
View File
@@ -1,11 +1,12 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sys/utsname.h>
#include <linux/capability.h>
#include "af-list.h"
#include "sd-bus.h"
#include "analyze-verify-util.h"
#include "analyze.h"
#include "analyze-security.h"
#include "analyze-verify.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "bus-map-properties.h"
@@ -17,8 +18,6 @@
#include "fileio.h"
#include "format-table.h"
#include "in-addr-prefix-util.h"
#include "locale-util.h"
#include "macro.h"
#include "manager.h"
#include "missing_sched.h"
#include "mkdir.h"
@@ -32,7 +31,6 @@
#include "set.h"
#include "stdio-util.h"
#include "strv.h"
#include "terminal-util.h"
#include "unit-def.h"
#include "unit-name.h"
#include "unit-serialize.h"
+5
View File
@@ -1,10 +1,15 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "sd-bus.h"
#include "analyze.h"
#include "analyze-service-watchdogs.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "bus-util.h"
#include "parse-util.h"
#include "runtime-scope.h"
#include "string-util.h"
int verb_service_watchdogs(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
+4 -1
View File
@@ -1,11 +1,14 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdio.h>
#include "alloc-util.h"
#include "analyze.h"
#include "analyze-smbios11.h"
#include "escape.h"
#include "glyph-util.h"
#include "log.h"
#include "smbios11.h"
#include "virt.h"
int verb_smbios11(int argc, char *argv[], void *userdata) {
unsigned n = 0;
+5 -1
View File
@@ -1,9 +1,13 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdio.h>
#include <unistd.h>
#include "alloc-util.h"
#include "analyze.h"
#include "analyze-srk.h"
#include "fileio.h"
#include "log.h"
#include "terminal-util.h"
#include "tpm2-util.h"
int verb_srk(int argc, char *argv[], void *userdata) {
+3 -1
View File
@@ -3,13 +3,15 @@
#include "alloc-util.h"
#include "analyze.h"
#include "analyze-syscall-filter.h"
#include "ansi-color.h"
#include "fd-util.h"
#include "fileio.h"
#include "log.h"
#include "nulstr-util.h"
#include "pager.h"
#include "seccomp-util.h"
#include "set.h"
#include "strv.h"
#include "terminal-util.h"
#if HAVE_SECCOMP
+7 -1
View File
@@ -1,5 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "sd-bus.h"
#include "alloc-util.h"
#include "analyze.h"
#include "analyze-time-data.h"
@@ -7,9 +9,13 @@
#include "bus-locator.h"
#include "bus-map-properties.h"
#include "bus-unit-util.h"
#include "memory-util.h"
#include "bus-util.h"
#include "log.h"
#include "runtime-scope.h"
#include "special.h"
#include "string-util.h"
#include "strv.h"
#include "time-util.h"
static void subtract_timestamp(usec_t *a, usec_t b) {
assert(a);
+1 -4
View File
@@ -1,10 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-bus.h"
#include "memory-util.h"
#include "time-util.h"
#include "forward.h"
#include "unit-def.h"
typedef struct BootTimes {
+4
View File
@@ -1,9 +1,13 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "sd-bus.h"
#include "alloc-util.h"
#include "analyze.h"
#include "analyze-time.h"
#include "analyze-time-data.h"
#include "bus-util.h"
#include "runtime-scope.h"
int verb_time(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
+3 -2
View File
@@ -2,11 +2,12 @@
#include "analyze.h"
#include "analyze-timespan.h"
#include "calendarspec.h"
#include "ansi-color.h"
#include "format-table.h"
#include "glyph-util.h"
#include "log.h"
#include "strv.h"
#include "terminal-util.h"
#include "time-util.h"
int verb_timespan(int argc, char *argv[], void *userdata) {
STRV_FOREACH(input_timespan, strv_skip(argv, 1)) {
+5 -1
View File
@@ -2,8 +2,12 @@
#include "analyze.h"
#include "analyze-timestamp.h"
#include "ansi-color.h"
#include "errno-util.h"
#include "format-table.h"
#include "terminal-util.h"
#include "log.h"
#include "strv.h"
#include "time-util.h"
static int test_timestamp_one(const char *p) {
_cleanup_(table_unrefp) Table *table = NULL;
+5
View File
@@ -1,12 +1,17 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdio.h>
#include <fnmatch.h>
#include "alloc-util.h"
#include "analyze.h"
#include "analyze-unit-files.h"
#include "hashmap.h"
#include "log.h"
#include "path-lookup.h"
#include "strv.h"
#include "unit-file.h"
static bool strv_fnmatch_strv_or_empty(char* const* patterns, char **strv, int flags) {
STRV_FOREACH(s, strv)
+3 -1
View File
@@ -1,5 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdio.h>
#include "analyze.h"
#include "analyze-unit-paths.h"
#include "path-lookup.h"
@@ -16,5 +18,5 @@ int verb_unit_paths(int argc, char *argv[], void *userdata) {
STRV_FOREACH(p, paths.search_path)
puts(*p);
return EXIT_SUCCESS;
return 0;
}
+5 -1
View File
@@ -2,17 +2,21 @@
#include <stdlib.h>
#include "sd-bus.h"
#include "all-units.h"
#include "alloc-util.h"
#include "analyze.h"
#include "analyze-verify-util.h"
#include "bus-error.h"
#include "bus-util.h"
#include "errno-util.h"
#include "log.h"
#include "manager.h"
#include "pager.h"
#include "path-util.h"
#include "set.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "unit-name.h"
#include "unit-serialize.h"
+3 -3
View File
@@ -1,10 +1,10 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "forward.h"
#include "execute.h"
#include "path-lookup.h"
typedef struct ExecCommand ExecCommand;
typedef struct Unit Unit;
typedef enum RecursiveErrors {
RECURSIVE_ERRORS_YES, /* Look for errors in all associated units */
+6 -1
View File
@@ -2,10 +2,15 @@
#include "alloc-util.h"
#include "analyze.h"
#include "analyze-verify.h"
#include "analyze-verify-util.h"
#include "analyze-verify.h"
#include "copy.h"
#include "extract-word.h"
#include "log.h"
#include "path-util.h"
#include "rm-rf.h"
#include "runtime-scope.h"
#include "strv.h"
#include "tmpfile-util.h"
static int process_aliases(char *argv[], char *tempdir, char ***ret) {
+8 -31
View File
@@ -4,14 +4,15 @@
***/
#include <getopt.h>
#include <inttypes.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "sd-bus.h"
#include "sd-json.h"
#include "alloc-util.h"
#include "analyze-verify-util.h"
#include "analyze.h"
#include "analyze-architectures.h"
#include "analyze-blame.h"
@@ -40,7 +41,6 @@
#include "analyze-srk.h"
#include "analyze-syscall-filter.h"
#include "analyze-time.h"
#include "analyze-time-data.h"
#include "analyze-timespan.h"
#include "analyze-timestamp.h"
#include "analyze-unit-files.h"
@@ -48,48 +48,25 @@
#include "analyze-verify.h"
#include "build.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "bus-map-properties.h"
#include "bus-unit-util.h"
#include "bus-util.h"
#include "calendarspec.h"
#include "cap-list.h"
#include "capability-util.h"
#include "conf-files.h"
#include "constants.h"
#include "copy.h"
#include "exit-status.h"
#include "extract-word.h"
#include "fd-util.h"
#include "fileio.h"
#include "filesystems.h"
#include "format-table.h"
#include "glob-util.h"
#include "hashmap.h"
#include "dissect-image.h"
#include "image-policy.h"
#include "locale-util.h"
#include "log.h"
#include "loop-util.h"
#include "main-func.h"
#include "mount-util.h"
#include "nulstr-util.h"
#include "pager.h"
#include "parse-argument.h"
#include "parse-util.h"
#include "path-util.h"
#include "pretty-print.h"
#include "rm-rf.h"
#if HAVE_SECCOMP
# include "seccomp-util.h"
#endif
#include "sort-util.h"
#include "special.h"
#include "stat-util.h"
#include "runtime-scope.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "strxcpyx.h"
#include "terminal-util.h"
#include "time-util.h"
#include "unit-name.h"
#include "verb-log-control.h"
#include "verbs.h"
DotMode arg_dot = DEP_ALL;
+2 -9
View File
@@ -1,16 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "forward.h"
#include "sd-json.h"
#include "analyze-verify-util.h"
#include "bus-util.h"
#include "pager.h"
#include "pretty-print.h"
#include "time-util.h"
#include "unit-file.h"
typedef enum RecursiveErrors RecursiveErrors;
typedef enum DotMode {
DEP_ALL,
+1
View File
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "analyze-verify-util.h"
#include "execute.h"
#include "tests.h"
const char *arg_instance = "test_instance";