1 | /** @file
|
---|
2 | * PDM - Pluggable Device Manager, Async I/O Completion.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2007-2017 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___VBox_vmm_pdmasynccompletion_h
|
---|
27 | #define ___VBox_vmm_pdmasynccompletion_h
|
---|
28 |
|
---|
29 | #include <VBox/types.h>
|
---|
30 | #include <iprt/sg.h>
|
---|
31 |
|
---|
32 |
|
---|
33 | RT_C_DECLS_BEGIN
|
---|
34 |
|
---|
35 | /** @defgroup grp_pdm_async_completion The PDM Async I/O Completion API
|
---|
36 | * @ingroup grp_pdm
|
---|
37 | * @{
|
---|
38 | */
|
---|
39 |
|
---|
40 | /** Pointer to a PDM async completion template handle. */
|
---|
41 | typedef struct PDMASYNCCOMPLETIONTEMPLATE *PPDMASYNCCOMPLETIONTEMPLATE;
|
---|
42 | /** Pointer to a PDM async completion template handle pointer. */
|
---|
43 | typedef PPDMASYNCCOMPLETIONTEMPLATE *PPPDMASYNCCOMPLETIONTEMPLATE;
|
---|
44 |
|
---|
45 | /** Pointer to a PDM async completion task handle. */
|
---|
46 | typedef struct PDMASYNCCOMPLETIONTASK *PPDMASYNCCOMPLETIONTASK;
|
---|
47 | /** Pointer to a PDM async completion task handle pointer. */
|
---|
48 | typedef PPDMASYNCCOMPLETIONTASK *PPPDMASYNCCOMPLETIONTASK;
|
---|
49 |
|
---|
50 | /** Pointer to a PDM async completion endpoint handle. */
|
---|
51 | typedef struct PDMASYNCCOMPLETIONENDPOINT *PPDMASYNCCOMPLETIONENDPOINT;
|
---|
52 | /** Pointer to a PDM async completion endpoint handle pointer. */
|
---|
53 | typedef PPDMASYNCCOMPLETIONENDPOINT *PPPDMASYNCCOMPLETIONENDPOINT;
|
---|
54 |
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * Completion callback for devices.
|
---|
58 | *
|
---|
59 | * @param pDevIns The device instance.
|
---|
60 | * @param pvUser User argument.
|
---|
61 | * @param rc The status code of the completed request.
|
---|
62 | */
|
---|
63 | typedef DECLCALLBACK(void) FNPDMASYNCCOMPLETEDEV(PPDMDEVINS pDevIns, void *pvUser, int rc);
|
---|
64 | /** Pointer to a FNPDMASYNCCOMPLETEDEV(). */
|
---|
65 | typedef FNPDMASYNCCOMPLETEDEV *PFNPDMASYNCCOMPLETEDEV;
|
---|
66 |
|
---|
67 |
|
---|
68 | /**
|
---|
69 | * Completion callback for drivers.
|
---|
70 | *
|
---|
71 | * @param pDrvIns The driver instance.
|
---|
72 | * @param pvTemplateUser User argument given when creating the template.
|
---|
73 | * @param pvUser User argument given during request initiation.
|
---|
74 | * @param rc The status code of the completed request.
|
---|
75 | */
|
---|
76 | typedef DECLCALLBACK(void) FNPDMASYNCCOMPLETEDRV(PPDMDRVINS pDrvIns, void *pvTemplateUser, void *pvUser, int rc);
|
---|
77 | /** Pointer to a FNPDMASYNCCOMPLETEDRV(). */
|
---|
78 | typedef FNPDMASYNCCOMPLETEDRV *PFNPDMASYNCCOMPLETEDRV;
|
---|
79 |
|
---|
80 |
|
---|
81 | /**
|
---|
82 | * Completion callback for USB devices.
|
---|
83 | *
|
---|
84 | * @param pUsbIns The USB device instance.
|
---|
85 | * @param pvUser User argument.
|
---|
86 | * @param rc The status code of the completed request.
|
---|
87 | */
|
---|
88 | typedef DECLCALLBACK(void) FNPDMASYNCCOMPLETEUSB(PPDMUSBINS pUsbIns, void *pvUser, int rc);
|
---|
89 | /** Pointer to a FNPDMASYNCCOMPLETEUSB(). */
|
---|
90 | typedef FNPDMASYNCCOMPLETEUSB *PFNPDMASYNCCOMPLETEUSB;
|
---|
91 |
|
---|
92 |
|
---|
93 | /**
|
---|
94 | * Completion callback for internal.
|
---|
95 | *
|
---|
96 | * @param pVM The cross context VM structure.
|
---|
97 | * @param pvUser User argument for the task.
|
---|
98 | * @param pvUser2 User argument for the template.
|
---|
99 | * @param rc The status code of the completed request.
|
---|
100 | */
|
---|
101 | typedef DECLCALLBACK(void) FNPDMASYNCCOMPLETEINT(PVM pVM, void *pvUser, void *pvUser2, int rc);
|
---|
102 | /** Pointer to a FNPDMASYNCCOMPLETEINT(). */
|
---|
103 | typedef FNPDMASYNCCOMPLETEINT *PFNPDMASYNCCOMPLETEINT;
|
---|
104 |
|
---|
105 | VMMR3DECL(int) PDMR3AsyncCompletionTemplateCreateInternal(PVM pVM, PPPDMASYNCCOMPLETIONTEMPLATE ppTemplate,
|
---|
106 | PFNPDMASYNCCOMPLETEINT pfnCompleted, void *pvUser2, const char *pszDesc);
|
---|
107 | VMMR3DECL(int) PDMR3AsyncCompletionTemplateDestroy(PPDMASYNCCOMPLETIONTEMPLATE pTemplate);
|
---|
108 | VMMR3DECL(int) PDMR3AsyncCompletionEpCreateForFile(PPPDMASYNCCOMPLETIONENDPOINT ppEndpoint,
|
---|
109 | const char *pszFilename, uint32_t fFlags,
|
---|
110 | PPDMASYNCCOMPLETIONTEMPLATE pTemplate);
|
---|
111 |
|
---|
112 | /** @defgroup grp_pdmacep_file_flags Flags for PDMR3AsyncCompletionEpCreateForFile
|
---|
113 | * @{ */
|
---|
114 | /** Open the file in read-only mode. */
|
---|
115 | #define PDMACEP_FILE_FLAGS_READ_ONLY RT_BIT_32(0)
|
---|
116 | /** Whether the file should not be write protected.
|
---|
117 | * The default is to protect the file against writes by other processes
|
---|
118 | * when opened in read/write mode to prevent data corruption by
|
---|
119 | * concurrent access which can occur if the local writeback cache is enabled.
|
---|
120 | */
|
---|
121 | #define PDMACEP_FILE_FLAGS_DONT_LOCK RT_BIT_32(2)
|
---|
122 | /** Open the endpoint with the host cache enabled. */
|
---|
123 | #define PDMACEP_FILE_FLAGS_HOST_CACHE_ENABLED RT_BIT_32(3)
|
---|
124 | /** @} */
|
---|
125 |
|
---|
126 | VMMR3DECL(void) PDMR3AsyncCompletionEpClose(PPDMASYNCCOMPLETIONENDPOINT pEndpoint);
|
---|
127 | VMMR3DECL(int) PDMR3AsyncCompletionEpRead(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, RTFOFF off,
|
---|
128 | PCRTSGSEG paSegments, unsigned cSegments,
|
---|
129 | size_t cbRead, void *pvUser,
|
---|
130 | PPPDMASYNCCOMPLETIONTASK ppTask);
|
---|
131 | VMMR3DECL(int) PDMR3AsyncCompletionEpWrite(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, RTFOFF off,
|
---|
132 | PCRTSGSEG paSegments, unsigned cSegments,
|
---|
133 | size_t cbWrite, void *pvUser,
|
---|
134 | PPPDMASYNCCOMPLETIONTASK ppTask);
|
---|
135 | VMMR3DECL(int) PDMR3AsyncCompletionEpFlush(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, void *pvUser, PPPDMASYNCCOMPLETIONTASK ppTask);
|
---|
136 | VMMR3DECL(int) PDMR3AsyncCompletionEpGetSize(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, uint64_t *pcbSize);
|
---|
137 | VMMR3DECL(int) PDMR3AsyncCompletionEpSetSize(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, uint64_t cbSize);
|
---|
138 | VMMR3DECL(int) PDMR3AsyncCompletionEpSetBwMgr(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, const char *pszBwMgr);
|
---|
139 | VMMR3DECL(int) PDMR3AsyncCompletionTaskCancel(PPDMASYNCCOMPLETIONTASK pTask);
|
---|
140 | VMMR3DECL(int) PDMR3AsyncCompletionBwMgrSetMaxForFile(PUVM pUVM, const char *pszBwMgr, uint32_t cbMaxNew);
|
---|
141 |
|
---|
142 | /** @} */
|
---|
143 |
|
---|
144 | RT_C_DECLS_END
|
---|
145 |
|
---|
146 | #endif
|
---|
147 |
|
---|