1 | /** $Id: VDIoBackend.h 76578 2019-01-01 06:11:47Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | *
|
---|
4 | * VBox HDD container test utility, async I/O backend
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2013-2019 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef VBOX_INCLUDED_SRC_testcase_VDIoBackend_h
|
---|
20 | #define VBOX_INCLUDED_SRC_testcase_VDIoBackend_h
|
---|
21 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
22 | # pragma once
|
---|
23 | #endif
|
---|
24 |
|
---|
25 | #include <iprt/sg.h>
|
---|
26 |
|
---|
27 | #include "VDDefs.h"
|
---|
28 |
|
---|
29 | /** I/O backend handle. */
|
---|
30 | typedef struct VDIOBACKEND *PVDIOBACKEND;
|
---|
31 | /** Pointer to a I/O backend handle. */
|
---|
32 | typedef PVDIOBACKEND *PPVDIOBACKEND;
|
---|
33 |
|
---|
34 | /** Storage handle. */
|
---|
35 | typedef struct VDIOSTORAGE *PVDIOSTORAGE;
|
---|
36 | /** Pointer to a storage handle. */
|
---|
37 | typedef PVDIOSTORAGE *PPVDIOSTORAGE;
|
---|
38 |
|
---|
39 | /**
|
---|
40 | * Completion handler.
|
---|
41 | *
|
---|
42 | * @returns nothing.
|
---|
43 | * @param pvUser Opaque user data.
|
---|
44 | * @param rcReq Completion code for the request.
|
---|
45 | */
|
---|
46 | typedef DECLCALLBACK(int) FNVDIOCOMPLETE(void *pvUser, int rcReq);
|
---|
47 | /** Pointer to a completion handler. */
|
---|
48 | typedef FNVDIOCOMPLETE *PFNVDIOCOMPLETE;
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * Creates a new memory I/O backend.
|
---|
52 | *
|
---|
53 | * @returns IPRT status code.
|
---|
54 | *
|
---|
55 | * @param ppIoBackend Where to store the handle on success.
|
---|
56 | */
|
---|
57 | int VDIoBackendCreate(PPVDIOBACKEND ppIoBackend);
|
---|
58 |
|
---|
59 | /**
|
---|
60 | * Destroys a memory I/O backend.
|
---|
61 | *
|
---|
62 | * @returns nothing.
|
---|
63 | *
|
---|
64 | * @param pIoBackend The backend to destroy.
|
---|
65 | */
|
---|
66 | void VDIoBackendDestroy(PVDIOBACKEND pIoBackend);
|
---|
67 |
|
---|
68 | int VDIoBackendStorageCreate(PVDIOBACKEND pIoBackend, const char *pszBackend,
|
---|
69 | const char *pszName, PFNVDIOCOMPLETE pfnComplete,
|
---|
70 | PPVDIOSTORAGE ppIoStorage);
|
---|
71 |
|
---|
72 | void VDIoBackendStorageDestroy(PVDIOSTORAGE pIoStorage);
|
---|
73 |
|
---|
74 | int VDIoBackendStorageSetSize(PVDIOSTORAGE pIoStorage, uint64_t cbSize);
|
---|
75 |
|
---|
76 | int VDIoBackendStorageGetSize(PVDIOSTORAGE pIoStorage, uint64_t *pcbSize);
|
---|
77 |
|
---|
78 | DECLHIDDEN(int) VDIoBackendDumpToFile(PVDIOSTORAGE pIoStorage, const char *pszPath);
|
---|
79 |
|
---|
80 | /**
|
---|
81 | * Enqueues a new I/O request.
|
---|
82 | *
|
---|
83 | * @returns IPRT status code.
|
---|
84 | *
|
---|
85 | * @param pIoStorage Storage handle.
|
---|
86 | * @param enmTxDir The transfer direction.
|
---|
87 | * @param off Start offset of the transfer.
|
---|
88 | * @param cbTransfer Size of the transfer.
|
---|
89 | * @param pSgBuf S/G buffer to use.
|
---|
90 | * @param pvUser Opaque user data.
|
---|
91 | * @param fSync Flag whether to wait for the operation to complete.
|
---|
92 | */
|
---|
93 | int VDIoBackendTransfer(PVDIOSTORAGE pIoStorage, VDIOTXDIR enmTxDir, uint64_t off,
|
---|
94 | size_t cbTransfer, PRTSGBUF pSgBuf, void *pvUser, bool fSync);
|
---|
95 |
|
---|
96 | #endif /* !VBOX_INCLUDED_SRC_testcase_VDIoBackend_h */
|
---|