Debian Codegraph @

src/sysupdate/sysupdate-transfer.h

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include "sd-id128.h"
5
6 #include "sysupdate-forward.h"
7 #include "sysupdate-partition.h"
8 #include "sysupdate-resource.h"
9
10 typedef struct Transfer {
11 char *id;
12
13 char *min_version;
14 char **protected_versions;
15 char *current_symlink;
16 bool verify;
17
18 char **features;
19 char **requisite_features;
20 bool enabled;
21
22 Resource source, target;
23
24 uint64_t instances_max;
25 bool remove_temporary;
26
27 char **changelog;
28 char **appstream;
29
30 /* When creating a new partition/file, optionally override these attributes explicitly */
31 sd_id128_t partition_uuid;
32 bool partition_uuid_set;
33 uint64_t partition_flags;
34 bool partition_flags_set;
35 mode_t mode;
36 uint64_t tries_left, tries_done;
37 int no_auto;
38 int read_only;
39 int growfs;
40
41 /* If we create a new file/dir/subvol in the fs, the temporary and final path we create it under, as well as the read-only flag for it */
42 char *temporary_partial_path;
43 char *temporary_pending_path;
44 char *final_path;
45 int install_read_only;
46
47 /* If we write to a partition in a partition table, the metrics of it */
48 PartitionInfo partition_info;
49 PartitionChange partition_change;
50 char *final_partition_label;
51
52 /* Derived partition type UUIDs used to indicate partial/pending state on the partition type level,
53 * instead of polluting the partition label with prefixes */
54 sd_id128_t partition_type_partial;
55 sd_id128_t partition_type_pending;
56
57 Context *context;
58 } Transfer;
59
60 typedef int (*TransferProgress)(const Transfer *t, const Instance *inst, unsigned percentage);
61
62 Transfer* transfer_new(Context *ctx);
63 Transfer* transfer_free(Transfer *t);
64 DEFINE_TRIVIAL_CLEANUP_FUNC(Transfer*, transfer_free);
65
66 int transfer_read_definition(Transfer *t, const char *path, const char **dirs, Hashmap *features);
67
68 int transfer_resolve_paths(Transfer *t, const char *root, const char *node);
69
70 int transfer_vacuum(Transfer *t, uint64_t space, const char *extra_protected_version);
71
72 int transfer_compute_temporary_paths(Transfer *t, Instance *i, InstanceMetadata *f);
73 int transfer_acquire_instance(Transfer *t, Instance *i, InstanceMetadata *f, TransferProgress cb, void *userdata);
74 int transfer_process_partial_and_pending_instance(Transfer *t, Instance *i);
75
76 int transfer_install_instance(Transfer *t, Instance *i, const char *root);