From: Sascha Wildner Date: Wed, 12 Mar 2014 19:12:02 +0000 (+0100) Subject: rc: Use kldload -n in our rc scripts which load modules. X-Git-Tag: v3.9.0~351 X-Git-Url: https://gitweb.dragonflybsd.org/~tuxillo/dragonfly.git/commitdiff_plain/7164054b28a2b197eb257169ff8e898c42d5902f rc: Use kldload -n in our rc scripts which load modules. --- diff --git a/etc/rc.d/abi b/etc/rc.d/abi index aa2ff3e240..2c57998432 100644 --- a/etc/rc.d/abi +++ b/etc/rc.d/abi @@ -1,7 +1,6 @@ #!/bin/sh # # $FreeBSD: src/etc/rc.d/abi,v 1.2 2003/05/05 15:38:41 mtm Exp $ -# $DragonFly: src/etc/rc.d/abi,v 1.6 2008/01/09 18:51:08 josepht Exp $ # # PROVIDE: abi @@ -20,9 +19,9 @@ stop_cmd=":" sysv_start() { echo -n ' sysvipc' - kldload sysvmsg >/dev/null 2>&1 - kldload sysvsem >/dev/null 2>&1 - kldload sysvshm >/dev/null 2>&1 + kldload -n sysvmsg + kldload -n sysvsem + kldload -n sysvshm } load_rc_config $name run_rc_command "$1" @@ -34,9 +33,7 @@ start_cmd="linux_start" linux_start() { echo -n ' linux' - if ! kldstat -q -m "linuxaout" || ! kldstat -q -m "linuxelf"; then - kldload linux > /dev/null 2>&1 - fi + kldload -n linux if [ -x /compat/linux/sbin/ldconfig ]; then /compat/linux/sbin/ldconfig fi diff --git a/etc/rc.d/addswap b/etc/rc.d/addswap index 80164ec353..85195c5aea 100644 --- a/etc/rc.d/addswap +++ b/etc/rc.d/addswap @@ -23,13 +23,7 @@ addswap_start() *) if [ -w "${swapfile}" ]; then # load vn kernel module if needed - if [ ! -c /dev/vn0 ]; then - if kldload vn; then - info 'vn module loaded.' - else - err 1 'vn module failed to load.' - fi - fi + kldload -n vn || exit 1 echo "Adding ${swapfile} as additional swap" vnconfig -e vn0 ${swapfile} swap fi diff --git a/etc/rc.d/ip6fw b/etc/rc.d/ip6fw index bfca5ef388..7544ee6ea6 100644 --- a/etc/rc.d/ip6fw +++ b/etc/rc.d/ip6fw @@ -1,7 +1,6 @@ #!/bin/sh # # $FreeBSD: src/etc/rc.d/ip6fw,v 1.3 2003/06/29 05:15:57 mtm Exp $ -# $DragonFly: src/etc/rc.d/ip6fw,v 1.3 2005/11/19 21:47:32 swildner Exp $ # # PROVIDE: ip6fw @@ -20,13 +19,9 @@ ip6fw_prestart() { # Load IPv6 firewall module, if not already loaded if ! ${SYSCTL} net.inet6.ip6.fw.enable > /dev/null 2>&1; then - kldload ip6fw && { - debug 'Kernel IPv6 firewall module loaded.' - return 0 - } - warn 'IPv6 firewall kernel module failed to load.' - return 1 + kldload -n ip6fw || return 1 fi + return 0 } ip6fw_start() diff --git a/etc/rc.d/ipfw b/etc/rc.d/ipfw index a987ee479b..b2e45bb491 100644 --- a/etc/rc.d/ipfw +++ b/etc/rc.d/ipfw @@ -1,7 +1,6 @@ #!/bin/sh # # $FreeBSD: src/etc/rc.d/ipfw,v 1.4 2003/03/30 15:52:18 mtm Exp $ -# $DragonFly: src/etc/rc.d/ipfw,v 1.4 2008/07/06 23:55:51 thomas Exp $ # # PROVIDE: ipfw @@ -18,13 +17,10 @@ stop_cmd="ipfw_stop" ipfw_precmd() { + # Load IPv4 firewall module, if not already loaded if ! ${SYSCTL} net.inet.ip.fw.enable > /dev/null 2>&1; then - if ! kldload ipfw; then - warn "unable to load ipfw firewall module." - return 1 - fi + kldload -n ipfw || return 1 fi - return 0 } diff --git a/etc/rc.d/mountcritremote b/etc/rc.d/mountcritremote index 61b9fab9c3..820c1fedff 100644 --- a/etc/rc.d/mountcritremote +++ b/etc/rc.d/mountcritremote @@ -27,11 +27,7 @@ mountcritremote_precmd() case "`mount -d -a -t nfs 2> /dev/null`" in *mount_nfs*) # Handle absent nfs client support - if ! sysctl vfs.nfs >/dev/null 2>&1; then - kldload nfs || warn 'nfs mount ' \ - 'requested, but no nfs client in kernel' \ - return 1 - fi + kldload -n nfs || return 1 ;; esac return 0 diff --git a/etc/rc.d/nfsclient b/etc/rc.d/nfsclient index 1683fe56f5..55a2bd0496 100644 --- a/etc/rc.d/nfsclient +++ b/etc/rc.d/nfsclient @@ -1,7 +1,6 @@ #!/bin/sh # # $FreeBSD: src/etc/rc.d/nfsclient,v 1.3 2002/10/12 10:31:31 schweikh Exp $ -# $DragonFly: src/etc/rc.d/nfsclient,v 1.6 2005/11/19 21:47:32 swildner Exp $ # # PROVIDE: nfsclient @@ -19,12 +18,7 @@ stop_cmd="unmount_all" # Load nfs module if it was not compiled into the kernel nfsclient_precmd() { - if ! sysctl vfs.nfs >/dev/null 2>&1; then - if ! kldload nfs; then - warn 'Could not load nfs module' - return 1 - fi - fi + kldload -n nfs || return 1 return 0 } diff --git a/etc/rc.d/nfsserver b/etc/rc.d/nfsserver index a7068fa9c4..e2b68542e1 100644 --- a/etc/rc.d/nfsserver +++ b/etc/rc.d/nfsserver @@ -1,7 +1,6 @@ #!/bin/sh # # $FreeBSD: src/etc/rc.d/nfsserver,v 1.2 2002/10/12 10:31:31 schweikh Exp $ -# $DragonFly: src/etc/rc.d/nfsserver,v 1.4 2005/11/19 21:47:32 swildner Exp $ # # PROVIDE: nfsserver @@ -17,12 +16,7 @@ stop_cmd=":" # Load nfs modules if they were not compiled into the kernel nfsserver_start() { - if ! sysctl vfs.nfs >/dev/null 2>&1; then - if ! kldload nfs; then - warn 'Could not load NFS module' - return 1 - fi - fi + kldload -n nfs || return 1 return 0 } diff --git a/etc/rc.d/pf b/etc/rc.d/pf index 8b2f74f1a1..249d3f6f6e 100644 --- a/etc/rc.d/pf +++ b/etc/rc.d/pf @@ -1,7 +1,6 @@ #!/bin/sh # # $FreeBSD: src/etc/rc.d/pf,v 1.3 2004/06/23 01:42:06 mlaier Exp $ -# $DragonFly: src/etc/rc.d/pf,v 1.5 2008/02/21 22:42:10 hasso Exp $ # # PROVIDE: pf @@ -29,13 +28,7 @@ extra_commands="reload resync status" pf_prestart() { # load pf kernel module if needed - if ! kldstat -q -m "pf"; then - if kldload pf; then - info 'pf module loaded.' - else - err 1 'pf module failed to load.' - fi - fi + kldload -n pf || exit 1 # check for pf rules if [ ! -r "${pf_rules}" ] diff --git a/etc/rc.d/pflog b/etc/rc.d/pflog index a9d4575b38..48823f1dcd 100644 --- a/etc/rc.d/pflog +++ b/etc/rc.d/pflog @@ -1,7 +1,6 @@ #!/bin/sh # # $FreeBSD: src/etc/rc.d/pflog,v 1.2 2004/08/31 14:23:51 mlaier Exp $ -# $DragonFly: src/etc/rc.d/pflog,v 1.6 2008/02/21 22:42:10 hasso Exp $ # # PROVIDE: pflog @@ -27,13 +26,7 @@ extra_commands="resync status" pflog_prestart() { # load pflog kernel module if needed - if ! kldstat -q -m "pflog"; then - if kldload pf; then - info 'pflog module loaded.' - else - err 1 'pflog module failed to load.' - fi - fi + kldload -n pf || exit 1 # set pflog0 interface to up state if ! ifconfig pflog0 up; then diff --git a/etc/rc.d/syscons b/etc/rc.d/syscons index e879a4f849..7eaac66b61 100644 --- a/etc/rc.d/syscons +++ b/etc/rc.d/syscons @@ -25,7 +25,6 @@ # SUCH DAMAGE. # # $FreeBSD: src/etc/rc.d/syscons,v 1.9 2002/09/09 22:40:34 gordon Exp $ -# $DragonFly: src/etc/rc.d/syscons,v 1.5 2005/11/19 21:47:32 swildner Exp $ # # PROVIDE: syscons @@ -160,7 +159,7 @@ syscons_start() for i in `kldstat | awk '$5 ~ "^splash_.*$" { print $5 }'`; do kldunload ${i} done - kldstat -v | grep -q _saver || kldload ${saver}_saver + kldload -n ${saver}_saver ;; esac diff --git a/etc/rc.d/vknetd b/etc/rc.d/vknetd index 1b4b96c05f..3d4682ba5d 100644 --- a/etc/rc.d/vknetd +++ b/etc/rc.d/vknetd @@ -16,13 +16,7 @@ pidfile="/var/run/${name}.pid" vknetd_precmd() { # load if_tap kernel module if needed - if ! kldstat -q -m "if_tap"; then - if kldload if_tap; then - info 'if_tap module loaded.' - else - err 1 'if_tap module failed to load.' - fi - fi + kldload -n if_tap || exit 1 } load_rc_config $name