Changed the cache access from vfat...Region() to Cc...Data().

svn path=/trunk/; revision=2285
This commit is contained in:
Hartmut Birr 2001-10-10 22:14:34 +00:00
parent a23989370d
commit 069a01eede

View file

@ -1,4 +1,4 @@
/* $Id: direntry.c,v 1.4 2001/08/01 15:59:24 hbirr Exp $ /* $Id: direntry.c,v 1.5 2001/10/10 22:14:34 hbirr Exp $
* *
* *
* FILE: DirEntry.c * FILE: DirEntry.c
@ -83,14 +83,14 @@ vfatGetNextDirEntry (PDEVICE_EXTENSION pDeviceExt,
PWSTR pLongFileName, PWSTR pLongFileName,
PFAT_DIR_ENTRY pDirEntry) PFAT_DIR_ENTRY pDirEntry)
{ {
NTSTATUS status;
ULONG indexInPage = *pDirectoryIndex % ENTRIES_PER_CACHEPAGE(pDeviceExt); ULONG indexInPage = *pDirectoryIndex % ENTRIES_PER_CACHEPAGE(pDeviceExt);
ULONG pageNumber = *pDirectoryIndex / ENTRIES_PER_CACHEPAGE(pDeviceExt); ULONG pageNumber = *pDirectoryIndex / ENTRIES_PER_CACHEPAGE(pDeviceExt);
PVOID currentPage = NULL; PVOID currentPage = NULL;
PCACHE_SEGMENT cacheSegment = NULL;
FATDirEntry * fatDirEntry; FATDirEntry * fatDirEntry;
slot * longNameEntry; slot * longNameEntry;
ULONG cpos; ULONG cpos;
LARGE_INTEGER FileOffset;
PVOID Context;
DPRINT ("vfatGetNextDirEntry (%x,%x,%d,%x,%x)\n", DPRINT ("vfatGetNextDirEntry (%x,%x,%d,%x,%x)\n",
pDeviceExt, pDeviceExt,
@ -101,16 +101,11 @@ vfatGetNextDirEntry (PDEVICE_EXTENSION pDeviceExt,
*pLongFileName = 0; *pLongFileName = 0;
DPRINT ("Validating current directory page\n"); FileOffset.QuadPart = pageNumber * CACHEPAGESIZE(pDeviceExt);
status = vfatRequestAndValidateRegion (pDeviceExt, if (!CcMapData(pDirectoryFCB->FileObject, &FileOffset,
pDirectoryFCB, CACHEPAGESIZE(pDeviceExt), TRUE, &Context, &currentPage))
pageNumber * CACHEPAGESIZE(pDeviceExt),
(PVOID *) &currentPage,
&cacheSegment,
FALSE);
if (!NT_SUCCESS (status))
{ {
return status; return STATUS_UNSUCCESSFUL;
} }
while (TRUE) while (TRUE)
@ -120,9 +115,7 @@ vfatGetNextDirEntry (PDEVICE_EXTENSION pDeviceExt,
if (vfatIsDirEntryEndMarker (&fatDirEntry [indexInPage])) if (vfatIsDirEntryEndMarker (&fatDirEntry [indexInPage]))
{ {
DPRINT ("end of directory, returning no more entries\n"); DPRINT ("end of directory, returning no more entries\n");
status = vfatReleaseRegion (pDeviceExt, CcUnpinData(Context);
pDirectoryFCB,
cacheSegment);
return STATUS_NO_MORE_ENTRIES; return STATUS_NO_MORE_ENTRIES;
} }
else if (vfatIsDirEntryLongName (&fatDirEntry [indexInPage]) else if (vfatIsDirEntryLongName (&fatDirEntry [indexInPage])
@ -155,22 +148,12 @@ vfatGetNextDirEntry (PDEVICE_EXTENSION pDeviceExt,
indexInPage = 0; indexInPage = 0;
pageNumber++; pageNumber++;
status = vfatReleaseRegion (pDeviceExt, CcUnpinData(Context);
pDirectoryFCB, FileOffset.QuadPart = pageNumber * CACHEPAGESIZE(pDeviceExt);
cacheSegment); if (!CcMapData(pDirectoryFCB->FileObject, &FileOffset,
if (!NT_SUCCESS (status)) CACHEPAGESIZE(pDeviceExt), TRUE, &Context, &currentPage))
{ {
return status; return STATUS_UNSUCCESSFUL;
}
status = vfatRequestAndValidateRegion (pDeviceExt,
pDirectoryFCB,
pageNumber * CACHEPAGESIZE(pDeviceExt),
(PVOID *) &currentPage,
&cacheSegment,
FALSE);
if (!NT_SUCCESS (status))
{
return status;
} }
longNameEntry = (slot *) currentPage; longNameEntry = (slot *) currentPage;
} }
@ -197,22 +180,12 @@ vfatGetNextDirEntry (PDEVICE_EXTENSION pDeviceExt,
indexInPage = 0; indexInPage = 0;
pageNumber++; pageNumber++;
status = vfatReleaseRegion (pDeviceExt, CcUnpinData(Context);
pDirectoryFCB, FileOffset.QuadPart = pageNumber * CACHEPAGESIZE(pDeviceExt);
cacheSegment); if (!CcMapData(pDirectoryFCB->FileObject, &FileOffset,
if (!NT_SUCCESS (status)) CACHEPAGESIZE(pDeviceExt), TRUE, &Context, &currentPage))
{ {
return status; return STATUS_UNSUCCESSFUL;
}
status = vfatRequestAndValidateRegion (pDeviceExt,
pDirectoryFCB,
pageNumber * CACHEPAGESIZE(pDeviceExt),
(PVOID *) &currentPage,
&cacheSegment,
FALSE);
if (!NT_SUCCESS (status))
{
return status;
} }
} }
} }
@ -223,13 +196,8 @@ vfatGetNextDirEntry (PDEVICE_EXTENSION pDeviceExt,
break; break;
} }
} }
CcUnpinData(Context);
DPRINT ("Releasing current directory page\n"); return STATUS_SUCCESS;
status = vfatReleaseRegion (pDeviceExt,
pDirectoryFCB,
cacheSegment);
return status;
} }