We already determine the architecture of disk images and make a choice,
and store it per partition. Let's make this accessible globally.
printf(" Sec. Size: %" PRIu32 "\n", m->sector_size);
+ printf(" Arch.: %s\n",
+ strna(architecture_to_string(dissected_image_architecture(m))));
+
if (arg_json_format_flags & JSON_FORMAT_OFF)
putc('\n', stdout);
return r;
}
+Architecture dissected_image_architecture(DissectedImage *img) {
+ assert(img);
+
+ if (img->partitions[PARTITION_ROOT].found &&
+ img->partitions[PARTITION_ROOT].architecture >= 0)
+ return img->partitions[PARTITION_ROOT].architecture;
+
+ if (img->partitions[PARTITION_USR].found &&
+ img->partitions[PARTITION_USR].architecture >= 0)
+ return img->partitions[PARTITION_USR].architecture;
+
+ return _ARCHITECTURE_INVALID;
+}
+
int dissect_loop_device(
LoopDevice *loop,
const VeritySettings *verity,
int dissected_image_acquire_metadata(DissectedImage *m, DissectImageFlags extra_flags);
+Architecture dissected_image_architecture(DissectedImage *m);
+
DecryptedImage* decrypted_image_ref(DecryptedImage *p);
DecryptedImage* decrypted_image_unref(DecryptedImage *p);
DEFINE_TRIVIAL_CLEANUP_FUNC(DecryptedImage*, decrypted_image_unref);