[ros-dev] Re: [ros-svn] [hbirr] 13570: - Started the rewriting
of the cache manger.
xnavara at volny.cz
Sat Feb 19 00:19:25 CET 2005
Filip Navara wrote:
> Hartmut Birr wrote:
>>> [cc02.diff] Don't try to map data past the end of file in VFAT.
>> I think that this patch isn't necessary, because the real problem is
>> in pin.c.
> At first I did the same thing as you did in the attached patch. Then I
> actually followed it by some testing on Windows and _it is possible to
> map data past the end of file_ with CcMapData. I haven't tried to
> access the mapped memory though...
I did more testing and the result is the attached patch (comment
inside). Does it look ok?
-------------- next part --------------
--- section.c (revision 13615)
+++ section.c (working copy)
@@ -866,15 +866,20 @@
FileOffset.QuadPart = SegOffset + SectionData->Segment->FileOffset;
Length = PageCount * PAGE_SIZE;
- if (SegOffset > SectionData->Segment->RawLength)
+ if (SegOffset >= SectionData->Segment->RawLength)
+ /* It is perfectly valid to map area past the end of file with CcMapData
+ * and then access the pages. In this case the page fault doesn't result
+ * in I/O request and we get zeroed pages.
+ return STATUS_SUCCESS;
if (Length + SegOffset > SectionData->Segment->RawLength)
Length = SectionData->Segment->RawLength - SegOffset;
Status = MmspRawReadPages(SectionData->Section->FileObject,
@@ -1717,7 +1722,7 @@
Status = MmspReadSectionSegmentPages(SectionData, Offset, PageCount, Pfn);
- DPRINT1("MiReadPage failed (Status %x)\n", Status);
+ DPRINT1("MmspReadSectionSegmentPages failed (Status %x)\n", Status);
More information about the Ros-dev