Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/etc Change mount_critical_filesystems() so that if given an ...



details:   https://anonhg.NetBSD.org/src/rev/71713e0126db
branches:  trunk
changeset: 467973:71713e0126db
user:      cjs <cjs%NetBSD.org@localhost>
date:      Thu Apr 01 03:58:44 1999 +0000

description:
Change mount_critical_filesystems() so that if given an argument
of "local" it will not mount filesystem types it identifies as
network file systems (currently just nfs). Call the function twice,
before networking starts with arg "local", after networking starts
with arg "network". Remove critfs_require_network as is now redundant.

diffstat:

 etc/rc      |  10 +++-------
 etc/rc.conf |   6 +-----
 etc/rc.subr |  32 +++++++++++++++++++++++++++++++-
 3 files changed, 35 insertions(+), 13 deletions(-)

diffs (103 lines):

diff -r 94d99eeb30f2 -r 71713e0126db etc/rc
--- a/etc/rc    Thu Apr 01 02:49:12 1999 +0000
+++ b/etc/rc    Thu Apr 01 03:58:44 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: rc,v 1.123 1999/03/26 13:45:47 drochner Exp $
+#      $NetBSD: rc,v 1.124 1999/04/01 03:58:44 cjs Exp $
 #      originally from: @(#)rc 8.2 (Berkeley) 3/17/94
 
 # System startup script run by init on autoboot
@@ -104,9 +104,7 @@
        fi
 fi
 
-if ! checkyesno critfs_require_network; then
-       mount_critical_filesystems
-fi
+mount_critical_filesystems local
 
 # set hostname, turn on network
 echo 'starting network'
@@ -115,9 +113,7 @@
        exit 1
 fi
 
-if checkyesno critfs_require_network; then
-       mount_critical_filesystems
-fi
+mount_critical_filesystems network
 
 # Network Address Translation...
 if checkyesno ipnat && [ -f /etc/ipnat.conf ]; then
diff -r 94d99eeb30f2 -r 71713e0126db etc/rc.conf
--- a/etc/rc.conf       Thu Apr 01 02:49:12 1999 +0000
+++ b/etc/rc.conf       Thu Apr 01 03:58:44 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: rc.conf,v 1.46 1999/03/26 13:10:17 sommerfe Exp $
+#      $NetBSD: rc.conf,v 1.47 1999/04/01 03:58:44 cjs Exp $
 #
 # see rc.conf(5) for more information.
 
@@ -34,10 +34,6 @@
 # don't want to be warned about it
 no_swap=NO
 
-# When to mount critical filesystems.   By default, these are mounted after
-# the network is started.
-critfs_require_network=YES
-
 # One-time actions and programs on boot-up.
 lkm=NO                                         # run /etc/rc.lkm
 savecore=YES           savecore_flags=""
diff -r 94d99eeb30f2 -r 71713e0126db etc/rc.subr
--- a/etc/rc.subr       Thu Apr 01 02:49:12 1999 +0000
+++ b/etc/rc.subr       Thu Apr 01 03:58:44 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: rc.subr,v 1.6 1999/03/24 18:59:47 mellon Exp $
+#      $NetBSD: rc.subr,v 1.7 1999/04/01 03:58:44 cjs Exp $
 # functions used by various rc scripts
 
 #
@@ -32,8 +32,12 @@
 #      Go through the list of critical filesystems, checking each one
 #      to see if it is mounted, and if it is not, mounting it.
 #
+fstab=/etc/fstab
 mount_critical_filesystems() {
        for fs in /usr /var $critical_filesystems; do
+               if [ $1 = local ] && ! islocalfs $fs; then
+                       continue
+               fi
                mount | (
                        ismounted=no
                        while read what _on on _type type; do
@@ -47,3 +51,29 @@
                )  
        done
 }
+
+islocalfs() {
+       if [ -z "$1" ]; then
+               echo 'islocalfs() called with no fs argument: aborting.'
+               exit 3
+       fi
+       while read dev dir type opts; do
+               if [ "$1" = "$dir" ]; then
+                       case $type in
+                               # Local filesystems.
+                               ados|cd9660|ext2fs|fdesc|ffs) return 0;;
+                               filecore|kernfs|lfs|mfs|msdos|null) return 0;;
+                               portal|procfs|ufs|umap|union) return 0;;
+                               # Network filesystems
+                               nfs) return 1;;
+                               # If we don't know, err on the safe side
+                               # and assume it's a network FS.
+                               *) return 1;;
+                       esac
+               fi
+       done < $fstab
+       # We didn't find the FS. Return local to show error as
+       # early in boot sequence as possible.
+       echo "WARNING: islocalfs() in rc.subr doesn't recognise fstype $fs"
+       return 1;
+}



Home | Main Index | Thread Index | Old Index