1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Kernel
4 * FILE: ntoskrnl/cache/mdlsup.c
5 * PURPOSE: Logging and configuration routines
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7 */
8
9 /* INCLUDES *******************************************************************/
10
11 #include <ntoskrnl.h>
12 #include "newcc.h"
13 #define NDEBUG
14 #include <debug.h>
15
16 /* GLOBALS ********************************************************************/
17
18 /* FUNCTIONS ******************************************************************/
19
20 PMDL
21 NTAPI
CcpBuildCacheMdl(PFILE_OBJECT FileObject,PLARGE_INTEGER FileOffset,ULONG Length,PIO_STATUS_BLOCK IOSB)22 CcpBuildCacheMdl(PFILE_OBJECT FileObject,
23 PLARGE_INTEGER FileOffset,
24 ULONG Length,
25 PIO_STATUS_BLOCK IOSB)
26 {
27 PMDL Mdl;
28 PVOID Bcb, Buffer;
29
30 BOOLEAN Result = CcMapData(FileObject,
31 FileOffset,
32 Length,
33 PIN_WAIT,
34 &Bcb,
35 &Buffer);
36
37 if (!Result)
38 {
39 IOSB->Information = 0;
40 IOSB->Status = STATUS_UNSUCCESSFUL;
41 return NULL;
42 }
43
44 IOSB->Information = Length;
45 IOSB->Status = STATUS_SUCCESS;
46
47 Mdl = IoAllocateMdl(Buffer, Length, FALSE, FALSE, NULL);
48
49 if (!Mdl)
50 {
51 IOSB->Information = 0;
52 IOSB->Status = STATUS_NO_MEMORY;
53 return NULL;
54 }
55
56 IOSB->Information = Length;
57 IOSB->Status = STATUS_SUCCESS;
58
59 return Mdl;
60 }
61
62 VOID
63 NTAPI
CcMdlRead(IN PFILE_OBJECT FileObject,IN PLARGE_INTEGER FileOffset,IN ULONG Length,OUT PMDL * MdlChain,OUT PIO_STATUS_BLOCK IoStatus)64 CcMdlRead(IN PFILE_OBJECT FileObject,
65 IN PLARGE_INTEGER FileOffset,
66 IN ULONG Length,
67 OUT PMDL *MdlChain,
68 OUT PIO_STATUS_BLOCK IoStatus)
69 {
70 *MdlChain = CcpBuildCacheMdl(FileObject, FileOffset, Length, IoStatus);
71 }
72
73 VOID
74 NTAPI
CcMdlReadComplete(IN PFILE_OBJECT FileObject,IN PMDL MdlChain)75 CcMdlReadComplete(IN PFILE_OBJECT FileObject,
76 IN PMDL MdlChain)
77 {
78 IoFreeMdl(MdlChain);
79 }
80
81 VOID
82 NTAPI
CcMdlReadComplete2(IN PFILE_OBJECT FileObject,IN PMDL MdlChain)83 CcMdlReadComplete2(IN PFILE_OBJECT FileObject,
84 IN PMDL MdlChain)
85 {
86 UNIMPLEMENTED
87 }
88
89 VOID
90 NTAPI
CcPrepareMdlWrite(IN PFILE_OBJECT FileObject,IN PLARGE_INTEGER FileOffset,IN ULONG Length,OUT PMDL * MdlChain,OUT PIO_STATUS_BLOCK IoStatus)91 CcPrepareMdlWrite(IN PFILE_OBJECT FileObject,
92 IN PLARGE_INTEGER FileOffset,
93 IN ULONG Length,
94 OUT PMDL *MdlChain,
95 OUT PIO_STATUS_BLOCK IoStatus)
96 {
97 *MdlChain = CcpBuildCacheMdl(FileObject, FileOffset, Length, IoStatus);
98 }
99
100 VOID
101 NTAPI
CcMdlWriteComplete(IN PFILE_OBJECT FileObject,IN PLARGE_INTEGER FileOffset,IN PMDL MdlChain)102 CcMdlWriteComplete(IN PFILE_OBJECT FileObject,
103 IN PLARGE_INTEGER FileOffset,
104 IN PMDL MdlChain)
105 {
106 IoFreeMdl(MdlChain);
107 }
108
109 VOID
110 NTAPI
CcMdlWriteComplete2(IN PFILE_OBJECT FileObject,IN PLARGE_INTEGER FileOffset,IN PMDL MdlChain)111 CcMdlWriteComplete2(IN PFILE_OBJECT FileObject,
112 IN PLARGE_INTEGER FileOffset,
113 IN PMDL MdlChain)
114 {
115 UNIMPLEMENTED
116 }
117
118 VOID
119 NTAPI
CcMdlWriteAbort(IN PFILE_OBJECT FileObject,IN PMDL MdlChain)120 CcMdlWriteAbort(IN PFILE_OBJECT FileObject,
121 IN PMDL MdlChain)
122 {
123 ASSERT(FALSE);
124 IoFreeMdl(MdlChain);
125 }
126
127 /* EOF */
128