CreateFileMapping processing

Does anyone know where I can find information on CreateFileMapping? (It
seems like there could be a whole book written about this one.)

I’d like to find a discussion of the internal processing for this API call
(which IRPs are sent and what should be filled in for them by my FSD).
Specifically I’d like to know how it handles EOF and reading of the actual
data from memory, and how does the data from the file on disk get into
memory, etc.

Any input you may have would be better than what I have already found…

Thanks - Greg


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> Does anyone know where I can find information on CreateFileMapping? (It

seems like there could be a whole book written about this one.)

I’d like to find a discussion of the internal processing for this API call
(which IRPs are sent and what should be filled in for them by my FSD).
Specifically I’d like to know how it handles EOF and reading of the actual
data from memory, and how does the data from the file on disk get into
memory, etc.

Rajeev Nagar’s book on filesystems is for you. EOF handling, FastIo
callbacks for locking hierarchy and FCB locks are described there.

CreateFileMapping aka NtCreateSection does things like grabbing both FCB
locks exclusively by AcquireForNtCreateSection callback, then (sorry for not
remembering the details just off-head) queries some file information via the
IRP, then allocates some MM’s internal structures and sets pointers to them
in your SECTION_OBJECT_POINTERS structure pointed by your file object.

EOF handling on paging reads:

  • if read starts after ValidDataLength - fail it with STATUS_END_OF_FILE,
    don’t bother zeroing - MM will do this for you.
  • if read starts before ValidDataLength but extends beyound
    ValidDataLength - complete it with necessary Irp->IoStatus.Information value
    which will reflect only real data being read which is before
    ValidDataLength. Don’t bother zeroing the tail - MM will do this for you.

Max


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

  1. bytes beyond EOF to the end of the last page are materialized as
    zeros
  2. you are building references to the single underlying mapped section
    object for the file. this is direct, and when mapped are exactly the
    physical pages as are accessed for cached IO on the file. NT has a
    memory mapped stream cache, not a logical block cache.
  3. plain old page faults, the IRPs will have IRP_PAGING_IO turned on in
    Irp->Flags

-----Original Message-----
From: xxxxx@filetek.com [mailto:xxxxx@filetek.com]
Sent: Wednesday, August 01, 2001 7:10 AM
To: File Systems Developers
Subject: [ntfsd] CreateFileMapping processing

Does anyone know where I can find information on CreateFileMapping? (It
seems like there could be a whole book written about this one.)

I’d like to find a discussion of the internal processing for this API
call
(which IRPs are sent and what should be filled in for them by my FSD).
Specifically I’d like to know how it handles EOF and reading of the
actual
data from memory, and how does the data from the file on disk get into
memory, etc.

Any input you may have would be better than what I have already found…

Thanks - Greg


You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Thanks you guys - I appreciate the help a lot!

greg


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com