]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sysupdate: Clean up includes
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 21 May 2025 11:56:03 +0000 (13:56 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 21 May 2025 14:53:40 +0000 (23:53 +0900)
Split out of #37344.

23 files changed:
src/sysupdate/sysupdate-cache.c
src/sysupdate/sysupdate-cache.h
src/sysupdate/sysupdate-feature.c
src/sysupdate/sysupdate-feature.h
src/sysupdate/sysupdate-forward.h [new file with mode: 0644]
src/sysupdate/sysupdate-instance.c
src/sysupdate/sysupdate-instance.h
src/sysupdate/sysupdate-partition.c
src/sysupdate/sysupdate-partition.h
src/sysupdate/sysupdate-pattern.c
src/sysupdate/sysupdate-pattern.h
src/sysupdate/sysupdate-resource.c
src/sysupdate/sysupdate-resource.h
src/sysupdate/sysupdate-transfer.c
src/sysupdate/sysupdate-transfer.h
src/sysupdate/sysupdate-update-set-flags.c
src/sysupdate/sysupdate-update-set-flags.h
src/sysupdate/sysupdate-update-set.c
src/sysupdate/sysupdate-update-set.h
src/sysupdate/sysupdate.c
src/sysupdate/sysupdate.h
src/sysupdate/sysupdated.c
src/sysupdate/updatectl.c

index bc3a62bbb21ae6cc13d3f7eeffc0c00d4c780533..23cef57b088fca833b9d4d5414fe66bd0d3bc0ab 100644 (file)
@@ -1,5 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include "alloc-util.h"
+#include "hashmap.h"
 #include "memory-util.h"
 #include "sysupdate-cache.h"
 
index d6a789739938e15d5589806ea6e35399ecab871c..dbce5e6232cfbd5f3b9f8c41c29bca631aac6f32 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include "hashmap.h"
+#include "sysupdate-forward.h"
 
 typedef struct WebCacheItem {
         char *url;
index 133db82b0b54f7bed978ae1324c06bae8c08aab4..2771b58a8ad59b6fb025f2abd7fa66be8bba5a04 100644 (file)
@@ -4,6 +4,7 @@
 #include "conf-parser.h"
 #include "hash-funcs.h"
 #include "path-util.h"
+#include "string-util.h"
 #include "sysupdate.h"
 #include "sysupdate-feature.h"
 #include "web-util.h"
index c66e9084d02dd702f363c56950ac54a026a02a47..08ba9f06758cd7d57eed5537a53e08095fdd77dc 100644 (file)
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include "hash-funcs.h"
-#include "memory-util.h"
+#include "sysupdate-forward.h"
 
 typedef struct Feature {
         unsigned n_ref;
diff --git a/src/sysupdate/sysupdate-forward.h b/src/sysupdate/sysupdate-forward.h
new file mode 100644 (file)
index 0000000..d6b83c0
--- /dev/null
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#include "forward.h" /* IWYU pragma: export */
+
+typedef struct Context Context;
+typedef struct PartitionInfo PartitionInfo;
+typedef struct Resource Resource;
+typedef struct Instance Instance;
+typedef struct InstanceMetadata InstanceMetadata;
index b06fe9bc965d7e9cc790b757e37207fd7987a73a..91b5d988d99c48f420e65a0ad136f6ef0d127258 100644 (file)
@@ -1,8 +1,5 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include <fcntl.h>
-#include <sys/stat.h>
-
 #include "alloc-util.h"
 #include "log.h"
 #include "sysupdate-instance.h"
index 0d845c8a32a74baec0154b962134246ee628da98..42ba1f1ba92763e6f9a6c703afbafc04851b9700 100644 (file)
@@ -1,18 +1,10 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <inttypes.h>
-#include <stdbool.h>
-#include <sys/types.h>
-
 #include "sd-id128.h"
 
-#include "fs-util.h"
+#include "sysupdate-forward.h"
 #include "sysupdate-partition.h"
-#include "time-util.h"
-
-typedef struct Resource Resource;
-typedef struct Instance Instance;
 
 typedef struct InstanceMetadata {
         /* Various bits of metadata for each instance, that is either derived from the filename/GPT label or
index f22d9eae2313240b59bb2d21e7c0ea390539032d..cd85db5236e9faf29eafc447aaf87279e793a2fb 100644 (file)
@@ -3,12 +3,9 @@
 #include <sys/file.h>
 
 #include "alloc-util.h"
-#include "extract-word.h"
+#include "fdisk-util.h"
 #include "gpt.h"
-#include "id128-util.h"
 #include "log.h"
-#include "parse-util.h"
-#include "stdio-util.h"
 #include "string-util.h"
 #include "sysupdate-partition.h"
 
index 15324013f3be158e4329f6e1ad9426094755124f..21277962e4147a9650113dfa9b78d28ec8aab112 100644 (file)
@@ -1,16 +1,9 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <errno.h>
-#include <inttypes.h>
-#include <sys/types.h>
-
 #include "sd-id128.h"
 
-#include "fdisk-util.h"
-#include "macro.h"
-
-typedef struct PartitionInfo PartitionInfo;
+#include "sysupdate-forward.h"
 
 typedef enum PartitionChange {
         PARTITION_FLAGS           = 1 << 0,
@@ -23,7 +16,7 @@ typedef enum PartitionChange {
         _PARTITION_CHANGE_INVALID = -EINVAL,
 } PartitionChange;
 
-struct PartitionInfo {
+typedef struct PartitionInfo {
         size_t partno;
         uint64_t start, size;
         uint64_t flags;
@@ -33,7 +26,7 @@ struct PartitionInfo {
         bool no_auto;
         bool read_only;
         bool growfs;
-};
+} PartitionInfo;
 
 #define PARTITION_INFO_NULL                     \
         {                                       \
index 82b00d3d3b040e1c752961a13e3e3c9549c826b7..27c58f6e6d3cfbed515154405944553380c7dc89 100644 (file)
@@ -5,12 +5,11 @@
 #include "list.h"
 #include "log.h"
 #include "parse-util.h"
-#include "path-util.h"
-#include "stdio-util.h"
 #include "string-util.h"
 #include "strv.h"
 #include "sysupdate-instance.h"
 #include "sysupdate-pattern.h"
+#include "time-util.h"
 
 typedef enum PatternElementType {
         PATTERN_LITERAL,
index 0bfb515fd4a2750f7eae4c4fb37d8db9f29a8533..fb59f0e174ee8e9862f324eb9be54690f6cd18c1 100644 (file)
@@ -1,11 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <stdbool.h>
-
-#include "time-util.h"
-
-typedef struct InstanceMetadata InstanceMetadata;
+#include "sysupdate-forward.h"
 
 enum {
         PATTERN_MATCH_NO,
index 045af007a54012dda627c84024e065a8399e1e8c..6817df1644c9855aeae851be6fe4607b2d213921 100644 (file)
 #include "device-util.h"
 #include "devnum-util.h"
 #include "dirent-util.h"
-#include "env-util.h"
+#include "errno-util.h"
 #include "fd-util.h"
+#include "fdisk-util.h"
 #include "fileio.h"
 #include "find-esp.h"
 #include "glyph-util.h"
 #include "gpt.h"
 #include "hexdecoct.h"
 #include "import-util.h"
-#include "macro.h"
 #include "missing_magic.h"
 #include "process-util.h"
 #include "sort-util.h"
+#include "stat-util.h"
 #include "string-table.h"
 #include "strv.h"
-#include "sysupdate.h"
 #include "sysupdate-cache.h"
 #include "sysupdate-instance.h"
 #include "sysupdate-pattern.h"
 #include "sysupdate-resource.h"
+#include "time-util.h"
 #include "utf8.h"
 
 void resource_destroy(Resource *rr) {
index 1e1f16ac3479bf79a46711684fdd46814d6c30b6..afaca79f5f63ab42e8f2287d2a904a5f49adcdea 100644 (file)
@@ -1,16 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <inttypes.h>
-#include <stdbool.h>
-#include <sys/types.h>
-
 #include "gpt.h"
-#include "hashmap.h"
-#include "macro.h"
-
-typedef struct Resource Resource;
-typedef struct Instance Instance;
+#include "sysupdate-forward.h"
 
 typedef enum ResourceType {
         RESOURCE_URL_FILE,
@@ -76,7 +68,7 @@ typedef enum PathRelativeTo {
         _PATH_RELATIVE_TO_INVALID = -EINVAL,
 } PathRelativeTo;
 
-struct Resource {
+typedef struct Resource {
         ResourceType type;
 
         /* Where to look for instances, and what to match precisely */
@@ -93,7 +85,7 @@ struct Resource {
 
         /* If this is a partition resource (RESOURCE_PARTITION), then how many partition slots are currently unassigned, that we can use */
         size_t n_empty;
-};
+} Resource;
 
 void resource_destroy(Resource *rr);
 
index 9ed55dd816e2045352f86e170354c55683b79a54..f9c87ffad7e7d47718c453a6d8f5488848c75d43 100644 (file)
@@ -1,18 +1,23 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <stdlib.h>
+#include <sys/stat.h>
+
 #include "sd-id128.h"
 
 #include "alloc-util.h"
-#include "blockdev-util.h"
 #include "build-path.h"
 #include "chase.h"
 #include "conf-parser.h"
 #include "dirent-util.h"
+#include "errno-util.h"
 #include "event-util.h"
 #include "extract-word.h"
 #include "fd-util.h"
+#include "fs-util.h"
 #include "glyph-util.h"
 #include "gpt.h"
+#include "hashmap.h"
 #include "hexdecoct.h"
 #include "install-file.h"
 #include "mkdir.h"
 #include "parse-helpers.h"
 #include "parse-util.h"
 #include "percent-util.h"
+#include "pidref.h"
 #include "process-util.h"
-#include "random-util.h"
 #include "rm-rf.h"
 #include "signal-util.h"
-#include "socket-util.h"
 #include "specifier.h"
-#include "stat-util.h"
 #include "stdio-util.h"
 #include "strv.h"
 #include "sync-util.h"
@@ -36,6 +39,7 @@
 #include "sysupdate-pattern.h"
 #include "sysupdate-resource.h"
 #include "sysupdate-transfer.h"
+#include "time-util.h"
 #include "tmpfile-util.h"
 #include "web-util.h"
 
index 6c80f05581c838abf68867f7688e6edb7bda4077..1a6cba804fcc0d0537fe9e0d30483cb25d0c2417 100644 (file)
@@ -1,17 +1,12 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <inttypes.h>
-#include <stdbool.h>
-#include <sys/types.h>
-
 #include "sd-id128.h"
 
+#include "sysupdate-forward.h"
 #include "sysupdate-partition.h"
 #include "sysupdate-resource.h"
 
-typedef struct Context Context;
-
 typedef struct Transfer {
         char *id;
 
index ffed02d1f10966993e7915e21e5ce8746993d73f..394e3907918e4c0cca97c4810aebfb9656fa06fe 100644 (file)
@@ -1,10 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include "ansi-color.h"
-#include "assert-util.h"
 #include "glyph-util.h"
 #include "sysupdate-update-set-flags.h"
-#include "terminal-util.h"
 
 const char* update_set_flags_to_color(UpdateSetFlags flags) {
 
index 881dfdeffff78d7aee0fd8d96594875f644bd5c0..b0036e0b2e6412544e0bb02694af6c3974333dec 100644 (file)
@@ -1,6 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
+#include "forward.h"
+
 typedef enum UpdateSetFlags {
         UPDATE_NEWEST     = 1 << 0,
         UPDATE_AVAILABLE  = 1 << 1,
index 8ca0fea850ebaf823b4bb060a7543d80e6019fdd..72a19a532185cacdfc0507601c623a7795bac5c4 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
-#include "alloc-util.h"
-#include "ansi-color.h"
+#include <stdlib.h>
+
 #include "string-util.h"
 #include "sysupdate-update-set.h"
 
index 18b9ef9fc709685b63c2d462b39732e91509d5d4..38904834a0710f8078a25e31282445e9e9fdffc6 100644 (file)
@@ -1,21 +1,15 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <inttypes.h>
-#include <stdbool.h>
-#include <sys/types.h>
-
+#include "sysupdate-forward.h"
 #include "sysupdate-update-set-flags.h"
 
-typedef struct Instance Instance;
-typedef struct UpdateSet UpdateSet;
-
-struct UpdateSet {
+typedef struct UpdateSet {
         UpdateSetFlags flags;
         char *version;
         Instance **instances;
         size_t n_instances;
-};
+} UpdateSet;
 
 UpdateSet* update_set_free(UpdateSet *us);
 int update_set_cmp(UpdateSet *const*a, UpdateSet *const*b);
index 418d19c26b13696b24e9eb1a40b04ab7c9bee83d..7d8b88bb148f1245c8ffcb843790a69fe5683a05 100644 (file)
@@ -16,7 +16,7 @@
 #include "glyph-util.h"
 #include "hexdecoct.h"
 #include "image-policy.h"
-#include "json-util.h"
+#include "loop-util.h"
 #include "main-func.h"
 #include "mount-util.h"
 #include "os-util.h"
@@ -37,7 +37,6 @@
 #include "sysupdate-transfer.h"
 #include "sysupdate-update-set.h"
 #include "sysupdate-util.h"
-#include "terminal-util.h"
 #include "utf8.h"
 #include "verbs.h"
 
index ba9fd4496867829c4f7742fe800bc7fd760b1eca..092aeb877100af71982d82768d8078b4deda2c6f 100644 (file)
@@ -1,13 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
-#include <inttypes.h>
-#include <stdbool.h>
-
 #include "specifier.h"
-
-/* Forward declare this type so that Transfers can point at it */
-typedef struct Context Context;
+#include "sysupdate-forward.h"
 
 extern bool arg_sync;
 extern uint64_t arg_instances_max;
index 430e46e6e99ec85ebac50b5660e395ae0a75682b..fa04515feec5f1234441f09130880a5a62c47e30 100644 (file)
@@ -1,5 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <stdlib.h>
+#include <sys/stat.h>
+
 #include "sd-bus.h"
 #include "sd-json.h"
 
@@ -9,9 +12,11 @@
 #include "bus-get-properties.h"
 #include "bus-label.h"
 #include "bus-log-control-api.h"
+#include "bus-object.h"
 #include "bus-polkit.h"
 #include "bus-util.h"
 #include "common-signal.h"
+#include "constants.h"
 #include "discover-image.h"
 #include "dropin.h"
 #include "env-util.h"
 #include "event-util.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "format-util.h"
 #include "hashmap.h"
 #include "log.h"
 #include "main-func.h"
 #include "memfd-util.h"
-#include "mkdir-label.h"
 #include "notify-recv.h"
 #include "os-util.h"
 #include "parse-util.h"
+#include "path-util.h"
+#include "pidref.h"
 #include "process-util.h"
+#include "runtime-scope.h"
 #include "service-util.h"
 #include "signal-util.h"
-#include "socket-util.h"
 #include "string-table.h"
+#include "strv.h"
 #include "sysupdate-util.h"
 #include "utf8.h"
 
index af65f28429f923c14554cc13ed97999d5227f817..8e830fd6568004853630158572018a909c5bff0f 100644 (file)
@@ -4,6 +4,7 @@
 #include <locale.h>
 
 #include "sd-bus.h"
+#include "sd-event.h"
 #include "sd-json.h"
 
 #include "alloc-util.h"
 #include "bus-locator.h"
 #include "bus-map-properties.h"
 #include "bus-util.h"
-#include "conf-files.h"
-#include "conf-parser.h"
-#include "errno-list.h"
-#include "fd-util.h"
-#include "fileio.h"
+#include "errno-util.h"
 #include "format-table.h"
-#include "fs-util.h"
+#include "hashmap.h"
 #include "json-util.h"
 #include "main-func.h"
-#include "os-util.h"
 #include "pager.h"
-#include "path-util.h"
 #include "polkit-agent.h"
 #include "pretty-print.h"
+#include "runtime-scope.h"
+#include "string-util.h"
 #include "strv.h"
 #include "sysupdate-update-set-flags.h"
 #include "sysupdate-util.h"