]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/shared/dissect-image.h
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / shared / dissect-image.h
index 175ddd8ea0c48f7a21968c71944d323413a2d2c5..20afbb5bf6224b4a31674ede86d73d266dac95b4 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
 #pragma once
 
 /***
@@ -32,6 +33,7 @@ struct DissectedPartition {
         bool rw:1;
         int partno;        /* -1 if there was no partition and the images contains a file system directly */
         int architecture;  /* Intended architecture: either native, secondary or unset (-1). */
+        sd_id128_t uuid;   /* Partition entry UUID as reported by the GPT */
         char *fstype;
         char *node;
         char *decrypted_node;
@@ -67,6 +69,8 @@ typedef enum DissectImageFlags {
         DISSECT_IMAGE_DISCARD_ANY = DISSECT_IMAGE_DISCARD_ON_LOOP |
                                     DISSECT_IMAGE_DISCARD |
                                     DISSECT_IMAGE_DISCARD_ON_CRYPTO,
+        DISSECT_IMAGE_GPT_ONLY = 16,         /* Only recognize images with GPT partition tables */
+        DISSECT_IMAGE_REQUIRE_ROOT = 32,     /* Don't accept disks without root partition */
 } DissectImageFlags;
 
 struct DissectedImage {
@@ -76,7 +80,7 @@ struct DissectedImage {
         DissectedPartition partitions[_PARTITION_DESIGNATOR_MAX];
 };
 
-int dissect_image(int fd, const void *root_hash, size_t root_hash_size, DissectedImage **ret);
+int dissect_image(int fd, const void *root_hash, size_t root_hash_size, DissectImageFlags flags, DissectedImage **ret);
 
 DissectedImage* dissected_image_unref(DissectedImage *m);
 DEFINE_TRIVIAL_CLEANUP_FUNC(DissectedImage*, dissected_image_unref);
@@ -91,3 +95,5 @@ int decrypted_image_relinquish(DecryptedImage *d);
 
 const char* partition_designator_to_string(int i) _const_;
 int partition_designator_from_string(const char *name) _pure_;
+
+int root_hash_load(const char *image, void **ret, size_t *ret_size);