1 /* $Id: close.c,v 1.8 2001/08/14 20:47:30 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
;
69 VfatClose (PDEVICE_OBJECT DeviceObject
, PIRP Irp
)
71 * FUNCTION: Closes a file
74 PIO_STACK_LOCATION Stack
= IoGetCurrentIrpStackLocation (Irp
);
75 PFILE_OBJECT FileObject
= Stack
->FileObject
;
76 PDEVICE_EXTENSION DeviceExtension
= DeviceObject
->DeviceExtension
;
79 DPRINT ("VfatClose(DeviceObject %x, Irp %x)\n", DeviceObject
, Irp
);
81 ExAcquireResourceExclusiveLite (&DeviceExtension
->DirResource
, TRUE
);
82 Status
= VfatCloseFile (DeviceExtension
, FileObject
);
83 ExReleaseResourceLite (&DeviceExtension
->DirResource
);
85 Irp
->IoStatus
.Status
= Status
;
86 Irp
->IoStatus
.Information
= 0;
88 IoCompleteRequest (Irp
, IO_NO_INCREMENT
);