ReactOS 0.4.15-dev-7677-g8209aa5
copysup.c File Reference
#include <ntoskrnl.h>
#include "newcc.h"
#include "section/newmm.h"
#include <debug.h>
Include dependency graph for copysup.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define TAG_COPY_READ   TAG('C', 'o', 'p', 'y')
 
#define TAG_COPY_WRITE   TAG('R', 'i', 't', 'e')
 

Functions

BOOLEAN NTAPI CcCopyRead (IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus)
 
VOID NTAPI CcFastCopyRead (IN PFILE_OBJECT FileObject, IN ULONG FileOffset, IN ULONG Length, IN ULONG PageCount, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus)
 
BOOLEAN NTAPI CcCopyWrite (IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN PVOID Buffer)
 
VOID NTAPI CcFastCopyWrite (IN PFILE_OBJECT FileObject, IN ULONG FileOffset, IN ULONG Length, IN PVOID Buffer)
 
BOOLEAN NTAPI CcCanIWrite (IN PFILE_OBJECT FileObject, IN ULONG BytesToWrite, IN BOOLEAN Wait, IN UCHAR Retrying)
 
VOID NTAPI CcDeferWrite (IN PFILE_OBJECT FileObject, IN PCC_POST_DEFERRED_WRITE PostRoutine, IN PVOID Context1, IN PVOID Context2, IN ULONG BytesToWrite, IN BOOLEAN Retrying)
 

Variables

ULONG CcFastMdlReadWait
 
ULONG CcFastMdlReadNotPossible
 
ULONG CcFastReadNotPossible
 
ULONG CcFastReadWait
 
ULONG CcFastReadNoWait
 
ULONG CcFastReadResourceMiss
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 14 of file copysup.c.

◆ TAG_COPY_READ

#define TAG_COPY_READ   TAG('C', 'o', 'p', 'y')

Definition at line 26 of file copysup.c.

◆ TAG_COPY_WRITE

#define TAG_COPY_WRITE   TAG('R', 'i', 't', 'e')

Definition at line 27 of file copysup.c.

Function Documentation

◆ CcCanIWrite()

BOOLEAN NTAPI CcCanIWrite ( IN PFILE_OBJECT  FileObject,
IN ULONG  BytesToWrite,
IN BOOLEAN  Wait,
IN UCHAR  Retrying 
)

Definition at line 214 of file copysup.c.

218{
220 return FALSE;
221}
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57

Referenced by __attribute__(), _Requires_lock_held_(), Ext2WriteFile(), Ext2WriteVolume(), FsRtlCopyWrite(), FsRtlCopyWrite2(), FsRtlPrepareMdlWriteDev(), RxCommonWrite(), UDFCommonWrite(), and VfatWrite().

◆ CcCopyRead()

BOOLEAN NTAPI CcCopyRead ( IN PFILE_OBJECT  FileObject,
IN PLARGE_INTEGER  FileOffset,
IN ULONG  Length,
IN BOOLEAN  Wait,
OUT PVOID  Buffer,
OUT PIO_STATUS_BLOCK  IoStatus 
)

Definition at line 43 of file copysup.c.

49{
51 ULONG ReadLen;
52 PVOID Bcb;
53 PCHAR BufferTarget = (PCHAR)Buffer;
54 LARGE_INTEGER CacheOffset, EndOfExtent, NextOffset;
55
56 DPRINT("CcCopyRead(%x,%x,%d,%d,%x)\n",
58 FileOffset->LowPart,
59 Length,
60 Wait,
61 Buffer);
62
63 CacheOffset.QuadPart = FileOffset->QuadPart;
64 EndOfExtent.QuadPart = FileOffset->QuadPart + Length;
65
66 while (CacheOffset.QuadPart < EndOfExtent.QuadPart)
67 {
68 NextOffset.QuadPart = CacheOffset.QuadPart;
69 NextOffset.LowPart = (NextOffset.LowPart + CACHE_STRIPE) & ~(CACHE_STRIPE-1);
70 ReadLen = EndOfExtent.QuadPart - CacheOffset.QuadPart;
71 if (CacheOffset.QuadPart + ReadLen > NextOffset.QuadPart)
72 {
73 ReadLen = NextOffset.QuadPart - CacheOffset.QuadPart;
74 }
75
76 DPRINT("Reading %d bytes in this go (at %08x%08x)\n",
77 ReadLen,
78 CacheOffset.HighPart,
79 CacheOffset.LowPart);
80
82 &CacheOffset,
83 ReadLen,
85 &Bcb,
86 (PVOID*)&ReadBuffer))
87 {
89 IoStatus->Information = 0;
90 DPRINT("Failed CcCopyRead\n");
91 return FALSE;
92 }
93
94 DPRINT("Copying %d bytes at %08x%08x\n",
95 ReadLen,
96 CacheOffset.HighPart,
97 CacheOffset.LowPart);
98
99 RtlCopyMemory(BufferTarget, ReadBuffer, ReadLen);
100
101 BufferTarget += ReadLen;
102
103 CacheOffset = NextOffset;
105 }
106
107 IoStatus->Status = STATUS_SUCCESS;
108 IoStatus->Information = Length;
109
110 DPRINT("Done with CcCopyRead\n");
111
112 return TRUE;
113}
#define ReadBuffer(BaseIoAddress, Buffer, Count)
Definition: atapi.h:339
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:160
Definition: bufpool.h:45
#define TRUE
Definition: types.h:120
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:414
#define PCHAR
Definition: match.c:90
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:159
#define CACHE_STRIPE
Definition: newcc.h:123
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define PIN_IF_BCB
#define PIN_WAIT
VOID NTAPI CcUnpinData(IN PVOID Bcb)
Definition: pinsup.c:955
BOOLEAN NTAPI CcPinRead(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, OUT PVOID *Bcb, OUT PVOID *Buffer)
Definition: pinsup.c:802
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
LONGLONG QuadPart
Definition: typedefs.h:114
ULONG LowPart
Definition: typedefs.h:106
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:170

Referenced by _Requires_lock_held_(), do_read(), Ext2LoadInodeXattr(), Ext2ReadFile(), Ext2ReadInode(), Ext2ReadVolume(), Ext2RefreshSuper(), FsRtlCopyRead(), FsRtlCopyRead2(), PerformTest(), RxCommonRead(), Test_CcCopyRead(), TestIrpHandler(), UDFCommonRead(), and VfatCommonRead().

◆ CcCopyWrite()

BOOLEAN NTAPI CcCopyWrite ( IN PFILE_OBJECT  FileObject,
IN PLARGE_INTEGER  FileOffset,
IN ULONG  Length,
IN BOOLEAN  Wait,
IN PVOID  Buffer 
)

Definition at line 129 of file copysup.c.

134{
135 INT Count = 0;
138 PVOID WriteBuf;
139 ULONG WriteLen;
140 LARGE_INTEGER CurrentOffset = *FileOffset;
141 LARGE_INTEGER EndOffset;
142 LARGE_INTEGER NextOffset;
143
144 EndOffset.QuadPart = CurrentOffset.QuadPart + Length;
145
146 DPRINT("CcCopyWrite(%x,%x,%d,%d,%x)\n",
148 FileOffset->LowPart,
149 Length,
150 Wait,
151 Buffer);
152
153 while (CurrentOffset.QuadPart < EndOffset.QuadPart)
154 {
155 NextOffset.HighPart = CurrentOffset.HighPart;
156 NextOffset.LowPart = (CurrentOffset.LowPart + CACHE_STRIPE) & ~(CACHE_STRIPE - 1);
157 DPRINT("NextOffset %08x%08x\n", NextOffset.u.HighPart, NextOffset.u.LowPart);
158 WriteLen = MIN(NextOffset.QuadPart - CurrentOffset.QuadPart, Length);
159
160 DPRINT("Copying %x bytes from %08x%08x\n",
161 WriteLen,
162 CurrentOffset.u.HighPart,
163 CurrentOffset.u.LowPart);
164
165 DPRINT("CcPreparePinWrite\n");
166
168 &CurrentOffset,
169 WriteLen,
170 FALSE,
172 (PVOID *)&Bcb, &WriteBuf);
173
174 DPRINT("Result %s %x %x\n", Result ? "TRUE" : "FALSE", Bcb, WriteBuf);
175 if (!Result)
176 {
177 DPRINT1("CcPreparePinWrite Failed?\n");
178 if (Wait)
180 else
181 return FALSE;
182 }
183
184 DPRINT("Copying actual memory to BCB#%x (@%x) (from buffer at %x)\n",
186 WriteBuf,
187 Bcb->BaseAddress);
188
189 RtlCopyMemory(WriteBuf, ((PCHAR)Buffer) + Count, WriteLen);
190 Count += WriteLen;
191 Length -= WriteLen;
192 CurrentOffset = NextOffset;
193 Bcb->Dirty = TRUE;
195 }
196
197 DPRINT("Done with CcCopyWrite\n");
198
199 return TRUE;
200}
unsigned char BOOLEAN
#define MIN(x, y)
Definition: rdesktop.h:171
#define DPRINT1
Definition: precomp.h:8
DECLSPEC_NORETURN NTSYSAPI VOID NTAPI RtlRaiseStatus(_In_ NTSTATUS Status)
NOCC_BCB CcCacheSections[CACHE_NUM_SECTIONS]
Definition: pinsup.c:98
int Count
Definition: noreturn.cpp:7
BOOLEAN NTAPI CcPreparePinWrite(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Zero, IN ULONG Flags, OUT PVOID *Bcb, OUT PVOID *Buffer)
Definition: pinsup.c:827
Definition: newcc.h:4
int32_t INT
Definition: typedefs.h:58
#define STATUS_NOT_MAPPED_DATA
Definition: udferr_usr.h:157
struct _LARGE_INTEGER::@2291 u
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by __attribute__(), _Requires_lock_held_(), Ext2WriteFile(), Ext2WriteVolume(), FatMarkEaRangeDirty(), FsRtlCopyWrite(), FsRtlCopyWrite2(), RxCommonWrite(), Test_CcCopyWrite(), TestIrpHandler(), UDFCommonWrite(), UDFPurgeCacheEx_(), and VfatWrite().

◆ CcDeferWrite()

VOID NTAPI CcDeferWrite ( IN PFILE_OBJECT  FileObject,
IN PCC_POST_DEFERRED_WRITE  PostRoutine,
IN PVOID  Context1,
IN PVOID  Context2,
IN ULONG  BytesToWrite,
IN BOOLEAN  Retrying 
)

◆ CcFastCopyRead()

VOID NTAPI CcFastCopyRead ( IN PFILE_OBJECT  FileObject,
IN ULONG  FileOffset,
IN ULONG  Length,
IN ULONG  PageCount,
OUT PVOID  Buffer,
OUT PIO_STATUS_BLOCK  IoStatus 
)

Definition at line 117 of file copysup.c.

123{
125}

Referenced by FsRtlCopyRead(), and FsRtlCopyRead2().

◆ CcFastCopyWrite()

VOID NTAPI CcFastCopyWrite ( IN PFILE_OBJECT  FileObject,
IN ULONG  FileOffset,
IN ULONG  Length,
IN PVOID  Buffer 
)

Definition at line 204 of file copysup.c.

208{
210}

Referenced by FsRtlCopyWrite(), and FsRtlCopyWrite2().

Variable Documentation

◆ CcFastMdlReadNotPossible

ULONG CcFastMdlReadNotPossible

Definition at line 20 of file copysup.c.

Referenced by FsRtlMdlReadDev().

◆ CcFastMdlReadWait

ULONG CcFastMdlReadWait

Definition at line 19 of file copysup.c.

Referenced by FsRtlMdlReadDev().

◆ CcFastReadNotPossible

ULONG CcFastReadNotPossible

Definition at line 21 of file copysup.c.

Referenced by FsRtlCopyRead(), and FsRtlIncrementCcFastReadNotPossible().

◆ CcFastReadNoWait

ULONG CcFastReadNoWait

Definition at line 23 of file copysup.c.

Referenced by FsRtlIncrementCcFastReadNoWait().

◆ CcFastReadResourceMiss

ULONG CcFastReadResourceMiss

Definition at line 24 of file copysup.c.

Referenced by FsRtlIncrementCcFastReadResourceMiss().

◆ CcFastReadWait

ULONG CcFastReadWait

Definition at line 22 of file copysup.c.

Referenced by FsRtlCopyRead(), and FsRtlIncrementCcFastReadWait().