]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: use id128_equal_string() at various places
authorLennart Poettering <lennart@poettering.net>
Mon, 14 Feb 2022 13:56:37 +0000 (14:56 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 14 Feb 2022 14:14:11 +0000 (15:14 +0100)
src/home/homed-manager.c
src/home/homework-luks.c
src/shared/bootspec.c

index c1ec555cacf313b747120f6d838ebda1a475e6b6..dc1bb070dc7bcfd6c6d73bdb02c74ebf929bdf52 100644 (file)
@@ -1239,10 +1239,7 @@ static int manager_add_device(Manager *m, sd_device *d) {
                 return 0;
         if (r < 0)
                 return log_error_errno(r, "Failed to acquire ID_PART_ENTRY_TYPE device property, ignoring: %m");
-        r = sd_id128_from_string(parttype, &id);
-        if (r < 0)
-                return log_debug_errno(r, "Failed to parse ID_PART_ENTRY_TYPE field '%s', ignoring: %m", parttype);
-        if (!sd_id128_equal(id, GPT_USER_HOME)) {
+        if (id128_equal_string(parttype, GPT_USER_HOME) <= 0) {
                 log_debug("Found partition (%s) we don't care about, ignoring.", sysfs);
                 return 0;
         }
index b400d7307d54db7c0a20a3438ffaddbb0459f633..d28cc3713b6a8e389168e8543d6ececaffa9fe01 100644 (file)
@@ -28,6 +28,7 @@
 #include "filesystems.h"
 #include "fs-util.h"
 #include "fsck-util.h"
+#include "gpt.h"
 #include "home-util.h"
 #include "homework-luks.h"
 #include "homework-mount.h"
@@ -703,7 +704,7 @@ static int luks_validate(
                 if (!pp)
                         return errno > 0 ? -errno : -EIO;
 
-                if (!streq_ptr(blkid_partition_get_type_string(pp), "773f91ef-66d4-49b5-bd83-d683bf40ad16"))
+                if (id128_equal_string(blkid_partition_get_type_string(pp), GPT_USER_HOME) <= 0)
                         continue;
 
                 if (!streq_ptr(blkid_partition_get_name(pp), label))
index 52268f60415bb73910ce424aa348939b3fcdbd89..ab5bd969bb09f89c775c4510e70f462377e88b24 100644 (file)
@@ -22,6 +22,8 @@
 #include "errno-util.h"
 #include "fd-util.h"
 #include "fileio.h"
+#include "gpt.h"
+#include "id128-util.h"
 #include "parse-util.h"
 #include "path-util.h"
 #include "pe-header.h"
@@ -889,7 +891,7 @@ static int verify_esp_blkid(
         r = blkid_probe_lookup_value(b, "PART_ENTRY_TYPE", &v, NULL);
         if (r != 0)
                 return log_error_errno(errno ?: EIO, "Failed to probe partition type UUID of \"%s\": %m", node);
-        if (!streq(v, "c12a7328-f81f-11d2-ba4b-00a0c93ec93b"))
+        if (id128_equal_string(v, GPT_ESP) <= 0)
                 return log_full_errno(searching ? LOG_DEBUG : LOG_ERR,
                                        SYNTHETIC_ERRNO(searching ? EADDRNOTAVAIL : ENODEV),
                                        "File system \"%s\" has wrong type for an EFI System Partition (ESP).", node);
@@ -982,7 +984,7 @@ static int verify_esp_udev(
         r = sd_device_get_property_value(d, "ID_PART_ENTRY_TYPE", &v);
         if (r < 0)
                 return log_error_errno(r, "Failed to get device property: %m");
-        if (!streq(v, "c12a7328-f81f-11d2-ba4b-00a0c93ec93b"))
+        if (id128_equal_string(v, GPT_ESP) <= 0)
                 return log_full_errno(searching ? LOG_DEBUG : LOG_ERR,
                                        SYNTHETIC_ERRNO(searching ? EADDRNOTAVAIL : ENODEV),
                                        "File system \"%s\" has wrong type for an EFI System Partition (ESP).", node);
@@ -1280,7 +1282,7 @@ static int verify_xbootldr_blkid(
                 r = blkid_probe_lookup_value(b, "PART_ENTRY_TYPE", &v, NULL);
                 if (r != 0)
                         return log_error_errno(errno ?: SYNTHETIC_ERRNO(EIO), "Failed to probe partition type UUID of \"%s\": %m", node);
-                if (!streq(v, "bc13c2ff-59e6-4262-a352-b275fd6f7172"))
+                if (id128_equal_string(v, GPT_XBOOTLDR) <= 0)
                         return log_full_errno(searching ? LOG_DEBUG : LOG_ERR,
                                               searching ? SYNTHETIC_ERRNO(EADDRNOTAVAIL) : SYNTHETIC_ERRNO(ENODEV),
                                               "File system \"%s\" has wrong type for extended boot loader partition.", node);
@@ -1344,7 +1346,7 @@ static int verify_xbootldr_udev(
                 r = sd_device_get_property_value(d, "ID_PART_ENTRY_TYPE", &v);
                 if (r < 0)
                         return log_error_errno(r, "Failed to get device property: %m");
-                if (!streq(v, "bc13c2ff-59e6-4262-a352-b275fd6f7172"))
+                if (id128_equal_string(v, GPT_XBOOTLDR))
                         return log_full_errno(searching ? LOG_DEBUG : LOG_ERR,
                                               searching ? SYNTHETIC_ERRNO(EADDRNOTAVAIL) : SYNTHETIC_ERRNO(ENODEV),
                                               "File system \"%s\" has wrong type for extended boot loader partition.", node);