mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-11-11 12:24:29 +03:00
dissect-image: take reference of DecryptedImage into DissectedImage
No functional changes. Preparation for later commits.
This commit is contained in:
@@ -1112,9 +1112,14 @@ DissectedImage* dissected_image_unref(DissectedImage *m) {
|
||||
if (!m)
|
||||
return NULL;
|
||||
|
||||
/* First, clear dissected partitions. */
|
||||
for (PartitionDesignator i = 0; i < _PARTITION_DESIGNATOR_MAX; i++)
|
||||
dissected_partition_done(m->partitions + i);
|
||||
|
||||
/* Second, free decrypted images. This must be after dissected_partition_done(), as freeing
|
||||
* DecryptedImage may try to deactivate partitions. */
|
||||
decrypted_image_unref(m->decrypted_image);
|
||||
|
||||
free(m->image_name);
|
||||
free(m->hostname);
|
||||
strv_free(m->machine_info);
|
||||
@@ -2096,7 +2101,8 @@ int dissected_image_decrypt(
|
||||
return -EINVAL;
|
||||
|
||||
if (!m->encrypted && !m->verity_ready) {
|
||||
*ret = NULL;
|
||||
if (ret)
|
||||
*ret = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2130,7 +2136,9 @@ int dissected_image_decrypt(
|
||||
}
|
||||
}
|
||||
|
||||
*ret = TAKE_PTR(d);
|
||||
m->decrypted_image = TAKE_PTR(d);
|
||||
if (ret)
|
||||
*ret = decrypted_image_ref(m->decrypted_image);
|
||||
|
||||
return 1;
|
||||
#else
|
||||
|
||||
@@ -211,6 +211,7 @@ struct DissectedImage {
|
||||
bool single_file_system:1; /* MBR/GPT or single file system */
|
||||
|
||||
DissectedPartition partitions[_PARTITION_DESIGNATOR_MAX];
|
||||
DecryptedImage *decrypted_image;
|
||||
|
||||
/* Meta information extracted from /etc/os-release and similar */
|
||||
char *image_name;
|
||||
|
||||
Reference in New Issue
Block a user