VirtualBox

source: vbox/trunk/include/VBox/vmm/pdmasynccompletion.h@ 56291

Last change on this file since 56291 was 56291, checked in by vboxsync, 10 years ago

include: Updated (C) year.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 6.4 KB
Line 
1/** @file
2 * PDM - Pluggable Device Manager, Async I/O Completion.
3 */
4
5/*
6 * Copyright (C) 2007-2015 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 <VBox/err.h>
31#include <iprt/assert.h>
32#include <iprt/sg.h>
33
34
35RT_C_DECLS_BEGIN
36
37/** @defgroup grp_pdm_async_completion The PDM Async I/O Completion API
38 * @ingroup grp_pdm
39 * @{
40 */
41
42/** Pointer to a PDM async completion template handle. */
43typedef struct PDMASYNCCOMPLETIONTEMPLATE *PPDMASYNCCOMPLETIONTEMPLATE;
44/** Pointer to a PDM async completion template handle pointer. */
45typedef PPDMASYNCCOMPLETIONTEMPLATE *PPPDMASYNCCOMPLETIONTEMPLATE;
46
47/** Pointer to a PDM async completion task handle. */
48typedef struct PDMASYNCCOMPLETIONTASK *PPDMASYNCCOMPLETIONTASK;
49/** Pointer to a PDM async completion task handle pointer. */
50typedef PPDMASYNCCOMPLETIONTASK *PPPDMASYNCCOMPLETIONTASK;
51
52/** Pointer to a PDM async completion endpoint handle. */
53typedef struct PDMASYNCCOMPLETIONENDPOINT *PPDMASYNCCOMPLETIONENDPOINT;
54/** Pointer to a PDM async completion endpoint handle pointer. */
55typedef PPDMASYNCCOMPLETIONENDPOINT *PPPDMASYNCCOMPLETIONENDPOINT;
56
57
58/**
59 * Completion callback for devices.
60 *
61 * @param pDevIns The device instance.
62 * @param pvUser User argument.
63 * @param rc The status code of the completed request.
64 */
65typedef DECLCALLBACK(void) FNPDMASYNCCOMPLETEDEV(PPDMDEVINS pDevIns, void *pvUser, int rc);
66/** Pointer to a FNPDMASYNCCOMPLETEDEV(). */
67typedef FNPDMASYNCCOMPLETEDEV *PFNPDMASYNCCOMPLETEDEV;
68
69
70/**
71 * Completion callback for drivers.
72 *
73 * @param pDrvIns The driver instance.
74 * @param pvTemplateUser User argument given when creating the template.
75 * @param pvUser User argument given during request initiation.
76 * @param rc The status code of the completed request.
77 */
78typedef DECLCALLBACK(void) FNPDMASYNCCOMPLETEDRV(PPDMDRVINS pDrvIns, void *pvTemplateUser, void *pvUser, int rc);
79/** Pointer to a FNPDMASYNCCOMPLETEDRV(). */
80typedef FNPDMASYNCCOMPLETEDRV *PFNPDMASYNCCOMPLETEDRV;
81
82
83/**
84 * Completion callback for USB devices.
85 *
86 * @param pUsbIns The USB device instance.
87 * @param pvUser User argument.
88 * @param rc The status code of the completed request.
89 */
90typedef DECLCALLBACK(void) FNPDMASYNCCOMPLETEUSB(PPDMUSBINS pUsbIns, void *pvUser, int rc);
91/** Pointer to a FNPDMASYNCCOMPLETEUSB(). */
92typedef FNPDMASYNCCOMPLETEUSB *PFNPDMASYNCCOMPLETEUSB;
93
94
95/**
96 * Completion callback for internal.
97 *
98 * @param pVM Pointer to the shared VM structure.
99 * @param pvUser User argument for the task.
100 * @param pvUser2 User argument for the template.
101 * @param rc The status code of the completed request.
102 */
103typedef DECLCALLBACK(void) FNPDMASYNCCOMPLETEINT(PVM pVM, void *pvUser, void *pvUser2, int rc);
104/** Pointer to a FNPDMASYNCCOMPLETEINT(). */
105typedef FNPDMASYNCCOMPLETEINT *PFNPDMASYNCCOMPLETEINT;
106
107VMMR3DECL(int) PDMR3AsyncCompletionTemplateCreateInternal(PVM pVM, PPPDMASYNCCOMPLETIONTEMPLATE ppTemplate, PFNPDMASYNCCOMPLETEINT pfnCompleted, void *pvUser2, const char *pszDesc);
108VMMR3DECL(int) PDMR3AsyncCompletionTemplateDestroy(PPDMASYNCCOMPLETIONTEMPLATE pTemplate);
109VMMR3DECL(int) PDMR3AsyncCompletionEpCreateForFile(PPPDMASYNCCOMPLETIONENDPOINT ppEndpoint,
110 const char *pszFilename, uint32_t fFlags,
111 PPDMASYNCCOMPLETIONTEMPLATE pTemplate);
112
113/** @defgroup grp_pdmacep_file_flags Flags for PDMR3AsyncCompletionEpCreateForFile
114 * @{ */
115/** Open the file in read-only mode. */
116#define PDMACEP_FILE_FLAGS_READ_ONLY RT_BIT_32(0)
117/** Whether the file should not be write protected.
118 * The default is to protect the file against writes by other processes
119 * when opened in read/write mode to prevent data corruption by
120 * concurrent access which can occur if the local writeback cache is enabled.
121 */
122#define PDMACEP_FILE_FLAGS_DONT_LOCK RT_BIT_32(2)
123/** Open the endpoint with the host cache enabled. */
124#define PDMACEP_FILE_FLAGS_HOST_CACHE_ENABLED RT_BIT_32(3)
125/** @} */
126
127VMMR3DECL(void) PDMR3AsyncCompletionEpClose(PPDMASYNCCOMPLETIONENDPOINT pEndpoint);
128VMMR3DECL(int) PDMR3AsyncCompletionEpRead(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, RTFOFF off,
129 PCRTSGSEG paSegments, unsigned cSegments,
130 size_t cbRead, void *pvUser,
131 PPPDMASYNCCOMPLETIONTASK ppTask);
132VMMR3DECL(int) PDMR3AsyncCompletionEpWrite(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, RTFOFF off,
133 PCRTSGSEG paSegments, unsigned cSegments,
134 size_t cbWrite, void *pvUser,
135 PPPDMASYNCCOMPLETIONTASK ppTask);
136VMMR3DECL(int) PDMR3AsyncCompletionEpFlush(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, void *pvUser, PPPDMASYNCCOMPLETIONTASK ppTask);
137VMMR3DECL(int) PDMR3AsyncCompletionEpGetSize(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, uint64_t *pcbSize);
138VMMR3DECL(int) PDMR3AsyncCompletionEpSetSize(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, uint64_t cbSize);
139VMMR3DECL(int) PDMR3AsyncCompletionEpSetBwMgr(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, const char *pszBwMgr);
140VMMR3DECL(int) PDMR3AsyncCompletionTaskCancel(PPDMASYNCCOMPLETIONTASK pTask);
141VMMR3DECL(int) PDMR3AsyncCompletionBwMgrSetMaxForFile(PUVM pUVM, const char *pszBwMgr, uint32_t cbMaxNew);
142
143/** @} */
144
145RT_C_DECLS_END
146
147#endif
148
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette