Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Jul 2014 02:33:41 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r268784 - stable/10/sbin/fsck_msdosfs
Message-ID:  <201407170233.s6H2Xfvx065100@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Thu Jul 17 02:33:40 2014
New Revision: 268784
URL: http://svnweb.freebsd.org/changeset/base/268784

Log:
  MFC	r268628, r268631, r268635:
  
  Convert *rootDir from external to static.
  
  fsck_msdosfs: be a bit more permissive.
  
  The free space value in the FSInfo block is merely unitialized when it is
  0xffffffff. This fixes a bug found in NetBSD.
  
  Respect FSFIXFAT.
  
  Fix some whitespace issues while here.
  
  Obtained from:	NetBSD (CVS rev. 1.22, rev. 1.9), OpenBSD (misc)

Modified:
  stable/10/sbin/fsck_msdosfs/check.c
  stable/10/sbin/fsck_msdosfs/ext.h
  stable/10/sbin/fsck_msdosfs/fat.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/fsck_msdosfs/check.c
==============================================================================
--- stable/10/sbin/fsck_msdosfs/check.c	Thu Jul 17 02:22:03 2014	(r268783)
+++ stable/10/sbin/fsck_msdosfs/check.c	Thu Jul 17 02:33:40 2014	(r268784)
@@ -142,7 +142,7 @@ checkfilesys(const char *fname)
 		goto out;
 
 	/* now write the FATs */
-	if (mod & FSFATMOD) {
+	if (mod & (FSFATMOD|FSFIXFAT)) {
 		if (ask(1, "Update FATs")) {
 			mod |= writefat(dosfs, &boot, fat, mod & FSFIXFAT);
 			if (mod & FSFATAL)

Modified: stable/10/sbin/fsck_msdosfs/ext.h
==============================================================================
--- stable/10/sbin/fsck_msdosfs/ext.h	Thu Jul 17 02:22:03 2014	(r268783)
+++ stable/10/sbin/fsck_msdosfs/ext.h	Thu Jul 17 02:33:40 2014	(r268784)
@@ -26,7 +26,7 @@
  */
 
 #ifndef EXT_H
-#define EXT_H
+#define	EXT_H
 
 #include <sys/types.h>
 
@@ -71,8 +71,8 @@ int checkfilesys(const char *);
 #define	FSFATMOD	4		/* The FAT was modified */
 #define	FSERROR		8		/* Some unrecovered error remains */
 #define	FSFATAL		16		/* Some unrecoverable error occurred */
-#define FSDIRTY		32		/* File system is dirty */
-#define FSFIXFAT	64		/* Fix file system FAT */
+#define	FSDIRTY		32		/* File system is dirty */
+#define	FSFIXFAT	64		/* Fix file system FAT */
 
 /*
  * read a boot block in a machine independent fashion and translate

Modified: stable/10/sbin/fsck_msdosfs/fat.c
==============================================================================
--- stable/10/sbin/fsck_msdosfs/fat.c	Thu Jul 17 02:22:03 2014	(r268783)
+++ stable/10/sbin/fsck_msdosfs/fat.c	Thu Jul 17 02:33:40 2014	(r268784)
@@ -242,7 +242,7 @@ readfat(int fs, struct bootblock *boot, 
 			ret |= FSDIRTY;
 		else {
 			/* just some odd byte sequence in FAT */
-				
+
 			switch (boot->ClustMask) {
 			case CLUST32_MASK:
 				pwarn("%s (%02x%02x%02x%02x%02x%02x%02x%02x)\n",
@@ -262,7 +262,7 @@ readfat(int fs, struct bootblock *boot, 
 				break;
 			}
 
-	
+
 			if (ask(1, "Correct"))
 				ret |= FSFIXFAT;
 		}
@@ -653,7 +653,7 @@ checklost(int dosfs, struct bootblock *b
 	cl_t head;
 	int mod = FSOK;
 	int ret;
-	
+
 	for (head = CLUST_FIRST; head < boot->NumClusters; head++) {
 		/* find next untravelled chain */
 		if (fat[head].head != head
@@ -677,8 +677,9 @@ checklost(int dosfs, struct bootblock *b
 
 	if (boot->bpbFSInfo) {
 		ret = 0;
-		if (boot->FSFree != boot->NumFree) {
-			pwarn("Free space in FSInfo block (%d) not correct (%d)\n",
+		if (boot->FSFree != 0xffffffffU &&
+		    boot->FSFree != boot->NumFree) {
+			pwarn("Free space in FSInfo block (%u) not correct (%u)\n",
 			      boot->FSFree, boot->NumFree);
 			if (ask(1, "Fix")) {
 				boot->FSFree = boot->NumFree;



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