Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenlock.c
Go to the documentation of this file.
00001 /* 00002 * PROJECT: ReactOS FAT file system driver 00003 * LICENSE: GNU GPLv3 as published by the Free Software Foundation 00004 * FILE: drivers/filesystems/fastfat/lock.c 00005 * PURPOSE: Lock support routines 00006 * PROGRAMMERS: Aleksey Bragin (aleksey@reactos.org) 00007 */ 00008 00009 /* INCLUDES *****************************************************************/ 00010 00011 #define NDEBUG 00012 #include "fastfat.h" 00013 00014 /* FUNCTIONS ****************************************************************/ 00015 00016 NTSTATUS 00017 NTAPI 00018 FatiLockControl(PFAT_IRP_CONTEXT IrpContext, PIRP Irp) 00019 { 00020 PIO_STACK_LOCATION IrpSp; 00021 TYPE_OF_OPEN TypeOfOpen; 00022 PVCB Vcb; 00023 PFCB Fcb; 00024 PCCB Ccb; 00025 NTSTATUS Status; 00026 00027 /* Get IRP stack location */ 00028 IrpSp = IoGetCurrentIrpStackLocation(Irp); 00029 00030 /* Determine type of open */ 00031 TypeOfOpen = FatDecodeFileObject(IrpSp->FileObject, &Vcb, &Fcb, &Ccb); 00032 00033 /* Only user file open is allowed */ 00034 if (TypeOfOpen != UserFileOpen) 00035 { 00036 FatCompleteRequest(IrpContext, Irp, STATUS_INVALID_PARAMETER); 00037 return STATUS_INVALID_PARAMETER; 00038 } 00039 00040 /* Acquire shared FCB lock */ 00041 if (!FatAcquireSharedFcb(IrpContext, Fcb)) 00042 { 00043 UNIMPLEMENTED; 00044 //Status = FatFsdPostRequest(IrpContext, Irp); 00045 Status = STATUS_NOT_IMPLEMENTED; 00046 return Status; 00047 } 00048 00049 /* Check oplock state */ 00050 Status = FsRtlCheckOplock(&Fcb->Fcb.Oplock, 00051 Irp, 00052 IrpContext, 00053 FatOplockComplete, 00054 NULL); 00055 00056 if (Status != STATUS_SUCCESS) 00057 { 00058 /* Release FCB lock */ 00059 FatReleaseFcb(IrpContext, Fcb); 00060 00061 return Status; 00062 } 00063 00064 /* Process the lock */ 00065 Status = FsRtlProcessFileLock(&Fcb->Fcb.Lock, Irp, NULL); 00066 00067 /* Update Fast I/O state */ 00068 Fcb->Header.IsFastIoPossible = FatIsFastIoPossible(Fcb); 00069 00070 /* Complete the request */ 00071 FatCompleteRequest(IrpContext, NULL, 0); 00072 00073 /* Release FCB lock */ 00074 FatReleaseFcb(IrpContext, Fcb); 00075 00076 return Status; 00077 } 00078 00079 NTSTATUS 00080 NTAPI 00081 FatLockControl(PDEVICE_OBJECT DeviceObject, PIRP Irp) 00082 { 00083 PFAT_IRP_CONTEXT IrpContext; 00084 NTSTATUS Status; 00085 BOOLEAN TopLevel; 00086 00087 DPRINT1("FatLockControl()\n"); 00088 00089 /* Enter FsRtl critical region */ 00090 FsRtlEnterFileSystem(); 00091 00092 /* Set Top Level IRP if not set */ 00093 TopLevel = FatIsTopLevelIrp(Irp); 00094 00095 /* Build an irp context */ 00096 IrpContext = FatBuildIrpContext(Irp, IoIsOperationSynchronous(Irp)); 00097 00098 /* Call internal function */ 00099 Status = FatiLockControl(IrpContext, Irp); 00100 00101 /* Reset Top Level IRP */ 00102 if (TopLevel) IoSetTopLevelIrp(NULL); 00103 00104 /* Leave FsRtl critical region */ 00105 FsRtlExitFileSystem(); 00106 00107 return Status; 00108 } 00109 00110 VOID 00111 NTAPI 00112 FatOplockComplete(IN PVOID Context, 00113 IN PIRP Irp) 00114 { 00115 UNIMPLEMENTED; 00116 } 00117 00118 VOID 00119 NTAPI 00120 FatPrePostIrp(IN PVOID Context, 00121 IN PIRP Irp) 00122 { 00123 UNIMPLEMENTED; 00124 } 00125 00126 /* EOF */ Generated on Sat May 26 2012 04:22:58 for ReactOS by
1.7.6.1
|