Author: glen
Date: Wed Feb  2 18:15:10 2011
New Revision: 12103

Modified:
   geninitrd/trunk/functions
   geninitrd/trunk/geninitrd
Log:
rename dm_* helpers to avoid confision what they do and make them more generic

Modified: geninitrd/trunk/functions
==============================================================================
--- geninitrd/trunk/functions   (original)
+++ geninitrd/trunk/functions   Wed Feb  2 18:15:10 2011
@@ -66,7 +66,7 @@
        case $rootdev in
        /dev/dm-*)
                local node
-               node=$(dm_longname "$rootdev") || return 1
+               node=$(dm_node "$rootdev") || return 1
                if [ "$node" ]; then
                        rootdev="$node"
                fi
@@ -75,7 +75,7 @@
 
        case $rootdev in
        /dev/mapper/*)
-               local dm_uuid=$(dmsetup info -c --noheadings $rootdev | awk -F: 
'{print $8}')
+               local dm_uuid=$(dm_uuid "$rootdev")
                case $dm_uuid in
                LVM-*)
                        local node
@@ -145,9 +145,23 @@
        echo $lvm_path
 }
 
-# try to resolve /dev/dm-0 to item from /dev/mapper dir
-dm_longname() {
+# resolve /dev/dm-0, /dev/mapper/name
+# @return      DM name
+dm_name() {
        local node="$1"
-       local dm_name=$(dmsetup info -c --noheadings $node | awk -F: '{print 
$1}')
-       echo "/dev/mapper/$dm_name"
+       dmsetup info -c --noheadings $node | awk -F: '{print $1}'
+}
+
+# get UUID for DM node
+# node can be /dev/dm-0, /dev/mapper/name
+# @return      UUID
+dm_uuid() {
+       local node="$1"
+       dmsetup info -c --noheadings $node | awk -F: '{print $8}'
+}
+
+# resolve any dm node to it's full path in /dev/mapper
+dm_node() {
+       local node="$1"
+       printf "/dev/mapper/%s" $(dm_name "$node")
 }

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd   (original)
+++ geninitrd/trunk/geninitrd   Wed Feb  2 18:15:10 2011
@@ -460,7 +460,7 @@
 
        if [[ "$devpath" = /dev/dm-* ]]; then
                # /dev/dm-3 -> /dev/mapper/sil_ahbgadcbchfc3
-               devpath=$(dm_longname "$devpath")
+               devpath=$(dm_node "$devpath")
        fi
 
        if [ -L "$devpath" ] && ! is_lvm "$devpath"; then
_______________________________________________
pld-cvs-commit mailing list
pld-cvs-commit@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to