1 | /** $Id: VDIoBackendMem.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | *
|
---|
4 | * VBox HDD container test utility, async I/O memory backend
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2011-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_VDIoBackendMem_h
|
---|
30 | #define VBOX_INCLUDED_SRC_testcase_VDIoBackendMem_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 | /** Memory backend handle. */
|
---|
40 | typedef struct VDIOBACKENDMEM *PVDIOBACKENDMEM;
|
---|
41 | /** Pointer to a memory backend handle. */
|
---|
42 | typedef PVDIOBACKENDMEM *PPVDIOBACKENDMEM;
|
---|
43 |
|
---|
44 | /**
|
---|
45 | * Completion handler.
|
---|
46 | *
|
---|
47 | * @returns IPRT status code.
|
---|
48 | * @param pvUser Opaque user data.
|
---|
49 | * @param rcReq Completion code for the request.
|
---|
50 | */
|
---|
51 | typedef DECLCALLBACKTYPE(int, FNVDIOCOMPLETE,(void *pvUser, int rcReq));
|
---|
52 | /** Pointer to a completion handler. */
|
---|
53 | typedef FNVDIOCOMPLETE *PFNVDIOCOMPLETE;
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * Creates a new memory I/O backend.
|
---|
57 | *
|
---|
58 | * @returns IPRT status code.
|
---|
59 | *
|
---|
60 | * @param ppIoBackend Where to store the handle on success.
|
---|
61 | */
|
---|
62 | int VDIoBackendMemCreate(PPVDIOBACKENDMEM ppIoBackend);
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * Destroys a memory I/O backend.
|
---|
66 | *
|
---|
67 | * @returns IPRT status code.
|
---|
68 | *
|
---|
69 | * @param pIoBackend The backend to destroy.
|
---|
70 | */
|
---|
71 | int VDIoBackendMemDestroy(PVDIOBACKENDMEM pIoBackend);
|
---|
72 |
|
---|
73 | /**
|
---|
74 | * Enqueues a new I/O request.
|
---|
75 | *
|
---|
76 | * @returns IPRT status code.
|
---|
77 | *
|
---|
78 | * @param pIoBackend The backend which should handle the
|
---|
79 | * transfer.
|
---|
80 | * @param pMemDisk The memory disk the request is for.
|
---|
81 | * @param enmTxDir The transfer direction.
|
---|
82 | * @param off Start offset of the transfer.
|
---|
83 | * @param cbTransfer Size of the transfer.
|
---|
84 | * @param pSgBuf S/G buffer to use.
|
---|
85 | * @param pfnComplete Completion handler to call.
|
---|
86 | * @param pvUser Opaque user data.
|
---|
87 | */
|
---|
88 | int VDIoBackendMemTransfer(PVDIOBACKENDMEM pIoBackend, PVDMEMDISK pMemDisk,
|
---|
89 | VDIOTXDIR enmTxDir, uint64_t off, size_t cbTransfer,
|
---|
90 | PRTSGBUF pSgBuf, PFNVDIOCOMPLETE pfnComplete, void *pvUser);
|
---|
91 |
|
---|
92 | #endif /* !VBOX_INCLUDED_SRC_testcase_VDIoBackendMem_h */
|
---|