I develop an virtual disk device driver ( FILE_REMOVABLE_MEDIA ).
it works fine,but i need to disable the “write cache” to ensure the datas
stored on the removeable media are always coherent.
So the media could be removed at any time. The system do with a
“FILE_FLOPPY_DISKETTE” device.
How do i must create my device ?
the actual device declaration is :
ntStatus = IoCreateDevice (
DriverObject, /* Our Driver Object */
sizeof (EXTENSION), /* Size of state information */
&ntUnicodeString, /* Device name “\Device\Name” */
FILE_DEVICE_DISK, /* Device type */
FILE_REMOVABLE_MEDIA, /* Device characteristics */
FALSE, /* Exclusive device */
ppDeviceObject); /* Returned ptr to
Device Object */
Unfortunately (Windows) caching occurs in the filesystem layer, not the
volume layer. Fastfat has lots of special-case code to ensure floppy
transfers are flushed quickly, but there is no generic API I know of to
inform the filesystem that you don’t want files to be cached on top of
you.
One possibility is to have a passive worker thread wake up every second
or so and fire off an IRP_MJ_FLUSH_BUFFERS at the filesystem on top of
you (against a file object representing a UserVolumeOpen, see fastfat).
You can also write a filesystem filter to twiddle on the
FILE_WRITE_THROUGH flag for every file open on your volume (but I don’t
know what unintended side effects this may produce).
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of JP
Sent: Thursday, October 24, 2002 3:18 AM
To: File Systems Developers
Subject: [ntfsd] disable write cache on virtual disk driver
I develop an virtual disk device driver ( FILE_REMOVABLE_MEDIA ).
it works fine,but i need to disable the “write cache” to
ensure the datas stored on the removeable media are always
coherent. So the media could be removed at any time. The
system do with a “FILE_FLOPPY_DISKETTE” device.
How do i must create my device ?
the actual device declaration is :
ntStatus = IoCreateDevice (
DriverObject, /* Our Driver Object */
sizeof (EXTENSION), /* Size of state information */
&ntUnicodeString, /* Device name “\Device\Name” */
FILE_DEVICE_DISK, /* Device type */
FILE_REMOVABLE_MEDIA, /* Device characteristics */
FALSE, /* Exclusive device */
ppDeviceObject); /* Returned ptr to
Device Object */
You are currently subscribed to ntfsd as: xxxxx@nryan.com
To unsubscribe send a blank email to %%email.unsub%%