read using existing file object

Hello,

Is it safe to save the current byte offset from the pFileObject (into a
LARGE_INTEGER) then doing a READ operation and afterwards setting the
current byte offset to its original value?

Or I should be calling SET_INFORMATION / FIlE_POSITION_INFORMATION ?


Elias

The simple answer is no to both questions unless you are synchronizing
all other reads/writes to the same file object. If you are then you can
simply save it and restore it. Remember, it is possible to have
multiple threads trying to do IO to the same file object at the same
time.

It would be better to generate asynchronous reads using the given file
object, they will not affect the current byte offset.

Neal Christiansen
Microsoft File System Filter Group

This posting is provided “AS IS” with no warranties, and confers no
rights.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of lallous
Sent: Monday, December 15, 2003 1:44 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] read using existing file object

Hello,

Is it safe to save the current byte offset from the pFileObject (into a
LARGE_INTEGER) then doing a READ operation and afterwards setting the
current byte offset to its original value?

Or I should be calling SET_INFORMATION / FIlE_POSITION_INFORMATION ?


Elias


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Neal,

If understood FAT source correctly file system decide to update
FileObject->CurrentByteOffset based on FileObject->Flags value. So
generating asynchronous IRP will not help if you want to use some particular
FileObject to read data.

Alexei.

“Neal Christiansen” wrote in message
news:xxxxx@ntfsd…

The simple answer is no to both questions unless you are synchronizing
all other reads/writes to the same file object. If you are then you can
simply save it and restore it. Remember, it is possible to have
multiple threads trying to do IO to the same file object at the same
time.

It would be better to generate asynchronous reads using the given file
object, they will not affect the current byte offset.

Neal Christiansen
Microsoft File System Filter Group

This posting is provided “AS IS” with no warranties, and confers no
rights.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of lallous
Sent: Monday, December 15, 2003 1:44 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] read using existing file object

Hello,

Is it safe to save the current byte offset from the pFileObject (into a
LARGE_INTEGER) then doing a READ operation and afterwards setting the
current byte offset to its original value?

Or I should be calling SET_INFORMATION / FIlE_POSITION_INFORMATION ?


Elias


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com