]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sysupdate: Remove circular header includes
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 19 Apr 2025 21:12:18 +0000 (23:12 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 23 Apr 2025 08:33:37 +0000 (10:33 +0200)
src/sysupdate/sysupdate-feature.h
src/sysupdate/sysupdate-instance.h
src/sysupdate/sysupdate-pattern.c
src/sysupdate/sysupdate-pattern.h
src/sysupdate/sysupdate-resource.h
src/sysupdate/sysupdate-transfer.c
src/sysupdate/sysupdate-transfer.h
src/sysupdate/sysupdate-update-set.h
src/sysupdate/sysupdate.c

index 4b52b0a4472c26fa4232dcf88538256daea8a218..c66e9084d02dd702f363c56950ac54a026a02a47 100644 (file)
@@ -1,8 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include "hash-funcs.h"
-#include "macro.h"
-#include "sysupdate-transfer.h"
+#include "memory-util.h"
 
 typedef struct Feature {
         unsigned n_ref;
index 2860d295da32c40651253682e0a5f3f7eb3bba78..f39db617d33940401e5b33463588cdc369510f96 100644 (file)
 #include "fs-util.h"
 #include "time-util.h"
 
-typedef struct InstanceMetadata InstanceMetadata;
-typedef struct Instance Instance;
-
-#include "sysupdate-resource.h"
 #include "sysupdate-partition.h"
 
-struct InstanceMetadata {
+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
          * from metadata of the file/partition itself */
         char *version;
@@ -33,7 +32,7 @@ struct InstanceMetadata {
         int growfs;
         uint8_t sha256sum[32];             /* SHA256 sum of the download (i.e. compressed) file */
         bool sha256sum_set;
-};
+} InstanceMetadata;
 
 #define INSTANCE_METADATA_NULL                  \
         {                                       \
index ff099c8edddbfdcba171ccef11009e5a3d89e67d..1266bc7295a5fad1ee34b0ccc3a1834cec22f7cd 100644 (file)
@@ -8,6 +8,7 @@
 #include "path-util.h"
 #include "stdio-util.h"
 #include "string-util.h"
+#include "sysupdate-instance.h"
 #include "sysupdate-pattern.h"
 
 typedef enum PatternElementType {
index e8ea104623f55ca341d99e39deb44bb2c7d0bda8..0bfb515fd4a2750f7eae4c4fb37d8db9f29a8533 100644 (file)
@@ -3,9 +3,10 @@
 
 #include <stdbool.h>
 
-#include "sysupdate-instance.h"
 #include "time-util.h"
 
+typedef struct InstanceMetadata InstanceMetadata;
+
 enum {
         PATTERN_MATCH_NO,
         PATTERN_MATCH_YES,
index 1bcbe0f8e5df0b632e52a97c565e33ee0a60a119..1e1f16ac3479bf79a46711684fdd46814d6c30b6 100644 (file)
@@ -9,10 +9,8 @@
 #include "hashmap.h"
 #include "macro.h"
 
-/* Forward declare this type so that the headers below can use it */
 typedef struct Resource Resource;
-
-#include "sysupdate-instance.h"
+typedef struct Instance Instance;
 
 typedef enum ResourceType {
         RESOURCE_URL_FILE,
index 2bdf8c6c3ab5631354e93111ec4bf998be85e947..bd54c398eba729671970c47ba2af055062a1f5a5 100644 (file)
@@ -31,6 +31,7 @@
 #include "sync-util.h"
 #include "sysupdate.h"
 #include "sysupdate-feature.h"
+#include "sysupdate-instance.h"
 #include "sysupdate-pattern.h"
 #include "sysupdate-resource.h"
 #include "sysupdate-transfer.h"
index 505c573d63b82bbefcdad7e5dea20203b0c2c9d6..6c80f05581c838abf68867f7688e6edb7bda4077 100644 (file)
@@ -7,14 +7,12 @@
 
 #include "sd-id128.h"
 
-/* Forward declare this type so that the headers below can use it */
-typedef struct Transfer Transfer;
-
 #include "sysupdate-partition.h"
 #include "sysupdate-resource.h"
-#include "sysupdate.h"
 
-struct Transfer {
+typedef struct Context Context;
+
+typedef struct Transfer {
         char *id;
 
         char *min_version;
@@ -55,7 +53,7 @@ struct Transfer {
         PartitionChange partition_change;
 
         Context *context;
-};
+} Transfer;
 
 typedef int (*TransferProgress)(const Transfer *t, const Instance *inst, unsigned percentage);
 
index ed012025819a243c21c0343468d927d72eb73ae6..18b9ef9fc709685b63c2d462b39732e91509d5d4 100644 (file)
@@ -5,11 +5,11 @@
 #include <stdbool.h>
 #include <sys/types.h>
 
-typedef struct UpdateSet UpdateSet;
-
-#include "sysupdate-instance.h"
 #include "sysupdate-update-set-flags.h"
 
+typedef struct Instance Instance;
+typedef struct UpdateSet UpdateSet;
+
 struct UpdateSet {
         UpdateSetFlags flags;
         char *version;
index 2333019636feedaf77fb1254b9e4e5ba14f7d3c1..3bd91ac02247da73312244648e382ea4b982ccee 100644 (file)
@@ -31,6 +31,7 @@
 #include "strv.h"
 #include "sysupdate.h"
 #include "sysupdate-feature.h"
+#include "sysupdate-instance.h"
 #include "sysupdate-transfer.h"
 #include "sysupdate-update-set.h"
 #include "sysupdate-util.h"