dracut/0007-dracut-functions-factor-out-all-get_maj_min-variants.patch
2012-02-17 12:39:11 +01:00

57 lines
2.0 KiB
Diff

From c4e48eaea1b31a8c70af43a400eda7948cfecc94 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 16 Feb 2012 11:48:17 +0100
Subject: [PATCH] dracut-functions: factor out all get_maj_min() variants
---
dracut-functions | 15 +++------------
1 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index 41d752e..0b24889 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -212,11 +212,7 @@ find_block_device() {
[[ $_dev != ${_dev#UUID=} ]] && _dev=/dev/disk/by-uuid/${_dev#UUID=}
[[ $_dev != ${_dev#LABEL=} ]] && _dev=/dev/disk/by-label/${_dev#LABEL=}
[[ -b $_dev ]] || return 1 # oops, not a block device.
- ls -nLl "$_dev" | {
- read _x _x _x _x _maj _min _x
- _maj=${_maj//,/}
- echo $_maj:$_min
- } && return 0
+ get_maj_min "$_dev" && return 0
fi
done < /etc/fstab
@@ -281,11 +277,6 @@ check_block_and_slaves() {
return 1
}
-get_numeric_dev() {
- local _x _maj _min
- ls -lH "$1" | { read _x _x _x _x _maj _min _x; printf "%d:%d" ${_maj%%,} $_min; }
-}
-
# ugly workaround for the lvm design
# There is no volume group device,
# so, there are no slave devices for volume groups.
@@ -295,7 +286,7 @@ get_numeric_dev() {
check_vol_slaves() {
local _lv _vg _pv
for i in /dev/mapper/*; do
- _lv=$(get_numeric_dev $i)
+ _lv=$(get_maj_min $i)
if [[ $_lv = $2 ]]; then
_vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
# strip space
@@ -303,7 +294,7 @@ check_vol_slaves() {
if [[ $_vg ]]; then
for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
do
- check_block_and_slaves $1 $(get_numeric_dev $_pv) && return 0
+ check_block_and_slaves $1 $(get_maj_min $_pv) && return 0
done
fi
fi