1 | /** $Id: VDIoBackendMem.h 35471 2011-01-10 21:10:19Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | *
|
---|
4 | * VBox HDD container test utility, async I/O memory backend
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2011 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 __VDIoBackendMem_h__
|
---|
19 | #define __VDIoBackendMem_h__
|
---|
20 |
|
---|
21 | #include <iprt/sg.h>
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * I/O transfer direction.
|
---|
25 | */
|
---|
26 | typedef enum VDIOTXDIR
|
---|
27 | {
|
---|
28 | /** Read. */
|
---|
29 | VDIOTXDIR_READ = 0,
|
---|
30 | /** Write. */
|
---|
31 | VDIOTXDIR_WRITE,
|
---|
32 | /** Flush. */
|
---|
33 | VDIOTXDIR_FLUSH,
|
---|
34 | /** Invalid. */
|
---|
35 | VDIOTXDIR_INVALID
|
---|
36 | } VDIOTXDIR;
|
---|
37 |
|
---|
38 | /** Memory backend handle. */
|
---|
39 | typedef struct VDIOBACKENDMEM *PVDIOBACKENDMEM;
|
---|
40 | /** Pointer to a memory backend handle. */
|
---|
41 | typedef PVDIOBACKENDMEM *PPVDIOBACKENDMEM;
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * Completion handler.
|
---|
45 | *
|
---|
46 | * @returns nothing.
|
---|
47 | * @param pvUser Opaque user data.
|
---|
48 | * @param rcReq Completion code for the request.
|
---|
49 | */
|
---|
50 | typedef DECLCALLBACK(int) FNVDIOCOMPLETE(void *pvUser, int rcReq);
|
---|
51 | /** Pointer to a completion handler. */
|
---|
52 | typedef FNVDIOCOMPLETE *PFNVDIOCOMPLETE;
|
---|
53 |
|
---|
54 | /**
|
---|
55 | * Creates a new memory I/O backend.
|
---|
56 | *
|
---|
57 | * @returns IPRT status code.
|
---|
58 | *
|
---|
59 | * @param ppIoBackend Where to store the handle on success.
|
---|
60 | */
|
---|
61 | int VDIoBackendMemCreate(PPVDIOBACKENDMEM ppIoBackend);
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * Destroys a memory I/O backend.
|
---|
65 | *
|
---|
66 | * @returns IPRT status code.
|
---|
67 | *
|
---|
68 | * @param pIoBackend The backend to destroy.
|
---|
69 | */
|
---|
70 | int VDIoBackendMemDestroy(PVDIOBACKENDMEM pIoBackend);
|
---|
71 |
|
---|
72 | /**
|
---|
73 | * Enqueues a new I/O request.
|
---|
74 | *
|
---|
75 | * @returns IPRT status code.
|
---|
76 | *
|
---|
77 | * @param pIoBackend The backend which should handle the
|
---|
78 | * transfer.
|
---|
79 | * @param pMemDisk The memory disk the request is for.
|
---|
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 pfnComplete Completion handler to call.
|
---|
85 | * @param pvUser Opaque user data.
|
---|
86 | */
|
---|
87 | int VDIoBackendMemTransfer(PVDIOBACKENDMEM pIoBackend, PVDMEMDISK pMemDisk,
|
---|
88 | VDIOTXDIR enmTxDir, uint64_t off, size_t cbTransfer, PCRTSGSEG paSegs,
|
---|
89 | unsigned cSegs,
|
---|
90 | PFNVDIOCOMPLETE pfnComplete, void *pvUser);
|
---|
91 |
|
---|
92 | #endif /* __VDIoBackendMem_h__ */
|
---|