|
From: Guido de J. <gui...@ch...> - 2001-09-25 19:38:31
|
Now I don't too much about ReactOS programming, but IMHO Jack was quite plain
about it:
There is this function called MiReadPage() which you can find in
mm/section.c, lines 252-337. This function does a call to IOReadPage() in
line 290, if the page in cache is not up-to-date. According to Jack it is not
an error if this function returns STATUS_END_OF_FILE, which apparently is not
equal to NT_SUCCESS(). So he added
&& Status != STATUS_END_OF_FILE
to line 295. IMHO it will have been even better if you add
&& (Status != STATUS_END_OF_FILE)
in stead. Do you really need a diff for this?
See added line numbers below.
- Guido
On Tuesday 25 September 2001 20:27, Jason Filby wrote:
> Has anyone tested/updated the tree with this update and the latest
> one from Jack?
>
> Jack: it seems that most developers prefer that you send them the
> "diffs".. but I don't think I have diff installed?..
>
> - Jason
>
> --- "Jack (Butch) Griffin" <bu...@qw...> wrote:
> > I have been playing with the ReactOS operating system and trying to
> > get a
> > console mode app written in vistual C++ to run. The app is your
> > basic hello
> > world application. I did not really expect that the complete
> > infra-structure was in place for this to run, but I figured it
> > would point
> > out what was missing and give me a starting point for beginning to
> > learn
> > about the design of this OS.
> >
> > Anyway I have found a problem and do not know who should get the
> > updated
> > code. The problem is in MiReadPage() and the updated code is
> > below. The
> > only change is that STATUS_END_OF_FILE is a legimate return from
> > IoPageRead(). It does not mean an error occurred, just that the
> > file did
> > not contain enough data to fill the page. Function that call
> > MiReadPage()
> > assume that the data read are OK if the return value is
> > STATUS_END_OF_FILE,
> > so the update of the Page pointer must be done in this case.
> >
> > Thanks
> > Jack Griffin
252: NTSTATUS
MiReadPage(PMEMORY_AREA MemoryArea,
PLARGE_INTEGER Offset,
PVOID* Page)
{
IO_STATUS_BLOCK IoStatus;
PFILE_OBJECT FileObject;
PMDL Mdl;
NTSTATUS Status;
PREACTOS_COMMON_FCB_HEADER Fcb;
FileObject = MemoryArea->Data.SectionData.Section->FileObject;
Fcb = (PREACTOS_COMMON_FCB_HEADER)FileObject->FsContext;
if (FileObject->Flags & FO_DIRECT_CACHE_PAGING_READ &&
(Offset->QuadPart % PAGESIZE) == 0)
{
ULONG BaseOffset;
PVOID BaseAddress;
BOOLEAN UptoDate;
PCACHE_SEGMENT CacheSeg;
LARGE_INTEGER SegOffset;
PHYSICAL_ADDRESS Addr;
Status = CcRosGetCacheSegment(Fcb->Bcb,
(ULONG)Offset->QuadPart,
&BaseOffset,
&BaseAddress,
&UptoDate,
&CacheSeg);
if (!NT_SUCCESS(Status))
{
return(Status);
}
if (!UptoDate)
{
Mdl = MmCreateMdl(NULL, BaseAddress, Fcb->Bcb->CacheSegmentSize);
MmBuildMdlForNonPagedPool(Mdl);
SegOffset.QuadPart = BaseOffset;
290: Status = IoPageRead(FileObject,
Mdl,
&SegOffset,
&IoStatus,
TRUE);
295: if (!NT_SUCCESS(Status) && Status != STATUS_END_OF_FILE)
{
CcRosReleaseCacheSegment(Fcb->Bcb, CacheSeg, FALSE);
return(Status);
}
}
Addr = MmGetPhysicalAddress(BaseAddress +
Offset->QuadPart - BaseOffset);
(*Page) = (PVOID)(ULONG)Addr.QuadPart;
MmReferencePage((*Page));
CcRosReleaseCacheSegment(Fcb->Bcb, CacheSeg, TRUE);
return(STATUS_SUCCESS);
}
else
{
/*
* Allocate a page, this is rather complicated by the possibility
* we might have to move other things out of memory
*/
(*Page) = MmAllocPage(0);
while ((*Page) == NULL)
{
MmWaitForFreePages();
(*Page) = MmAllocPage(0);
}
/*
* Create an mdl to hold the page we are going to read data into.
*/
Mdl = MmCreateMdl(NULL, NULL, PAGESIZE);
MmBuildMdlFromPages(Mdl, (PULONG)Page);
/*
* Call the FSD to read the page
*/
Status = IoPageRead(FileObject,
Mdl,
Offset,
&IoStatus,
FALSE);
return(Status);
}
337: }
====================================================
= To remove yourself from this mailing list, go to =
= http://www.reactos.com/home/mailing.html =
====================================================
|