Blame 0029-Pass-device-name-instead-of-major-minor-in-for_each_.patch

Harald Hoyer 3957aa
From d0096de764e73f372f9ca93063f0270fc6b02c20 Mon Sep 17 00:00:00 2001
Harald Hoyer 3957aa
From: Cong Wang <xiyou.wangcong@gmail.com>
Harald Hoyer 3957aa
Date: Tue, 20 Dec 2011 14:09:59 +0800
Harald Hoyer 3957aa
Subject: [PATCH] Pass device name instead of major:minor in
Harald Hoyer 3957aa
 for_each_host_dev_fs()
Harald Hoyer 3957aa
Harald Hoyer 3957aa
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Harald Hoyer 3957aa
---
Harald Hoyer 3957aa
 dracut           |   11 +++++------
Harald Hoyer 3957aa
 dracut-functions |   11 ++++++-----
Harald Hoyer 3957aa
 2 files changed, 11 insertions(+), 11 deletions(-)
Harald Hoyer 3957aa
Harald Hoyer 3957aa
diff --git a/dracut b/dracut
Harald Hoyer 3957aa
index c3584c0..8c24e7b 100755
Harald Hoyer 3957aa
--- a/dracut
Harald Hoyer 3957aa
+++ b/dracut
Harald Hoyer 3957aa
@@ -528,9 +528,8 @@ chmod 755 "$initdir"
Harald Hoyer 3957aa
 for line in "${fstab_lines[@]}"; do
Harald Hoyer 3957aa
     set -- $line
Harald Hoyer 3957aa
     #dev mp fs fsopts
Harald Hoyer 3957aa
-    dev="$(get_maj_min $1)"
Harald Hoyer 3957aa
-    push host_devs "${dev:-$1}"
Harald Hoyer 3957aa
-    push host_fs_types "$dev|$3"
Harald Hoyer 3957aa
+    push host_devs "$1"
Harald Hoyer 3957aa
+    push host_fs_types "$1|$3"
Harald Hoyer 3957aa
 done
Harald Hoyer 3957aa
 
Harald Hoyer 3957aa
 for f in $add_fstab; do
Harald Hoyer 3957aa
@@ -556,13 +555,13 @@ if [[ $hostonly ]]; then
Harald Hoyer 3957aa
 
Harald Hoyer 3957aa
     for mp in "${host_mp[@]}"; do
Harald Hoyer 3957aa
         mountpoint "$mp" >/dev/null 2>&1 || continue
Harald Hoyer 3957aa
-        push host_devs $(find_block_device "$mp")
Harald Hoyer 3957aa
+        push host_devs $(readlink -f "/dev/block/$(find_block_device "$mp")")
Harald Hoyer 3957aa
     done
Harald Hoyer 3957aa
 fi
Harald Hoyer 3957aa
 
Harald Hoyer 3957aa
 _get_fs_type() (
Harald Hoyer 3957aa
     [[ $1 ]] || return
Harald Hoyer 3957aa
-    if [[ -b /dev/block/$1 ]] && get_fs_env /dev/block/$1; then
Harald Hoyer 3957aa
+    if [[ -b $1 ]] && get_fs_env $1; then
Harald Hoyer 3957aa
         echo "$1|$ID_FS_TYPE"
Harald Hoyer 3957aa
         return 1
Harald Hoyer 3957aa
     fi
Harald Hoyer 3957aa
@@ -576,7 +575,7 @@ _get_fs_type() (
Harald Hoyer 3957aa
 for dev in "${host_devs[@]}"; do
Harald Hoyer 3957aa
     unset fs_type
Harald Hoyer 3957aa
     for fstype in $(_get_fs_type $dev) \
Harald Hoyer 3957aa
-        $(check_block_and_slaves _get_fs_type $dev); do
Harald Hoyer 3957aa
+        $(check_block_and_slaves _get_fs_type $(get_maj_min $dev)); do
Harald Hoyer 3957aa
         if ! strstr " ${host_fs_types[*]} " " $fstype ";then
Harald Hoyer 3957aa
             push host_fs_types "$fstype"
Harald Hoyer 3957aa
         fi
Harald Hoyer 3957aa
diff --git a/dracut-functions b/dracut-functions
Harald Hoyer 3957aa
index a77a002..a9b15cc 100755
Harald Hoyer 3957aa
--- a/dracut-functions
Harald Hoyer 3957aa
+++ b/dracut-functions
Harald Hoyer 3957aa
@@ -247,16 +247,17 @@ find_root_block_device() { find_block_device /; }
Harald Hoyer 3957aa
 for_each_host_dev_fs()
Harald Hoyer 3957aa
 {
Harald Hoyer 3957aa
     local _func="$1"
Harald Hoyer 3957aa
+    local _dev
Harald Hoyer 3957aa
+    local _fs
Harald Hoyer 3957aa
     for f in ${host_fs_types[@]}; do
Harald Hoyer 3957aa
         OLDIFS="$IFS"
Harald Hoyer 3957aa
         IFS="|"
Harald Hoyer 3957aa
         set -- $f
Harald Hoyer 3957aa
         IFS="$OLDIFS"
Harald Hoyer 3957aa
-        dev=$1
Harald Hoyer 3957aa
-        [[ -b /dev/block/$dev ]] && dev="/dev/block/$dev"
Harald Hoyer 3957aa
-        [[ -b $dev ]] || continue
Harald Hoyer 3957aa
-        fs="$2"
Harald Hoyer 3957aa
-        $_func $dev $fs
Harald Hoyer 3957aa
+        _dev="$1"
Harald Hoyer 3957aa
+        [[ -b "$_dev" ]] || continue
Harald Hoyer 3957aa
+        _fs="$2"
Harald Hoyer 3957aa
+        $_func $_dev $_fs
Harald Hoyer 3957aa
     done
Harald Hoyer 3957aa
 }
Harald Hoyer 3957aa