ReactOS  0.4.13-dev-73-gcfe54aa
blockio.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: GNU GENERAL PUBLIC LICENSE VERSION 2
3  * PROJECT: ReiserFs file system driver for Windows NT/2000/XP/Vista.
4  * FILE: blockio.c
5  * PURPOSE:
6  * PROGRAMMER: Mark Piper, Matt Wu, Bo BrantÚn.
7  * HOMEPAGE:
8  * UPDATE HISTORY:
9  */
10 
11 /* INCLUDES *****************************************************************/
12 
13 #include "rfsd.h"
14 
15 /* GLOBALS ***************************************************************/
16 
18 
19 /* DEFINITIONS *************************************************************/
20 
21 typedef struct _RFSD_RW_CONTEXT {
28 
29 #ifdef _PREFAST_
30 IO_COMPLETION_ROUTINE RfsdReadWriteBlockSyncCompletionRoutine;
31 IO_COMPLETION_ROUTINE RfsdReadWriteBlockAsyncCompletionRoutine;
32 IO_COMPLETION_ROUTINE RfsdMediaEjectControlCompletion;
33 #endif // _PREFAST_
34 
38  IN PIRP Irp,
39  IN PVOID Context );
40 
44  IN PIRP Irp,
45  IN PVOID Context );
46 
50  IN PIRP Irp,
51  IN PVOID Contxt );
52 
53 #ifdef ALLOC_PRAGMA
54 #pragma alloc_text(PAGE, RfsdLockUserBuffer)
55 #pragma alloc_text(PAGE, RfsdGetUserBuffer)
56 #pragma alloc_text(PAGE, RfsdReadSync)
57 #pragma alloc_text(PAGE, RfsdReadDisk)
58 #pragma alloc_text(PAGE, RfsdDiskIoControl)
59 #pragma alloc_text(PAGE, RfsdReadWriteBlocks)
60 #pragma alloc_text(PAGE, RfsdMediaEjectControl)
61 #pragma alloc_text(PAGE, RfsdDiskShutDown)
62 #endif
63 
64 /* FUNCTIONS ***************************************************************/
65 
68  IN ULONG Length,
70 {
72 
73  PAGED_CODE();
74 
75  ASSERT(Irp != NULL);
76 
77  if (Irp->MdlAddress != NULL) {
78 
79  return STATUS_SUCCESS;
80  }
81 
82  IoAllocateMdl(Irp->UserBuffer, Length, FALSE, FALSE, Irp);
83 
84  if (Irp->MdlAddress == NULL) {
85 
87  }
88 
89  _SEH2_TRY {
90 
91  MmProbeAndLockPages(Irp->MdlAddress, Irp->RequestorMode, Operation);
92 
95 
96  IoFreeMdl(Irp->MdlAddress);
97 
98  Irp->MdlAddress = NULL;
99 
100  DbgBreak();
101 
103  } _SEH2_END;
104 
105  return Status;
106 }
107 
108 PVOID
110 {
111  PAGED_CODE();
112 
113  ASSERT(Irp != NULL);
114 
115  if (Irp->MdlAddress) {
116 
117 #if (_WIN32_WINNT >= 0x0500)
119 #else
120  return MmGetSystemAddressForMdl(Irp->MdlAddress);
121 #endif
122  } else {
123 
124  return Irp->UserBuffer;
125  }
126 }
127 
131  IN PIRP Irp,
132  IN PVOID Context )
133 {
135 
136  if (!NT_SUCCESS( Irp->IoStatus.Status )) {
137  DbgBreak(); // [mark]
138  pContext->MasterIrp->IoStatus = Irp->IoStatus;
139  }
140 
141  IoFreeMdl( Irp->MdlAddress );
142  IoFreeIrp( Irp );
143 
144  if (InterlockedDecrement(&pContext->Blocks) == 0) {
145 
146  pContext->MasterIrp->IoStatus.Information = 0;
147 
148  if (NT_SUCCESS(pContext->MasterIrp->IoStatus.Status)) {
149 
150  pContext->MasterIrp->IoStatus.Information =
151  pContext->Length;
152  }
153 
154  KeSetEvent( &pContext->Event, 0, FALSE );
155  }
156 
158 
160 }
161 
165  IN PIRP Irp,
167  )
168 {
170 
171  if (!NT_SUCCESS( Irp->IoStatus.Status )) {
172  DbgBreak(); // [mark]
173  pContext->MasterIrp->IoStatus = Irp->IoStatus;
174  }
175 
176  if (InterlockedDecrement(&pContext->Blocks) == 0) {
177 
178  pContext->MasterIrp->IoStatus.Information = 0;
179 
180  if (NT_SUCCESS(pContext->MasterIrp->IoStatus.Status)) {
181 
182  pContext->MasterIrp->IoStatus.Information =
183  pContext->Length;
184  }
185 
186  IoMarkIrpPending( pContext->MasterIrp );
187 
188  ExFreePool(pContext);
189  }
190 
192 
193  return STATUS_SUCCESS;
194 }
195 
196 // Looks like this is really just getting an MDL (memory descriptor list) from the MM and doing its business...
197 // ... but IoCallDriver is what will actually read from the disk device to furnish non-chached or paging IO operations!
198 // NOTE: It is vital that IoCallDriver use sector-aligned offset and length (otherwise, 0xc000000d = STATUS_INVALID_PARAMETER) will result!
199 NTSTATUS
201  IN PRFSD_IRP_CONTEXT IrpContext,
202  IN PRFSD_VCB Vcb,
203  IN PRFSD_BDL RfsdBDL, // The block-description list
204  IN ULONG Length, // Length of data to read
205  IN ULONG Count, // Count of blocks inside the BDL
206  IN BOOLEAN bVerify )
207 {
208  PMDL Mdl;
209  PIRP Irp;
210  PIRP MasterIrp = IrpContext->Irp;
213  PRFSD_RW_CONTEXT pContext = NULL;
214  ULONG i;
215  BOOLEAN bBugCheck = FALSE;
216 
217  PAGED_CODE();
218 
219  ASSERT(MasterIrp);
220 
221  _SEH2_TRY {
222 
224 
225  if (!pContext) {
227  _SEH2_LEAVE;
228  }
229 
230  RtlZeroMemory(pContext, sizeof(RFSD_RW_CONTEXT));
231 
232  pContext->Wait = IrpContext->IsSynchronous;
233  pContext->MasterIrp = MasterIrp;
234  pContext->Blocks = Count;
235  pContext->Length = 0;
236 
237  if (pContext->Wait) {
239  }
240 
241  for (i = 0; i < Count; i++) {
242 
244  MasterIrp,
245  (CCHAR)(Vcb->TargetDeviceObject->StackSize + 1) );
246 
247  if (!Irp) {
249 #ifdef __REACTOS__
250  ExFreePool(pContext);
251  pContext = NULL;
252 #endif
253  _SEH2_LEAVE;
254  }
255 
256  Mdl = IoAllocateMdl( (PCHAR)MasterIrp->UserBuffer +
257  RfsdBDL[i].Offset,
258  RfsdBDL[i].Length,
259  FALSE,
260  FALSE,
261  Irp );
262 
263  if (!Mdl) {
265 #ifdef __REACTOS__
266  ExFreePool(pContext);
267  pContext = NULL;
268 #endif
269  _SEH2_LEAVE;
270  }
271 
272  IoBuildPartialMdl( MasterIrp->MdlAddress,
273  Mdl,
274  (PCHAR)MasterIrp->UserBuffer + RfsdBDL[i].Offset,
275  RfsdBDL[i].Length );
276 
279 
280 
281  IrpSp->MajorFunction = IrpContext->MajorFunction;
282  IrpSp->Parameters.Read.Length = RfsdBDL[i].Length;
283  IrpSp->Parameters.Read.ByteOffset.QuadPart = RfsdBDL[i].Lba;
284 
286  Irp,
287  ((IrpContext->IsSynchronous) ?
290  (PVOID) pContext,
291  TRUE,
292  TRUE,
293  TRUE );
294 
296 
297  IrpSp->MajorFunction = IrpContext->MajorFunction;
298  IrpSp->Parameters.Read.Length = RfsdBDL[i].Length;
299  IrpSp->Parameters.Read.ByteOffset.QuadPart = RfsdBDL[i].Lba;
300 
301  if (bVerify) {
303  }
304 
305  RfsdBDL[i].Irp = Irp;
306  }
307 
308  MasterIrp->AssociatedIrp.IrpCount = Count;
309 
310  if (IrpContext->IsSynchronous) {
311  MasterIrp->AssociatedIrp.IrpCount += 1;
312  }
313 
314  pContext->Length = Length;
315 
316  bBugCheck = TRUE;
317 
318  for (i = 0; i < Count; i++) {
319  Status = IoCallDriver ( Vcb->TargetDeviceObject,
320  RfsdBDL[i].Irp);
321  }
322 
323  if (IrpContext->IsSynchronous) {
324  KeWaitForSingleObject( &(pContext->Event),
326 
327  KeClearEvent( &(pContext->Event) );
328  }
329 
330  } _SEH2_FINALLY {
331 
332  if (IrpContext->IsSynchronous) {
333  if (MasterIrp)
334  Status = MasterIrp->IoStatus.Status;
335 
336  if (pContext)
337  ExFreePool(pContext);
338 
339  } else {
340  IrpContext->Irp = NULL;
342  }
343 
345  if (bBugCheck) {
347  }
348 
349  for (i = 0; i < Count; i++) {
350  if (RfsdBDL[i].Irp != NULL ) {
351  if ( RfsdBDL[i].Irp->MdlAddress != NULL ) {
352  IoFreeMdl( RfsdBDL[i].Irp->MdlAddress );
353  }
354 
355  IoFreeIrp( RfsdBDL[i].Irp );
356  }
357  }
358  }
359  } _SEH2_END;
360 
361  return Status;
362 }
363 
364 NTSTATUS
366  IN PRFSD_VCB Vcb,
368  IN ULONG Length,
369  OUT PVOID Buffer,
371  )
372 {
373  PKEVENT Event = NULL;
374  PIRP Irp;
377 
378  PAGED_CODE();
379 
380  ASSERT(Vcb != NULL);
381  ASSERT(Vcb->TargetDeviceObject != NULL);
382  ASSERT(Buffer != NULL);
383 
384  _SEH2_TRY {
385 
387 
388  if (NULL == Event) {
389  _SEH2_LEAVE;
390  }
391 
393 
395  IRP_MJ_READ,
396  Vcb->TargetDeviceObject,
397  Buffer,
398  Length,
400  Event,
401  &IoStatus
402  );
403 
404  if (!Irp) {
406  _SEH2_LEAVE;
407  }
408 
409  if (bVerify) {
412  }
413 
414  Status = IoCallDriver(Vcb->TargetDeviceObject, Irp);
415 
416  if (Status == STATUS_PENDING) {
418  Event,
419  Suspended,
420  KernelMode,
421  FALSE,
422  NULL
423  );
424 
425  Status = IoStatus.Status;
426  }
427 
428  } _SEH2_FINALLY {
429 
430  if (Event) {
431  ExFreePool(Event);
432  }
433  } _SEH2_END;
434 
435  return Status;
436 }
437 
438 NTSTATUS
440  IN PRFSD_VCB Vcb,
441  IN ULONGLONG Offset, // Byte offset (relative to disk) to read from (need not be sector-aligned!)
442  IN ULONG Size,
443  IN OUT PVOID Buffer,
444  IN BOOLEAN bVerify ) // True if the volume should be verified before reading
445 {
447  PUCHAR Buf;
448  ULONG Length;
449  ULONGLONG Lba;
450 
451  PAGED_CODE();
452 
453  // Align the offset and length to the sector boundaries
454  Lba = Offset & (~((ULONGLONG)SECTOR_SIZE - 1));
455  Length = (ULONG)(Size + Offset + SECTOR_SIZE - 1 - Lba) &
456  (~((ULONG)SECTOR_SIZE - 1));
457 
458  // Allocate a temporary buffer to read the sector-aligned data into
460  if (!Buf) {
461  RfsdPrint((DBG_ERROR, "RfsdReadDisk: no enough memory.\n"));
463 
464  goto errorout;
465  }
466 
467  // Read the data
468  Status = RfsdReadSync( Vcb,
469  Lba,
470  Length,
471  Buf,
472  FALSE );
473 
474  if (!NT_SUCCESS(Status)) {
475  RfsdPrint((DBG_ERROR, "RfsdReadDisk: Read Block Device error.\n"));
476 
477  goto errorout;
478  }
479 
480  // Copy the requested data into the user's buffer
481  RtlCopyMemory(Buffer, &Buf[Offset - Lba], Size);
482 
483 errorout:
484 
485  if (Buf)
486  ExFreePool(Buf);
487 
488  return Status;
489 }
490 
491 NTSTATUS
494  IN ULONG IoctlCode,
496  IN ULONG InputBufferSize,
498  IN OUT PULONG OutputBufferSize)
499 {
500  ULONG OutBufferSize = 0;
501  KEVENT Event;
502  PIRP Irp;
505 
506  PAGED_CODE();
507 
509 
510  if (OutputBufferSize)
511  {
512  OutBufferSize = *OutputBufferSize;
513  }
514 
516 
518  IoctlCode,
519  DeviceObject,
520  InputBuffer,
521  InputBufferSize,
522  OutputBuffer,
524  FALSE,
525  &Event,
526  &IoStatus
527  );
528 
529  if (Irp == NULL) {
530  RfsdPrint((DBG_ERROR, "RfsdDiskIoControl: Building IRQ error!\n"));
532  }
533 
535 
536  if (Status == STATUS_PENDING) {
538  Status = IoStatus.Status;
539  }
540 
541  if (OutputBufferSize) {
542  *OutputBufferSize = (ULONG) IoStatus.Information;
543  }
544 
545  return Status;
546 }
547 
551  IN PIRP Irp,
552  IN PVOID Contxt
553  )
554 {
555  PKEVENT Event = (PKEVENT)Contxt;
556 
557  KeSetEvent( Event, 0, FALSE );
558 
560 
561  return STATUS_SUCCESS;
562 }
563 
565 VOID
567  IN PRFSD_IRP_CONTEXT IrpContext,
568  IN PRFSD_VCB Vcb,
569  IN BOOLEAN bPrevent
570  )
571 {
572  PIRP Irp;
573  KEVENT Event;
575  PREVENT_MEDIA_REMOVAL Prevent;
577 
578  PAGED_CODE();
579 
581  &Vcb->MainResource,
582  TRUE );
583 
584  if (bPrevent != IsFlagOn(Vcb->Flags, VCB_REMOVAL_PREVENTED)) {
585  if (bPrevent) {
587  } else {
589  }
590  }
591 
593  &Vcb->MainResource,
595 
596  Prevent.PreventMediaRemoval = bPrevent;
597 
599 
601  Vcb->TargetDeviceObject,
602  &Prevent,
603  sizeof(PREVENT_MEDIA_REMOVAL),
604  NULL,
605  0,
606  FALSE,
607  NULL,
608  &IoStatus );
609 
610  if (Irp != NULL) {
613  &Event,
614  TRUE,
615  TRUE,
616  TRUE );
617 
618  Status = IoCallDriver(Vcb->TargetDeviceObject, Irp);
619 
620  if (Status == STATUS_PENDING) {
622  Executive,
623  KernelMode,
624  FALSE,
625  NULL );
626  }
627  }
628 }
629 
630 NTSTATUS
632 {
633  PIRP Irp;
634  KEVENT Event;
637 
638  PAGED_CODE();
639 
641 
643  Vcb->TargetDeviceObject,
644  NULL,
645  0,
646  NULL,
647  &Event,
648  &IoStatus);
649 
650  if (Irp) {
651  Status = IoCallDriver(Vcb->TargetDeviceObject, Irp);
652 
653  if (Status == STATUS_PENDING) {
655  Executive,
656  KernelMode,
657  FALSE,
658  NULL);
659 
660  Status = IoStatus.Status;
661  }
662  } else {
663  Status = IoStatus.Status;
664  }
665 
666  return Status;
667 }
signed char * PCHAR
Definition: retypes.h:7
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
#define RFSD_BUGCHK_BLOCK
Definition: rfsd.h:206
#define IN
Definition: typedefs.h:38
PVOID RfsdGetUserBuffer(IN PIRP Irp)
Definition: blockio.c:109
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
struct _KEVENT * PKEVENT
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define __drv_mustHoldCriticalRegion
Definition: ffsdrv.h:34
NTSTATUS NTAPI RfsdMediaEjectControlCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Contxt)
Definition: blockio.c:549
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:63
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
PIRP NTAPI IoBuildSynchronousFsdRequest(IN ULONG MajorFunction, IN PDEVICE_OBJECT DeviceObject, IN PVOID Buffer, IN ULONG Length, IN PLARGE_INTEGER StartingOffset, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:1069
#define IRP_MJ_SHUTDOWN
_In_ PIRP Irp
Definition: csq.h:116
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
PIRP MasterIrp
Definition: blockio.c:22
unsigned char * PUCHAR
Definition: retypes.h:3
ULONG Blocks
Definition: blockio.c:25
LONG NTSTATUS
Definition: precomp.h:26
_In_ PIRP _In_ ULONG _In_ ULONG _In_ ULONG _In_ ULONG OutBufferSize
Definition: classpnp.h:429
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
#define RFSD_POOL_TAG
Definition: rfsd.h:99
NTSTATUS RfsdReadSync(IN PRFSD_VCB Vcb, IN ULONGLONG Offset, IN ULONG Length, OUT PVOID Buffer, BOOLEAN bVerify)
Definition: blockio.c:365
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
NTSTATUS NTAPI RfsdReadWriteBlockAsyncCompletionRoutine(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: blockio.c:163
__drv_mustHoldCriticalRegion VOID RfsdMediaEjectControl(IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN BOOLEAN bPrevent)
Definition: blockio.c:566
#define PAGED_CODE()
Definition: video.h:57
CHAR InputBuffer[80]
Definition: conmgr.c:33
_SEH2_TRY
Definition: create.c:4250
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:515
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
NTSTATUS RfsdReadWriteBlocks(IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_BDL RfsdBDL, IN ULONG Length, IN ULONG Count, IN BOOLEAN bVerify)
Definition: blockio.c:200
VOID NTAPI IoBuildPartialMdl(IN PMDL SourceMdl, IN PMDL TargetMdl, IN PVOID VirtualAddress, IN ULONG Length)
Definition: iomdl.c:96
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
NTSTATUS RfsdLockUserBuffer(IN PIRP Irp, IN ULONG Length, IN LOCK_OPERATION Operation)
Definition: blockio.c:67
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
struct _RFSD_RW_CONTEXT * PRFSD_RW_CONTEXT
#define SECTOR_SIZE
Definition: winldr.h:34
#define IsFlagOn(a, b)
Definition: ext2fs.h:177
#define STATUS_INVALID_USER_BUFFER
Definition: udferr_usr.h:166
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:434
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define _SEH2_AbnormalTermination()
Definition: pseh2_64.h:13
#define SL_OVERRIDE_VERIFY_VOLUME
Definition: iotypes.h:1779
Definition: bufpool.h:45
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
PIRP NTAPI IoMakeAssociatedIrp(IN PIRP Irp, IN CCHAR StackSize)
Definition: irp.c:1925
static BOOL bVerify
Definition: verify.c:27
ULONG Length
Definition: blockio.c:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
char CCHAR
Definition: typedefs.h:50
uint64_t ULONGLONG
Definition: typedefs.h:65
#define Vcb
Definition: cdprocs.h:1425
#define VCB_REMOVAL_PREVENTED
Definition: ext2fs.h:798
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
VOID NTAPI IoFreeMdl(PMDL Mdl)
Definition: iomdl.c:146
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
struct _RFSD_RW_CONTEXT RFSD_RW_CONTEXT
NTSTATUS NTAPI RfsdReadWriteBlockSyncCompletionRoutine(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: blockio.c:129
BOOLEAN PreventMediaRemoval
Definition: ntddstor.h:251
#define InterlockedDecrement
Definition: armddk.h:52
#define RfsdPrint(arg)
Definition: rfsd.h:1069
PRFSD_GLOBAL RfsdGlobal
Definition: init.c:17
#define DBG_ERROR
Definition: ffsdrv.h:1031
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2647
ClearFlag(Dirent->Flags, DIRENT_FLAG_NOT_PERSISTENT)
NTSTATUS RfsdDiskIoControl(IN PDEVICE_OBJECT DeviceObject, IN ULONG IoctlCode, IN PVOID InputBuffer, IN ULONG InputBufferSize, IN OUT PVOID OutputBuffer, IN OUT PULONG OutputBufferSize)
Definition: blockio.c:492
Status
Definition: gdiplustypes.h:24
PMDL NTAPI IoAllocateMdl(IN PVOID VirtualAddress, IN ULONG Length, IN BOOLEAN SecondaryBuffer, IN BOOLEAN ChargeQuota, IN PIRP Irp)
Definition: iomdl.c:22
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
NTSTATUS RfsdReadDisk(IN PRFSD_VCB Vcb, IN ULONGLONG Offset, IN ULONG Size, IN OUT PVOID Buffer, IN BOOLEAN bVerify)
Definition: blockio.c:439
NTSTATUS RfsdDiskShutDown(PRFSD_VCB Vcb)
Definition: blockio.c:631
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
_SEH2_END
Definition: create.c:4424
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:935
enum _LOCK_OPERATION LOCK_OPERATION
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
_SEH2_FINALLY
Definition: create.c:4395
#define RfsdBugCheck(A, B, C, D)
Definition: rfsd.h:232
unsigned int * PULONG
Definition: retypes.h:1
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:881
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define OUT
Definition: typedefs.h:39
VOID NTAPI IoFreeIrp(IN PIRP Irp)
Definition: irp.c:1666
unsigned int ULONG
Definition: retypes.h:1
#define MmGetSystemAddressForMdl(Mdl)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
_In_ FLT_SET_CONTEXT_OPERATION Operation
Definition: fltkernel.h:1468
#define DbgBreak()
Definition: ext2fs.h:46
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define IOCTL_DISK_MEDIA_REMOVAL
Definition: cdrw_usr.h:176
#define _SEH2_LEAVE
Definition: filesup.c:20
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
KEVENT Event
Definition: blockio.c:23
return STATUS_SUCCESS
Definition: btrfs.c:2725
IoMarkIrpPending(Irp)
FORCEINLINE VOID IoSetNextIrpStackLocation(_Inout_ PIRP Irp)
Definition: iofuncs.h:2632
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
BOOLEAN Wait
Definition: blockio.c:24