ReactOS 0.4.15-dev-8222-g9164419
flushbuf.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Named Pipe FileSystem
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: drivers/filesystems/npfs/flushbuf.c
5 * PURPOSE: Buffers Flushing Support
6 * PROGRAMMERS: ReactOS Portable Systems Group
7 */
8
9/* INCLUDES *******************************************************************/
10
11#include "npfs.h"
12
13// File ID number for NPFS bugchecking support
14#define NPFS_BUGCHECK_FILE_ID (NPFS_BUGCHECK_FLUSHBUF)
15
16/* FUNCTIONS ******************************************************************/
17
21 IN PIRP Irp)
22{
23 NODE_TYPE_CODE NodeTypeCode;
25 ULONG NamedPipeEnd;
27 PNP_DATA_QUEUE FlushQueue;
28 PAGED_CODE();
29
31 NULL,
32 &Ccb,
33 &NamedPipeEnd);
34 if (NodeTypeCode != NPFS_NTC_CCB) return STATUS_PIPE_DISCONNECTED;
35
36 ExAcquireResourceExclusiveLite(&Ccb->NonPagedCcb->Lock, TRUE);
37
38 if (NamedPipeEnd == FILE_PIPE_SERVER_END)
39 {
40 FlushQueue = &Ccb->DataQueue[FILE_PIPE_OUTBOUND];
41 }
42 else
43 {
44 FlushQueue = &Ccb->DataQueue[FILE_PIPE_INBOUND];
45 }
46
47 if (FlushQueue->QueueState == WriteEntries)
48 {
49 Status = NpAddDataQueueEntry(NamedPipeEnd,
50 Ccb,
51 FlushQueue,
53 2,
54 0,
55 Irp,
56 NULL,
57 0);
58 }
59 else
60 {
62 }
63
64 ExReleaseResourceLite(&Ccb->NonPagedCcb->Lock);
65 return Status;
66}
67
71 IN PIRP Irp)
72{
74 PAGED_CODE();
75
78
80
83
85 {
86 Irp->IoStatus.Status = Status;
88 }
89
90 return Status;
91}
92
93/* EOF */
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define PAGED_CODE()
LONG NTSTATUS
Definition: precomp.h:26
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:592
_In_ PIRP Irp
Definition: csq.h:116
NTSTATUS NTAPI NpAddDataQueueEntry(IN ULONG NamedPipeEnd, IN PNP_CCB Ccb, IN PNP_DATA_QUEUE DataQueue, IN ULONG Who, IN ULONG Type, IN ULONG DataSize, IN PIRP Irp, IN PVOID Buffer, IN ULONG ByteOffset)
Definition: datasup.c:295
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
USHORT NODE_TYPE_CODE
Definition: nodetype.h:22
FORCEINLINE VOID NpReleaseVcb(VOID)
Definition: npfs.h:344
FORCEINLINE VOID NpAcquireSharedVcb(VOID)
Definition: npfs.h:328
@ WriteEntries
Definition: npfs.h:124
#define NPFS_NTC_CCB
Definition: npfs.h:115
#define ExAcquireResourceExclusiveLite(res, wait)
Definition: env_spec_w32.h:615
NODE_TYPE_CODE NTAPI NpDecodeFileObject(IN PFILE_OBJECT FileObject, OUT PVOID *PrimaryContext OPTIONAL, OUT PNP_CCB *Ccb, OUT PULONG NamedPipeEnd OPTIONAL)
Definition: fileobsup.c:20
NTSTATUS NTAPI NpCommonFlushBuffers(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: flushbuf.c:20
NTSTATUS NTAPI NpFsdFlushBuffers(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: flushbuf.c:70
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
Status
Definition: gdiplustypes.h:25
#define FILE_PIPE_OUTBOUND
Definition: iotypes.h:82
#define FILE_PIPE_INBOUND
Definition: iotypes.h:81
#define FILE_PIPE_SERVER_END
Definition: iotypes.h:85
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1822
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_PIPE_DISCONNECTED
Definition: ntstatus.h:412
#define STATUS_PENDING
Definition: ntstatus.h:82
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: npfs.h:259
ULONG QueueState
Definition: npfs.h:139
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
#define IO_NAMED_PIPE_INCREMENT
Definition: iotypes.h:604