2 * PROJECT: ReactOS FAT file system driver
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: drivers/filesystems/fastfat/rw.c
5 * PURPOSE: Read/write support
6 * PROGRAMMERS: Aleksey Bragin (aleksey@reactos.org)
10 /* INCLUDES *****************************************************************/
15 /* FUNCTIONS *****************************************************************/
19 FatiRead(PFAT_IRP_CONTEXT IrpContext
)
22 LARGE_INTEGER ByteOffset
;
23 PFILE_OBJECT FileObject
;
24 TYPE_OF_OPEN OpenType
;
25 PIO_STACK_LOCATION IrpSp
= IrpContext
->Stack
;
30 FileObject
= IrpSp
->FileObject
;
31 NumberOfBytes
= IrpSp
->Parameters
.Read
.Length
;
32 ByteOffset
= IrpSp
->Parameters
.Read
.ByteOffset
;
33 if (NumberOfBytes
== 0)
35 FatCompleteRequest(IrpContext
, IrpContext
->Irp
, STATUS_SUCCESS
);
36 return STATUS_SUCCESS
;
39 OpenType
= FatDecodeFileObject(FileObject
, &Vcb
, &Fcb
, &Ccb
);
41 DPRINT1("FatiRead() Fcb %p, Name %wZ, Offset %d, Length %d, Handle %p\n",
42 Fcb
, &FileObject
->FileName
, ByteOffset
.LowPart
, NumberOfBytes
, Fcb
->FatHandle
);
43 return STATUS_NOT_IMPLEMENTED
;
48 FatRead(PDEVICE_OBJECT DeviceObject
, PIRP Irp
)
51 BOOLEAN TopLevel
, CanWait
;
52 PFAT_IRP_CONTEXT IrpContext
;
56 Status
= STATUS_INVALID_DEVICE_REQUEST
;
57 /* Get CanWait flag */
58 if (IoGetCurrentIrpStackLocation(Irp
)->FileObject
!= NULL
)
59 CanWait
= IoIsOperationSynchronous(Irp
);
61 /* Enter FsRtl critical region */
62 FsRtlEnterFileSystem();
64 if (DeviceObject
!= FatGlobalData
.DiskDeviceObject
)
66 /* Set Top Level IRP if not set */
67 if (IoGetTopLevelIrp() == NULL
)
69 IoSetTopLevelIrp(Irp
);
73 /* Build an irp context */
74 IrpContext
= FatBuildIrpContext(Irp
, CanWait
);
76 /* Perform the actual read */
77 Status
= FatiRead(IrpContext
);
79 /* Restore top level Irp */
81 IoSetTopLevelIrp(NULL
);
83 /* Leave FsRtl critical region */
84 FsRtlExitFileSystem();
86 DPRINT1("FatRead()\n");
92 FatWrite(PDEVICE_OBJECT DeviceObject
, PIRP Irp
)
94 DPRINT1("FatWrite()\n");
95 return STATUS_NOT_IMPLEMENTED
;