Author: fireball
Date: Sat Aug 23 05:47:52 2008
New Revision: 35558
URL:
http://svn.reactos.org/svn/reactos?rev=35558&view=rev
Log:
- Remove a hack around sending FSCTL_ to an opened volume handle, it works good enough
without the need to open another handle to the file system.
Modified:
trunk/reactos/lib/fslib/vfatlib/check/io.c
Modified: trunk/reactos/lib/fslib/vfatlib/check/io.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fslib/vfatlib/check/io…
==============================================================================
--- trunk/reactos/lib/fslib/vfatlib/check/io.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fslib/vfatlib/check/io.c [iso-8859-1] Sat Aug 23 05:47:52 2008
@@ -72,6 +72,8 @@
return;
}
+ // Query geometry and partition info, to have bytes per sector, etc
+
CurrentOffset.QuadPart = 0LL;
changes = last = NULL;
@@ -80,43 +82,12 @@
BOOLEAN fs_isdirty(PUNICODE_STRING DriveRoot)
{
- OBJECT_ATTRIBUTES ObjectAttributes;
ULONG DirtyMask = 0;
- WCHAR TempRootBuf[128];
- UNICODE_STRING TempRoot;
- HANDLE FileSystem;
+ NTSTATUS Status;
IO_STATUS_BLOCK IoSb;
- NTSTATUS Status;
-
- /* Add backslash to the end, so FS will be opened */
- TempRoot.Length = 0;
- TempRoot.MaximumLength = sizeof(TempRootBuf);
- TempRoot.Buffer = TempRootBuf;
- RtlCopyUnicodeString(&TempRoot, DriveRoot);
- if (TempRoot.Length == (TempRoot.MaximumLength-1)) return FALSE;
- wcscat(TempRoot.Buffer, L"\\");
- TempRoot.Length += sizeof(WCHAR);
-
- InitializeObjectAttributes(&ObjectAttributes,
- &TempRoot,
- 0,
- NULL,
- NULL);
-
- Status = NtOpenFile(&FileSystem,
- FILE_GENERIC_READ,
- &ObjectAttributes,
- &IoSb,
- 0,
- 0);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("NtOpenFile() failed with status 0x%.08x\n", Status);
- return FALSE;
- }
/* Check if volume is dirty */
- Status = NtFsControlFile(FileSystem,
+ Status = NtFsControlFile(fd/*FileSystem*/,
NULL, NULL, NULL, &IoSb,
FSCTL_IS_VOLUME_DIRTY,
NULL, 0, &DirtyMask, sizeof(DirtyMask));
@@ -124,17 +95,12 @@
if (!NT_SUCCESS(Status))
{
DPRINT1("NtFsControlFile() failed with Status 0x%08x\n", Status);
- /* Close FS handle */
- NtClose(FileSystem);
return FALSE;
}
- /* Close FS handle */
- NtClose(FileSystem);
-
+ /* Convert Dirty mask to a boolean value */
return (DirtyMask & 1);
}
-
void fs_read(loff_t pos,int size,void *data)
{