From: Pingfan Liu <piliu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH] dracut.sh: for_each_host_xx() function should indicate the empty case
Date: Mon, 4 Dec 2017 17:24:11 +0800 [thread overview]
Message-ID: <1512379451-17727-1-git-send-email-piliu@redhat.com> (raw)
The caller of "for_each_host_xx func" needs to tell three cases:
func success/ fail / not be called.
E.g, in kdump case, host_devs can be empty, and we want to know it.
Signed-off-by: Pingfan Liu <piliu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
dracut-functions.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index 112b243..575bd4a 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -468,7 +468,8 @@ for_each_host_dev_fs()
local _dev
local _ret=1
- [[ "${#host_fs_types[@]}" ]] || return 0
+ [[ "${#host_fs_types[@]}" ]] || return 2
+
for _dev in "${!host_fs_types[@]}"; do
$_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0
@@ -527,7 +528,7 @@ for_each_host_dev_and_slaves_all()
local _dev
local _ret=1
- [[ "${host_devs[@]}" ]] || return 0
+ [[ "${host_devs[@]}" ]] || return 2
for _dev in "${host_devs[@]}"; do
[[ -b "$_dev" ]] || continue
@@ -543,7 +544,7 @@ for_each_host_dev_and_slaves()
local _func="$1"
local _dev
- [[ "${host_devs[@]}" ]] || return 0
+ [[ "${host_devs[@]}" ]] || return 2
for _dev in "${host_devs[@]}"; do
[[ -b "$_dev" ]] || continue
--
2.7.4
next reply other threads:[~2017-12-04 9:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-04 9:24 Pingfan Liu [this message]
[not found] ` <1512379451-17727-1-git-send-email-piliu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-12-04 10:04 ` [PATCH] dracut.sh: for_each_host_xx() function should indicate the empty case Dracut GitHub Import Bot
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=1512379451-17727-1-git-send-email-piliu@redhat.com \
--to=piliu-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=initramfs-u79uwXL29TY76Z2rM5mHXA@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