Author: hbelusca
Date: Sun Dec 27 19:55:47 2015
New Revision: 70447

URL: http://svn.reactos.org/svn/reactos?rev=70447&view=rev
Log:
[VFATLIB]
- DPRINT messages printed via VfatPrint by the check-disk procedure.
- Addendum to r70434 and r70435 : The return value of fs_close is equal to the 
number of corrections made on the disk (0 corrections --> success; 1+ --> 
something was corrected).
  That way, the old code "return fs_close(FixErrors) ? STATUS_SUCCESS : 
STATUS_UNSUCCESSFUL;" that we had since eons (which always happened to return 
STATUS_SUCCESS) was actually
  indicating to us that our FAT32-formatted volumes were corrupted.
  If you test this revision, you should see something happening if you try to 
install ReactOS now (something that should have happened since ages actually).

Modified:
    trunk/reactos/lib/fslib/vfatlib/vfatlib.c

Modified: trunk/reactos/lib/fslib/vfatlib/vfatlib.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fslib/vfatlib/vfatlib.c?rev=70447&r1=70446&r2=70447&view=diff
==============================================================================
--- trunk/reactos/lib/fslib/vfatlib/vfatlib.c   [iso-8859-1] (original)
+++ trunk/reactos/lib/fslib/vfatlib/vfatlib.c   [iso-8859-1] Sun Dec 27 
19:55:47 2015
@@ -265,7 +265,6 @@
         DPRINT1("Failed to umount volume (Status: 0x%x)\n", LockStatus);
     }
 
-
     LockStatus = NtFsControlFile(FileHandle,
                                  NULL,
                                  NULL,
@@ -302,7 +301,6 @@
     ULONG NewPercent;
 
     Context->CurrentSectorCount += (ULONGLONG)Increment;
-
 
     NewPercent = (Context->CurrentSectorCount * 100ULL) / 
Context->TotalSectorCount;
 
@@ -331,6 +329,8 @@
     /* Prepare parameters */
     TextOut.Lines = 1;
     TextOut.Output = TextBuf;
+
+    DPRINT1("VfatPrint -- %s", TextBuf);
 
     /* Do the callback */
     if (ChkdskCallback)
@@ -351,7 +351,6 @@
     BOOLEAN salvage_files;
     ULONG free_clusters;
     DOS_FS fs;
-    int ret;
 
     /* Store callback pointer */
     ChkdskCallback = Callback;
@@ -373,11 +372,7 @@
     if (CheckOnlyIfDirty && !fs_isdirty())
     {
         /* No need to check FS */
-        // NOTE: Returning the value of fs_close looks suspicious.
-        // return fs_close(FALSE);
-        ret = fs_close(FALSE);
-        DPRINT1("No need to check FS; fs_close returning %d\n", (unsigned 
int)ret);
-        return STATUS_SUCCESS;
+        return (fs_close(FALSE) == 0 ? STATUS_SUCCESS : 
STATUS_DISK_CORRUPT_ERROR);
     }
 
     read_boot(&fs);
@@ -425,7 +420,7 @@
     }
 
     VfatPrint("%wZ: %u files, %lu/%lu clusters\n", DriveRoot,
-        FsCheckTotalFiles, fs.clusters - free_clusters, fs.clusters );
+        FsCheckTotalFiles, fs.clusters - free_clusters, fs.clusters);
 
     if (FixErrors)
     {
@@ -437,11 +432,7 @@
     }
 
     /* Close the volume */
-    // NOTE: Returning the value of fs_close looks suspicious.
-    // return fs_close(FixErrors) ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL;
-    ret = fs_close(FixErrors);
-    DPRINT1("fs_close returning %d\n", (unsigned int)ret);
-    return STATUS_SUCCESS;
+    return (fs_close(FixErrors) == 0 ? STATUS_SUCCESS : 
STATUS_DISK_CORRUPT_ERROR);
 }
 
 /* EOF */


Reply via email to