3 * reactos/ntoskrnl/fs/util.c
10 /**********************************************************************
12 * FsRtlIsTotalDeviceFailure@4
15 * Check if an NTSTATUS error code represents a
16 * disk hardware failure.
23 * FALSE if either (NtStatus >= STATUS_SUCCESS),
24 * STATUS_CRC_ERROR, STATUS_DEVICE_DATA_ERROR;
30 FsRtlIsTotalDeviceFailure (
35 (NT_SUCCESS(NtStatus))
36 || (STATUS_CRC_ERROR == NtStatus)
37 || (STATUS_DEVICE_DATA_ERROR == NtStatus)
44 /**********************************************************************
46 * FsRtlIsNtstatusExpected/1
50 * Check an NTSTATUS value is expected by the FS kernel
58 * TRUE if NtStatus is NOT one out of:
59 * - STATUS_ACCESS_VIOLATION
60 * - STATUS_ILLEGAL_INSTRUCTION
61 * - STATUS_DATATYPE_MISALIGNMENT
62 * - STATUS_INSTRUCTION_MISALIGNMENT
63 * which are the forbidden return stati in the FsRtl
64 * subsystem; FALSE otherwise.
67 * 2002-01-17 Fixed a bad bug reported by Bo Brantén.
68 * Up to version 1.8, this function's semantics was
69 * exactly the opposite! Thank you Bo.
73 FsRtlIsNtstatusExpected (
78 (STATUS_DATATYPE_MISALIGNMENT == NtStatus)
79 || (STATUS_ACCESS_VIOLATION == NtStatus)
80 || (STATUS_ILLEGAL_INSTRUCTION == NtStatus)
81 || (STATUS_INSTRUCTION_MISALIGNMENT == NtStatus)
88 /**********************************************************************
90 * FsRtlNormalizeNtstatus@8
93 * Normalize an NTSTATUS value for using in the FS subsystem.
97 * NTSTATUS to normalize.
99 * NTSTATUS to return if the NtStatusToNormalize
100 * value is unexpected by the FS kernel subsystem.
103 * NtStatusToNormalize if it is an expected value,
104 * otherwise NormalizedNtStatus.
108 FsRtlNormalizeNtstatus (
109 IN NTSTATUS NtStatusToNormalize,
110 IN NTSTATUS NormalizedNtStatus
114 (TRUE == FsRtlIsNtstatusExpected(NtStatusToNormalize))
115 ? NtStatusToNormalize
116 : NormalizedNtStatus;
120 /**********************************************************************
121 * Miscellanea (they may fit somewhere else)
122 *********************************************************************/
125 /**********************************************************************
127 * FsRtlAllocateResource@0
138 FsRtlAllocateResource (VOID)
144 /**********************************************************************
146 * FsRtlBalanceReads@4
158 IN PDEVICE_OBJECT TargetDevice
161 return STATUS_SUCCESS;
165 /**********************************************************************
176 * From Bo Branten's ntifs.h v12.
182 IN PFILE_OBJECT FileObject,
183 IN PLARGE_INTEGER FileOffset,
188 OUT PIO_STATUS_BLOCK IoStatus,
189 IN PDEVICE_OBJECT DeviceObject
196 /**********************************************************************
207 * From Bo Branten's ntifs.h v12.
212 IN PFILE_OBJECT FileObject,
213 IN PLARGE_INTEGER FileOffset,
218 OUT PIO_STATUS_BLOCK IoStatus,
219 IN PDEVICE_OBJECT DeviceObject
226 /**********************************************************************
240 IN PFILE_OBJECT FileObject,
241 IN OUT PLARGE_INTEGER FileSize
244 FILE_STANDARD_INFORMATION Info;
248 Status = IoQueryFileInformation(FileObject,
249 FileStandardInformation,
253 if (NT_SUCCESS(Status))
255 FileSize->QuadPart = Info.EndOfFile.QuadPart;
262 /**********************************************************************
264 * FsRtlPostPagingFileStackOverflow@12
275 FsRtlPostPagingFileStackOverflow (
284 /**********************************************************************
286 * FsRtlPostStackOverflow@12
297 FsRtlPostStackOverflow (
306 /**********************************************************************
308 * FsRtlSyncVolumes@12
316 * It always returns STATUS_SUCCESS.
326 return STATUS_SUCCESS;