VirtualBox

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

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

tstVDIo: Implement dumptofile action to dump memory backed files to disk

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1/** $Id: VDIoBackend.h 52710 2014-09-11 20:25:53Z vboxsync $ */
2/** @file
3 *
4 * VBox HDD container test utility, async I/O backend
5 */
6
7/*
8 * Copyright (C) 2013 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#ifndef __VDIoBackend_h__
19#define __VDIoBackend_h__
20
21#include <iprt/sg.h>
22
23#include "VDDefs.h"
24
25/** I/O backend handle. */
26typedef struct VDIOBACKEND *PVDIOBACKEND;
27/** Pointer to a I/O backend handle. */
28typedef PVDIOBACKEND *PPVDIOBACKEND;
29
30/** Storage handle. */
31typedef struct VDIOSTORAGE *PVDIOSTORAGE;
32/** Pointer to a storage handle. */
33typedef PVDIOSTORAGE *PPVDIOSTORAGE;
34
35/**
36 * Completion handler.
37 *
38 * @returns nothing.
39 * @param pvUser Opaque user data.
40 * @param rcReq Completion code for the request.
41 */
42typedef DECLCALLBACK(int) FNVDIOCOMPLETE(void *pvUser, int rcReq);
43/** Pointer to a completion handler. */
44typedef FNVDIOCOMPLETE *PFNVDIOCOMPLETE;
45
46/**
47 * Creates a new memory I/O backend.
48 *
49 * @returns IPRT status code.
50 *
51 * @param ppIoBackend Where to store the handle on success.
52 */
53int VDIoBackendCreate(PPVDIOBACKEND ppIoBackend);
54
55/**
56 * Destroys a memory I/O backend.
57 *
58 * @returns nothing.
59 *
60 * @param pIoBackend The backend to destroy.
61 */
62void VDIoBackendDestroy(PVDIOBACKEND pIoBackend);
63
64int VDIoBackendStorageCreate(PVDIOBACKEND pIoBackend, const char *pszBackend,
65 const char *pszName, PFNVDIOCOMPLETE pfnComplete,
66 PPVDIOSTORAGE ppIoStorage);
67
68void VDIoBackendStorageDestroy(PVDIOSTORAGE pIoStorage);
69
70int VDIoBackendStorageSetSize(PVDIOSTORAGE pIoStorage, uint64_t cbSize);
71
72int VDIoBackendStorageGetSize(PVDIOSTORAGE pIoStorage, uint64_t *pcbSize);
73
74DECLHIDDEN(int) VDIoBackendDumpToFile(PVDIOSTORAGE pIoStorage, const char *pszPath);
75
76/**
77 * Enqueues a new I/O request.
78 *
79 * @returns IPRT status code.
80 *
81 * @param pIoStorage Storage handle.
82 * @param enmTxDir The transfer direction.
83 * @param off Start offset of the transfer.
84 * @param cbTransfer Size of the transfer.
85 * @param pSgBuf S/G buffer to use.
86 * @param pvUser Opaque user data.
87 * @param fSync Flag whether to wait for the operation to complete.
88 */
89int VDIoBackendTransfer(PVDIOSTORAGE pIoStorage, VDIOTXDIR enmTxDir, uint64_t off,
90 size_t cbTransfer, PRTSGBUF pSgBuf, void *pvUser, bool fSync);
91
92#endif /* __VDIoBackendMem_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