[Libguestfs] [PATCH v2 2/4] daemon: Print device names when they are translated.

Richard W.M. Jones rjones at redhat.com
Thu Mar 5 13:15:31 UTC 2020


This helps to debug problems with the new device name translation
code.  We can think about removing this later when the code is known
to work well.
---
 daemon/device-name-translation.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/daemon/device-name-translation.c b/daemon/device-name-translation.c
index 30173f5c2..b17f3c683 100644
--- a/daemon/device-name-translation.c
+++ b/daemon/device-name-translation.c
@@ -195,6 +195,10 @@ device_name_translation (const char *device)
       return NULL;
   }
 
+  /* If the device name is different, print the translation. */
+  if (STRNEQ (device, ret))
+    fprintf (stderr, "device name translated: %s -> %s\n", device, ret);
+
   /* Now check the device is openable. */
   fd = open (ret, O_RDONLY|O_CLOEXEC);
   if (fd >= 0) {
@@ -281,5 +285,9 @@ reverse_device_name_translation (const char *device)
     }
   }
 
+  /* If the device name is different, print the translation. */
+  if (STRNEQ (device, ret))
+    fprintf (stderr, "reverse device name translated: %s -> %s\n", device, ret);
+
   return ret;
 }
-- 
2.25.0




More information about the Libguestfs mailing list