1 /* $Id: close.c,v 1.9 2001/11/02 22:44:34 hbirr Exp $
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: services/fs/vfat/close.c
6 * PURPOSE: VFAT Filesystem
7 * PROGRAMMER: Jason Filby (jasonfilby@yahoo.com)
10 /* INCLUDES *****************************************************************/
12 #include <ddk/ntddk.h>
19 /* FUNCTIONS ****************************************************************/
22 VfatCloseFile (PDEVICE_EXTENSION DeviceExt
, PFILE_OBJECT FileObject
)
24 * FUNCTION: Closes a file
29 NTSTATUS Status
= STATUS_SUCCESS
;
31 DPRINT ("VfatCloseFile(DeviceExt %x, FileObject %x)\n",
32 DeviceExt
, FileObject
);
34 /* FIXME : update entry in directory? */
35 pCcb
= (PVFATCCB
) (FileObject
->FsContext2
);
37 DPRINT ("pCcb %x\n", pCcb
);
40 return STATUS_SUCCESS
;
42 if (FileObject
->FileName
.Buffer
)
44 // This a FO, that was created outside from FSD.
45 // Some FO's are created with IoCreateStreamFileObject() insid from FSD.
46 // This FO's haven't a FileName.
48 if (FileObject
->DeletePending
)
50 if (pFcb
->Flags
& FCB_DELETE_PENDING
)
52 delEntry (DeviceExt
, FileObject
);
55 Status
= STATUS_DELETE_PENDING
;
57 FileObject
->FsContext2
= NULL
;
58 vfatReleaseFCB (DeviceExt
, pFcb
);
61 FileObject
->FsContext2
= NULL
;
68 NTSTATUS
VfatClose (PVFAT_IRP_CONTEXT IrpContext
)
70 * FUNCTION: Closes a file
75 DPRINT ("VfatClose(DeviceObject %x, Irp %x)\n", DeviceObject
, Irp
);
77 if (!ExAcquireResourceExclusiveLite (&IrpContext
->DeviceExt
->DirResource
, IrpContext
->Flags
& IRPCONTEXT_CANWAIT
))
79 return VfatQueueRequest (IrpContext
);
82 Status
= VfatCloseFile (IrpContext
->DeviceExt
, IrpContext
->FileObject
);
83 ExReleaseResourceLite (&IrpContext
->DeviceExt
->DirResource
);
85 IrpContext
->Irp
->IoStatus
.Status
= Status
;
86 IrpContext
->Irp
->IoStatus
.Information
= 0;
87 IoCompleteRequest (IrpContext
->Irp
, IO_NO_INCREMENT
);
88 VfatFreeIrpContext(IrpContext
);