Merge to trunk head (r46631)
[reactos.git] / ntoskrnl / fsrtl / faulttol.c
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 4.0
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
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 /* Return Status */
69 Status = IoStatusBlock.Status;
70 }
71
72 /* Return the status */
73 return Status;
74 }
75
76 /*++
77 * @name FsRtlSyncVolumes
78 * @implemented NT 4.0
79 *
80 * The FsRtlSyncVolumes routine is deprecated.
81 *
82 * @return Always returns STATUS_SUCCESS.
83 *
84 * @remarks Deprecated.
85 *
86 *--*/
87 NTSTATUS
88 NTAPI
89 FsRtlSyncVolumes(ULONG Unknown0,
90 ULONG Unknown1,
91 ULONG Unknown2)
92 {
93 /* Always return success */
94 return STATUS_SUCCESS;
95 }