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