VirtualBox

source: vbox/trunk/src/VBox/Storage/testcase/VDIoBackend.h

Last change on this file was 106061, checked in by vboxsync, 7 weeks ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
Line 
1/** $Id: VDIoBackend.h 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 *
4 * VBox HDD container test utility, async I/O backend
5 */
6
7/*
8 * Copyright (C) 2013-2024 Oracle and/or its affiliates.
9 *
10 * This file is part of VirtualBox base platform packages, as
11 * available from https://www.virtualbox.org.
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation, in version 3 of the
16 * License.
17 *
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, see <https://www.gnu.org/licenses>.
25 *
26 * SPDX-License-Identifier: GPL-3.0-only
27 */
28
29#ifndef VBOX_INCLUDED_SRC_testcase_VDIoBackend_h
30#define VBOX_INCLUDED_SRC_testcase_VDIoBackend_h
31#ifndef RT_WITHOUT_PRAGMA_ONCE
32# pragma once
33#endif
34
35#include <iprt/sg.h>
36
37#include "VDDefs.h"
38
39/** I/O backend handle. */
40typedef struct VDIOBACKEND *PVDIOBACKEND;
41/** Pointer to a I/O backend handle. */
42typedef PVDIOBACKEND *PPVDIOBACKEND;
43
44/** Storage handle. */
45typedef struct VDIOSTORAGE *PVDIOSTORAGE;
46/** Pointer to a storage handle. */
47typedef PVDIOSTORAGE *PPVDIOSTORAGE;
48
49/**
50 * Completion handler.
51 *
52 * @returns IPRT status code.
53 * @param pvUser Opaque user data.
54 * @param rcReq Completion code for the request.
55 */
56typedef DECLCALLBACKTYPE(int, FNVDIOCOMPLETE,(void *pvUser, int rcReq));
57/** Pointer to a completion handler. */
58typedef FNVDIOCOMPLETE *PFNVDIOCOMPLETE;
59
60/**
61 * Creates a new memory I/O backend.
62 *
63 * @returns IPRT status code.
64 *
65 * @param ppIoBackend Where to store the handle on success.
66 */
67int VDIoBackendCreate(PPVDIOBACKEND ppIoBackend);
68
69/**
70 * Destroys a memory I/O backend.
71 *
72 * @param pIoBackend The backend to destroy.
73 */
74void VDIoBackendDestroy(PVDIOBACKEND pIoBackend);
75
76int VDIoBackendStorageCreate(PVDIOBACKEND pIoBackend, const char *pszBackend,
77 const char *pszName, PFNVDIOCOMPLETE pfnComplete,
78 PPVDIOSTORAGE ppIoStorage);
79
80void VDIoBackendStorageDestroy(PVDIOSTORAGE pIoStorage);
81
82int VDIoBackendStorageSetSize(PVDIOSTORAGE pIoStorage, uint64_t cbSize);
83
84int VDIoBackendStorageGetSize(PVDIOSTORAGE pIoStorage, uint64_t *pcbSize);
85
86DECLHIDDEN(int) VDIoBackendDumpToFile(PVDIOSTORAGE pIoStorage, const char *pszPath);
87
88/**
89 * Enqueues a new I/O request.
90 *
91 * @returns IPRT status code.
92 *
93 * @param pIoStorage Storage handle.
94 * @param enmTxDir The transfer direction.
95 * @param off Start offset of the transfer.
96 * @param cbTransfer Size of the transfer.
97 * @param pSgBuf S/G buffer to use.
98 * @param pvUser Opaque user data.
99 * @param fSync Flag whether to wait for the operation to complete.
100 */
101int VDIoBackendTransfer(PVDIOSTORAGE pIoStorage, VDIOTXDIR enmTxDir, uint64_t off,
102 size_t cbTransfer, PRTSGBUF pSgBuf, void *pvUser, bool fSync);
103
104#endif /* !VBOX_INCLUDED_SRC_testcase_VDIoBackend_h */
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