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
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
|
||||||
//#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include "cdfs.h"
|
#include "cdfs.h"
|
||||||
|
@ -58,12 +58,12 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
UNICODE_STRING DeviceName;
|
UNICODE_STRING DeviceName;
|
||||||
|
|
||||||
DbgPrint("CDFS 0.0.1\n");
|
DbgPrint("CDFS 0.0.2\n");
|
||||||
|
|
||||||
RtlInitUnicodeString(&DeviceName,
|
RtlInitUnicodeString(&DeviceName,
|
||||||
L"\\Device\\cdfs");
|
L"\\Device\\cdfs");
|
||||||
Status = IoCreateDevice(DriverObject,
|
Status = IoCreateDevice(DriverObject,
|
||||||
sizeof(CDFS_GLOBAL_DATA),
|
sizeof(CDFS_GLOBAL_DATA),
|
||||||
&DeviceName,
|
&DeviceName,
|
||||||
FILE_DEVICE_CD_ROM_FILE_SYSTEM,
|
FILE_DEVICE_CD_ROM_FILE_SYSTEM,
|
||||||
0,
|
0,
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -41,8 +41,10 @@
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
CdfsGetEntryName(PDEVICE_EXTENSION DeviceExt,
|
CdfsGetEntryName(PDEVICE_EXTENSION DeviceExt,
|
||||||
PVOID Block,
|
PVOID *Context,
|
||||||
ULONG BlockLength,
|
PVOID *Block,
|
||||||
|
PLARGE_INTEGER StreamOffset,
|
||||||
|
ULONG DirLength,
|
||||||
PVOID *Ptr,
|
PVOID *Ptr,
|
||||||
PWSTR Name,
|
PWSTR Name,
|
||||||
PULONG pIndex,
|
PULONG pIndex,
|
||||||
|
@ -55,20 +57,35 @@ CdfsGetEntryName(PDEVICE_EXTENSION DeviceExt,
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG Index = 0;
|
ULONG Index = 0;
|
||||||
ULONG Offset = 0;
|
ULONG Offset = 0;
|
||||||
|
ULONG BlockOffset = 0;
|
||||||
|
|
||||||
Record = (PDIR_RECORD)Block;
|
Record = (PDIR_RECORD)*Block;
|
||||||
while(Index < *pIndex)
|
while(Index < *pIndex)
|
||||||
{
|
{
|
||||||
Offset = Offset + Record->RecordLength;
|
BlockOffset += Record->RecordLength;
|
||||||
|
Offset += Record->RecordLength;
|
||||||
|
|
||||||
Record = (PDIR_RECORD)(Block + Offset);
|
Record = (PDIR_RECORD)(*Block + BlockOffset);
|
||||||
if (Record->RecordLength == 0)
|
if (BlockOffset >= BLOCKSIZE || Record->RecordLength == 0)
|
||||||
{
|
{
|
||||||
Offset = ROUND_UP(Offset, 2048);
|
DPRINT("Map next sector\n");
|
||||||
Record = (PDIR_RECORD)(Block + Offset);
|
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);
|
return(STATUS_NO_MORE_ENTRIES);
|
||||||
|
|
||||||
Index++;
|
Index++;
|
||||||
|
@ -202,8 +219,9 @@ CdfsFindFile(PDEVICE_EXTENSION DeviceExt,
|
||||||
DirIndex = *pDirIndex;
|
DirIndex = *pDirIndex;
|
||||||
|
|
||||||
if(!CcMapData(DeviceExt->StreamFileObject, &StreamOffset,
|
if(!CcMapData(DeviceExt->StreamFileObject, &StreamOffset,
|
||||||
DirSize, TRUE, &Context, &Block))
|
BLOCKSIZE, TRUE, &Context, &Block))
|
||||||
{
|
{
|
||||||
|
DPRINT("CcMapData() failed\n");
|
||||||
return(STATUS_UNSUCCESSFUL);
|
return(STATUS_UNSUCCESSFUL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,11 +238,17 @@ CdfsFindFile(PDEVICE_EXTENSION DeviceExt,
|
||||||
DPRINT("RecordLength %u ExtAttrRecordLength %u NameLength %u\n",
|
DPRINT("RecordLength %u ExtAttrRecordLength %u NameLength %u\n",
|
||||||
Record->RecordLength, Record->ExtAttrRecordLength, Record->FileIdLength);
|
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)
|
if (Status == STATUS_NO_MORE_ENTRIES)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else if (Status == STATUS_UNSUCCESSFUL)
|
||||||
|
{
|
||||||
|
/* Note: the directory cache has already been unpinned */
|
||||||
|
return(Status);
|
||||||
|
}
|
||||||
|
|
||||||
DPRINT("Name '%S'\n", name);
|
DPRINT("Name '%S'\n", name);
|
||||||
|
|
||||||
|
@ -314,7 +338,7 @@ CdfsGetDirectoryInformation(PFCB Fcb,
|
||||||
{
|
{
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
|
|
||||||
DPRINT1("CdfsGetDirectoryInformation() called\n");
|
DPRINT("CdfsGetDirectoryInformation() called\n");
|
||||||
|
|
||||||
Length = wcslen(Fcb->ObjectName) * sizeof(WCHAR);
|
Length = wcslen(Fcb->ObjectName) * sizeof(WCHAR);
|
||||||
if ((sizeof (FILE_BOTH_DIRECTORY_INFORMATION) + Length) > BufferLength)
|
if ((sizeof (FILE_BOTH_DIRECTORY_INFORMATION) + Length) > BufferLength)
|
||||||
|
@ -358,7 +382,7 @@ CdfsGetFullDirectoryInformation(PFCB Fcb,
|
||||||
{
|
{
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
|
|
||||||
DPRINT1("CdfsGetFullDirectoryInformation() called\n");
|
DPRINT("CdfsGetFullDirectoryInformation() called\n");
|
||||||
|
|
||||||
Length = wcslen(Fcb->ObjectName) * sizeof(WCHAR);
|
Length = wcslen(Fcb->ObjectName) * sizeof(WCHAR);
|
||||||
if ((sizeof (FILE_BOTH_DIRECTORY_INFORMATION) + Length) > BufferLength)
|
if ((sizeof (FILE_BOTH_DIRECTORY_INFORMATION) + Length) > BufferLength)
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -246,8 +246,8 @@ CdfsFCBInitializeCache(PVCB Vcb,
|
||||||
Fcb->DevExt = Vcb;
|
Fcb->DevExt = Vcb;
|
||||||
|
|
||||||
Status = CcRosInitializeFileCache(FileObject,
|
Status = CcRosInitializeFileCache(FileObject,
|
||||||
&Fcb->RFCB.Bcb,
|
&Fcb->RFCB.Bcb,
|
||||||
PAGESIZE);
|
PAGESIZE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("CcRosInitializeFileCache failed\n");
|
DbgPrint("CcRosInitializeFileCache failed\n");
|
||||||
|
@ -380,7 +380,7 @@ CdfsMakeFCBFromDirEntry(PVCB Vcb,
|
||||||
|
|
||||||
rcFCB->RFCB.FileSize.QuadPart = Size;
|
rcFCB->RFCB.FileSize.QuadPart = Size;
|
||||||
rcFCB->RFCB.ValidDataLength.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);
|
// DPRINT1("%S %d %d\n", longName, Size, (ULONG)rcFCB->RFCB.AllocationSize.QuadPart);
|
||||||
CdfsFCBInitializeCache(Vcb, rcFCB);
|
CdfsFCBInitializeCache(Vcb, rcFCB);
|
||||||
rcFCB->RefCount++;
|
rcFCB->RefCount++;
|
||||||
|
@ -447,6 +447,7 @@ CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt,
|
||||||
ULONG DirSize;
|
ULONG DirSize;
|
||||||
PDIR_RECORD Record;
|
PDIR_RECORD Record;
|
||||||
ULONG Offset;
|
ULONG Offset;
|
||||||
|
ULONG BlockOffset;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
LARGE_INTEGER StreamOffset;
|
LARGE_INTEGER StreamOffset;
|
||||||
|
@ -474,18 +475,20 @@ CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt,
|
||||||
StreamOffset.QuadPart = (LONGLONG)DirectoryFcb->Entry.ExtentLocationL * (LONGLONG)BLOCKSIZE;
|
StreamOffset.QuadPart = (LONGLONG)DirectoryFcb->Entry.ExtentLocationL * (LONGLONG)BLOCKSIZE;
|
||||||
|
|
||||||
if(!CcMapData(DeviceExt->StreamFileObject, &StreamOffset,
|
if(!CcMapData(DeviceExt->StreamFileObject, &StreamOffset,
|
||||||
DirSize, TRUE, &Context, &Block))
|
BLOCKSIZE, TRUE, &Context, &Block))
|
||||||
{
|
{
|
||||||
|
DPRINT("CcMapData() failed\n");
|
||||||
return(STATUS_UNSUCCESSFUL);
|
return(STATUS_UNSUCCESSFUL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset = 0;
|
Offset = 0;
|
||||||
|
BlockOffset = 0;
|
||||||
Record = (PDIR_RECORD)Block;
|
Record = (PDIR_RECORD)Block;
|
||||||
while(TRUE)
|
while(TRUE)
|
||||||
{
|
{
|
||||||
if (Record->RecordLength == 0)
|
if (Record->RecordLength == 0)
|
||||||
{
|
{
|
||||||
DPRINT1("RecordLength == 0 Stopped!\n");
|
DPRINT("RecordLength == 0 Stopped!\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,12 +512,26 @@ CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt,
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset = Offset + Record->RecordLength;
|
Offset += Record->RecordLength;
|
||||||
Record = (PDIR_RECORD)(Block + Offset);
|
BlockOffset += Record->RecordLength;
|
||||||
if (Record->RecordLength == 0)
|
Record = (PDIR_RECORD)(Block + BlockOffset);
|
||||||
|
if (BlockOffset >= BLOCKSIZE || Record->RecordLength == 0)
|
||||||
{
|
{
|
||||||
Offset = ROUND_UP(Offset, 2048);
|
DPRINT("Map next sector\n");
|
||||||
Record = (PDIR_RECORD)(Block + Offset);
|
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)
|
if (Offset >= DirSize)
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -100,7 +100,7 @@ CdfsGetSVDData(PUCHAR Buffer,
|
||||||
|
|
||||||
Svd = (PSVD)Buffer;
|
Svd = (PSVD)Buffer;
|
||||||
|
|
||||||
DPRINT1("EscapeSequences: '%.32s'\n", Svd->EscapeSequences);
|
DPRINT("EscapeSequences: '%.32s'\n", Svd->EscapeSequences);
|
||||||
|
|
||||||
if (strncmp(Svd->EscapeSequences, "%/@", 3) == 0)
|
if (strncmp(Svd->EscapeSequences, "%/@", 3) == 0)
|
||||||
{
|
{
|
||||||
|
@ -143,6 +143,7 @@ CdfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
ULONG Sector;
|
ULONG Sector;
|
||||||
PVD_HEADER VdHeader;
|
PVD_HEADER VdHeader;
|
||||||
|
|
||||||
|
Vcb->CdInfo.JolietLevel = 0;
|
||||||
Sector = CDFS_PRIMARY_DESCRIPTOR_LOCATION;
|
Sector = CDFS_PRIMARY_DESCRIPTOR_LOCATION;
|
||||||
|
|
||||||
Buffer = ExAllocatePool(NonPagedPool,
|
Buffer = ExAllocatePool(NonPagedPool,
|
||||||
|
@ -346,12 +347,14 @@ CdfsMountVolume(PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
Fcb->RFCB.FileSize.QuadPart = DeviceExt->CdInfo.VolumeSpaceSize * BLOCKSIZE;
|
Fcb->RFCB.FileSize.QuadPart = DeviceExt->CdInfo.VolumeSpaceSize * BLOCKSIZE;
|
||||||
Fcb->RFCB.ValidDataLength.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.ExtentLocationL = 0;
|
||||||
Fcb->Entry.DataLengthL = DeviceExt->CdInfo.VolumeSpaceSize * BLOCKSIZE;
|
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))
|
if (!NT_SUCCESS (Status))
|
||||||
{
|
{
|
||||||
DbgPrint("CcRosInitializeFileCache failed\n");
|
DbgPrint("CcRosInitializeFileCache failed\n");
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -86,8 +86,6 @@ CdfsReadFile(PDEVICE_EXTENSION DeviceExt,
|
||||||
LARGE_INTEGER FileOffset;
|
LARGE_INTEGER FileOffset;
|
||||||
IO_STATUS_BLOCK IoStatus;
|
IO_STATUS_BLOCK IoStatus;
|
||||||
|
|
||||||
DPRINT1("Try caching!\n");
|
|
||||||
|
|
||||||
FileOffset.QuadPart = (LONGLONG)ReadOffset;
|
FileOffset.QuadPart = (LONGLONG)ReadOffset;
|
||||||
CcCopyRead(FileObject,
|
CcCopyRead(FileObject,
|
||||||
&FileOffset,
|
&FileOffset,
|
||||||
|
|
Loading…
Reference in a new issue