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