ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
ac3a84
From 0f7bee592dfc80fd1a682a280399fdb493ea5e6d Mon Sep 17 00:00:00 2001
ac3a84
From: Yu Watanabe <watanabe.yu+github@gmail.com>
ac3a84
Date: Sun, 13 Nov 2022 13:27:36 +0900
ac3a84
Subject: [PATCH] find-esp: include device sysname in the log message
ac3a84
ac3a84
(cherry picked from commit 388d14659d250545125f8e950e3abb6eb8682c61)
ac3a84
ac3a84
Related: #2138081
ac3a84
---
ac3a84
 src/shared/find-esp.c | 52 +++++++++++++++++++++++--------------------
ac3a84
 1 file changed, 28 insertions(+), 24 deletions(-)
ac3a84
ac3a84
diff --git a/src/shared/find-esp.c b/src/shared/find-esp.c
ac3a84
index aa0b02cc2f..fa234c8b5f 100644
ac3a84
--- a/src/shared/find-esp.c
ac3a84
+++ b/src/shared/find-esp.c
ac3a84
@@ -165,61 +165,65 @@ static int verify_esp_udev(
ac3a84
 
ac3a84
         r = sd_device_get_devname(d, &node);
ac3a84
         if (r < 0)
ac3a84
-                return log_error_errno(r, "Failed to get device node: %m");
ac3a84
+                return log_device_error_errno(d, r, "Failed to get device node: %m");
ac3a84
 
ac3a84
         r = sd_device_get_property_value(d, "ID_FS_TYPE", &v);
ac3a84
         if (r < 0)
ac3a84
-                return log_error_errno(r, "Failed to get device property: %m");
ac3a84
+                return log_device_error_errno(d, r, "Failed to get device property: %m");
ac3a84
         if (!streq(v, "vfat"))
ac3a84
-                return log_full_errno(searching ? LOG_DEBUG : LOG_ERR,
ac3a84
-                                      SYNTHETIC_ERRNO(searching ? EADDRNOTAVAIL : ENODEV),
ac3a84
-                                      "File system \"%s\" is not FAT.", node );
ac3a84
+                return log_device_full_errno(d,
ac3a84
+                                             searching ? LOG_DEBUG : LOG_ERR,
ac3a84
+                                             SYNTHETIC_ERRNO(searching ? EADDRNOTAVAIL : ENODEV),
ac3a84
+                                             "File system \"%s\" is not FAT.", node );
ac3a84
 
ac3a84
         r = sd_device_get_property_value(d, "ID_PART_ENTRY_SCHEME", &v);
ac3a84
         if (r < 0)
ac3a84
-                return log_full_errno(searching && r == -ENOENT ? LOG_DEBUG : LOG_ERR,
ac3a84
-                                      searching && r == -ENOENT ? SYNTHETIC_ERRNO(EADDRNOTAVAIL) : r,
ac3a84
-                                      "Failed to get device property: %m");
ac3a84
+                return log_device_full_errno(d,
ac3a84
+                                             searching && r == -ENOENT ? LOG_DEBUG : LOG_ERR,
ac3a84
+                                             searching && r == -ENOENT ? SYNTHETIC_ERRNO(EADDRNOTAVAIL) : r,
ac3a84
+                                             "Failed to get device property: %m");
ac3a84
         if (!streq(v, "gpt"))
ac3a84
-                return log_full_errno(searching ? LOG_DEBUG : LOG_ERR,
ac3a84
-                                      SYNTHETIC_ERRNO(searching ? EADDRNOTAVAIL : ENODEV),
ac3a84
-                                      "File system \"%s\" is not on a GPT partition table.", node);
ac3a84
+                return log_device_full_errno(d,
ac3a84
+                                             searching ? LOG_DEBUG : LOG_ERR,
ac3a84
+                                             SYNTHETIC_ERRNO(searching ? EADDRNOTAVAIL : ENODEV),
ac3a84
+                                             "File system \"%s\" is not on a GPT partition table.", node);
ac3a84
 
ac3a84
         r = sd_device_get_property_value(d, "ID_PART_ENTRY_TYPE", &v);
ac3a84
         if (r < 0)
ac3a84
-                return log_error_errno(r, "Failed to get device property: %m");
ac3a84
+                return log_device_error_errno(d, r, "Failed to get device property: %m");
ac3a84
         if (sd_id128_string_equal(v, SD_GPT_ESP) <= 0)
ac3a84
-                return log_full_errno(searching ? LOG_DEBUG : LOG_ERR,
ac3a84
-                                       SYNTHETIC_ERRNO(searching ? EADDRNOTAVAIL : ENODEV),
ac3a84
-                                       "File system \"%s\" has wrong type for an EFI System Partition (ESP).", node);
ac3a84
+                return log_device_full_errno(d,
ac3a84
+                                             searching ? LOG_DEBUG : LOG_ERR,
ac3a84
+                                             SYNTHETIC_ERRNO(searching ? EADDRNOTAVAIL : ENODEV),
ac3a84
+                                             "File system \"%s\" has wrong type for an EFI System Partition (ESP).", node);
ac3a84
 
ac3a84
         r = sd_device_get_property_value(d, "ID_PART_ENTRY_UUID", &v);
ac3a84
         if (r < 0)
ac3a84
-                return log_error_errno(r, "Failed to get device property: %m");
ac3a84
+                return log_device_error_errno(d, r, "Failed to get device property: %m");
ac3a84
         r = sd_id128_from_string(v, &uuid);
ac3a84
         if (r < 0)
ac3a84
-                return log_error_errno(r, "Partition \"%s\" has invalid UUID \"%s\".", node, v);
ac3a84
+                return log_device_error_errno(d, r, "Partition \"%s\" has invalid UUID \"%s\".", node, v);
ac3a84
 
ac3a84
         r = sd_device_get_property_value(d, "ID_PART_ENTRY_NUMBER", &v);
ac3a84
         if (r < 0)
ac3a84
-                return log_error_errno(r, "Failed to get device property: %m");
ac3a84
+                return log_device_error_errno(d, r, "Failed to get device property: %m");
ac3a84
         r = safe_atou32(v, &part);
ac3a84
         if (r < 0)
ac3a84
-                return log_error_errno(r, "Failed to parse PART_ENTRY_NUMBER field.");
ac3a84
+                return log_device_error_errno(d, r, "Failed to parse PART_ENTRY_NUMBER field.");
ac3a84
 
ac3a84
         r = sd_device_get_property_value(d, "ID_PART_ENTRY_OFFSET", &v);
ac3a84
         if (r < 0)
ac3a84
-                return log_error_errno(r, "Failed to get device property: %m");
ac3a84
+                return log_device_error_errno(d, r, "Failed to get device property: %m");
ac3a84
         r = safe_atou64(v, &pstart);
ac3a84
         if (r < 0)
ac3a84
-                return log_error_errno(r, "Failed to parse PART_ENTRY_OFFSET field.");
ac3a84
+                return log_device_error_errno(d, r, "Failed to parse PART_ENTRY_OFFSET field.");
ac3a84
 
ac3a84
         r = sd_device_get_property_value(d, "ID_PART_ENTRY_SIZE", &v);
ac3a84
         if (r < 0)
ac3a84
-                return log_error_errno(r, "Failed to get device property: %m");
ac3a84
+                return log_device_error_errno(d, r, "Failed to get device property: %m");
ac3a84
         r = safe_atou64(v, &psize);
ac3a84
         if (r < 0)
ac3a84
-                return log_error_errno(r, "Failed to parse PART_ENTRY_SIZE field.");
ac3a84
+                return log_device_error_errno(d, r, "Failed to parse PART_ENTRY_SIZE field.");
ac3a84
 
ac3a84
         if (ret_part)
ac3a84
                 *ret_part = part;
ac3a84
@@ -637,7 +641,7 @@ static int verify_xbootldr_udev(
ac3a84
 
ac3a84
         r = sd_device_get_devname(d, &node);
ac3a84
         if (r < 0)
ac3a84
-                return log_error_errno(r, "Failed to get device node: %m");
ac3a84
+                return log_device_error_errno(d, r, "Failed to get device node: %m");
ac3a84
 
ac3a84
         r = sd_device_get_property_value(d, "ID_PART_ENTRY_SCHEME", &type);
ac3a84
         if (r < 0)