[readonly/geninitrd: 446/1068] - more consistent lookup of long device-mapper name

draenog draenog at pld-linux.org
Sat Nov 2 19:49:51 CET 2013


commit 14da5fc6824ea6464f076ce937251f55b906eb39
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Mon Oct 22 17:24:37 2007 +0000

    - more consistent lookup of long device-mapper name
    
    svn-id: @8837

 functions | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/functions b/functions
index fe259ba..2c347fc 100644
--- a/functions
+++ b/functions
@@ -102,10 +102,9 @@ dm_lvm2_name() {
 dm_longname() {
 	local node="$1"
 	local ret
+	local dm_major=$(awk '$2 == "device-mapper" {print $1}' /proc/devices)
+	local dm_minor=${node#/dev/dm-}
 
-	ret=$(find /dev -type b | xargs ls -l | LC_ALL=C sort -k5,6 | grep -B1 $node | awk '{print $NF; exit}')
-	if [ -z "$ret" ]; then
-		ret=$node
-	fi
-	echo "$ret"
+	local dm_name=$(devmap_name $dm_major:$dm_minor)
+	echo "/dev/mapper/$dm_name"
 }
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/readonly/geninitrd.git/commitdiff/147754ca159d40ca5eb541074dc043d8cbd92090



More information about the pld-cvs-commit mailing list