From 3e0f1aff945b1456eb62207c32bcf3e99f840a0c Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 14 May 2025 23:35:14 +0200 Subject: [PATCH] portable: Clean up includes Split out of #37344. --- src/portable/portable.c | 11 ++++++----- src/portable/portable.h | 6 +----- src/portable/portablectl.c | 7 +------ src/portable/portabled-bus.c | 7 +++++-- src/portable/portabled-bus.h | 4 ++-- src/portable/portabled-forward.h | 8 ++++++++ src/portable/portabled-image-bus.c | 9 ++++++--- src/portable/portabled-image-bus.h | 6 ++---- src/portable/portabled-image.c | 5 ++++- src/portable/portabled-image.h | 7 +------ src/portable/portabled-operation.c | 5 +++++ src/portable/portabled-operation.h | 13 +++---------- src/portable/portabled.c | 8 ++++---- src/portable/portabled.h | 6 +----- 14 files changed, 49 insertions(+), 53 deletions(-) create mode 100644 src/portable/portabled-forward.h diff --git a/src/portable/portable.c b/src/portable/portable.c index 763f283bb4a..75e32abcce2 100644 --- a/src/portable/portable.c +++ b/src/portable/portable.c @@ -2,6 +2,7 @@ #include +#include "sd-bus.h" #include "sd-messages.h" #include "bus-common-errors.h" @@ -9,7 +10,6 @@ #include "bus-locator.h" #include "chase.h" #include "conf-files.h" -#include "constants.h" #include "copy.h" #include "data-fd-util.h" #include "dirent-util.h" @@ -17,19 +17,20 @@ #include "dissect-image.h" #include "env-file.h" #include "env-util.h" -#include "errno-list.h" +#include "errno-util.h" #include "escape.h" #include "extension-util.h" +#include "extract-word.h" #include "fd-util.h" #include "fileio.h" #include "fs-util.h" +#include "glyph-util.h" #include "install.h" #include "iovec-util.h" -#include "locale-util.h" #include "log-context.h" +#include "log.h" #include "loop-util.h" #include "mkdir.h" -#include "nulstr-util.h" #include "os-util.h" #include "path-lookup.h" #include "portable.h" @@ -44,7 +45,7 @@ #include "string-table.h" #include "strv.h" #include "tmpfile-util.h" -#include "user-util.h" +#include "unit-name.h" #include "vpick.h" /* Markers used in the first line of our 20-portable.conf unit file drop-in to determine, that a) the unit file was diff --git a/src/portable/portable.h b/src/portable/portable.h index 03977159f08..c0ce30f72dd 100644 --- a/src/portable/portable.h +++ b/src/portable/portable.h @@ -1,13 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "sd-bus.h" - #include "dissect-image.h" -#include "hashmap.h" -#include "macro.h" +#include "forward.h" #include "runtime-scope.h" -#include "set.h" #include "string-util.h" typedef struct PortableMetadata { diff --git a/src/portable/portablectl.c b/src/portable/portablectl.c index 6624f36299c..ab49cf6edf7 100644 --- a/src/portable/portablectl.c +++ b/src/portable/portablectl.c @@ -1,6 +1,5 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include #include #include "sd-bus.h" @@ -12,18 +11,15 @@ #include "bus-unit-util.h" #include "bus-wait-for-jobs.h" #include "chase.h" -#include "constants.h" -#include "dirent-util.h" #include "env-file.h" #include "fd-util.h" #include "fileio.h" #include "format-table.h" #include "fs-util.h" -#include "locale-util.h" +#include "install.h" #include "main-func.h" #include "os-util.h" #include "pager.h" -#include "parse-argument.h" #include "parse-util.h" #include "path-util.h" #include "polkit-agent.h" @@ -31,7 +27,6 @@ #include "pretty-print.h" #include "string-util.h" #include "strv.h" -#include "terminal-util.h" #include "verbs.h" static PagerFlags arg_pager_flags = 0; diff --git a/src/portable/portabled-bus.c b/src/portable/portabled-bus.c index f313ce37ca9..e347db5c0db 100644 --- a/src/portable/portabled-bus.c +++ b/src/portable/portabled-bus.c @@ -1,20 +1,23 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include "sd-bus.h" + #include "alloc-util.h" #include "btrfs-util.h" -#include "bus-common-errors.h" +#include "bus-error.h" #include "bus-object.h" #include "bus-polkit.h" #include "discover-image.h" #include "fd-util.h" +#include "hashmap.h" #include "io-util.h" +#include "log.h" #include "portable.h" #include "portabled.h" #include "portabled-bus.h" #include "portabled-image.h" #include "portabled-image-bus.h" #include "strv.h" -#include "user-util.h" static int property_get_pool_path( sd_bus *bus, diff --git a/src/portable/portabled-bus.h b/src/portable/portabled-bus.h index c216c3aa759..b95ce5c6474 100644 --- a/src/portable/portabled-bus.h +++ b/src/portable/portabled-bus.h @@ -1,9 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "sd-bus.h" +#include "sd-bus-vtable.h" -typedef struct PortableChange PortableChange; +#include "portabled-forward.h" extern const sd_bus_vtable manager_vtable[]; diff --git a/src/portable/portabled-forward.h b/src/portable/portabled-forward.h new file mode 100644 index 00000000000..c4529f07fac --- /dev/null +++ b/src/portable/portabled-forward.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +#pragma once + +#include "forward.h" // IWYU pragma: export + +typedef struct Manager Manager; +typedef struct Operation Operation; +typedef struct PortableChange PortableChange; diff --git a/src/portable/portabled-image-bus.c b/src/portable/portabled-image-bus.c index 6a35262e6d0..021035ab85c 100644 --- a/src/portable/portabled-image-bus.c +++ b/src/portable/portabled-image-bus.c @@ -2,29 +2,32 @@ #include #include -#include #include +#include "sd-bus.h" + #include "alloc-util.h" #include "bus-common-errors.h" #include "bus-get-properties.h" -#include "bus-label.h" #include "bus-object.h" #include "bus-polkit.h" #include "bus-util.h" #include "discover-image.h" #include "fd-util.h" #include "fileio.h" +#include "hashmap.h" +#include "image-policy.h" #include "io-util.h" #include "os-util.h" +#include "path-util.h" #include "portable.h" #include "portabled.h" #include "portabled-bus.h" #include "portabled-image.h" #include "portabled-image-bus.h" +#include "portabled-operation.h" #include "process-util.h" #include "strv.h" -#include "user-util.h" static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_type, image_type, ImageType); diff --git a/src/portable/portabled-image-bus.h b/src/portable/portabled-image-bus.h index d37c244315e..5784d3ab151 100644 --- a/src/portable/portabled-image-bus.h +++ b/src/portable/portabled-image-bus.h @@ -1,12 +1,10 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "sd-bus.h" +#include "sd-bus-vtable.h" #include "bus-object.h" -#include "discover-image.h" - -typedef struct Manager Manager; +#include "portabled-forward.h" int bus_image_common_get_os_release(Manager *m, sd_bus_message *message, const char *name_or_path, Image *image, sd_bus_error *error); int bus_image_common_get_metadata(Manager *m, sd_bus_message *message, const char *name_or_path, Image *image, sd_bus_error *error); diff --git a/src/portable/portabled-image.c b/src/portable/portabled-image.c index f14d1a69efd..961ca4588a6 100644 --- a/src/portable/portabled-image.c +++ b/src/portable/portabled-image.c @@ -1,6 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include "portable.h" +#include "sd-event.h" + +#include "discover-image.h" +#include "hashmap.h" #include "portabled.h" #include "portabled-image.h" diff --git a/src/portable/portabled-image.h b/src/portable/portabled-image.h index 424694b3fd8..ababa411a88 100644 --- a/src/portable/portabled-image.h +++ b/src/portable/portabled-image.h @@ -1,12 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "sd-bus.h" - -#include "discover-image.h" -#include "hashmap.h" - -typedef struct Manager Manager; +#include "portabled-forward.h" Image *manager_image_cache_get(Manager *m, const char *name_or_path); diff --git a/src/portable/portabled-operation.c b/src/portable/portabled-operation.c index 0e4a6e46294..236904c728c 100644 --- a/src/portable/portabled-operation.c +++ b/src/portable/portabled-operation.c @@ -1,9 +1,14 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include #include +#include "sd-bus.h" +#include "sd-event.h" + #include "alloc-util.h" #include "fd-util.h" +#include "format-util.h" #include "log.h" #include "portabled.h" #include "portabled-operation.h" diff --git a/src/portable/portabled-operation.h b/src/portable/portabled-operation.h index efbadc46209..7d3210a3f35 100644 --- a/src/portable/portabled-operation.h +++ b/src/portable/portabled-operation.h @@ -1,19 +1,12 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include - -#include "sd-bus.h" -#include "sd-event.h" - #include "list.h" - -typedef struct Manager Manager; -typedef struct Operation Operation; +#include "portabled-forward.h" #define OPERATIONS_MAX 64 -struct Operation { +typedef struct Operation { Manager *manager; pid_t pid; sd_bus_message *message; @@ -22,7 +15,7 @@ struct Operation { sd_event_source *event_source; int (*done)(Operation *o, int ret, sd_bus_error *error); LIST_FIELDS(Operation, operations); -}; +} Operation; int operation_new(Manager *manager, pid_t child, sd_bus_message *message, int errno_fd, Operation **ret); Operation *operation_free(Operation *o); diff --git a/src/portable/portabled.c b/src/portable/portabled.c index ddc9935a7d6..b9c880992d5 100644 --- a/src/portable/portabled.c +++ b/src/portable/portabled.c @@ -1,24 +1,24 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include -#include #include "sd-bus.h" +#include "sd-event.h" #include "alloc-util.h" #include "bus-log-control-api.h" -#include "bus-polkit.h" #include "bus-util.h" #include "common-signal.h" #include "constants.h" #include "daemon-util.h" +#include "hashmap.h" +#include "log.h" #include "main-func.h" #include "portabled.h" -#include "portabled-bus.h" #include "portabled-image-bus.h" -#include "process-util.h" #include "service-util.h" #include "signal-util.h" +#include "time-util.h" static Manager* manager_unref(Manager *m); DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_unref); diff --git a/src/portable/portabled.h b/src/portable/portabled.h index 418c1040daf..c7ce2479555 100644 --- a/src/portable/portabled.h +++ b/src/portable/portabled.h @@ -1,13 +1,9 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "sd-bus.h" -#include "sd-event.h" - #include "bus-object.h" -#include "hashmap.h" #include "list.h" -#include "portabled-operation.h" +#include "portabled-forward.h" #include "runtime-scope.h" typedef struct Manager { -- 2.47.3