1 | /** $Id: VDIoBackendMem.h 62482 2016-07-22 18:30:37Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | *
|
---|
4 | * VBox HDD container test utility, async I/O memory backend
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2011-2016 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 | #include "VDDefs.h"
|
---|
24 |
|
---|
25 | /** Memory backend handle. */
|
---|
26 | typedef struct VDIOBACKENDMEM *PVDIOBACKENDMEM;
|
---|
27 | /** Pointer to a memory backend handle. */
|
---|
28 | typedef PVDIOBACKENDMEM *PPVDIOBACKENDMEM;
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * Completion handler.
|
---|
32 | *
|
---|
33 | * @returns nothing.
|
---|
34 | * @param pvUser Opaque user data.
|
---|
35 | * @param rcReq Completion code for the request.
|
---|
36 | */
|
---|
37 | typedef DECLCALLBACK(int) FNVDIOCOMPLETE(void *pvUser, int rcReq);
|
---|
38 | /** Pointer to a completion handler. */
|
---|
39 | typedef FNVDIOCOMPLETE *PFNVDIOCOMPLETE;
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Creates a new memory I/O backend.
|
---|
43 | *
|
---|
44 | * @returns IPRT status code.
|
---|
45 | *
|
---|
46 | * @param ppIoBackend Where to store the handle on success.
|
---|
47 | */
|
---|
48 | int VDIoBackendMemCreate(PPVDIOBACKENDMEM ppIoBackend);
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * Destroys a memory I/O backend.
|
---|
52 | *
|
---|
53 | * @returns IPRT status code.
|
---|
54 | *
|
---|
55 | * @param pIoBackend The backend to destroy.
|
---|
56 | */
|
---|
57 | int VDIoBackendMemDestroy(PVDIOBACKENDMEM pIoBackend);
|
---|
58 |
|
---|
59 | /**
|
---|
60 | * Enqueues a new I/O request.
|
---|
61 | *
|
---|
62 | * @returns IPRT status code.
|
---|
63 | *
|
---|
64 | * @param pIoBackend The backend which should handle the
|
---|
65 | * transfer.
|
---|
66 | * @param pMemDisk The memory disk the request is for.
|
---|
67 | * @param enmTxDir The transfer direction.
|
---|
68 | * @param off Start offset of the transfer.
|
---|
69 | * @param cbTransfer Size of the transfer.
|
---|
70 | * @param pSgBuf S/G buffer to use.
|
---|
71 | * @param pfnComplete Completion handler to call.
|
---|
72 | * @param pvUser Opaque user data.
|
---|
73 | */
|
---|
74 | int VDIoBackendMemTransfer(PVDIOBACKENDMEM pIoBackend, PVDMEMDISK pMemDisk,
|
---|
75 | VDIOTXDIR enmTxDir, uint64_t off, size_t cbTransfer,
|
---|
76 | PRTSGBUF pSgBuf, PFNVDIOCOMPLETE pfnComplete, void *pvUser);
|
---|
77 |
|
---|
78 | #endif /* __VDIoBackendMem_h__ */
|
---|