mirror of
https://github.com/systemd/systemd.git
synced 2025-03-11 20:58:27 +03:00
dissect-image: introduce DISSECTED_PARTITION_NULL
Currently, it is not necessary to set partno or architecture in dissect_image_new(), but just for safety. Preparation for later commits.
This commit is contained in:
parent
00e295055b
commit
babd5b08b5
@ -184,6 +184,9 @@ static int dissected_image_new(const char *path, DissectedImage **ret) {
|
||||
.image_name = TAKE_PTR(name),
|
||||
};
|
||||
|
||||
for (PartitionDesignator i = 0; i < _PARTITION_DESIGNATOR_MAX; i++)
|
||||
m->partitions[i] = DISSECTED_PARTITION_NULL;
|
||||
|
||||
*ret = TAKE_PTR(m);
|
||||
return 0;
|
||||
}
|
||||
@ -199,10 +202,7 @@ static void dissected_partition_done(DissectedPartition *p) {
|
||||
free(p->decrypted_node);
|
||||
free(p->mount_options);
|
||||
|
||||
*p = (DissectedPartition) {
|
||||
.partno = -1,
|
||||
.architecture = _ARCHITECTURE_INVALID,
|
||||
};
|
||||
*p = DISSECTED_PARTITION_NULL;
|
||||
}
|
||||
|
||||
#if HAVE_BLKID
|
||||
|
@ -33,6 +33,12 @@ struct DissectedPartition {
|
||||
uint64_t offset;
|
||||
};
|
||||
|
||||
#define DISSECTED_PARTITION_NULL \
|
||||
((DissectedPartition) { \
|
||||
.partno = -1, \
|
||||
.architecture = _ARCHITECTURE_INVALID, \
|
||||
})
|
||||
|
||||
typedef enum PartitionDesignator {
|
||||
PARTITION_ROOT,
|
||||
PARTITION_ROOT_SECONDARY, /* Secondary architecture */
|
||||
|
Loading…
x
Reference in New Issue
Block a user