mkinitrd unification across distributions
 help / color / mirror / Atom feed
From: dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
To: vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	chaowang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: [patch 2/3] Add for_each_host_dev for device only checking
Date: Fri, 17 Aug 2012 20:35:21 +0800	[thread overview]
Message-ID: <20120817123905.206266546@redhat.com> (raw)
In-Reply-To: 20120817123519.082687047@redhat.com

[-- Attachment #1: 0816-2-add-for-each-dev.patch --]
[-- Type: text/plain, Size: 2227 bytes --]

For lvm, multipath, iscsi modules they do not care about the filesystem,
Also there could be devcie in host_devs but it does not get formated.

For these kind of modules, use for_each_host_dev will be better than use
for_each_host_dev_fs, here add a new function to iterate the host_devs.

Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 dracut-functions.sh                   |   15 +++++++++++++++
 modules.d/90lvm/module-setup.sh       |    2 +-
 modules.d/90multipath/module-setup.sh |    2 +-
 modules.d/95iscsi/module-setup.sh     |    2 +-
 4 files changed, 18 insertions(+), 3 deletions(-)

--- dracut.orig/dracut-functions.sh
+++ dracut/dracut-functions.sh
@@ -387,6 +387,21 @@ find_mp_fstype() {
 # finds the major:minor of the block device backing the root filesystem.
 find_root_block_device() { find_block_device /; }
 
+# for_each_host_dev <func>
+# Execute "<func> <dev>" for every "<dev>" found
+# in ${host_devs[@]}
+for_each_host_dev()
+{
+    local _func="$1"
+    local _dev
+    local _ret=1
+    for _dev in ${host_devs[@]}; do
+        [[ -b "$_dev" ]] || continue
+        $_func $_dev && _ret=0
+    done
+    return $_ret
+}
+
 # for_each_host_dev_fs <func>
 # Execute "<func> <dev> <filesystem>" for every "<dev>|<fs>" pair found
 # in ${host_fs_types[@]}
--- dracut.orig/modules.d/90lvm/module-setup.sh
+++ dracut/modules.d/90lvm/module-setup.sh
@@ -22,7 +22,7 @@ check() {
     }
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for_each_host_dev_fs check_lvm || return 1
+        for_each_host_dev check_lvm || return 1
     }
 
     return 0
--- dracut.orig/modules.d/90multipath/module-setup.sh
+++ dracut/modules.d/90multipath/module-setup.sh
@@ -16,7 +16,7 @@ check() {
     }
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for_each_host_dev_fs is_mpath || return 1
+        for_each_host_dev is_mpath || return 1
     }
 
     return 0
--- dracut.orig/modules.d/95iscsi/module-setup.sh
+++ dracut/modules.d/95iscsi/module-setup.sh
@@ -23,7 +23,7 @@ check() {
     )
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for_each_host_dev_fs is_iscsi || return 1
+        for_each_host_dev is_iscsi || return 1
     }
     return 0
 }

  parent reply	other threads:[~2012-08-17 12:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-17 12:35 [patch 0/3] add --device option dyoung-H+wXaHxf7aLQT0dZR+AlfA
2012-08-17 12:35 ` [patch 1/3] wait host devs in base module dyoung-H+wXaHxf7aLQT0dZR+AlfA
     [not found]   ` <20120817123905.089958024-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-08-17 16:57     ` Vivek Goyal
     [not found]       ` <20120817165709.GA11604-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-08-20  5:53         ` Dave Young
     [not found]           ` <5031D0ED.4070901-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-08-20 14:59             ` Vivek Goyal
     [not found]               ` <20120820145946.GD31044-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-08-21  7:32                 ` Dave Young
2012-08-17 12:35 ` dyoung-H+wXaHxf7aLQT0dZR+AlfA [this message]
     [not found]   ` <20120817123905.206266546-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-08-17 17:02     ` [patch 2/3] Add for_each_host_dev for device only checking Vivek Goyal
     [not found]       ` <20120817170217.GB11604-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-08-20  5:56         ` Dave Young
     [not found]           ` <5031D18B.2070208-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-08-20 14:56             ` Vivek Goyal
2012-08-17 12:35 ` [patch 3/3] Add a dracut option --device to bring up a device in initramfs dyoung-H+wXaHxf7aLQT0dZR+AlfA
     [not found]   ` <20120817123905.353853040-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-08-17 17:04     ` Vivek Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120817123905.206266546@redhat.com \
    --to=dyoung-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=chaowang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox