From d70ce4face22900251b5f6fb5edc5e80342ed4a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 27 Dec 2015 19:55:47 +0000 Subject: [PATCH] [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). svn path=/trunk/; revision=70447 --- reactos/lib/fslib/vfatlib/vfatlib.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/reactos/lib/fslib/vfatlib/vfatlib.c b/reactos/lib/fslib/vfatlib/vfatlib.c index 930e021bf47..45d38fdb383 100644 --- a/reactos/lib/fslib/vfatlib/vfatlib.c +++ b/reactos/lib/fslib/vfatlib/vfatlib.c @@ -265,7 +265,6 @@ VfatFormat(IN PUNICODE_STRING DriveRoot, DPRINT1("Failed to umount volume (Status: 0x%x)\n", LockStatus); } - LockStatus = NtFsControlFile(FileHandle, NULL, NULL, @@ -303,7 +302,6 @@ UpdateProgress(PFORMAT_CONTEXT Context, Context->CurrentSectorCount += (ULONGLONG)Increment; - NewPercent = (Context->CurrentSectorCount * 100ULL) / Context->TotalSectorCount; if (NewPercent > Context->Percent) @@ -332,6 +330,8 @@ VfatPrint(PCHAR Format, ...) TextOut.Lines = 1; TextOut.Output = TextBuf; + DPRINT1("VfatPrint -- %s", TextBuf); + /* Do the callback */ if (ChkdskCallback) ChkdskCallback(OUTPUT, 0, &TextOut); @@ -351,7 +351,6 @@ VfatChkdsk(IN PUNICODE_STRING DriveRoot, BOOLEAN salvage_files; ULONG free_clusters; DOS_FS fs; - int ret; /* Store callback pointer */ ChkdskCallback = Callback; @@ -373,11 +372,7 @@ VfatChkdsk(IN PUNICODE_STRING DriveRoot, 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 @@ VfatChkdsk(IN PUNICODE_STRING DriveRoot, } 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 @@ VfatChkdsk(IN PUNICODE_STRING DriveRoot, } /* 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 */