VirtualBox

source: vbox/trunk/include/VBox/vmm/pdmstorageifs.h

Last change on this file was 99739, checked in by vboxsync, 13 months ago

*: doxygen corrections (mostly about removing @returns from functions returning void).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 47.3 KB
Line 
1/** @file
2 * PDM - Pluggable Device Manager, Storage related interfaces.
3 */
4
5/*
6 * Copyright (C) 2006-2023 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_pdmstorageifs_h
37#define VBOX_INCLUDED_vmm_pdmstorageifs_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42#include <iprt/sg.h>
43#include <VBox/types.h>
44#include <VBox/vdmedia.h>
45
46RT_C_DECLS_BEGIN
47
48struct PDMISECKEY;
49struct PDMISECKEYHLP;
50
51
52/** @defgroup grp_pdm_ifs_storage PDM Storage Interfaces
53 * @ingroup grp_pdm_interfaces
54 * @{
55 */
56
57
58/** Pointer to a mount interface. */
59typedef struct PDMIMOUNTNOTIFY *PPDMIMOUNTNOTIFY;
60/**
61 * Block interface (up).
62 * Pair with PDMIMOUNT.
63 */
64typedef struct PDMIMOUNTNOTIFY
65{
66 /**
67 * Called when a media is mounted.
68 *
69 * @param pInterface Pointer to the interface structure containing the called function pointer.
70 * @thread The emulation thread.
71 */
72 DECLR3CALLBACKMEMBER(void, pfnMountNotify,(PPDMIMOUNTNOTIFY pInterface));
73
74 /**
75 * Called when a media is unmounted
76 * @param pInterface Pointer to the interface structure containing the called function pointer.
77 * @thread The emulation thread.
78 */
79 DECLR3CALLBACKMEMBER(void, pfnUnmountNotify,(PPDMIMOUNTNOTIFY pInterface));
80} PDMIMOUNTNOTIFY;
81/** PDMIMOUNTNOTIFY interface ID. */
82#define PDMIMOUNTNOTIFY_IID "fa143ac9-9fc6-498e-997f-945380a558f9"
83
84
85/** Pointer to mount interface. */
86typedef struct PDMIMOUNT *PPDMIMOUNT;
87/**
88 * Mount interface (down).
89 * Pair with PDMIMOUNTNOTIFY.
90 */
91typedef struct PDMIMOUNT
92{
93 /**
94 * Unmount the media.
95 *
96 * The driver will validate and pass it on. On the rebounce it will decide whether or not to detach it self.
97 *
98 * @returns VBox status code.
99 * @param pInterface Pointer to the interface structure containing the called function pointer.
100 * @thread The emulation thread.
101 * @param fForce Force the unmount, even for locked media.
102 * @param fEject Eject the medium. Only relevant for host drives.
103 * @thread The emulation thread.
104 */
105 DECLR3CALLBACKMEMBER(int, pfnUnmount,(PPDMIMOUNT pInterface, bool fForce, bool fEject));
106
107 /**
108 * Checks if a media is mounted.
109 *
110 * @returns true if mounted.
111 * @returns false if not mounted.
112 * @param pInterface Pointer to the interface structure containing the called function pointer.
113 * @thread Any thread.
114 */
115 DECLR3CALLBACKMEMBER(bool, pfnIsMounted,(PPDMIMOUNT pInterface));
116
117 /**
118 * Locks the media, preventing any unmounting of it.
119 *
120 * @returns VBox status code.
121 * @param pInterface Pointer to the interface structure containing the called function pointer.
122 * @thread The emulation thread.
123 */
124 DECLR3CALLBACKMEMBER(int, pfnLock,(PPDMIMOUNT pInterface));
125
126 /**
127 * Unlocks the media, canceling previous calls to pfnLock().
128 *
129 * @returns VBox status code.
130 * @param pInterface Pointer to the interface structure containing the called function pointer.
131 * @thread The emulation thread.
132 */
133 DECLR3CALLBACKMEMBER(int, pfnUnlock,(PPDMIMOUNT pInterface));
134
135 /**
136 * Checks if a media is locked.
137 *
138 * @returns true if locked.
139 * @returns false if not locked.
140 * @param pInterface Pointer to the interface structure containing the called function pointer.
141 * @thread Any thread.
142 */
143 DECLR3CALLBACKMEMBER(bool, pfnIsLocked,(PPDMIMOUNT pInterface));
144} PDMIMOUNT;
145/** PDMIMOUNT interface ID. */
146#define PDMIMOUNT_IID "34fc7a4c-623a-4806-a6bf-5be1be33c99f"
147
148
149/**
150 * Callback which provides progress information.
151 *
152 * @return VBox status code.
153 * @param pvUser Opaque user data.
154 * @param uPercentage Completion percentage.
155 */
156typedef DECLCALLBACKTYPE(int, FNSIMPLEPROGRESS,(void *pvUser, unsigned uPercentage));
157/** Pointer to FNSIMPLEPROGRESS() */
158typedef FNSIMPLEPROGRESS *PFNSIMPLEPROGRESS;
159
160
161/**
162 * Media type.
163 */
164typedef enum PDMMEDIATYPE
165{
166 /** Error (for the query function). */
167 PDMMEDIATYPE_ERROR = 1,
168 /** 360KB 5 1/4" floppy drive. */
169 PDMMEDIATYPE_FLOPPY_360,
170 /** 720KB 3 1/2" floppy drive. */
171 PDMMEDIATYPE_FLOPPY_720,
172 /** 1.2MB 5 1/4" floppy drive. */
173 PDMMEDIATYPE_FLOPPY_1_20,
174 /** 1.44MB 3 1/2" floppy drive. */
175 PDMMEDIATYPE_FLOPPY_1_44,
176 /** 2.88MB 3 1/2" floppy drive. */
177 PDMMEDIATYPE_FLOPPY_2_88,
178 /** Fake drive that can take up to 15.6 MB images.
179 * C=255, H=2, S=63. */
180 PDMMEDIATYPE_FLOPPY_FAKE_15_6,
181 /** Fake drive that can take up to 63.5 MB images.
182 * C=255, H=2, S=255. */
183 PDMMEDIATYPE_FLOPPY_FAKE_63_5,
184 /** CDROM drive. */
185 PDMMEDIATYPE_CDROM,
186 /** DVD drive. */
187 PDMMEDIATYPE_DVD,
188 /** Hard disk drive. */
189 PDMMEDIATYPE_HARD_DISK
190} PDMMEDIATYPE;
191
192/** Check if the given block type is a floppy. */
193#define PDMMEDIATYPE_IS_FLOPPY(a_enmType) ( (a_enmType) >= PDMMEDIATYPE_FLOPPY_360 && (a_enmType) <= PDMMEDIATYPE_FLOPPY_2_88 )
194
195/**
196 * Raw command data transfer direction.
197 */
198typedef enum PDMMEDIATXDIR
199{
200 PDMMEDIATXDIR_NONE = 0,
201 PDMMEDIATXDIR_FROM_DEVICE,
202 PDMMEDIATXDIR_TO_DEVICE
203} PDMMEDIATXDIR;
204
205/**
206 * Media geometry structure.
207 */
208typedef struct PDMMEDIAGEOMETRY
209{
210 /** Number of cylinders. */
211 uint32_t cCylinders;
212 /** Number of heads. */
213 uint32_t cHeads;
214 /** Number of sectors. */
215 uint32_t cSectors;
216} PDMMEDIAGEOMETRY;
217
218/** Pointer to media geometry structure. */
219typedef PDMMEDIAGEOMETRY *PPDMMEDIAGEOMETRY;
220/** Pointer to constant media geometry structure. */
221typedef const PDMMEDIAGEOMETRY *PCPDMMEDIAGEOMETRY;
222
223/** Pointer to a media port interface. */
224typedef struct PDMIMEDIAPORT *PPDMIMEDIAPORT;
225/**
226 * Media port interface (down).
227 */
228typedef struct PDMIMEDIAPORT
229{
230 /**
231 * Returns the storage controller name, instance and LUN of the attached medium.
232 *
233 * @returns VBox status.
234 * @param pInterface Pointer to this interface.
235 * @param ppcszController Where to store the name of the storage controller.
236 * @param piInstance Where to store the instance number of the controller.
237 * @param piLUN Where to store the LUN of the attached device.
238 */
239 DECLR3CALLBACKMEMBER(int, pfnQueryDeviceLocation, (PPDMIMEDIAPORT pInterface, const char **ppcszController,
240 uint32_t *piInstance, uint32_t *piLUN));
241
242
243 /**
244 * Queries the vendor and product ID and revision to report for INQUIRY commands in underlying devices, optional.
245 *
246 * @returns VBox status code.
247 * @param pInterface Pointer to this interface.
248 * @param ppszVendorId Where to store the pointer to the vendor ID string to report.
249 * @param ppszProductId Where to store the pointer to the product ID string to report.
250 * @param ppszRevision Where to store the pointer to the revision string to report.
251 *
252 * @note The strings for the inquiry data are stored in the storage controller rather than in the device
253 * because if device attachments change (virtual CD/DVD drive versus host drive) there is currently no
254 * way to keep the INQUIRY data in extradata keys without causing trouble when the attachment is changed.
255 * Also Main currently doesn't has any settings for the attachment to store such information in the settings
256 * properly. Last reason (but not the most important one) is to stay compatible with older versions
257 * where the drive emulation was in AHCI but it now uses VSCSI and the settings overwrite should still work.
258 */
259 DECLR3CALLBACKMEMBER(int, pfnQueryScsiInqStrings, (PPDMIMEDIAPORT pInterface, const char **ppszVendorId,
260 const char **ppszProductId, const char **ppszRevision));
261
262} PDMIMEDIAPORT;
263/** PDMIMEDIAPORT interface ID. */
264#define PDMIMEDIAPORT_IID "77180ab8-6485-454f-b440-efca322b7bd7"
265
266/** Pointer to a media interface. */
267typedef struct PDMIMEDIA *PPDMIMEDIA;
268/**
269 * Media interface (up).
270 * Pairs with PDMIMEDIAPORT.
271 */
272typedef struct PDMIMEDIA
273{
274 /**
275 * Read bits.
276 *
277 * @returns VBox status code.
278 * @param pInterface Pointer to the interface structure containing the called function pointer.
279 * @param off Offset to start reading from. The offset must be aligned to a sector boundary.
280 * @param pvBuf Where to store the read bits.
281 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
282 * @thread Any thread.
283 */
284 DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIMEDIA pInterface, uint64_t off, void *pvBuf, size_t cbRead));
285
286 /**
287 * Read bits - version for DevPcBios.
288 *
289 * @returns VBox status code.
290 * @param pInterface Pointer to the interface structure containing the called function pointer.
291 * @param off Offset to start reading from. The offset must be aligned to a sector boundary.
292 * @param pvBuf Where to store the read bits.
293 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
294 * @thread Any thread.
295 *
296 * @note: Special version of pfnRead which doesn't try to suspend the VM when the DEKs for encrypted disks
297 * are missing but just returns an error.
298 */
299 DECLR3CALLBACKMEMBER(int, pfnReadPcBios,(PPDMIMEDIA pInterface, uint64_t off, void *pvBuf, size_t cbRead));
300
301 /**
302 * Write bits.
303 *
304 * @returns VBox status code.
305 * @param pInterface Pointer to the interface structure containing the called function pointer.
306 * @param off Offset to start writing at. The offset must be aligned to a sector boundary.
307 * @param pvBuf Where to store the write bits.
308 * @param cbWrite Number of bytes to write. Must be aligned to a sector boundary.
309 * @thread Any thread.
310 */
311 DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIMEDIA pInterface, uint64_t off, const void *pvBuf, size_t cbWrite));
312
313 /**
314 * Make sure that the bits written are actually on the storage medium.
315 *
316 * @returns VBox status code.
317 * @param pInterface Pointer to the interface structure containing the called function pointer.
318 * @thread Any thread.
319 */
320 DECLR3CALLBACKMEMBER(int, pfnFlush,(PPDMIMEDIA pInterface));
321
322 /**
323 * Send a raw command to the underlying device (CDROM).
324 * This method is optional (i.e. the function pointer may be NULL).
325 *
326 * @returns VBox status code.
327 * @param pInterface Pointer to the interface structure containing the called function pointer.
328 * @param pbCdb The command to process.
329 * @param cbCdb The length of the command in bytes.
330 * @param enmTxDir Direction of transfer.
331 * @param pvBuf Pointer tp the transfer buffer.
332 * @param pcbBuf Size of the transfer buffer.
333 * @param pabSense Status of the command (when return value is VERR_DEV_IO_ERROR).
334 * @param cbSense Size of the sense buffer in bytes.
335 * @param cTimeoutMillies Command timeout in milliseconds.
336 * @thread Any thread.
337 */
338 DECLR3CALLBACKMEMBER(int, pfnSendCmd,(PPDMIMEDIA pInterface, const uint8_t *pbCdb, size_t cbCdb,
339 PDMMEDIATXDIR enmTxDir, void *pvBuf, uint32_t *pcbBuf,
340 uint8_t *pabSense, size_t cbSense, uint32_t cTimeoutMillies));
341
342 /**
343 * Merge medium contents during a live snapshot deletion. All details
344 * must have been configured through CFGM or this will fail.
345 * This method is optional (i.e. the function pointer may be NULL).
346 *
347 * @returns VBox status code.
348 * @param pInterface Pointer to the interface structure containing the called function pointer.
349 * @param pfnProgress Function pointer for progress notification.
350 * @param pvUser Opaque user data for progress notification.
351 * @thread Any thread.
352 */
353 DECLR3CALLBACKMEMBER(int, pfnMerge,(PPDMIMEDIA pInterface, PFNSIMPLEPROGRESS pfnProgress, void *pvUser));
354
355 /**
356 * Sets the secret key retrieval interface to use to get secret keys.
357 *
358 * @returns VBox status code.
359 * @param pInterface Pointer to the interface structure containing the called function pointer.
360 * @param pIfSecKey The secret key interface to use.
361 * Use NULL to clear the currently set interface and clear all secret
362 * keys from the user.
363 * @param pIfSecKeyHlp The secret key helper interface to use.
364 * @thread Any thread.
365 */
366 DECLR3CALLBACKMEMBER(int, pfnSetSecKeyIf,(PPDMIMEDIA pInterface, struct PDMISECKEY *pIfSecKey,
367 struct PDMISECKEYHLP *pIfSecKeyHlp));
368
369 /**
370 * Get the media size in bytes.
371 *
372 * @returns Media size in bytes.
373 * @param pInterface Pointer to the interface structure containing the called function pointer.
374 * @thread Any thread.
375 */
376 DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMIMEDIA pInterface));
377
378 /**
379 * Gets the media sector size in bytes.
380 *
381 * @returns Media sector size in bytes.
382 * @param pInterface Pointer to the interface structure containing the called function pointer.
383 * @thread Any thread.
384 */
385 DECLR3CALLBACKMEMBER(uint32_t, pfnGetSectorSize,(PPDMIMEDIA pInterface));
386
387 /**
388 * Check if the media is readonly or not.
389 *
390 * @returns true if readonly.
391 * @returns false if read/write.
392 * @param pInterface Pointer to the interface structure containing the called function pointer.
393 * @thread Any thread.
394 */
395 DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMIMEDIA pInterface));
396
397 /**
398 * Returns whether the medium should be marked as rotational or not.
399 *
400 * @returns true if non rotating medium.
401 * @returns false if rotating medium.
402 * @param pInterface Pointer to the interface structure containing the called function pointer.
403 * @thread Any thread.
404 */
405 DECLR3CALLBACKMEMBER(bool, pfnIsNonRotational,(PPDMIMEDIA pInterface));
406
407 /**
408 * Get stored media geometry (physical CHS, PCHS) - BIOS property.
409 * This is an optional feature of a media.
410 *
411 * @returns VBox status code.
412 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
413 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnBiosSetPCHSGeometry() yet.
414 * @param pInterface Pointer to the interface structure containing the called function pointer.
415 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
416 * @remark This has no influence on the read/write operations.
417 * @thread Any thread.
418 */
419 DECLR3CALLBACKMEMBER(int, pfnBiosGetPCHSGeometry,(PPDMIMEDIA pInterface, PPDMMEDIAGEOMETRY pPCHSGeometry));
420
421 /**
422 * Store the media geometry (physical CHS, PCHS) - BIOS property.
423 * This is an optional feature of a media.
424 *
425 * @returns VBox status code.
426 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
427 * @param pInterface Pointer to the interface structure containing the called function pointer.
428 * @param pPCHSGeometry Pointer to PCHS geometry (cylinders/heads/sectors).
429 * @remark This has no influence on the read/write operations.
430 * @thread The emulation thread.
431 */
432 DECLR3CALLBACKMEMBER(int, pfnBiosSetPCHSGeometry,(PPDMIMEDIA pInterface, PCPDMMEDIAGEOMETRY pPCHSGeometry));
433
434 /**
435 * Get stored media geometry (logical CHS, LCHS) - BIOS property.
436 * This is an optional feature of a media.
437 *
438 * @returns VBox status code.
439 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
440 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnBiosSetLCHSGeometry() yet.
441 * @param pInterface Pointer to the interface structure containing the called function pointer.
442 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
443 * @remark This has no influence on the read/write operations.
444 * @thread Any thread.
445 */
446 DECLR3CALLBACKMEMBER(int, pfnBiosGetLCHSGeometry,(PPDMIMEDIA pInterface, PPDMMEDIAGEOMETRY pLCHSGeometry));
447
448 /**
449 * Store the media geometry (logical CHS, LCHS) - BIOS property.
450 * This is an optional feature of a media.
451 *
452 * @returns VBox status code.
453 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
454 * @param pInterface Pointer to the interface structure containing the called function pointer.
455 * @param pLCHSGeometry Pointer to LCHS geometry (cylinders/heads/sectors).
456 * @remark This has no influence on the read/write operations.
457 * @thread The emulation thread.
458 */
459 DECLR3CALLBACKMEMBER(int, pfnBiosSetLCHSGeometry,(PPDMIMEDIA pInterface, PCPDMMEDIAGEOMETRY pLCHSGeometry));
460
461 /**
462 * Checks if the device should be visible to the BIOS or not.
463 *
464 * @returns true if the device is visible to the BIOS.
465 * @returns false if the device is not visible to the BIOS.
466 * @param pInterface Pointer to the interface structure containing the called function pointer.
467 * @thread Any thread.
468 */
469 DECLR3CALLBACKMEMBER(bool, pfnBiosIsVisible,(PPDMIMEDIA pInterface));
470
471 /**
472 * Gets the media type.
473 *
474 * @returns media type.
475 * @param pInterface Pointer to the interface structure containing the called function pointer.
476 * @thread Any thread.
477 */
478 DECLR3CALLBACKMEMBER(PDMMEDIATYPE, pfnGetType,(PPDMIMEDIA pInterface));
479
480 /**
481 * Gets the UUID of the media drive.
482 *
483 * @returns VBox status code.
484 * @param pInterface Pointer to the interface structure containing the called function pointer.
485 * @param pUuid Where to store the UUID on success.
486 * @thread Any thread.
487 */
488 DECLR3CALLBACKMEMBER(int, pfnGetUuid,(PPDMIMEDIA pInterface, PRTUUID pUuid));
489
490 /**
491 * Discards the given range.
492 *
493 * @returns VBox status code.
494 * @param pInterface Pointer to the interface structure containing the called function pointer.
495 * @param paRanges Array of ranges to discard.
496 * @param cRanges Number of entries in the array.
497 * @thread Any thread.
498 */
499 DECLR3CALLBACKMEMBER(int, pfnDiscard,(PPDMIMEDIA pInterface, PCRTRANGE paRanges, unsigned cRanges));
500
501 /**
502 * Returns the number of regions for the medium.
503 *
504 * @returns Number of regions.
505 * @param pInterface Pointer to the interface structure containing the called function pointer.
506 */
507 DECLR3CALLBACKMEMBER(uint32_t, pfnGetRegionCount,(PPDMIMEDIA pInterface));
508
509 /**
510 * Queries the properties for the given region.
511 *
512 * @returns VBox status code.
513 * @retval VERR_NOT_FOUND if the region index is not known.
514 * @param pInterface Pointer to the interface structure containing the called function pointer.
515 * @param uRegion The region index to query the properties of.
516 * @param pu64LbaStart Where to store the starting LBA for the region on success.
517 * @param pcBlocks Where to store the number of blocks for the region on success.
518 * @param pcbBlock Where to store the size of one block in bytes on success.
519 * @param penmDataForm WHere to store the data form for the region on success.
520 */
521 DECLR3CALLBACKMEMBER(int, pfnQueryRegionProperties,(PPDMIMEDIA pInterface, uint32_t uRegion, uint64_t *pu64LbaStart,
522 uint64_t *pcBlocks, uint64_t *pcbBlock,
523 PVDREGIONDATAFORM penmDataForm));
524
525 /**
526 * Queries the properties for the region covering the given LBA.
527 *
528 * @returns VBox status code.
529 * @retval VERR_NOT_FOUND if the region index is not known.
530 * @param pInterface Pointer to the interface structure containing the called function pointer.
531 * @param u64LbaStart Where to store the starting LBA for the region on success.
532 * @param puRegion Where to store the region number on success.
533 * @param pcBlocks Where to store the number of blocks left in this region starting from the given LBA.
534 * @param pcbBlock Where to store the size of one block in bytes on success.
535 * @param penmDataForm WHere to store the data form for the region on success.
536 */
537 DECLR3CALLBACKMEMBER(int, pfnQueryRegionPropertiesForLba,(PPDMIMEDIA pInterface, uint64_t u64LbaStart,
538 uint32_t *puRegion, uint64_t *pcBlocks,
539 uint64_t *pcbBlock, PVDREGIONDATAFORM penmDataForm));
540
541} PDMIMEDIA;
542/** PDMIMEDIA interface ID. */
543#define PDMIMEDIA_IID "8ec68c48-dd20-4430-8386-f0d628a5aca6"
544
545
546/**
547 * Opaque I/O request handle.
548 *
549 * The specific content depends on the driver implementing this interface.
550 */
551typedef struct PDMMEDIAEXIOREQINT *PDMMEDIAEXIOREQ;
552/** Pointer to an I/O request handle. */
553typedef PDMMEDIAEXIOREQ *PPDMMEDIAEXIOREQ;
554/** NIL I/O request handle. */
555#define NIL_PDMMEDIAEXIOREQ ((PDMMEDIAEXIOREQ)0)
556
557/** A I/O request ID. */
558typedef uint64_t PDMMEDIAEXIOREQID;
559
560/**
561 * I/O Request Type.
562 */
563typedef enum PDMMEDIAEXIOREQTYPE
564{
565 /** Invalid tpe. */
566 PDMMEDIAEXIOREQTYPE_INVALID = 0,
567 /** Flush request. */
568 PDMMEDIAEXIOREQTYPE_FLUSH,
569 /** Write request. */
570 PDMMEDIAEXIOREQTYPE_WRITE,
571 /** Read request. */
572 PDMMEDIAEXIOREQTYPE_READ,
573 /** Discard request. */
574 PDMMEDIAEXIOREQTYPE_DISCARD,
575 /** SCSI command. */
576 PDMMEDIAEXIOREQTYPE_SCSI
577} PDMMEDIAEXIOREQTYPE;
578/** Pointer to a I/O request type. */
579typedef PDMMEDIAEXIOREQTYPE *PPDMMEDIAEXIOREQTYPE;
580
581/**
582 * Data direction for raw SCSI commands.
583 */
584typedef enum PDMMEDIAEXIOREQSCSITXDIR
585{
586 /** Invalid data direction. */
587 PDMMEDIAEXIOREQSCSITXDIR_INVALID = 0,
588 /** Direction is unknown. */
589 PDMMEDIAEXIOREQSCSITXDIR_UNKNOWN,
590 /** Direction is from device to host. */
591 PDMMEDIAEXIOREQSCSITXDIR_FROM_DEVICE,
592 /** Direction is from host to device. */
593 PDMMEDIAEXIOREQSCSITXDIR_TO_DEVICE,
594 /** No data transfer associated with this request. */
595 PDMMEDIAEXIOREQSCSITXDIR_NONE,
596 /** 32bit hack. */
597 PDMMEDIAEXIOREQSCSITXDIR_32BIT_HACK = 0x7fffffff
598} PDMMEDIAEXIOREQSCSITXDIR;
599
600/**
601 * I/O request state.
602 */
603typedef enum PDMMEDIAEXIOREQSTATE
604{
605 /** Invalid state. */
606 PDMMEDIAEXIOREQSTATE_INVALID = 0,
607 /** The request is active and being processed. */
608 PDMMEDIAEXIOREQSTATE_ACTIVE,
609 /** The request is suspended due to an error and no processing will take place. */
610 PDMMEDIAEXIOREQSTATE_SUSPENDED,
611 /** 32bit hack. */
612 PDMMEDIAEXIOREQSTATE_32BIT_HACK = 0x7fffffff
613} PDMMEDIAEXIOREQSTATE;
614/** Pointer to a I/O request state. */
615typedef PDMMEDIAEXIOREQSTATE *PPDMMEDIAEXIOREQSTATE;
616
617/** @name Supported feature flags
618 * @{ */
619/** I/O requests will execute asynchronously by default. */
620#define PDMIMEDIAEX_FEATURE_F_ASYNC RT_BIT_32(0)
621/** The discard request is supported. */
622#define PDMIMEDIAEX_FEATURE_F_DISCARD RT_BIT_32(1)
623/** The send raw SCSI command request is supported. */
624#define PDMIMEDIAEX_FEATURE_F_RAWSCSICMD RT_BIT_32(2)
625/** Mask of valid flags. */
626#define PDMIMEDIAEX_FEATURE_F_VALID (PDMIMEDIAEX_FEATURE_F_ASYNC | PDMIMEDIAEX_FEATURE_F_DISCARD | PDMIMEDIAEX_FEATURE_F_RAWSCSICMD)
627/** @} */
628
629/** @name I/O request specific flags
630 * @{ */
631/** Default behavior (async I/O).*/
632#define PDMIMEDIAEX_F_DEFAULT (0)
633/** The I/O request will be executed synchronously. */
634#define PDMIMEDIAEX_F_SYNC RT_BIT_32(0)
635/** Whether to suspend the VM on a recoverable error with
636 * an appropriate error message (disk full, etc.).
637 * The request will be retried by the driver implementing the interface
638 * when the VM resumes the next time. However before suspending the request
639 * the owner of the request will be notified using the PDMMEDIAEXPORT::pfnIoReqStateChanged.
640 * The same goes for resuming the request after the VM was resumed.
641 */
642#define PDMIMEDIAEX_F_SUSPEND_ON_RECOVERABLE_ERR RT_BIT_32(1)
643 /** Mask of valid flags. */
644#define PDMIMEDIAEX_F_VALID (PDMIMEDIAEX_F_SYNC | PDMIMEDIAEX_F_SUSPEND_ON_RECOVERABLE_ERR)
645/** @} */
646
647/** Pointer to an extended media notification interface. */
648typedef struct PDMIMEDIAEXPORT *PPDMIMEDIAEXPORT;
649
650/**
651 * Asynchronous version of the media interface (up).
652 * Pair with PDMIMEDIAEXPORT.
653 */
654typedef struct PDMIMEDIAEXPORT
655{
656 /**
657 * Notify completion of a I/O request.
658 *
659 * @returns VBox status code.
660 * @param pInterface Pointer to the interface structure containing the called function pointer.
661 * @param hIoReq The I/O request handle.
662 * @param pvIoReqAlloc The allocator specific memory for this request.
663 * @param rcReq IPRT Status code of the completed request.
664 * VERR_PDM_MEDIAEX_IOREQ_CANCELED if the request was canceled by a call to
665 * PDMIMEDIAEX::pfnIoReqCancel.
666 * @thread Any thread.
667 */
668 DECLR3CALLBACKMEMBER(int, pfnIoReqCompleteNotify, (PPDMIMEDIAEXPORT pInterface, PDMMEDIAEXIOREQ hIoReq,
669 void *pvIoReqAlloc, int rcReq));
670
671 /**
672 * Copy data from the memory buffer of the caller to the callees memory buffer for the given request.
673 *
674 * @returns VBox status code.
675 * @retval VERR_PDM_MEDIAEX_IOBUF_OVERFLOW if there is not enough room to store the data.
676 * @param pInterface Pointer to the interface structure containing the called function pointer.
677 * @param hIoReq The I/O request handle.
678 * @param pvIoReqAlloc The allocator specific memory for this request.
679 * @param offDst The destination offset from the start to write the data to.
680 * @param pSgBuf The S/G buffer to read the data from.
681 * @param cbCopy How many bytes to copy.
682 */
683 DECLR3CALLBACKMEMBER(int, pfnIoReqCopyFromBuf, (PPDMIMEDIAEXPORT pInterface, PDMMEDIAEXIOREQ hIoReq,
684 void *pvIoReqAlloc, uint32_t offDst, PRTSGBUF pSgBuf,
685 size_t cbCopy));
686
687 /**
688 * Copy data to the memory buffer of the caller from the callees memory buffer for the given request.
689 *
690 * @returns VBox status code.
691 * @retval VERR_PDM_MEDIAEX_IOBUF_UNDERRUN if there is not enough data to copy from the buffer.
692 * @param pInterface Pointer to the interface structure containing the called function pointer.
693 * @param hIoReq The I/O request handle.
694 * @param pvIoReqAlloc The allocator specific memory for this request.
695 * @param offSrc The offset from the start of the buffer to read the data from.
696 * @param pSgBuf The S/G buffer to write the data to.
697 * @param cbCopy How many bytes to copy.
698 */
699 DECLR3CALLBACKMEMBER(int, pfnIoReqCopyToBuf, (PPDMIMEDIAEXPORT pInterface, PDMMEDIAEXIOREQ hIoReq,
700 void *pvIoReqAlloc, uint32_t offSrc, PRTSGBUF pSgBuf,
701 size_t cbCopy));
702
703 /**
704 * Queries a pointer to the memory buffer for the request from the drive/device above.
705 *
706 * @returns VBox status code.
707 * @retval VERR_NOT_SUPPORTED if this is not supported for this request.
708 * @param pInterface Pointer to the interface structure containing the called function pointer.
709 * @param hIoReq The I/O request handle.
710 * @param pvIoReqAlloc The allocator specific memory for this request.
711 * @param ppvBuf Where to store the pointer to the guest buffer on success.
712 * @param pcbBuf Where to store the size of the buffer on success.
713 *
714 * @note This is an optional feature of the entity implementing this interface to avoid overhead
715 * by copying the data between buffers. If NULL it is not supported at all and the caller
716 * has to resort to PDMIMEDIAEXPORT::pfnIoReqCopyToBuf and PDMIMEDIAEXPORT::pfnIoReqCopyFromBuf.
717 * The same holds when VERR_NOT_SUPPORTED is returned.
718 *
719 * On the upside the caller of this interface might not call this method at all and just
720 * use the before mentioned methods to copy the data between the buffers.
721 */
722 DECLR3CALLBACKMEMBER(int, pfnIoReqQueryBuf, (PPDMIMEDIAEXPORT pInterface, PDMMEDIAEXIOREQ hIoReq,
723 void *pvIoReqAlloc, void **ppvBuf, size_t *pcbBuf));
724
725 /**
726 * Queries the specified amount of ranges to discard from the callee for the given I/O request.
727 *
728 * @returns VBox status code.
729 * @param pInterface Pointer to the interface structure containing the called function pointer.
730 * @param hIoReq The I/O request handle.
731 * @param pvIoReqAlloc The allocator specific memory for this request.
732 * @param idxRangeStart The range index to start with.
733 * @param cRanges How man ranges can be stored in the provided array.
734 * @param paRanges Where to store the ranges on success.
735 * @param *pcRanges Where to store the number of ranges copied over on success.
736 */
737 DECLR3CALLBACKMEMBER(int, pfnIoReqQueryDiscardRanges, (PPDMIMEDIAEXPORT pInterface, PDMMEDIAEXIOREQ hIoReq,
738 void *pvIoReqAlloc, uint32_t idxRangeStart,
739 uint32_t cRanges, PRTRANGE paRanges,
740 uint32_t *pcRanges));
741
742 /**
743 * Notify the request owner about a state change for the request.
744 *
745 * @param pInterface Pointer to the interface structure containing the called function pointer.
746 * @param hIoReq The I/O request handle.
747 * @param pvIoReqAlloc The allocator specific memory for this request.
748 * @param enmState The new state of the request.
749 */
750 DECLR3CALLBACKMEMBER(void, pfnIoReqStateChanged, (PPDMIMEDIAEXPORT pInterface, PDMMEDIAEXIOREQ hIoReq,
751 void *pvIoReqAlloc, PDMMEDIAEXIOREQSTATE enmState));
752
753 /**
754 * Informs the device that the underlying medium was ejected.
755 *
756 * @param pInterface Pointer to the interface structure containing the called function pointer.
757 */
758 DECLR3CALLBACKMEMBER(void, pfnMediumEjected, (PPDMIMEDIAEXPORT pInterface));
759
760} PDMIMEDIAEXPORT;
761
762/** PDMIMEDIAAEXPORT interface ID. */
763#define PDMIMEDIAEXPORT_IID "0ae2e534-6c28-41d6-9a88-7f88f2cb2ff8"
764
765
766/** Pointer to an extended media interface. */
767typedef struct PDMIMEDIAEX *PPDMIMEDIAEX;
768
769/**
770 * Extended version of PDMIMEDIA (down).
771 * Pair with PDMIMEDIAEXPORT.
772 */
773typedef struct PDMIMEDIAEX
774{
775 /**
776 * Queries the features supported by the entity implementing this interface.
777 *
778 * @returns VBox status code.
779 * @param pInterface Pointer to the interface structure containing the called function pointer.
780 * @param pfFeatures Where to store the supported feature flags on success.
781 */
782 DECLR3CALLBACKMEMBER(int, pfnQueryFeatures, (PPDMIMEDIAEX pInterface, uint32_t *pfFeatures));
783
784 /**
785 * Notifies the driver below that the device received a suspend notification.
786 *
787 * @param pInterface Pointer to the interface structure containing the called function pointer.
788 *
789 * @note this is required because the PDM drivers in the storage area usually get their suspend notification
790 * only after the device finished suspending. For some cases it is useful for the driver to know
791 * as early as possible that a suspend is in progress to stop issuing deferred requests or other things.
792 */
793 DECLR3CALLBACKMEMBER(void, pfnNotifySuspend, (PPDMIMEDIAEX pInterface));
794
795 /**
796 * Sets the size of the allocator specific memory for a I/O request.
797 *
798 * @returns VBox status code.
799 * @param pInterface Pointer to the interface structure containing the called function pointer.
800 * @param cbIoReqAlloc The size of the allocator specific memory in bytes.
801 * @thread EMT.
802 */
803 DECLR3CALLBACKMEMBER(int, pfnIoReqAllocSizeSet, (PPDMIMEDIAEX pInterface, size_t cbIoReqAlloc));
804
805 /**
806 * Allocates a new I/O request.
807 *
808 * @returns VBox status code.
809 * @retval VERR_PDM_MEDIAEX_IOREQID_CONFLICT if the ID belongs to a still active request.
810 * @param pInterface Pointer to the interface structure containing the called function pointer.
811 * @param phIoReq Where to store the handle to the new I/O request on success.
812 * @param ppvIoReqAlloc Where to store the pointer to the allocator specific memory on success.
813 * NULL if the memory size was not set or set to 0.
814 * @param uIoReqId A custom request ID which can be used to cancel the request.
815 * @param fFlags A combination of PDMIMEDIAEX_F_* flags.
816 * @thread Any thread.
817 */
818 DECLR3CALLBACKMEMBER(int, pfnIoReqAlloc, (PPDMIMEDIAEX pInterface, PPDMMEDIAEXIOREQ phIoReq, void **ppvIoReqAlloc,
819 PDMMEDIAEXIOREQID uIoReqId, uint32_t fFlags));
820
821 /**
822 * Frees a given I/O request.
823 *
824 * @returns VBox status code.
825 * @retval VERR_PDM_MEDIAEX_IOREQ_INVALID_STATE if the given request is still active.
826 * @param pInterface Pointer to the interface structure containing the called function pointer.
827 * @param hIoReq The I/O request to free.
828 * @thread Any thread.
829 */
830 DECLR3CALLBACKMEMBER(int, pfnIoReqFree, (PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQ hIoReq));
831
832 /**
833 * Queries the residual amount of data not transfered when the request completed.
834 *
835 * @returns VBox status code.
836 * @retval VERR_PDM_MEDIAEX_IOREQ_INVALID_STATE has not completed yet.
837 * @param pInterface Pointer to the interface structure containing the called function pointer.
838 * @param hIoReq The I/O request.
839 * @param pcbResidual Where to store the amount of resdiual data in bytes.
840 * @thread Any thread.
841 */
842 DECLR3CALLBACKMEMBER(int, pfnIoReqQueryResidual, (PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQ hIoReq, size_t *pcbResidual));
843
844 /**
845 * Queries the residual amount of data not transfered when the request completed.
846 *
847 * @returns VBox status code.
848 * @retval VERR_PDM_MEDIAEX_IOREQ_INVALID_STATE has not completed yet.
849 * @param pInterface Pointer to the interface structure containing the called function pointer.
850 * @param hIoReq The I/O request.
851 * @param pcbXfer Where to store the amount of resdiual data in bytes.
852 * @thread Any thread.
853 *
854 * @note For simple read/write requests this returns the amount to read/write as given to the
855 * PDMIMEDIAEX::pfnIoReqRead or PDMIMEDIAEX::pfnIoReqWrite call.
856 * For SCSI commands this returns the transfer size as given in the provided CDB.
857 */
858 DECLR3CALLBACKMEMBER(int, pfnIoReqQueryXferSize, (PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQ hIoReq, size_t *pcbXfer));
859
860 /**
861 * Cancels all I/O active requests.
862 *
863 * @returns VBox status code.
864 * @param pInterface Pointer to the interface structure containing the called function pointer.
865 * @thread Any thread.
866 */
867 DECLR3CALLBACKMEMBER(int, pfnIoReqCancelAll, (PPDMIMEDIAEX pInterface));
868
869 /**
870 * Cancels a I/O request identified by the ID.
871 *
872 * @returns VBox status code.
873 * @retval VERR_PDM_MEDIAEX_IOREQID_NOT_FOUND if the given ID could not be found in the active request list.
874 * (The request has either completed already or an invalid ID was given).
875 * @param pInterface Pointer to the interface structure containing the called function pointer.
876 * @param uIoReqId The I/O request ID
877 * @thread Any thread.
878 */
879 DECLR3CALLBACKMEMBER(int, pfnIoReqCancel, (PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQID uIoReqId));
880
881 /**
882 * Start a reading request.
883 *
884 * @returns VBox status code.
885 * @retval VERR_PDM_MEDIAEX_IOREQ_CANCELED if the request was canceled by a call to
886 * PDMIMEDIAEX::pfnIoReqCancel.
887 * @retval VINF_PDM_MEDIAEX_IOREQ_IN_PROGRESS if the request was successfully submitted but is still in progress.
888 * Completion will be notified through PDMIMEDIAEXPORT::pfnIoReqCompleteNotify with the appropriate status code.
889 * @retval VINF_SUCCESS if the request completed successfully.
890 * @param pInterface Pointer to the interface structure containing the called function pointer.
891 * @param hIoReq The I/O request to associate the read with.
892 * @param off Offset to start reading from. Must be aligned to a sector boundary.
893 * @param cbRead Number of bytes to read. Must be aligned to a sector boundary.
894 * @thread Any thread.
895 */
896 DECLR3CALLBACKMEMBER(int, pfnIoReqRead, (PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQ hIoReq, uint64_t off, size_t cbRead));
897
898 /**
899 * Start a writing request.
900 *
901 * @returns VBox status code.
902 * @retval VERR_PDM_MEDIAEX_IOREQ_CANCELED if the request was canceled by a call to
903 * PDMIMEDIAEX::pfnIoReqCancel.
904 * @retval VINF_PDM_MEDIAEX_IOREQ_IN_PROGRESS if the request was successfully submitted but is still in progress.
905 * Completion will be notified through PDMIMEDIAEXPORT::pfnIoReqCompleteNotify with the appropriate status code.
906 * @retval VINF_SUCCESS if the request completed successfully.
907 * @param pInterface Pointer to the interface structure containing the called function pointer.
908 * @param hIoReq The I/O request to associate the write with.
909 * @param off Offset to start reading from. Must be aligned to a sector boundary.
910 * @param cbWrite Number of bytes to write. Must be aligned to a sector boundary.
911 * @thread Any thread.
912 */
913 DECLR3CALLBACKMEMBER(int, pfnIoReqWrite, (PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQ hIoReq, uint64_t off, size_t cbWrite));
914
915 /**
916 * Flush everything to disk.
917 *
918 * @returns VBox status code.
919 * @retval VERR_PDM_MEDIAEX_IOREQ_CANCELED if the request was canceled by a call to
920 * PDMIMEDIAEX::pfnIoReqCancel.
921 * @retval VINF_PDM_MEDIAEX_IOREQ_IN_PROGRESS if the request was successfully submitted but is still in progress.
922 * Completion will be notified through PDMIMEDIAEXPORT::pfnIoReqCompleteNotify with the appropriate status code.
923 * @retval VINF_SUCCESS if the request completed successfully.
924 * @param pInterface Pointer to the interface structure containing the called function pointer.
925 * @param hIoReq The I/O request to associate the flush with.
926 * @thread Any thread.
927 */
928 DECLR3CALLBACKMEMBER(int, pfnIoReqFlush, (PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQ hIoReq));
929
930 /**
931 * Discards the given range.
932 *
933 * @returns VBox status code.
934 * @retval VERR_PDM_MEDIAEX_IOREQ_CANCELED if the request was canceled by a call to
935 * PDMIMEDIAEX::pfnIoReqCancel.
936 * @retval VINF_PDM_MEDIAEX_IOREQ_IN_PROGRESS if the request was successfully submitted but is still in progress.
937 * Completion will be notified through PDMIMEDIAEXPORT::pfnIoReqCompleteNotify with the appropriate status code.
938 * @retval VINF_SUCCESS if the request completed successfully.
939 * @param pInterface Pointer to the interface structure containing the called function pointer.
940 * @param hIoReq The I/O request to associate the discard with.
941 * @param cRangesMax The maximum number of ranges this request has associated, this must not be accurate
942 * but can actually be bigger than the amount of ranges actually available.
943 * @thread Any thread.
944 */
945 DECLR3CALLBACKMEMBER(int, pfnIoReqDiscard, (PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQ hIoReq, unsigned cRangesMax));
946
947 /**
948 * Send a raw command to the underlying device (CDROM).
949 *
950 * @returns VBox status code.
951 * @retval VERR_PDM_MEDIAEX_IOREQ_CANCELED if the request was canceled by a call to
952 * PDMIMEDIAEX::pfnIoReqCancel.
953 * @retval VINF_PDM_MEDIAEX_IOREQ_IN_PROGRESS if the request was successfully submitted but is still in progress.
954 * Completion will be notified through PDMIMEDIAEXPORT::pfnIoReqCompleteNotify with the appropriate status code.
955 * @param pInterface Pointer to the interface structure containing the called function pointer.
956 * @param hIoReq The I/O request to associate the command with.
957 * @param uLun The LUN the command is for.
958 * @param pbCdb The SCSI CDB containing the command.
959 * @param cbCdb Size of the CDB in bytes.
960 * @param enmTxDir Direction of transfer.
961 * @param penmTxDirRet Where to store the transfer direction as parsed from the CDB, optional.
962 * @param cbBuf Size of the transfer buffer.
963 * @param pabSense Where to store the optional sense key.
964 * @param cbSense Size of the sense key buffer.
965 * @param pcbSenseRet Where to store the amount of sense data written, optional.
966 * @param pu8ScsiSts Where to store the SCSI status on success.
967 * @param cTimeoutMillies Command timeout in milliseconds.
968 * @thread Any thread.
969 */
970 DECLR3CALLBACKMEMBER(int, pfnIoReqSendScsiCmd,(PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQ hIoReq,
971 uint32_t uLun, const uint8_t *pbCdb, size_t cbCdb,
972 PDMMEDIAEXIOREQSCSITXDIR enmTxDir, PDMMEDIAEXIOREQSCSITXDIR *penmTxDirRet,
973 size_t cbBuf, uint8_t *pabSense, size_t cbSense, size_t *pcbSenseRet,
974 uint8_t *pu8ScsiSts, uint32_t cTimeoutMillies));
975
976 /**
977 * Returns the number of active I/O requests.
978 *
979 * @returns Number of active I/O requests.
980 * @param pInterface Pointer to the interface structure containing the called function pointer.
981 * @thread Any thread.
982 */
983 DECLR3CALLBACKMEMBER(uint32_t, pfnIoReqGetActiveCount, (PPDMIMEDIAEX pInterface));
984
985 /**
986 * Returns the number of suspended requests.
987 *
988 * @returns Number of suspended I/O requests.
989 * @param pInterface Pointer to the interface structure containing the called function pointer.
990 * @thread Any thread.
991 */
992 DECLR3CALLBACKMEMBER(uint32_t, pfnIoReqGetSuspendedCount, (PPDMIMEDIAEX pInterface));
993
994 /**
995 * Gets the first suspended request handle.
996 *
997 * @returns VBox status code.
998 * @retval VERR_NOT_FOUND if there is no suspended request waiting.
999 * @param pInterface Pointer to the interface structure containing the called function pointer.
1000 * @param phIoReq Where to store the request handle on success.
1001 * @param ppvIoReqAlloc Where to store the pointer to the allocator specific memory on success.
1002 * @thread Any thread.
1003 *
1004 * @note This should only be called when the VM is suspended to make sure the request doesn't suddenly
1005 * changes into the active state again. The only purpose for this method for now is to make saving the state
1006 * possible without breaking saved state versions.
1007 */
1008 DECLR3CALLBACKMEMBER(int, pfnIoReqQuerySuspendedStart, (PPDMIMEDIAEX pInterface, PPDMMEDIAEXIOREQ phIoReq, void **ppvIoReqAlloc));
1009
1010 /**
1011 * Gets the next suspended request handle.
1012 *
1013 * @returns VBox status code.
1014 * @retval VERR_NOT_FOUND if there is no suspended request waiting.
1015 * @param pInterface Pointer to the interface structure containing the called function pointer.
1016 * @param hIoReq The current request handle.
1017 * @param phIoReqNext Where to store the request handle on success.
1018 * @param ppvIoReqAllocNext Where to store the pointer to the allocator specific memory on success.
1019 * @thread Any thread.
1020 *
1021 * @note This should only be called when the VM is suspended to make sure the request doesn't suddenly
1022 * changes into the active state again. The only purpose for this method for now is to make saving the state
1023 * possible without breaking saved state versions.
1024 */
1025 DECLR3CALLBACKMEMBER(int, pfnIoReqQuerySuspendedNext, (PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQ hIoReq,
1026 PPDMMEDIAEXIOREQ phIoReqNext, void **ppvIoReqAllocNext));
1027
1028 /**
1029 * Saves the given I/O request state in the provided saved state unit.
1030 *
1031 * @returns VBox status code.
1032 * @param pInterface Pointer to the interface structure containing the called function pointer.
1033 * @param pSSM The SSM handle.
1034 * @param hIoReq The request handle to save.
1035 */
1036 DECLR3CALLBACKMEMBER(int, pfnIoReqSuspendedSave, (PPDMIMEDIAEX pInterface, PSSMHANDLE pSSM, PDMMEDIAEXIOREQ hIoReq));
1037
1038 /**
1039 * Load a suspended request state from the given saved state unit and link it into the suspended list.
1040 *
1041 * @returns VBox status code.
1042 * @param pInterface Pointer to the interface structure containing the called function pointer.
1043 * @param pSSM The SSM handle to read the state from.
1044 * @param hIoReq The request handle to load the state into.
1045 */
1046 DECLR3CALLBACKMEMBER(int, pfnIoReqSuspendedLoad, (PPDMIMEDIAEX pInterface, PSSMHANDLE pSSM, PDMMEDIAEXIOREQ hIoReq));
1047
1048} PDMIMEDIAEX;
1049/** PDMIMEDIAEX interface ID. */
1050#define PDMIMEDIAEX_IID "29c9e82b-934e-45c5-bb84-0d871c3cc9dd"
1051
1052/** @} */
1053
1054RT_C_DECLS_END
1055
1056#endif /* !VBOX_INCLUDED_vmm_pdmstorageifs_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use