mfs: clean flag

. also implement now-possible fsck -p option
    	. allows unconditional fsck -p invocation at startup,
    	  only checking each filesystem if not marked clean
    	. mounting unclean is allowed but is forced readonly
    	. updating the superblock while mounted is now not
    	  allowed by mfs - must be done (e.g. by fsck.mfs)
    	  on an unmounted fs
	. clean flag is unset by mfs on mounting, and set by
	  mfs on clean unmounting (if clean flag was set at
	  mount time)

Signed-off-by: Ben Gras <ben@minix3.org>
This commit is contained in:
Ben Gras
2011-12-22 01:29:27 +01:00
parent 9a664b4984
commit 59ff5cbd87
13 changed files with 292 additions and 76 deletions

View File

@@ -38,7 +38,7 @@ install:: installpw # installpw needed to bootstrap pw db
install -m 644 -o root -g operator descr /usr/lib/
installforce:: $(ETC)/rc $(ETC)/rs.inet $(ETC)/rs.single $(ETC)/system.conf $(USRETC)/rc $(USR)/Makefile installpw
installforce:: $(ETC)/rc $(ETC)/rs.inet $(ETC)/rs.single $(ETC)/system.conf $(ETC)/rc.subr.minix $(USRETC)/rc $(USR)/Makefile installpw
installpw::
if [ ! -d $(ETC) ]; then mkdir $(ETC); chmod 755 $(ETC); fi
@@ -57,6 +57,9 @@ $(ETC)/rs.single: rs.single .PHONY
$(ETC)/system.conf: system.conf .PHONY
install -m 644 -o root -g operator $> $@
$(ETC)/rc.subr.minix: rc.subr.minix .PHONY
install -m 644 -o root -g operator $> $@
$(USRETC)/rc: usr/rc .PHONY
install -m 755 -o root -g operator $> $@

View File

@@ -2,7 +2,7 @@
mountfstab()
{
fsck_opts=""
fflag=""
fflag="-p"
while getopts "fo:" opt
do case $opt
@@ -18,13 +18,6 @@ mountfstab()
shift `expr $OPTIND - 1`
# Make fsck necessary for unclean shutdown
msg="The system was not properly shut down. Checking file systems."
if shutdown -C
then echo "$msg"
fflag="-f"
fi
fstabfile="$1"
if [ ! -f $fstabfile ]
@@ -44,17 +37,16 @@ mountfstab()
# This line's parameters
dev="$1"; mp="$2"; fstype="$3"
# Don't fsck / as it's already mounted
if [ "$mp" = "/" ]; then continue; fi
# Sanity checks
if [ ! -b $dev ]; then echo "$dev missing"; continue; fi
if [ ! -d $mp ]; then echo "$mp missing"; continue; fi
# Do fsck if necessary or requested
if [ -n "$fflag" ]
then echo "Checking $fstype $dev"
if ! fsck.$fstype $fflag $fsck_opts -p $dev
then echo "$dev fail"
continue
fi
then fsck.$fstype $fflag $fsck_opts $dev
fi
# Skip the actual mount for /, it's already mounted