]> git.pld-linux.org Git - projects/geninitrd.git/commitdiff
rename dm_* helpers to avoid confision what they do and make them more generic
authorElan Ruusamäe <glen@pld-linux.org>
Wed, 2 Feb 2011 17:15:10 +0000 (17:15 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Wed, 2 Feb 2011 17:15:10 +0000 (17:15 +0000)
svn-id: @12103

functions
geninitrd

index b348a751277f361cd0990237c133f88637ca71f0..988298d0c4267df961c30ce32a0e628602f6a8e1 100644 (file)
--- a/functions
+++ b/functions
@@ -66,7 +66,7 @@ find_root() {
        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 @@ find_root() {
 
        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 @@ dm_lvm2_name() {
        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")
 }
index 0dd047fe207a07757f5fc44bfbc6c367f0a49716..7ef7fdabbc337a17fff492165e5524827f84c8be 100755 (executable)
--- a/geninitrd
+++ b/geninitrd
@@ -460,7 +460,7 @@ find_modules_for_devpath() {
 
        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
This page took 0.243724 seconds and 4 git commands to generate.