1 | /** @file
|
---|
2 | * PDM - Pluggable Device Manager, Block cache.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2007-2022 Oracle and/or its affiliates.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox base platform packages, as
|
---|
9 | * available from https://www.virtualbox.org.
|
---|
10 | *
|
---|
11 | * This program is free software; you can redistribute it and/or
|
---|
12 | * modify it under the terms of the GNU General Public License
|
---|
13 | * as published by the Free Software Foundation, in version 3 of the
|
---|
14 | * License.
|
---|
15 | *
|
---|
16 | * This program is distributed in the hope that it will be useful, but
|
---|
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | * General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU General Public License
|
---|
22 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
23 | *
|
---|
24 | * The contents of this file may alternatively be used under the terms
|
---|
25 | * of the Common Development and Distribution License Version 1.0
|
---|
26 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
27 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
28 | * CDDL are applicable instead of those of the GPL.
|
---|
29 | *
|
---|
30 | * You may elect to license modified versions of this file under the
|
---|
31 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
32 | *
|
---|
33 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
34 | */
|
---|
35 |
|
---|
36 | #ifndef VBOX_INCLUDED_vmm_pdmblkcache_h
|
---|
37 | #define VBOX_INCLUDED_vmm_pdmblkcache_h
|
---|
38 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
39 | # pragma once
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #include <VBox/types.h>
|
---|
43 | #include <iprt/sg.h>
|
---|
44 |
|
---|
45 |
|
---|
46 | RT_C_DECLS_BEGIN
|
---|
47 |
|
---|
48 | /** @defgroup grp_pdm_blk_cache The PDM Block Cache API
|
---|
49 | * @ingroup grp_pdm
|
---|
50 | * @{
|
---|
51 | */
|
---|
52 |
|
---|
53 | /** Pointer to a PDM block cache. */
|
---|
54 | typedef struct PDMBLKCACHE *PPDMBLKCACHE;
|
---|
55 | /** Pointer to a PDM block cache pointer. */
|
---|
56 | typedef PPDMBLKCACHE *PPPDMBLKCACHE;
|
---|
57 |
|
---|
58 | /** I/O transfer handle. */
|
---|
59 | typedef struct PDMBLKCACHEIOXFER *PPDMBLKCACHEIOXFER;
|
---|
60 |
|
---|
61 | /**
|
---|
62 | * Block cache I/O request transfer direction.
|
---|
63 | */
|
---|
64 | typedef enum PDMBLKCACHEXFERDIR
|
---|
65 | {
|
---|
66 | /** Read */
|
---|
67 | PDMBLKCACHEXFERDIR_READ = 0,
|
---|
68 | /** Write */
|
---|
69 | PDMBLKCACHEXFERDIR_WRITE,
|
---|
70 | /** Flush */
|
---|
71 | PDMBLKCACHEXFERDIR_FLUSH,
|
---|
72 | /** Discard */
|
---|
73 | PDMBLKCACHEXFERDIR_DISCARD
|
---|
74 | } PDMBLKCACHEXFERDIR;
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * Completion callback for drivers.
|
---|
78 | *
|
---|
79 | * @param pDrvIns The driver instance.
|
---|
80 | * @param pvUser User argument given during request initiation.
|
---|
81 | * @param rc The status code of the completed request.
|
---|
82 | */
|
---|
83 | typedef DECLCALLBACKTYPE(void, FNPDMBLKCACHEXFERCOMPLETEDRV,(PPDMDRVINS pDrvIns, void *pvUser, int rc));
|
---|
84 | /** Pointer to a FNPDMBLKCACHEXFERCOMPLETEDRV(). */
|
---|
85 | typedef FNPDMBLKCACHEXFERCOMPLETEDRV *PFNPDMBLKCACHEXFERCOMPLETEDRV;
|
---|
86 |
|
---|
87 | /**
|
---|
88 | * I/O enqueue callback for drivers.
|
---|
89 | *
|
---|
90 | * @param pDrvIns The driver instance.
|
---|
91 | * @param enmXferDir Transfer direction.
|
---|
92 | * @param off Transfer offset.
|
---|
93 | * @param cbXfer Transfer size.
|
---|
94 | * @param pSgBuf Scather / gather buffer for the transfer.
|
---|
95 | * @param hIoXfer I/O transfer handle to ping on completion.
|
---|
96 | */
|
---|
97 | typedef DECLCALLBACKTYPE(int, FNPDMBLKCACHEXFERENQUEUEDRV,(PPDMDRVINS pDrvIns, PDMBLKCACHEXFERDIR enmXferDir, uint64_t off,
|
---|
98 | size_t cbXfer, PCRTSGBUF pSgBuf, PPDMBLKCACHEIOXFER hIoXfer));
|
---|
99 | /** Pointer to a FNPDMBLKCACHEXFERENQUEUEDRV(). */
|
---|
100 | typedef FNPDMBLKCACHEXFERENQUEUEDRV *PFNPDMBLKCACHEXFERENQUEUEDRV;
|
---|
101 |
|
---|
102 | /**
|
---|
103 | * Discard enqueue callback for drivers.
|
---|
104 | *
|
---|
105 | * @param pDrvIns The driver instance.
|
---|
106 | * @param paRanges Ranges to discard.
|
---|
107 | * @param cRanges Number of range entries.
|
---|
108 | * @param hIoXfer I/O handle to return on completion.
|
---|
109 | */
|
---|
110 | typedef DECLCALLBACKTYPE(int, FNPDMBLKCACHEXFERENQUEUEDISCARDDRV,(PPDMDRVINS pDrvIns, PCRTRANGE paRanges, unsigned cRanges,
|
---|
111 | PPDMBLKCACHEIOXFER hIoXfer));
|
---|
112 | /** Pointer to a FNPDMBLKCACHEXFERENQUEUEDISCARDDRV(). */
|
---|
113 | typedef FNPDMBLKCACHEXFERENQUEUEDISCARDDRV *PFNPDMBLKCACHEXFERENQUEUEDISCARDDRV;
|
---|
114 |
|
---|
115 | /**
|
---|
116 | * Completion callback for devices.
|
---|
117 | *
|
---|
118 | * @param pDevIns The device instance.
|
---|
119 | * @param pvUser User argument given during request initiation.
|
---|
120 | * @param rc The status code of the completed request.
|
---|
121 | */
|
---|
122 | typedef DECLCALLBACKTYPE(void, FNPDMBLKCACHEXFERCOMPLETEDEV,(PPDMDEVINS pDevIns, void *pvUser, int rc));
|
---|
123 | /** Pointer to a FNPDMBLKCACHEXFERCOMPLETEDEV(). */
|
---|
124 | typedef FNPDMBLKCACHEXFERCOMPLETEDEV *PFNPDMBLKCACHEXFERCOMPLETEDEV;
|
---|
125 |
|
---|
126 | /**
|
---|
127 | * I/O enqueue callback for devices.
|
---|
128 | *
|
---|
129 | * @param pDevIns The device instance.
|
---|
130 | * @param enmXferDir Transfer direction.
|
---|
131 | * @param off Transfer offset.
|
---|
132 | * @param cbXfer Transfer size.
|
---|
133 | * @param pSgBuf Scather / gather buffer for the transfer.
|
---|
134 | * @param hIoXfer I/O transfer handle to ping on completion.
|
---|
135 | */
|
---|
136 | typedef DECLCALLBACKTYPE(int, FNPDMBLKCACHEXFERENQUEUEDEV,(PPDMDEVINS pDevIns, PDMBLKCACHEXFERDIR enmXferDir, uint64_t off,
|
---|
137 | size_t cbXfer, PCRTSGBUF pSgBuf, PPDMBLKCACHEIOXFER hIoXfer));
|
---|
138 | /** Pointer to a FNPDMBLKCACHEXFERENQUEUEDEV(). */
|
---|
139 | typedef FNPDMBLKCACHEXFERENQUEUEDEV *PFNPDMBLKCACHEXFERENQUEUEDEV;
|
---|
140 |
|
---|
141 | /**
|
---|
142 | * Discard enqueue callback for devices.
|
---|
143 | *
|
---|
144 | * @param pDevIns The device instance.
|
---|
145 | * @param paRanges Ranges to discard.
|
---|
146 | * @param cRanges Number of range entries.
|
---|
147 | * @param hIoXfer I/O handle to return on completion.
|
---|
148 | */
|
---|
149 | typedef DECLCALLBACKTYPE(int, FNPDMBLKCACHEXFERENQUEUEDISCARDDEV,(PPDMDEVINS pDevIns, PCRTRANGE paRanges, unsigned cRanges,
|
---|
150 | PPDMBLKCACHEIOXFER hIoXfer));
|
---|
151 | /** Pointer to a FNPDMBLKCACHEXFERENQUEUEDISCARDDEV(). */
|
---|
152 | typedef FNPDMBLKCACHEXFERENQUEUEDISCARDDEV *PFNPDMBLKCACHEXFERENQUEUEDISCARDDEV;
|
---|
153 |
|
---|
154 | /**
|
---|
155 | * Completion callback for drivers.
|
---|
156 | *
|
---|
157 | * @param pvUserInt User argument given to PDMR3BlkCacheRetainInt.
|
---|
158 | * @param pvUser User argument given during request initiation.
|
---|
159 | * @param rc The status code of the completed request.
|
---|
160 | */
|
---|
161 | typedef DECLCALLBACKTYPE(void, FNPDMBLKCACHEXFERCOMPLETEINT,(void *pvUserInt, void *pvUser, int rc));
|
---|
162 | /** Pointer to a FNPDMBLKCACHEXFERCOMPLETEINT(). */
|
---|
163 | typedef FNPDMBLKCACHEXFERCOMPLETEINT *PFNPDMBLKCACHEXFERCOMPLETEINT;
|
---|
164 |
|
---|
165 | /**
|
---|
166 | * I/O enqueue callback for internal users.
|
---|
167 | *
|
---|
168 | * @param pvUser User data.
|
---|
169 | * @param enmXferDir Transfer direction.
|
---|
170 | * @param off Transfer offset.
|
---|
171 | * @param cbXfer Transfer size.
|
---|
172 | * @param pSgBuf Scather / gather buffer for the transfer.
|
---|
173 | * @param hIoXfer I/O transfer handle to ping on completion.
|
---|
174 | */
|
---|
175 | typedef DECLCALLBACKTYPE(int, FNPDMBLKCACHEXFERENQUEUEINT,(void *pvUser, PDMBLKCACHEXFERDIR enmXferDir, uint64_t off,
|
---|
176 | size_t cbXfer, PCRTSGBUF pSgBuf, PPDMBLKCACHEIOXFER hIoXfer));
|
---|
177 | /** Pointer to a FNPDMBLKCACHEXFERENQUEUEINT(). */
|
---|
178 | typedef FNPDMBLKCACHEXFERENQUEUEINT *PFNPDMBLKCACHEXFERENQUEUEINT;
|
---|
179 |
|
---|
180 | /**
|
---|
181 | * Discard enqueue callback for VMM internal users.
|
---|
182 | *
|
---|
183 | * @param pvUser User data.
|
---|
184 | * @param paRanges Ranges to discard.
|
---|
185 | * @param cRanges Number of range entries.
|
---|
186 | * @param hIoXfer I/O handle to return on completion.
|
---|
187 | */
|
---|
188 | typedef DECLCALLBACKTYPE(int, FNPDMBLKCACHEXFERENQUEUEDISCARDINT,(void *pvUser, PCRTRANGE paRanges, unsigned cRanges,
|
---|
189 | PPDMBLKCACHEIOXFER hIoXfer));
|
---|
190 | /** Pointer to a FNPDMBLKCACHEXFERENQUEUEDISCARDINT(). */
|
---|
191 | typedef FNPDMBLKCACHEXFERENQUEUEDISCARDINT *PFNPDMBLKCACHEXFERENQUEUEDISCARDINT;
|
---|
192 |
|
---|
193 | /**
|
---|
194 | * Completion callback for USB devices.
|
---|
195 | *
|
---|
196 | * @param pUsbIns The USB device instance.
|
---|
197 | * @param pvUser User argument given during request initiation.
|
---|
198 | * @param rc The status code of the completed request.
|
---|
199 | */
|
---|
200 | typedef DECLCALLBACKTYPE(void, FNPDMBLKCACHEXFERCOMPLETEUSB,(PPDMUSBINS pUsbIns, void *pvUser, int rc));
|
---|
201 | /** Pointer to a FNPDMBLKCACHEXFERCOMPLETEUSB(). */
|
---|
202 | typedef FNPDMBLKCACHEXFERCOMPLETEUSB *PFNPDMBLKCACHEXFERCOMPLETEUSB;
|
---|
203 |
|
---|
204 | /**
|
---|
205 | * I/O enqueue callback for USB devices.
|
---|
206 | *
|
---|
207 | * @param pUsbIns The USB device instance.
|
---|
208 | * @param enmXferDir Transfer direction.
|
---|
209 | * @param off Transfer offset.
|
---|
210 | * @param cbXfer Transfer size.
|
---|
211 | * @param pSgBuf Scather / gather buffer for the transfer.
|
---|
212 | * @param hIoXfer I/O transfer handle to ping on completion.
|
---|
213 | */
|
---|
214 | typedef DECLCALLBACKTYPE(int, FNPDMBLKCACHEXFERENQUEUEUSB,(PPDMUSBINS pUsbIns, PDMBLKCACHEXFERDIR enmXferDir, uint64_t off,
|
---|
215 | size_t cbXfer, PCRTSGBUF pSgBuf, PPDMBLKCACHEIOXFER hIoXfer));
|
---|
216 | /** Pointer to a FNPDMBLKCACHEXFERENQUEUEUSB(). */
|
---|
217 | typedef FNPDMBLKCACHEXFERENQUEUEUSB *PFNPDMBLKCACHEXFERENQUEUEUSB;
|
---|
218 |
|
---|
219 | /**
|
---|
220 | * Discard enqueue callback for USB devices.
|
---|
221 | *
|
---|
222 | * @param pUsbIns The USB device instance.
|
---|
223 | * @param paRanges Ranges to discard.
|
---|
224 | * @param cRanges Number of range entries.
|
---|
225 | * @param hIoXfer I/O handle to return on completion.
|
---|
226 | */
|
---|
227 | typedef DECLCALLBACKTYPE(int, FNPDMBLKCACHEXFERENQUEUEDISCARDUSB,(PPDMUSBINS pUsbIns, PCRTRANGE paRanges, unsigned cRanges,
|
---|
228 | PPDMBLKCACHEIOXFER hIoXfer));
|
---|
229 | /** Pointer to a FNPDMBLKCACHEXFERENQUEUEDISCARDUSB(). */
|
---|
230 | typedef FNPDMBLKCACHEXFERENQUEUEDISCARDUSB *PFNPDMBLKCACHEXFERENQUEUEDISCARDUSB;
|
---|
231 |
|
---|
232 | /**
|
---|
233 | * Create a block cache user for a driver instance.
|
---|
234 | *
|
---|
235 | * @returns VBox status code.
|
---|
236 | * @param pVM The cross context VM structure.
|
---|
237 | * @param pDrvIns The driver instance.
|
---|
238 | * @param ppBlkCache Where to store the handle to the block cache.
|
---|
239 | * @param pfnXferComplete The I/O transfer complete callback.
|
---|
240 | * @param pfnXferEnqueue The I/O request enqueue callback.
|
---|
241 | * @param pfnXferEnqueueDiscard The discard request enqueue callback.
|
---|
242 | * @param pcszId Unique ID used to identify the user.
|
---|
243 | */
|
---|
244 | VMMR3DECL(int) PDMR3BlkCacheRetainDriver(PVM pVM, PPDMDRVINS pDrvIns, PPPDMBLKCACHE ppBlkCache,
|
---|
245 | PFNPDMBLKCACHEXFERCOMPLETEDRV pfnXferComplete,
|
---|
246 | PFNPDMBLKCACHEXFERENQUEUEDRV pfnXferEnqueue,
|
---|
247 | PFNPDMBLKCACHEXFERENQUEUEDISCARDDRV pfnXferEnqueueDiscard,
|
---|
248 | const char *pcszId);
|
---|
249 |
|
---|
250 | /**
|
---|
251 | * Create a block cache user for a device instance.
|
---|
252 | *
|
---|
253 | * @returns VBox status code.
|
---|
254 | * @param pVM The cross context VM structure.
|
---|
255 | * @param pDevIns The device instance.
|
---|
256 | * @param ppBlkCache Where to store the handle to the block cache.
|
---|
257 | * @param pfnXferComplete The I/O transfer complete callback.
|
---|
258 | * @param pfnXferEnqueue The I/O request enqueue callback.
|
---|
259 | * @param pfnXferEnqueueDiscard The discard request enqueue callback.
|
---|
260 | * @param pcszId Unique ID used to identify the user.
|
---|
261 | */
|
---|
262 | VMMR3DECL(int) PDMR3BlkCacheRetainDevice(PVM pVM, PPDMDEVINS pDevIns, PPPDMBLKCACHE ppBlkCache,
|
---|
263 | PFNPDMBLKCACHEXFERCOMPLETEDEV pfnXferComplete,
|
---|
264 | PFNPDMBLKCACHEXFERENQUEUEDEV pfnXferEnqueue,
|
---|
265 | PFNPDMBLKCACHEXFERENQUEUEDISCARDDEV pfnXferEnqueueDiscard,
|
---|
266 | const char *pcszId);
|
---|
267 |
|
---|
268 | /**
|
---|
269 | * Create a block cache user for a USB instance.
|
---|
270 | *
|
---|
271 | * @returns VBox status code.
|
---|
272 | * @param pVM The cross context VM structure.
|
---|
273 | * @param pUsbIns The USB device instance.
|
---|
274 | * @param ppBlkCache Where to store the handle to the block cache.
|
---|
275 | * @param pfnXferComplete The I/O transfer complete callback.
|
---|
276 | * @param pfnXferEnqueue The I/O request enqueue callback.
|
---|
277 | * @param pfnXferEnqueueDiscard The discard request enqueue callback.
|
---|
278 | * @param pcszId Unique ID used to identify the user.
|
---|
279 | */
|
---|
280 | VMMR3DECL(int) PDMR3BlkCacheRetainUsb(PVM pVM, PPDMUSBINS pUsbIns, PPPDMBLKCACHE ppBlkCache,
|
---|
281 | PFNPDMBLKCACHEXFERCOMPLETEUSB pfnXferComplete,
|
---|
282 | PFNPDMBLKCACHEXFERENQUEUEUSB pfnXferEnqueue,
|
---|
283 | PFNPDMBLKCACHEXFERENQUEUEDISCARDUSB pfnXferEnqueueDiscard,
|
---|
284 | const char *pcszId);
|
---|
285 |
|
---|
286 | /**
|
---|
287 | * Create a block cache user for internal use by VMM.
|
---|
288 | *
|
---|
289 | * @returns VBox status code.
|
---|
290 | * @param pVM The cross context VM structure.
|
---|
291 | * @param pvUser Opaque user data.
|
---|
292 | * @param ppBlkCache Where to store the handle to the block cache.
|
---|
293 | * @param pfnXferComplete The I/O transfer complete callback.
|
---|
294 | * @param pfnXferEnqueue The I/O request enqueue callback.
|
---|
295 | * @param pfnXferEnqueueDiscard The discard request enqueue callback.
|
---|
296 | * @param pcszId Unique ID used to identify the user.
|
---|
297 | */
|
---|
298 | VMMR3DECL(int) PDMR3BlkCacheRetainInt(PVM pVM, void *pvUser, PPPDMBLKCACHE ppBlkCache,
|
---|
299 | PFNPDMBLKCACHEXFERCOMPLETEINT pfnXferComplete,
|
---|
300 | PFNPDMBLKCACHEXFERENQUEUEINT pfnXferEnqueue,
|
---|
301 | PFNPDMBLKCACHEXFERENQUEUEDISCARDINT pfnXferEnqueueDiscard,
|
---|
302 | const char *pcszId);
|
---|
303 |
|
---|
304 | /**
|
---|
305 | * Releases a block cache handle.
|
---|
306 | *
|
---|
307 | * @returns nothing.
|
---|
308 | * @param pBlkCache Block cache handle.
|
---|
309 | */
|
---|
310 | VMMR3DECL(void) PDMR3BlkCacheRelease(PPDMBLKCACHE pBlkCache);
|
---|
311 |
|
---|
312 | /**
|
---|
313 | * Releases all block cache handles for a device instance.
|
---|
314 | *
|
---|
315 | * @returns nothing.
|
---|
316 | * @param pVM The cross context VM structure.
|
---|
317 | * @param pDevIns The device instance.
|
---|
318 | */
|
---|
319 | VMMR3DECL(void) PDMR3BlkCacheReleaseDevice(PVM pVM, PPDMDEVINS pDevIns);
|
---|
320 |
|
---|
321 | /**
|
---|
322 | * Releases all block cache handles for a driver instance.
|
---|
323 | *
|
---|
324 | * @returns nothing.
|
---|
325 | * @param pVM The cross context VM structure.
|
---|
326 | * @param pDrvIns The driver instance.
|
---|
327 | */
|
---|
328 | VMMR3DECL(void) PDMR3BlkCacheReleaseDriver(PVM pVM, PPDMDRVINS pDrvIns);
|
---|
329 |
|
---|
330 | /**
|
---|
331 | * Releases all block cache handles for a USB device instance.
|
---|
332 | *
|
---|
333 | * @returns nothing.
|
---|
334 | * @param pVM The cross context VM structure.
|
---|
335 | * @param pUsbIns The USB device instance.
|
---|
336 | */
|
---|
337 | VMMR3DECL(void) PDMR3BlkCacheReleaseUsb(PVM pVM, PPDMUSBINS pUsbIns);
|
---|
338 |
|
---|
339 | /**
|
---|
340 | * Creates a read task on the given endpoint.
|
---|
341 | *
|
---|
342 | * @returns VBox status code.
|
---|
343 | * @param pBlkCache The cache instance.
|
---|
344 | * @param off Where to start reading from.
|
---|
345 | * @param pSgBuf Scatter gather buffer store the data in.
|
---|
346 | * @param cbRead The overall number of bytes to read.
|
---|
347 | * @param pvUser Opaque user data returned in the completion callback
|
---|
348 | * upon completion of the read.
|
---|
349 | */
|
---|
350 | VMMR3DECL(int) PDMR3BlkCacheRead(PPDMBLKCACHE pBlkCache, uint64_t off, PCRTSGBUF pSgBuf, size_t cbRead, void *pvUser);
|
---|
351 |
|
---|
352 | /**
|
---|
353 | * Creates a write task on the given endpoint.
|
---|
354 | *
|
---|
355 | * @returns VBox status code.
|
---|
356 | * @param pBlkCache The cache instance.
|
---|
357 | * @param off Where to start writing at.
|
---|
358 | * @param pSgBuf Scatter gather buffer gather the data from.
|
---|
359 | * @param cbWrite The overall number of bytes to write.
|
---|
360 | * @param pvUser Opaque user data returned in the completion callback
|
---|
361 | * upon completion of the task.
|
---|
362 | */
|
---|
363 | VMMR3DECL(int) PDMR3BlkCacheWrite(PPDMBLKCACHE pBlkCache, uint64_t off, PCRTSGBUF pSgBuf, size_t cbWrite, void *pvUser);
|
---|
364 |
|
---|
365 | /**
|
---|
366 | * Creates a flush task on the given endpoint.
|
---|
367 | *
|
---|
368 | * @returns VBox status code.
|
---|
369 | * @param pBlkCache The cache instance.
|
---|
370 | * @param pvUser Opaque user data returned in the completion callback
|
---|
371 | * upon completion of the task.
|
---|
372 | */
|
---|
373 | VMMR3DECL(int) PDMR3BlkCacheFlush(PPDMBLKCACHE pBlkCache, void *pvUser);
|
---|
374 |
|
---|
375 | /**
|
---|
376 | * Discards the given ranges from the cache.
|
---|
377 | *
|
---|
378 | * @returns VBox status code.
|
---|
379 | * @param pBlkCache The cache instance.
|
---|
380 | * @param paRanges Array of ranges to discard.
|
---|
381 | * @param cRanges Number of ranges in the array.
|
---|
382 | * @param pvUser Opaque user data returned in the completion callback
|
---|
383 | * upon completion of the task.
|
---|
384 | */
|
---|
385 | VMMR3DECL(int) PDMR3BlkCacheDiscard(PPDMBLKCACHE pBlkCache, PCRTRANGE paRanges, unsigned cRanges, void *pvUser);
|
---|
386 |
|
---|
387 | /**
|
---|
388 | * Notify the cache of a complete I/O transfer.
|
---|
389 | *
|
---|
390 | * @returns nothing.
|
---|
391 | * @param pBlkCache The cache instance.
|
---|
392 | * @param hIoXfer The I/O transfer handle which completed.
|
---|
393 | * @param rcIoXfer The status code of the completed request.
|
---|
394 | */
|
---|
395 | VMMR3DECL(void) PDMR3BlkCacheIoXferComplete(PPDMBLKCACHE pBlkCache, PPDMBLKCACHEIOXFER hIoXfer, int rcIoXfer);
|
---|
396 |
|
---|
397 | /**
|
---|
398 | * Suspends the block cache.
|
---|
399 | *
|
---|
400 | * The cache waits until all I/O transfers completed and stops to enqueue new
|
---|
401 | * requests after the call returned but will not accept reads, write or flushes
|
---|
402 | * either.
|
---|
403 | *
|
---|
404 | * @returns VBox status code.
|
---|
405 | * @param pBlkCache The cache instance.
|
---|
406 | */
|
---|
407 | VMMR3DECL(int) PDMR3BlkCacheSuspend(PPDMBLKCACHE pBlkCache);
|
---|
408 |
|
---|
409 | /**
|
---|
410 | * Resumes operation of the block cache.
|
---|
411 | *
|
---|
412 | * @returns VBox status code.
|
---|
413 | * @param pBlkCache The cache instance.
|
---|
414 | */
|
---|
415 | VMMR3DECL(int) PDMR3BlkCacheResume(PPDMBLKCACHE pBlkCache);
|
---|
416 |
|
---|
417 | /**
|
---|
418 | * Clears the block cache and removes all entries.
|
---|
419 | *
|
---|
420 | * The cache waits until all I/O transfers completed.
|
---|
421 | *
|
---|
422 | * @returns VBox status code.
|
---|
423 | * @param pBlkCache The cache instance.
|
---|
424 | */
|
---|
425 | VMMR3DECL(int) PDMR3BlkCacheClear(PPDMBLKCACHE pBlkCache);
|
---|
426 |
|
---|
427 | /** @} */
|
---|
428 |
|
---|
429 | RT_C_DECLS_END
|
---|
430 |
|
---|
431 | #endif /* !VBOX_INCLUDED_vmm_pdmblkcache_h */
|
---|
432 |
|
---|