VirtualBox

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

Last change on this file since 78415 was 76585, checked in by vboxsync, 6 years ago

*: scm --fix-header-guard-endif

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