From 1b18452663b4bbc06cee0022ad6adda097661bf8 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Mon, 16 Nov 2015 16:37:27 -0800 Subject: [PATCH] sys: initial fast I/O support --- build/VStudio/winfsp.vcxproj | 3 ++- build/VStudio/winfsp.vcxproj.filters | 7 ++++-- src/sys/driver.c | 32 ++++++++++++++++++++++++ src/sys/driver.h | 5 +++- src/sys/fastio.c | 37 ++++++++++++++++++++++++++++ src/sys/{seinfo.c => security.c} | 0 6 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 src/sys/fastio.c rename src/sys/{seinfo.c => security.c} (100%) diff --git a/build/VStudio/winfsp.vcxproj b/build/VStudio/winfsp.vcxproj index 93eb362f..fa2356a8 100644 --- a/build/VStudio/winfsp.vcxproj +++ b/build/VStudio/winfsp.vcxproj @@ -125,12 +125,13 @@ + - + diff --git a/build/VStudio/winfsp.vcxproj.filters b/build/VStudio/winfsp.vcxproj.filters index 589196c9..ac1c488d 100644 --- a/build/VStudio/winfsp.vcxproj.filters +++ b/build/VStudio/winfsp.vcxproj.filters @@ -57,10 +57,13 @@ Source Files - + Source Files - + + Source Files + + Source Files diff --git a/src/sys/driver.c b/src/sys/driver.c index 1d55c2d3..c3cca897 100644 --- a/src/sys/driver.c +++ b/src/sys/driver.c @@ -64,6 +64,38 @@ DriverEntry( DriverObject->MajorFunction[IRP_MJ_SET_QUOTA] = 0; DriverObject->MajorFunction[IRP_MJ_PNP] = 0; + /* setup fast I/O */ + static FAST_IO_DISPATCH FspFastIoDispatch = { 0 }; + FspFastIoDispatch.SizeOfFastIoDispatch = sizeof FspFastIoDispatch; + FspFastIoDispatch.FastIoCheckIfPossible = FspFastIoCheckIfPossible; + FspFastIoDispatch.FastIoRead = FsRtlCopyRead; + FspFastIoDispatch.FastIoWrite = FsRtlCopyWrite; + FspFastIoDispatch.FastIoQueryBasicInfo = 0; + FspFastIoDispatch.FastIoQueryStandardInfo = 0; + FspFastIoDispatch.FastIoLock = 0; + FspFastIoDispatch.FastIoUnlockSingle = 0; + FspFastIoDispatch.FastIoUnlockAll = 0; + FspFastIoDispatch.FastIoUnlockAllByKey = 0; + FspFastIoDispatch.FastIoDeviceControl = 0; + FspFastIoDispatch.AcquireFileForNtCreateSection = 0; + FspFastIoDispatch.ReleaseFileForNtCreateSection = 0; + FspFastIoDispatch.FastIoDetachDevice = 0; + FspFastIoDispatch.FastIoQueryNetworkOpenInfo = 0; + FspFastIoDispatch.AcquireForModWrite = 0; + FspFastIoDispatch.MdlRead = FsRtlMdlReadDev; + FspFastIoDispatch.MdlReadComplete = FsRtlMdlReadCompleteDev; + FspFastIoDispatch.PrepareMdlWrite = FsRtlPrepareMdlWriteDev; + FspFastIoDispatch.MdlWriteComplete = FsRtlMdlWriteCompleteDev; + FspFastIoDispatch.FastIoReadCompressed = 0; + FspFastIoDispatch.FastIoWriteCompressed = 0; + FspFastIoDispatch.MdlReadCompleteCompressed = 0; + FspFastIoDispatch.MdlWriteCompleteCompressed = 0; + FspFastIoDispatch.FastIoQueryOpen = 0; + FspFastIoDispatch.ReleaseForModWrite = 0; + FspFastIoDispatch.AcquireForCcFlush = 0; + FspFastIoDispatch.ReleaseForCcFlush = 0; + DriverObject->FastIoDispatch = &FspFastIoDispatch; + return STATUS_SUCCESS; } diff --git a/src/sys/driver.h b/src/sys/driver.h index 655f0f0c..dd258a77 100644 --- a/src/sys/driver.h +++ b/src/sys/driver.h @@ -7,7 +7,7 @@ #ifndef WINFSP_SYS_DRIVER_H_INCLUDED #define WINFSP_SYS_DRIVER_H_INCLUDED -#include +#include #define DRIVER_NAME "winfsp" @@ -39,4 +39,7 @@ DRIVER_DISPATCH FspSetVolumeInformation; DRIVER_DISPATCH FspShutdown; DRIVER_DISPATCH FspWrite; +/* fast I/O */ +FAST_IO_CHECK_IF_POSSIBLE FspFastIoCheckIfPossible; + #endif diff --git a/src/sys/fastio.c b/src/sys/fastio.c new file mode 100644 index 00000000..09adfb2e --- /dev/null +++ b/src/sys/fastio.c @@ -0,0 +1,37 @@ +/** + * @file sys/fastio.c + * + * @copyright 2015 Bill Zissimopoulos + */ + +#include + +FAST_IO_CHECK_IF_POSSIBLE FspFastIoCheckIfPossible; + +#ifdef ALLOC_PRAGMA +#pragma alloc_text(PAGE, FspFastIoCheckIfPossible) +#endif + +BOOLEAN +FspFastIoCheckIfPossible( + _In_ PFILE_OBJECT FileObject, + _In_ PLARGE_INTEGER FileOffset, + _In_ ULONG Length, + _In_ BOOLEAN Wait, + _In_ ULONG LockKey, + _In_ BOOLEAN CheckForReadOperation, + _Out_ PIO_STATUS_BLOCK IoStatus, + _In_ PDEVICE_OBJECT DeviceObject + ) +{ + UNREFERENCED_PARAMETER(FileObject); + UNREFERENCED_PARAMETER(FileOffset); + UNREFERENCED_PARAMETER(Length); + UNREFERENCED_PARAMETER(Wait); + UNREFERENCED_PARAMETER(LockKey); + UNREFERENCED_PARAMETER(CheckForReadOperation); + UNREFERENCED_PARAMETER(IoStatus); + UNREFERENCED_PARAMETER(DeviceObject); + + return FALSE; +} diff --git a/src/sys/seinfo.c b/src/sys/security.c similarity index 100% rename from src/sys/seinfo.c rename to src/sys/security.c