All of lore.kernel.org
 help / color / mirror / Atom feed
From: dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
To: harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: [patch 1/6 v2] Move wait for if functions to net lib
Date: Fri, 30 Nov 2012 11:20:22 +0800	[thread overview]
Message-ID: <20121130032659.837334774@redhat.com> (raw)
In-Reply-To: 20121130032021.140175185@redhat.com

[-- Attachment #1: patch1 --]
[-- Type: text/plain, Size: 2586 bytes --]

net-lib.sh are created for net related functions, move the wait_for_if* to
net-lib.sh naturally.

Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 modules.d/40network/dhclient-script.sh |    1 +
 modules.d/40network/net-lib.sh         |   23 +++++++++++++++++++++++
 modules.d/95fcoe/fcoe-up.sh            |    1 +
 modules.d/99base/dracut-lib.sh         |   23 -----------------------
 4 files changed, 25 insertions(+), 23 deletions(-)

--- dracut.orig/modules.d/99base/dracut-lib.sh
+++ dracut/modules.d/99base/dracut-lib.sh
@@ -481,29 +481,6 @@ else
     }
 fi
 
-wait_for_if_up() {
-    local cnt=0
-    local li
-    while [ $cnt -lt 200 ]; do
-        li=$(ip -o link show up dev $1)
-        [ -n "$li" ] && return 0
-        sleep 0.1
-        cnt=$(($cnt+1))
-    done
-    return 1
-}
-
-wait_for_route_ok() {
-    local cnt=0
-    while [ $cnt -lt 200 ]; do
-        li=$(ip route show)
-        [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
-        sleep 0.1
-        cnt=$(($cnt+1))
-    done
-    return 1
-}
-
 # root=nfs:[<server-ip>:]<root-dir>[:<nfs-options>]
 # root=nfs4:[<server-ip>:]<root-dir>[:<nfs-options>]
 nfsroot_to_var() {
--- dracut.orig/modules.d/40network/net-lib.sh
+++ dracut/modules.d/40network/net-lib.sh
@@ -315,3 +315,26 @@ parse_ifname_opts() {
     esac
 
 }
+
+wait_for_if_up() {
+    local cnt=0
+    local li
+    while [ $cnt -lt 200 ]; do
+        li=$(ip -o link show up dev $1)
+        [ -n "$li" ] && return 0
+        sleep 0.1
+        cnt=$(($cnt+1))
+    done
+    return 1
+}
+
+wait_for_route_ok() {
+    local cnt=0
+    while [ $cnt -lt 200 ]; do
+        li=$(ip route show)
+        [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
+        sleep 0.1
+        cnt=$(($cnt+1))
+    done
+    return 1
+}
--- dracut.orig/modules.d/40network/dhclient-script.sh
+++ dracut/modules.d/40network/dhclient-script.sh
@@ -51,6 +51,7 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
 export PS4="dhclient.$interface.$$ + "
 exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
 type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
 
 # We already need a set netif here
 netif=$interface
--- dracut.orig/modules.d/95fcoe/fcoe-up.sh
+++ dracut/modules.d/95fcoe/fcoe-up.sh
@@ -16,6 +16,7 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
 export PS4="fcoe-up.$1.$$ + "
 exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
 type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
 
 netif=$1
 dcb=$2


  reply	other threads:[~2012-11-30  3:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-30  3:20 [patch 0/6 v2] network fixes for link waiting dyoung-H+wXaHxf7aLQT0dZR+AlfA
2012-11-30  3:20 ` dyoung-H+wXaHxf7aLQT0dZR+AlfA [this message]
2012-11-30  3:20 ` [patch 2/6 v2] Add function linkup dyoung-H+wXaHxf7aLQT0dZR+AlfA
2012-11-30  3:20 ` [patch 3/6 v2] Change to use linkup function in network scripts dyoung-H+wXaHxf7aLQT0dZR+AlfA
2012-11-30  3:20 ` [patch 4/6 v2] Wait for link ready before use the interface dyoung-H+wXaHxf7aLQT0dZR+AlfA
2012-11-30  3:20 ` [patch 5/6 v2] Get failsafe ifaces for udev rule use dyoung-H+wXaHxf7aLQT0dZR+AlfA
2012-11-30  3:20 ` [patch 6/6 v2] Wait for interface up at the early stage dyoung-H+wXaHxf7aLQT0dZR+AlfA

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=20121130032659.837334774@redhat.com \
    --to=dyoung-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=harald-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.