]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Pass device name instead of major:minor in for_each_host_dev_fs()
authorCong Wang <xiyou.wangcong@gmail.com>
Tue, 20 Dec 2011 06:09:59 +0000 (14:09 +0800)
committerHarald Hoyer <harald@redhat.com>
Fri, 13 Jan 2012 10:35:49 +0000 (11:35 +0100)
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
dracut
dracut-functions

diff --git a/dracut b/dracut
index c3584c00b15b1b2cd3addb94aa92d5c59f46b23d..8c24e7b0345939fc483734c502b0bb2cf65fabec 100755 (executable)
--- a/dracut
+++ b/dracut
@@ -528,9 +528,8 @@ chmod 755 "$initdir"
 for line in "${fstab_lines[@]}"; do
     set -- $line
     #dev mp fs fsopts
-    dev="$(get_maj_min $1)"
-    push host_devs "${dev:-$1}"
-    push host_fs_types "$dev|$3"
+    push host_devs "$1"
+    push host_fs_types "$1|$3"
 done
 
 for f in $add_fstab; do
@@ -556,13 +555,13 @@ if [[ $hostonly ]]; then
 
     for mp in "${host_mp[@]}"; do
         mountpoint "$mp" >/dev/null 2>&1 || continue
-        push host_devs $(find_block_device "$mp")
+        push host_devs $(readlink -f "/dev/block/$(find_block_device "$mp")")
     done
 fi
 
 _get_fs_type() (
     [[ $1 ]] || return
-    if [[ -b /dev/block/$1 ]] && get_fs_env /dev/block/$1; then
+    if [[ -b $1 ]] && get_fs_env $1; then
         echo "$1|$ID_FS_TYPE"
         return 1
     fi
@@ -576,7 +575,7 @@ _get_fs_type() (
 for dev in "${host_devs[@]}"; do
     unset fs_type
     for fstype in $(_get_fs_type $dev) \
-        $(check_block_and_slaves _get_fs_type $dev); do
+        $(check_block_and_slaves _get_fs_type $(get_maj_min $dev)); do
         if ! strstr " ${host_fs_types[*]} " " $fstype ";then
             push host_fs_types "$fstype"
         fi
index a77a0029b36fd430501a093f481356a52ba393bb..a9b15ccd2bf44d0d38125f8928c5f21814bcff55 100755 (executable)
@@ -247,16 +247,17 @@ find_root_block_device() { find_block_device /; }
 for_each_host_dev_fs()
 {
     local _func="$1"
+    local _dev
+    local _fs
     for f in ${host_fs_types[@]}; do
         OLDIFS="$IFS"
         IFS="|"
         set -- $f
         IFS="$OLDIFS"
-        dev=$1
-        [[ -b /dev/block/$dev ]] && dev="/dev/block/$dev"
-        [[ -b $dev ]] || continue
-        fs="$2"
-        $_func $dev $fs
+        _dev="$1"
+        [[ -b "$_dev" ]] || continue
+        _fs="$2"
+        $_func $_dev $_fs
     done
 }