VirtualBox

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

Last change on this file since 46757 was 46247, checked in by vboxsync, 12 years ago

Storage/tstVDIo: Integrate runtime async I/O manager and add a file based storage backend in addition to the memory based backend

  • 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 46247 2013-05-23 19:19:42Z 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
74/**
75 * Enqueues a new I/O request.
76 *
77 * @returns IPRT status code.
78 *
79 * @param pIoStorage Storage handle.
80 * @param enmTxDir The transfer direction.
81 * @param off Start offset of the transfer.
82 * @param cbTransfer Size of the transfer.
83 * @param pSgBuf S/G buffer to use.
84 * @param pvUser Opaque user data.
85 * @param fSync Flag whether to wait for the operation to complete.
86 */
87int VDIoBackendTransfer(PVDIOSTORAGE pIoStorage, VDIOTXDIR enmTxDir, uint64_t off,
88 size_t cbTransfer, PRTSGBUF pSgBuf, void *pvUser, bool fSync);
89
90#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