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

@@ -3,7 +3,7 @@
.include <bsd.own.mk>
PROGRAMS= at_wini bios_wini cdprobe dev2name floppy loadramdisk mount \
pci procfs sh service sysenv mfs
pci procfs sh service sysenv mfs fsck.mfs
SCRIPTS=newroot
.if ${MKSMALL} != "yes"
@@ -43,6 +43,11 @@ bintoc: bintoc.c
image: proto.gen mtab rc $(EXTRA)
mkfs.mfs image proto.gen || { rm -f image; false; }
if fsck.mfs -s image | grep -q CLEAN; \
then : ; \
else echo "CLEAN sanity check of image failed." ; \
echo "(Perhaps install current mkfs and fsck.)" ; \
fi
ahci: ../ahci/ahci
install ${STRIPFLAG} ../$@/$@ $@
@@ -104,6 +109,12 @@ mount: ../../commands/mount/mount
../../commands/mount/mount:
$(MAKE) -C ../../commands/mount
fsck.mfs: ../../commands/fsck.mfs/fsck.mfs
install ${STRIPFLAG} ../../commands/$@/$@ $@
../../commands/fsck.mfs/fsck.mfs:
$(MAKE) -C ../../commands/fsck.mfs
newroot: ../../commands/newroot/newroot.sh
install ${STRIPFLAG} ../../commands/$@/$@.sh $@

View File

@@ -10,6 +10,7 @@ d--755 0 0
sh ---755 0 0 sh
service ---755 0 0 service
sysenv ---755 0 0 sysenv
fsck.mfs ---755 0 0 fsck.mfs
$
sbin d--755 0 0
@ACPI@

View File

@@ -5,6 +5,7 @@ exec >/dev/log
exec 2>/dev/log
exec </dev/null
FSCK=/bin/fsck.mfs
ACPI=/sbin/acpi
if [ -e $ACPI -a -n "`sysenv acpi`" ]
then
@@ -56,6 +57,10 @@ then
loadramdisk "$ramimagename"
fi
echo "Root device name is $rootdevname"
if [ -e $FSCK ]
then $FSCK -p $rootdevname
fi
/bin/newroot $bin_img"$rootdevname"
/bin/mount -e -t procfs none /proc || echo "WARNING: couldn't mount procfs"
exec /bin/sh /etc/rc "$@"