xref: /reactos/ntoskrnl/fsrtl/faulttol.c (revision c2c66aff)
1*c2c66affSColin Finck /*
2*c2c66affSColin Finck  * PROJECT:         ReactOS Kernel
3*c2c66affSColin Finck  * LICENSE:         GPL - See COPYING in the top level directory
4*c2c66affSColin Finck  * FILE:            ntoskrnl/fsrtl/faulttol.c
5*c2c66affSColin Finck  * PURPOSE:         Provides Fault Tolerance support for File System Drivers
6*c2c66affSColin Finck  * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
7*c2c66affSColin Finck  */
8*c2c66affSColin Finck 
9*c2c66affSColin Finck /* INCLUDES ******************************************************************/
10*c2c66affSColin Finck 
11*c2c66affSColin Finck #include <ntoskrnl.h>
12*c2c66affSColin Finck #include "ntddft.h"
13*c2c66affSColin Finck #define NDEBUG
14*c2c66affSColin Finck #include <debug.h>
15*c2c66affSColin Finck 
16*c2c66affSColin Finck /* PUBLIC FUNCTIONS **********************************************************/
17*c2c66affSColin Finck 
18*c2c66affSColin Finck /*++
19*c2c66affSColin Finck  * @name FsRtlBalanceReads
20*c2c66affSColin Finck  * @implemented NT 5.2
21*c2c66affSColin Finck  *
22*c2c66affSColin Finck  *     The FsRtlBalanceReads routine sends an IRP to an FTDISK Driver
23*c2c66affSColin Finck  *     requesting the driver to balance read requests across a mirror set.
24*c2c66affSColin Finck  *
25*c2c66affSColin Finck  * @param TargetDevice
26*c2c66affSColin Finck  *        A pointer to an FTDISK Device Object.
27*c2c66affSColin Finck  *
28*c2c66affSColin Finck  * @return The NTSTATUS error code returned by the FTDISK Driver.
29*c2c66affSColin Finck  *
30*c2c66affSColin Finck  * @remarks FTDISK is a Software RAID Implementation.
31*c2c66affSColin Finck  *
32*c2c66affSColin Finck  *--*/
33*c2c66affSColin Finck NTSTATUS
34*c2c66affSColin Finck NTAPI
FsRtlBalanceReads(PDEVICE_OBJECT TargetDevice)35*c2c66affSColin Finck FsRtlBalanceReads(PDEVICE_OBJECT TargetDevice)
36*c2c66affSColin Finck {
37*c2c66affSColin Finck     PIRP Irp;
38*c2c66affSColin Finck     KEVENT Event;
39*c2c66affSColin Finck     IO_STATUS_BLOCK IoStatusBlock;
40*c2c66affSColin Finck     NTSTATUS Status;
41*c2c66affSColin Finck 
42*c2c66affSColin Finck     /* Initialize the Local Event */
43*c2c66affSColin Finck     KeInitializeEvent(&Event, NotificationEvent, FALSE);
44*c2c66affSColin Finck 
45*c2c66affSColin Finck     /* Build the special IOCTL */
46*c2c66affSColin Finck     Irp = IoBuildDeviceIoControlRequest(FT_BALANCED_READ_MODE,
47*c2c66affSColin Finck                                         TargetDevice,
48*c2c66affSColin Finck                                         NULL,
49*c2c66affSColin Finck                                         0,
50*c2c66affSColin Finck                                         NULL,
51*c2c66affSColin Finck                                         0,
52*c2c66affSColin Finck                                         FALSE,
53*c2c66affSColin Finck                                         &Event,
54*c2c66affSColin Finck                                         &IoStatusBlock);
55*c2c66affSColin Finck     if (!Irp) return STATUS_INSUFFICIENT_RESOURCES;
56*c2c66affSColin Finck 
57*c2c66affSColin Finck     /* Send it */
58*c2c66affSColin Finck     Status = IoCallDriver(TargetDevice, Irp);
59*c2c66affSColin Finck 
60*c2c66affSColin Finck     /* Wait if needed */
61*c2c66affSColin Finck     if (Status == STATUS_PENDING)
62*c2c66affSColin Finck     {
63*c2c66affSColin Finck         Status = KeWaitForSingleObject(&Event,
64*c2c66affSColin Finck                                        Executive,
65*c2c66affSColin Finck                                        KernelMode,
66*c2c66affSColin Finck                                        FALSE,
67*c2c66affSColin Finck                                        NULL);
68*c2c66affSColin Finck         ASSERT(Status == STATUS_SUCCESS);
69*c2c66affSColin Finck 
70*c2c66affSColin Finck         /* Return Status */
71*c2c66affSColin Finck         Status = IoStatusBlock.Status;
72*c2c66affSColin Finck     }
73*c2c66affSColin Finck 
74*c2c66affSColin Finck     /* Return the status */
75*c2c66affSColin Finck     return Status;
76*c2c66affSColin Finck }
77*c2c66affSColin Finck 
78*c2c66affSColin Finck /*++
79*c2c66affSColin Finck  * @name FsRtlSyncVolumes
80*c2c66affSColin Finck  * @implemented NT 5.2
81*c2c66affSColin Finck  *
82*c2c66affSColin Finck  *     The FsRtlSyncVolumes routine is deprecated.
83*c2c66affSColin Finck  *
84*c2c66affSColin Finck  * @return Always returns STATUS_SUCCESS.
85*c2c66affSColin Finck  *
86*c2c66affSColin Finck  * @remarks Deprecated.
87*c2c66affSColin Finck  *
88*c2c66affSColin Finck  *--*/
89*c2c66affSColin Finck NTSTATUS
90*c2c66affSColin Finck NTAPI
FsRtlSyncVolumes(ULONG Unknown0,ULONG Unknown1,ULONG Unknown2)91*c2c66affSColin Finck FsRtlSyncVolumes(ULONG Unknown0,
92*c2c66affSColin Finck                  ULONG Unknown1,
93*c2c66affSColin Finck                  ULONG Unknown2)
94*c2c66affSColin Finck {
95*c2c66affSColin Finck     /* Always return success */
96*c2c66affSColin Finck     return STATUS_SUCCESS;
97*c2c66affSColin Finck }
98