ReactOS  0.4.15-dev-1632-g4e289ce
cleanup.c File Reference
#include "ntfs.h"
#include <debug.h>
Include dependency graph for cleanup.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS NtfsCleanupFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject, BOOLEAN CanWait)
 
NTSTATUS NtfsCleanup (PNTFS_IRP_CONTEXT IrpContext)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 31 of file cleanup.c.

Function Documentation

◆ NtfsCleanup()

NTSTATUS NtfsCleanup ( PNTFS_IRP_CONTEXT  IrpContext)

Definition at line 89 of file cleanup.c.

90 {
91  PDEVICE_EXTENSION DeviceExtension;
95 
96  DPRINT("NtfsCleanup() called\n");
97 
98  DeviceObject = IrpContext->DeviceObject;
100  {
101  DPRINT("Cleaning up file system\n");
102  IrpContext->Irp->IoStatus.Information = 0;
103  return STATUS_SUCCESS;
104  }
105 
106  FileObject = IrpContext->FileObject;
107  DeviceExtension = DeviceObject->DeviceExtension;
108 
109  if (!ExAcquireResourceExclusiveLite(&DeviceExtension->DirResource,
110  BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT)))
111  {
112  return NtfsMarkIrpContextForQueue(IrpContext);
113  }
114 
115  Status = NtfsCleanupFile(DeviceExtension, FileObject, BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT));
116 
117  ExReleaseResourceLite(&DeviceExtension->DirResource);
118 
119  if (Status == STATUS_PENDING)
120  {
121  return NtfsMarkIrpContextForQueue(IrpContext);
122  }
123 
124  IrpContext->Irp->IoStatus.Information = 0;
125  return Status;
126 }
PDEVICE_OBJECT DeviceObject
Definition: ntfs.h:484
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
FORCEINLINE NTSTATUS NtfsMarkIrpContextForQueue(PNTFS_IRP_CONTEXT IrpContext)
Definition: ntfs.h:565
LONG NTSTATUS
Definition: precomp.h:26
IO_STATUS_BLOCK IoStatus
PNTFS_GLOBAL_DATA NtfsGlobalData
Definition: ntfs.c:41
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define IRPCONTEXT_CANWAIT
Definition: vfat.h:575
void DPRINT(...)
Definition: polytest.cpp:61
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
Status
Definition: gdiplustypes.h:24
#define STATUS_PENDING
Definition: ntstatus.h:82
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
* PFILE_OBJECT
Definition: iotypes.h:1995
ULONG Flags
Definition: ntfs.h:477
PDEVICE_OBJECT DeviceObject
Definition: ntfs.h:148
NTSTATUS NtfsCleanupFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject, BOOLEAN CanWait)
Definition: cleanup.c:40
#define STATUS_SUCCESS
Definition: shellext.h:65
PFILE_OBJECT FileObject
Definition: ntfs.h:485

Referenced by NtfsDispatch().

◆ NtfsCleanupFile()

NTSTATUS NtfsCleanupFile ( PDEVICE_EXTENSION  DeviceExt,
PFILE_OBJECT  FileObject,
BOOLEAN  CanWait 
)

Definition at line 40 of file cleanup.c.

43 {
44  PNTFS_FCB Fcb;
45 
46  DPRINT("NtfsCleanupFile(DeviceExt %p, FileObject %p, CanWait %u)\n",
47  DeviceExt,
48  FileObject,
49  CanWait);
50 
51  Fcb = (PNTFS_FCB)(FileObject->FsContext);
52  if (!Fcb)
53  return STATUS_SUCCESS;
54 
55  if (Fcb->Flags & FCB_IS_VOLUME)
56  {
58 
59  if (Fcb->OpenHandleCount != 0)
60  {
61  // Remove share access when handled
62  }
63  }
64  else
65  {
67  {
68  return STATUS_PENDING;
69  }
70 
72 
74 
75  if (Fcb->OpenHandleCount != 0)
76  {
77  // Remove share access when handled
78  }
79 
81 
83  }
84 
85  return STATUS_SUCCESS;
86 }
Definition: cdstruc.h:902
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
void DPRINT(...)
Definition: polytest.cpp:61
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
FSRTL_COMMON_FCB_HEADER RFCB
Definition: ntfs.h:513
ULONG OpenHandleCount
Definition: ntfs.h:533
#define STATUS_PENDING
Definition: ntstatus.h:82
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
ULONG Flags
Definition: ntfs.h:532
struct _FCB * PNTFS_FCB
ERESOURCE MainResource
Definition: ntfs.h:524
#define FCB_IS_VOLUME
Definition: vfat.h:437
BOOLEAN NTAPI CcUninitializeCacheMap(IN PFILE_OBJECT FileObject, IN OPTIONAL PLARGE_INTEGER TruncateSize, IN OPTIONAL PCACHE_UNINITIALIZE_EVENT UninitializeEvent)
Definition: fssup.c:286
#define FO_CLEANUP_COMPLETE
Definition: iotypes.h:1787
#define NULL
Definition: types.h:112
#define STATUS_SUCCESS
Definition: shellext.h:65
_In_ PFCB Fcb
Definition: cdprocs.h:159

Referenced by NtfsCleanup().