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;
31 FsRtlIsTotalDeviceFailure (
36 (NT_SUCCESS(NtStatus))
37 || (STATUS_CRC_ERROR == NtStatus)
38 || (STATUS_DEVICE_DATA_ERROR == NtStatus)
46 /**********************************************************************
48 * FsRtlIsNtstatusExpected/1
52 * Check an NTSTATUS value is expected by the FS kernel
60 * TRUE if NtStatus is NOT one out of:
61 * - STATUS_ACCESS_VIOLATION
62 * - STATUS_ILLEGAL_INSTRUCTION
63 * - STATUS_DATATYPE_MISALIGNMENT
64 * - STATUS_INSTRUCTION_MISALIGNMENT
65 * which are the forbidden return stati in the FsRtl
66 * subsystem; FALSE otherwise.
69 * 2002-01-17 Fixed a bad bug reported by Bo Brantén.
70 * Up to version 1.8, this function's semantics was
71 * exactly the opposite! Thank you Bo.
77 FsRtlIsNtstatusExpected (
82 (STATUS_DATATYPE_MISALIGNMENT == NtStatus)
83 || (STATUS_ACCESS_VIOLATION == NtStatus)
84 || (STATUS_ILLEGAL_INSTRUCTION == NtStatus)
85 || (STATUS_INSTRUCTION_MISALIGNMENT == NtStatus)
92 /**********************************************************************
94 * FsRtlNormalizeNtstatus@8
97 * Normalize an NTSTATUS value for using in the FS subsystem.
100 * NtStatusToNormalize
101 * NTSTATUS to normalize.
103 * NTSTATUS to return if the NtStatusToNormalize
104 * value is unexpected by the FS kernel subsystem.
107 * NtStatusToNormalize if it is an expected value,
108 * otherwise NormalizedNtStatus.
114 FsRtlNormalizeNtstatus (
115 IN NTSTATUS NtStatusToNormalize,
116 IN NTSTATUS NormalizedNtStatus
120 (TRUE == FsRtlIsNtstatusExpected(NtStatusToNormalize))
121 ? NtStatusToNormalize
122 : NormalizedNtStatus;
126 /**********************************************************************
127 * Miscellanea (they may fit somewhere else)
128 *********************************************************************/
131 /**********************************************************************
133 * FsRtlAllocateResource@0
146 FsRtlAllocateResource (VOID)
152 /**********************************************************************
154 * FsRtlBalanceReads@4
168 IN PDEVICE_OBJECT TargetDevice
171 return STATUS_SUCCESS;
175 /**********************************************************************
186 * From Bo Branten's ntifs.h v12.
193 IN PFILE_OBJECT FileObject,
194 IN PLARGE_INTEGER FileOffset,
199 OUT PIO_STATUS_BLOCK IoStatus,
200 IN PDEVICE_OBJECT DeviceObject
207 /**********************************************************************
218 * From Bo Branten's ntifs.h v12.
225 IN PFILE_OBJECT FileObject,
226 IN PLARGE_INTEGER FileOffset,
231 OUT PIO_STATUS_BLOCK IoStatus,
232 IN PDEVICE_OBJECT DeviceObject
239 /**********************************************************************
254 IN PFILE_OBJECT FileObject,
255 IN OUT PLARGE_INTEGER FileSize
258 FILE_STANDARD_INFORMATION Info;
262 Status = IoQueryFileInformation(FileObject,
263 FileStandardInformation,
267 if (NT_SUCCESS(Status))
269 FileSize->QuadPart = Info.EndOfFile.QuadPart;
276 /**********************************************************************
278 * FsRtlPostPagingFileStackOverflow@12
290 FsRtlPostPagingFileStackOverflow (
299 /**********************************************************************
301 * FsRtlPostStackOverflow@12
313 FsRtlPostStackOverflow (
322 /**********************************************************************
324 * FsRtlSyncVolumes@12
332 * It always returns STATUS_SUCCESS.
344 return STATUS_SUCCESS;
347 #endif /* LIBCAPTIVE */