[Libguestfs] [PATCH 47/67] virt-list-filesystems: Fix to use $g->canonical_device_name instead of homebrew function.

Richard W.M. Jones rjones at redhat.com
Sat Aug 24 11:04:47 UTC 2013


From: "Richard W.M. Jones" <rjones at redhat.com>

The homebrew function didn't recognize /dev/ubd* device names, and in
any case using the API function is shorter and clearer.

(cherry picked from commit 42754046269806a6b6385fee0b72115c73461221)
---
 tools/virt-list-filesystems | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/tools/virt-list-filesystems b/tools/virt-list-filesystems
index 197308b..7b472ae 100755
--- a/tools/virt-list-filesystems
+++ b/tools/virt-list-filesystems
@@ -172,7 +172,7 @@ foreach $dev (sort keys %fses) {
     $fstype = $fses{$dev};
 
     if ($all || ($fstype ne "swap" && $fstype ne "unknown")) {
-        print canonicalize($dev);
+        print $g->canonical_device_name ($dev);
         if ($long) {
             print " $fstype";
         }
@@ -180,18 +180,6 @@ foreach $dev (sort keys %fses) {
     }
 }
 
-# The reverse of device name translation, see
-# BLOCK DEVICE NAMING in guestfs(3).
-sub canonicalize
-{
-    local $_ = shift;
-
-    if (m{^/dev/[hv]d([a-z]\d)$}) {
-        return "/dev/sd$1";
-    }
-    $_;
-}
-
 =head1 SHELL QUOTING
 
 Libvirt guest names can contain arbitrary characters, some of which
-- 
1.8.3.1




More information about the Libguestfs mailing list