mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Fixed several cache-related bugs.
Silenced debug messages. svn path=/trunk/; revision=2951
This commit is contained in:
parent
fb21de32de
commit
58cf63221a
5 changed files with 78 additions and 36 deletions
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: cdfs.c,v 1.2 2002/04/15 20:39:49 ekohl Exp $
|
||||
/* $Id: cdfs.c,v 1.3 2002/05/14 23:16:23 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
//#define NDEBUG
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
#include "cdfs.h"
|
||||
|
@ -58,7 +58,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
|
|||
NTSTATUS Status;
|
||||
UNICODE_STRING DeviceName;
|
||||
|
||||
DbgPrint("CDFS 0.0.1\n");
|
||||
DbgPrint("CDFS 0.0.2\n");
|
||||
|
||||
RtlInitUnicodeString(&DeviceName,
|
||||
L"\\Device\\cdfs");
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: dirctl.c,v 1.4 2002/05/09 15:53:02 ekohl Exp $
|
||||
/* $Id: dirctl.c,v 1.5 2002/05/14 23:16:23 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -41,8 +41,10 @@
|
|||
|
||||
static NTSTATUS
|
||||
CdfsGetEntryName(PDEVICE_EXTENSION DeviceExt,
|
||||
PVOID Block,
|
||||
ULONG BlockLength,
|
||||
PVOID *Context,
|
||||
PVOID *Block,
|
||||
PLARGE_INTEGER StreamOffset,
|
||||
ULONG DirLength,
|
||||
PVOID *Ptr,
|
||||
PWSTR Name,
|
||||
PULONG pIndex,
|
||||
|
@ -55,20 +57,35 @@ CdfsGetEntryName(PDEVICE_EXTENSION DeviceExt,
|
|||
NTSTATUS Status;
|
||||
ULONG Index = 0;
|
||||
ULONG Offset = 0;
|
||||
ULONG BlockOffset = 0;
|
||||
|
||||
Record = (PDIR_RECORD)Block;
|
||||
Record = (PDIR_RECORD)*Block;
|
||||
while(Index < *pIndex)
|
||||
{
|
||||
Offset = Offset + Record->RecordLength;
|
||||
BlockOffset += Record->RecordLength;
|
||||
Offset += Record->RecordLength;
|
||||
|
||||
Record = (PDIR_RECORD)(Block + Offset);
|
||||
if (Record->RecordLength == 0)
|
||||
Record = (PDIR_RECORD)(*Block + BlockOffset);
|
||||
if (BlockOffset >= BLOCKSIZE || Record->RecordLength == 0)
|
||||
{
|
||||
Offset = ROUND_UP(Offset, 2048);
|
||||
Record = (PDIR_RECORD)(Block + Offset);
|
||||
DPRINT("Map next sector\n");
|
||||
CcUnpinData(*Context);
|
||||
StreamOffset->QuadPart += BLOCKSIZE;
|
||||
Offset = ROUND_UP(Offset, BLOCKSIZE);
|
||||
BlockOffset = 0;
|
||||
|
||||
if (!CcMapData(DeviceExt->StreamFileObject,
|
||||
StreamOffset,
|
||||
BLOCKSIZE, TRUE,
|
||||
Context, Block))
|
||||
{
|
||||
DPRINT("CcMapData() failed\n");
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
Record = (PDIR_RECORD)(*Block + BlockOffset);
|
||||
}
|
||||
|
||||
if (Offset >= BlockLength)
|
||||
if (Offset >= DirLength)
|
||||
return(STATUS_NO_MORE_ENTRIES);
|
||||
|
||||
Index++;
|
||||
|
@ -202,8 +219,9 @@ CdfsFindFile(PDEVICE_EXTENSION DeviceExt,
|
|||
DirIndex = *pDirIndex;
|
||||
|
||||
if(!CcMapData(DeviceExt->StreamFileObject, &StreamOffset,
|
||||
DirSize, TRUE, &Context, &Block))
|
||||
BLOCKSIZE, TRUE, &Context, &Block))
|
||||
{
|
||||
DPRINT("CcMapData() failed\n");
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
|
@ -220,11 +238,17 @@ CdfsFindFile(PDEVICE_EXTENSION DeviceExt,
|
|||
DPRINT("RecordLength %u ExtAttrRecordLength %u NameLength %u\n",
|
||||
Record->RecordLength, Record->ExtAttrRecordLength, Record->FileIdLength);
|
||||
|
||||
Status = CdfsGetEntryName(DeviceExt, Block, DirSize, (PVOID*)&Ptr, name, &DirIndex, pDirIndex2);
|
||||
Status = CdfsGetEntryName(DeviceExt, &Context, &Block, &StreamOffset,
|
||||
DirSize, (PVOID*)&Ptr, name, &DirIndex, pDirIndex2);
|
||||
if (Status == STATUS_NO_MORE_ENTRIES)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (Status == STATUS_UNSUCCESSFUL)
|
||||
{
|
||||
/* Note: the directory cache has already been unpinned */
|
||||
return(Status);
|
||||
}
|
||||
|
||||
DPRINT("Name '%S'\n", name);
|
||||
|
||||
|
@ -314,7 +338,7 @@ CdfsGetDirectoryInformation(PFCB Fcb,
|
|||
{
|
||||
ULONG Length;
|
||||
|
||||
DPRINT1("CdfsGetDirectoryInformation() called\n");
|
||||
DPRINT("CdfsGetDirectoryInformation() called\n");
|
||||
|
||||
Length = wcslen(Fcb->ObjectName) * sizeof(WCHAR);
|
||||
if ((sizeof (FILE_BOTH_DIRECTORY_INFORMATION) + Length) > BufferLength)
|
||||
|
@ -358,7 +382,7 @@ CdfsGetFullDirectoryInformation(PFCB Fcb,
|
|||
{
|
||||
ULONG Length;
|
||||
|
||||
DPRINT1("CdfsGetFullDirectoryInformation() called\n");
|
||||
DPRINT("CdfsGetFullDirectoryInformation() called\n");
|
||||
|
||||
Length = wcslen(Fcb->ObjectName) * sizeof(WCHAR);
|
||||
if ((sizeof (FILE_BOTH_DIRECTORY_INFORMATION) + Length) > BufferLength)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: fcb.c,v 1.5 2002/05/09 15:53:02 ekohl Exp $
|
||||
/* $Id: fcb.c,v 1.6 2002/05/14 23:16:23 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -380,7 +380,7 @@ CdfsMakeFCBFromDirEntry(PVCB Vcb,
|
|||
|
||||
rcFCB->RFCB.FileSize.QuadPart = Size;
|
||||
rcFCB->RFCB.ValidDataLength.QuadPart = Size;
|
||||
rcFCB->RFCB.AllocationSize.QuadPart = ROUND_UP(Size, 2096);
|
||||
rcFCB->RFCB.AllocationSize.QuadPart = ROUND_UP(Size, BLOCKSIZE);
|
||||
// DPRINT1("%S %d %d\n", longName, Size, (ULONG)rcFCB->RFCB.AllocationSize.QuadPart);
|
||||
CdfsFCBInitializeCache(Vcb, rcFCB);
|
||||
rcFCB->RefCount++;
|
||||
|
@ -447,6 +447,7 @@ CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt,
|
|||
ULONG DirSize;
|
||||
PDIR_RECORD Record;
|
||||
ULONG Offset;
|
||||
ULONG BlockOffset;
|
||||
NTSTATUS Status;
|
||||
|
||||
LARGE_INTEGER StreamOffset;
|
||||
|
@ -474,18 +475,20 @@ CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt,
|
|||
StreamOffset.QuadPart = (LONGLONG)DirectoryFcb->Entry.ExtentLocationL * (LONGLONG)BLOCKSIZE;
|
||||
|
||||
if(!CcMapData(DeviceExt->StreamFileObject, &StreamOffset,
|
||||
DirSize, TRUE, &Context, &Block))
|
||||
BLOCKSIZE, TRUE, &Context, &Block))
|
||||
{
|
||||
DPRINT("CcMapData() failed\n");
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
Offset = 0;
|
||||
BlockOffset = 0;
|
||||
Record = (PDIR_RECORD)Block;
|
||||
while(TRUE)
|
||||
{
|
||||
if (Record->RecordLength == 0)
|
||||
{
|
||||
DPRINT1("RecordLength == 0 Stopped!\n");
|
||||
DPRINT("RecordLength == 0 Stopped!\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -509,12 +512,26 @@ CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt,
|
|||
return(Status);
|
||||
}
|
||||
|
||||
Offset = Offset + Record->RecordLength;
|
||||
Record = (PDIR_RECORD)(Block + Offset);
|
||||
if (Record->RecordLength == 0)
|
||||
Offset += Record->RecordLength;
|
||||
BlockOffset += Record->RecordLength;
|
||||
Record = (PDIR_RECORD)(Block + BlockOffset);
|
||||
if (BlockOffset >= BLOCKSIZE || Record->RecordLength == 0)
|
||||
{
|
||||
Offset = ROUND_UP(Offset, 2048);
|
||||
Record = (PDIR_RECORD)(Block + Offset);
|
||||
DPRINT("Map next sector\n");
|
||||
CcUnpinData(Context);
|
||||
StreamOffset.QuadPart += BLOCKSIZE;
|
||||
Offset = ROUND_UP(Offset, BLOCKSIZE);
|
||||
BlockOffset = 0;
|
||||
|
||||
if (!CcMapData(DeviceExt->StreamFileObject,
|
||||
&StreamOffset,
|
||||
BLOCKSIZE, TRUE,
|
||||
&Context, &Block))
|
||||
{
|
||||
DPRINT("CcMapData() failed\n");
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
Record = (PDIR_RECORD)(Block + BlockOffset);
|
||||
}
|
||||
|
||||
if (Offset >= DirSize)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: fsctl.c,v 1.4 2002/05/09 15:53:02 ekohl Exp $
|
||||
/* $Id: fsctl.c,v 1.5 2002/05/14 23:16:23 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -100,7 +100,7 @@ CdfsGetSVDData(PUCHAR Buffer,
|
|||
|
||||
Svd = (PSVD)Buffer;
|
||||
|
||||
DPRINT1("EscapeSequences: '%.32s'\n", Svd->EscapeSequences);
|
||||
DPRINT("EscapeSequences: '%.32s'\n", Svd->EscapeSequences);
|
||||
|
||||
if (strncmp(Svd->EscapeSequences, "%/@", 3) == 0)
|
||||
{
|
||||
|
@ -143,6 +143,7 @@ CdfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
|||
ULONG Sector;
|
||||
PVD_HEADER VdHeader;
|
||||
|
||||
Vcb->CdInfo.JolietLevel = 0;
|
||||
Sector = CDFS_PRIMARY_DESCRIPTOR_LOCATION;
|
||||
|
||||
Buffer = ExAllocatePool(NonPagedPool,
|
||||
|
@ -346,12 +347,14 @@ CdfsMountVolume(PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
Fcb->RFCB.FileSize.QuadPart = DeviceExt->CdInfo.VolumeSpaceSize * BLOCKSIZE;
|
||||
Fcb->RFCB.ValidDataLength.QuadPart = DeviceExt->CdInfo.VolumeSpaceSize * BLOCKSIZE;
|
||||
Fcb->RFCB.AllocationSize.QuadPart = ROUND_UP(DeviceExt->CdInfo.VolumeSpaceSize * BLOCKSIZE, PAGESIZE);
|
||||
Fcb->RFCB.AllocationSize.QuadPart = DeviceExt->CdInfo.VolumeSpaceSize * BLOCKSIZE;
|
||||
|
||||
Fcb->Entry.ExtentLocationL = 0;
|
||||
Fcb->Entry.DataLengthL = DeviceExt->CdInfo.VolumeSpaceSize * BLOCKSIZE;
|
||||
|
||||
Status = CcRosInitializeFileCache(DeviceExt->StreamFileObject, &Fcb->RFCB.Bcb, PAGESIZE);
|
||||
Status = CcRosInitializeFileCache(DeviceExt->StreamFileObject,
|
||||
&Fcb->RFCB.Bcb,
|
||||
PAGESIZE);
|
||||
if (!NT_SUCCESS (Status))
|
||||
{
|
||||
DbgPrint("CcRosInitializeFileCache failed\n");
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: rw.c,v 1.3 2002/05/09 15:53:02 ekohl Exp $
|
||||
/* $Id: rw.c,v 1.4 2002/05/14 23:16:23 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -86,8 +86,6 @@ CdfsReadFile(PDEVICE_EXTENSION DeviceExt,
|
|||
LARGE_INTEGER FileOffset;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
|
||||
DPRINT1("Try caching!\n");
|
||||
|
||||
FileOffset.QuadPart = (LONGLONG)ReadOffset;
|
||||
CcCopyRead(FileObject,
|
||||
&FileOffset,
|
||||
|
|
Loading…
Reference in a new issue