Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Jan 2003 15:28:34 -0800
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        current@FreeBSD.org
Cc:        tds@dmnstech.net
Subject:   Diff to make fsck(8) ignore certain filesystems.
Message-ID:  <20030127152834.A5410@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
This prevents fsck from failing at boot if there are nullfs or unionfs
filesystems in fstab(5), as reported by tds@dmnstech.net.  Anyone mind
if I commit this?  (Or have suggestions for filesystems to add to the
list?)

%%%
Index: fsck.c
===================================================================
RCS file: /home/ncvs/src/sbin/fsck/fsck.c,v
retrieving revision 1.12
diff -d -u -r1.12 fsck.c
--- fsck.c	31 Oct 2002 15:32:39 -0000	1.12
+++ fsck.c	27 Jan 2003 23:24:51 -0000
@@ -79,6 +79,8 @@
 static int flags = 0;
 static int forceflag = 0;
 
+static const char *nofsck[] = { "nullfs", "unionfs", NULL };
+
 static int checkfs(const char *, const char *, const char *, char *, pid_t *);
 static int selected(const char *);
 static void addoption(char *);
@@ -90,6 +92,7 @@
 static const char *getfslab(const char *);
 static void usage(void) __dead2;
 static int isok(struct fstab *);
+static int skip(const char *);
 
 int
 main(int argc, char *argv[])
@@ -209,6 +212,10 @@
 				errx(1, "%s has unknown file system type.",
 				    spec);
 		}
+		if (skip(type)) {
+			printf("%s: FILESYSTEM DOES NOT SUPPORT FSCK\n", *argv);
+			continue;
+		}
 		if ((flags & CHECK_BACKGRD) &&
 		    checkfs(type, spec, mntpt, "-F", NULL) == 0) {
 			printf("%s: DEFER FOR BACKGROUND CHECKING\n", *argv);
@@ -577,6 +584,17 @@
 	return vfstype;
 }
 
+static int
+skip(const char *fstype)
+{
+	const char *p;
+
+	for (p = nofsck[0]; p != NULL; p++) {
+		if (strcmp(p, fstype) == 0)
+			return 1;
+	}
+	return 0;
+}
 
 static void
 usage(void)
%%%

Thanx,
juli.
-- 
Juli Mallett <jmallett@FreeBSD.org>
AIM: BSDFlata -- IRC: juli on EFnet.
OpenDarwin, Mono, FreeBSD Developer.
ircd-hybrid Developer, EFnet addict.
FreeBSD on MIPS-Anything on FreeBSD.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030127152834.A5410>