1 | /** @file
|
---|
2 | * VD Container API - internal interfaces.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2011 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___VBox_VD_Interfaces_Internal_h
|
---|
27 | #define ___VBox_VD_Interfaces_Internal_h
|
---|
28 |
|
---|
29 | #include <iprt/sg.h>
|
---|
30 | #include <VBox/vd-ifs.h>
|
---|
31 |
|
---|
32 | RT_C_DECLS_BEGIN
|
---|
33 |
|
---|
34 | /**
|
---|
35 | * Interface to get the parent state.
|
---|
36 | *
|
---|
37 | * Per-operation interface. Optional, present only if there is a parent, and
|
---|
38 | * used only internally for compacting.
|
---|
39 | */
|
---|
40 | typedef struct VDINTERFACEPARENTSTATE
|
---|
41 | {
|
---|
42 | /**
|
---|
43 | * Common interface header.
|
---|
44 | */
|
---|
45 | VDINTERFACE Core;
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * Read data callback.
|
---|
49 | *
|
---|
50 | * @return VBox status code.
|
---|
51 | * @return VERR_VD_NOT_OPENED if no image is opened in HDD container.
|
---|
52 | * @param pvUser The opaque data passed for the operation.
|
---|
53 | * @param uOffset Offset of first reading byte from start of disk.
|
---|
54 | * Must be aligned to a sector boundary.
|
---|
55 | * @param pvBuffer Pointer to buffer for reading data.
|
---|
56 | * @param cbBuffer Number of bytes to read.
|
---|
57 | * Must be aligned to a sector boundary.
|
---|
58 | */
|
---|
59 | DECLR3CALLBACKMEMBER(int, pfnParentRead, (void *pvUser, uint64_t uOffset, void *pvBuffer, size_t cbBuffer));
|
---|
60 |
|
---|
61 | } VDINTERFACEPARENTSTATE, *PVDINTERFACEPARENTSTATE;
|
---|
62 |
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * Get parent state interface from interface list.
|
---|
66 | *
|
---|
67 | * @return Pointer to the first parent state interface in the list.
|
---|
68 | * @param pVDIfs Pointer to the interface list.
|
---|
69 | */
|
---|
70 | DECLINLINE(PVDINTERFACEPARENTSTATE) VDIfParentStateGet(PVDINTERFACE pVDIfs)
|
---|
71 | {
|
---|
72 | PVDINTERFACE pIf = VDInterfaceGet(pVDIfs, VDINTERFACETYPE_PARENTSTATE);
|
---|
73 |
|
---|
74 | /* Check that the interface descriptor is a progress interface. */
|
---|
75 | AssertMsgReturn( !pIf
|
---|
76 | || ( (pIf->enmInterface == VDINTERFACETYPE_PARENTSTATE)
|
---|
77 | && (pIf->cbSize == sizeof(VDINTERFACEPARENTSTATE))),
|
---|
78 | ("Not a parent state interface"), NULL);
|
---|
79 |
|
---|
80 | return (PVDINTERFACEPARENTSTATE)pIf;
|
---|
81 | }
|
---|
82 |
|
---|
83 | /** Forward declaration. Only visible in the VBoxHDD module. */
|
---|
84 | /** I/O context */
|
---|
85 | typedef struct VDIOCTX *PVDIOCTX;
|
---|
86 | /** Storage backend handle. */
|
---|
87 | typedef struct VDIOSTORAGE *PVDIOSTORAGE;
|
---|
88 | /** Pointer to a storage backend handle. */
|
---|
89 | typedef PVDIOSTORAGE *PPVDIOSTORAGE;
|
---|
90 |
|
---|
91 | /**
|
---|
92 | * Completion callback for meta/userdata reads or writes.
|
---|
93 | *
|
---|
94 | * @return VBox status code.
|
---|
95 | * VINF_SUCCESS if everything was successful and the transfer can continue.
|
---|
96 | * VERR_VD_ASYNC_IO_IN_PROGRESS if there is another data transfer pending.
|
---|
97 | * @param pBackendData The opaque backend data.
|
---|
98 | * @param pIoCtx I/O context associated with this request.
|
---|
99 | * @param pvUser Opaque user data passed during a read/write request.
|
---|
100 | * @param rcReq Status code for the completed request.
|
---|
101 | */
|
---|
102 | typedef DECLCALLBACK(int) FNVDXFERCOMPLETED(void *pBackendData, PVDIOCTX pIoCtx, void *pvUser, int rcReq);
|
---|
103 | /** Pointer to FNVDXFERCOMPLETED() */
|
---|
104 | typedef FNVDXFERCOMPLETED *PFNVDXFERCOMPLETED;
|
---|
105 |
|
---|
106 | /** Metadata transfer handle. */
|
---|
107 | typedef struct VDMETAXFER *PVDMETAXFER;
|
---|
108 | /** Pointer to a metadata transfer handle. */
|
---|
109 | typedef PVDMETAXFER *PPVDMETAXFER;
|
---|
110 |
|
---|
111 |
|
---|
112 | /**
|
---|
113 | * Internal I/O interface between the generic VD layer and the backends.
|
---|
114 | *
|
---|
115 | * Per-image. Always passed to backends.
|
---|
116 | */
|
---|
117 | typedef struct VDINTERFACEIOINT
|
---|
118 | {
|
---|
119 | /**
|
---|
120 | * Common interface header.
|
---|
121 | */
|
---|
122 | VDINTERFACE Core;
|
---|
123 |
|
---|
124 | /**
|
---|
125 | * Open callback
|
---|
126 | *
|
---|
127 | * @return VBox status code.
|
---|
128 | * @param pvUser The opaque data passed on container creation.
|
---|
129 | * @param pszLocation Name of the location to open.
|
---|
130 | * @param fOpen Flags for opening the backend.
|
---|
131 | * See RTFILE_O_* #defines, inventing another set
|
---|
132 | * of open flags is not worth the mapping effort.
|
---|
133 | * @param ppStorage Where to store the storage handle.
|
---|
134 | */
|
---|
135 | DECLR3CALLBACKMEMBER(int, pfnOpen, (void *pvUser, const char *pszLocation,
|
---|
136 | uint32_t fOpen, PPVDIOSTORAGE ppStorage));
|
---|
137 |
|
---|
138 | /**
|
---|
139 | * Close callback.
|
---|
140 | *
|
---|
141 | * @return VBox status code.
|
---|
142 | * @param pvUser The opaque data passed on container creation.
|
---|
143 | * @param pStorage The storage handle to close.
|
---|
144 | */
|
---|
145 | DECLR3CALLBACKMEMBER(int, pfnClose, (void *pvUser, PVDIOSTORAGE pStorage));
|
---|
146 |
|
---|
147 | /**
|
---|
148 | * Delete callback.
|
---|
149 | *
|
---|
150 | * @return VBox status code.
|
---|
151 | * @param pvUser The opaque data passed on container creation.
|
---|
152 | * @param pcszFilename Name of the file to delete.
|
---|
153 | */
|
---|
154 | DECLR3CALLBACKMEMBER(int, pfnDelete, (void *pvUser, const char *pcszFilename));
|
---|
155 |
|
---|
156 | /**
|
---|
157 | * Move callback.
|
---|
158 | *
|
---|
159 | * @return VBox status code.
|
---|
160 | * @param pvUser The opaque data passed on container creation.
|
---|
161 | * @param pcszSrc The path to the source file.
|
---|
162 | * @param pcszDst The path to the destination file.
|
---|
163 | * This file will be created.
|
---|
164 | * @param fMove A combination of the RTFILEMOVE_* flags.
|
---|
165 | */
|
---|
166 | DECLR3CALLBACKMEMBER(int, pfnMove, (void *pvUser, const char *pcszSrc, const char *pcszDst, unsigned fMove));
|
---|
167 |
|
---|
168 | /**
|
---|
169 | * Returns the free space on a disk.
|
---|
170 | *
|
---|
171 | * @return VBox status code.
|
---|
172 | * @param pvUser The opaque data passed on container creation.
|
---|
173 | * @param pcszFilename Name of a file to identify the disk.
|
---|
174 | * @param pcbFreeSpace Where to store the free space of the disk.
|
---|
175 | */
|
---|
176 | DECLR3CALLBACKMEMBER(int, pfnGetFreeSpace, (void *pvUser, const char *pcszFilename, int64_t *pcbFreeSpace));
|
---|
177 |
|
---|
178 | /**
|
---|
179 | * Returns the last modification timestamp of a file.
|
---|
180 | *
|
---|
181 | * @return VBox status code.
|
---|
182 | * @param pvUser The opaque data passed on container creation.
|
---|
183 | * @param pcszFilename Name of a file to identify the disk.
|
---|
184 | * @param pModificationTime Where to store the timestamp of the file.
|
---|
185 | */
|
---|
186 | DECLR3CALLBACKMEMBER(int, pfnGetModificationTime, (void *pvUser, const char *pcszFilename, PRTTIMESPEC pModificationTime));
|
---|
187 |
|
---|
188 | /**
|
---|
189 | * Returns the size of the opened storage backend.
|
---|
190 | *
|
---|
191 | * @return VBox status code.
|
---|
192 | * @param pvUser The opaque data passed on container creation.
|
---|
193 | * @param pStorage The storage handle to get the size from.
|
---|
194 | * @param pcbSize Where to store the size of the storage backend.
|
---|
195 | */
|
---|
196 | DECLR3CALLBACKMEMBER(int, pfnGetSize, (void *pvUser, PVDIOSTORAGE pStorage,
|
---|
197 | uint64_t *pcbSize));
|
---|
198 |
|
---|
199 | /**
|
---|
200 | * Sets the size of the opened storage backend if possible.
|
---|
201 | *
|
---|
202 | * @return VBox status code.
|
---|
203 | * @retval VERR_NOT_SUPPORTED if the backend does not support this operation.
|
---|
204 | * @param pvUser The opaque data passed on container creation.
|
---|
205 | * @param pStorage The storage handle.
|
---|
206 | * @param cbSize The new size of the image.
|
---|
207 | */
|
---|
208 | DECLR3CALLBACKMEMBER(int, pfnSetSize, (void *pvUser, PVDIOSTORAGE pStorage,
|
---|
209 | uint64_t cbSize));
|
---|
210 |
|
---|
211 | /**
|
---|
212 | * Initiate a read request for user data.
|
---|
213 | *
|
---|
214 | * @return VBox status code.
|
---|
215 | * @param pvUser The opaque user data passed on container creation.
|
---|
216 | * @param pStorage The storage handle.
|
---|
217 | * @param uOffset The offset to start reading from.
|
---|
218 | * @param pIoCtx I/O context passed in the read/write callback.
|
---|
219 | * @param cbRead How many bytes to read.
|
---|
220 | */
|
---|
221 | DECLR3CALLBACKMEMBER(int, pfnReadUser, (void *pvUser, PVDIOSTORAGE pStorage,
|
---|
222 | uint64_t uOffset, PVDIOCTX pIoCtx,
|
---|
223 | size_t cbRead));
|
---|
224 |
|
---|
225 | /**
|
---|
226 | * Initiate a write request for user data.
|
---|
227 | *
|
---|
228 | * @return VBox status code.
|
---|
229 | * @param pvUser The opaque user data passed on container creation.
|
---|
230 | * @param pStorage The storage handle.
|
---|
231 | * @param uOffset The offset to start writing to.
|
---|
232 | * @param pIoCtx I/O context passed in the read/write callback.
|
---|
233 | * @param cbWrite How many bytes to write.
|
---|
234 | * @param pfnCompleted Completion callback.
|
---|
235 | * @param pvCompleteUser Opaque user data passed in the completion callback.
|
---|
236 | */
|
---|
237 | DECLR3CALLBACKMEMBER(int, pfnWriteUser, (void *pvUser, PVDIOSTORAGE pStorage,
|
---|
238 | uint64_t uOffset, PVDIOCTX pIoCtx,
|
---|
239 | size_t cbWrite,
|
---|
240 | PFNVDXFERCOMPLETED pfnComplete,
|
---|
241 | void *pvCompleteUser));
|
---|
242 |
|
---|
243 | /**
|
---|
244 | * Reads metadata from storage.
|
---|
245 | * The current I/O context will be halted.
|
---|
246 | *
|
---|
247 | * @returns VBox status code.
|
---|
248 | * @param pvUser The opaque user data passed on container creation.
|
---|
249 | * @param pStorage The storage handle.
|
---|
250 | * @param uOffset Offset to start reading from.
|
---|
251 | * @param pvBuffer Where to store the data.
|
---|
252 | * @param cbBuffer How many bytes to read.
|
---|
253 | * @param pIoCtx The I/O context which triggered the read.
|
---|
254 | * @param ppMetaXfer Where to store the metadata transfer handle on success.
|
---|
255 | * @param pfnCompleted Completion callback.
|
---|
256 | * @param pvCompleteUser Opaque user data passed in the completion callback.
|
---|
257 | *
|
---|
258 | * @notes If pIoCtx is NULL the metadata read is handled synchronously
|
---|
259 | * i.e. the call returns only if the data is available in the given
|
---|
260 | * buffer. ppMetaXfer, pfnCompleted and pvCompleteUser are ignored in that case.
|
---|
261 | * Use the synchronous version only when opening/closing the image
|
---|
262 | * or when doing certain operations like resizing, compacting or repairing
|
---|
263 | * the disk.
|
---|
264 | */
|
---|
265 | DECLR3CALLBACKMEMBER(int, pfnReadMeta, (void *pvUser, PVDIOSTORAGE pStorage,
|
---|
266 | uint64_t uOffset, void *pvBuffer,
|
---|
267 | size_t cbBuffer, PVDIOCTX pIoCtx,
|
---|
268 | PPVDMETAXFER ppMetaXfer,
|
---|
269 | PFNVDXFERCOMPLETED pfnComplete,
|
---|
270 | void *pvCompleteUser));
|
---|
271 |
|
---|
272 | /**
|
---|
273 | * Writes metadata to storage.
|
---|
274 | *
|
---|
275 | * @returns VBox status code.
|
---|
276 | * @param pvUser The opaque user data passed on container creation.
|
---|
277 | * @param pStorage The storage handle.
|
---|
278 | * @param uOffset Offset to start writing to.
|
---|
279 | * @param pvBuffer Written data.
|
---|
280 | * @param cbBuffer How many bytes to write.
|
---|
281 | * @param pIoCtx The I/O context which triggered the write.
|
---|
282 | * @param pfnCompleted Completion callback.
|
---|
283 | * @param pvCompleteUser Opaque user data passed in the completion callback.
|
---|
284 | *
|
---|
285 | * @notes See pfnReadMeta().
|
---|
286 | */
|
---|
287 | DECLR3CALLBACKMEMBER(int, pfnWriteMeta, (void *pvUser, PVDIOSTORAGE pStorage,
|
---|
288 | uint64_t uOffset, const void *pvBuffer,
|
---|
289 | size_t cbBuffer, PVDIOCTX pIoCtx,
|
---|
290 | PFNVDXFERCOMPLETED pfnComplete,
|
---|
291 | void *pvCompleteUser));
|
---|
292 |
|
---|
293 | /**
|
---|
294 | * Releases a metadata transfer handle.
|
---|
295 | * The free space can be used for another transfer.
|
---|
296 | *
|
---|
297 | * @returns nothing.
|
---|
298 | * @param pvUser The opaque user data passed on container creation.
|
---|
299 | * @param pMetaXfer The metadata transfer handle to release.
|
---|
300 | */
|
---|
301 | DECLR3CALLBACKMEMBER(void, pfnMetaXferRelease, (void *pvUser, PVDMETAXFER pMetaXfer));
|
---|
302 |
|
---|
303 | /**
|
---|
304 | * Initiates a flush request.
|
---|
305 | *
|
---|
306 | * @return VBox status code.
|
---|
307 | * @param pvUser The opaque data passed on container creation.
|
---|
308 | * @param pStorage The storage handle to flush.
|
---|
309 | * @param pIoCtx I/O context which triggered the flush.
|
---|
310 | * @param pfnCompleted Completion callback.
|
---|
311 | * @param pvCompleteUser Opaque user data passed in the completion callback.
|
---|
312 | *
|
---|
313 | * @notes See pfnReadMeta().
|
---|
314 | */
|
---|
315 | DECLR3CALLBACKMEMBER(int, pfnFlush, (void *pvUser, PVDIOSTORAGE pStorage,
|
---|
316 | PVDIOCTX pIoCtx,
|
---|
317 | PFNVDXFERCOMPLETED pfnComplete,
|
---|
318 | void *pvCompleteUser));
|
---|
319 |
|
---|
320 | /**
|
---|
321 | * Copies a buffer into the I/O context.
|
---|
322 | *
|
---|
323 | * @return Number of bytes copied.
|
---|
324 | * @param pvUser The opaque user data passed on container creation.
|
---|
325 | * @param pIoCtx I/O context to copy the data to.
|
---|
326 | * @param pvBuffer Buffer to copy.
|
---|
327 | * @param cbBuffer Number of bytes to copy.
|
---|
328 | */
|
---|
329 | DECLR3CALLBACKMEMBER(size_t, pfnIoCtxCopyTo, (void *pvUser, PVDIOCTX pIoCtx,
|
---|
330 | const void *pvBuffer, size_t cbBuffer));
|
---|
331 |
|
---|
332 | /**
|
---|
333 | * Copies data from the I/O context into a buffer.
|
---|
334 | *
|
---|
335 | * @return Number of bytes copied.
|
---|
336 | * @param pvUser The opaque user data passed on container creation.
|
---|
337 | * @param pIoCtx I/O context to copy the data from.
|
---|
338 | * @param pvBuffer Destination buffer.
|
---|
339 | * @param cbBuffer Number of bytes to copy.
|
---|
340 | */
|
---|
341 | DECLR3CALLBACKMEMBER(size_t, pfnIoCtxCopyFrom, (void *pvUser, PVDIOCTX pIoCtx,
|
---|
342 | void *pvBuffer, size_t cbBuffer));
|
---|
343 |
|
---|
344 | /**
|
---|
345 | * Sets the buffer of the given context to a specific byte.
|
---|
346 | *
|
---|
347 | * @return Number of bytes set.
|
---|
348 | * @param pvUser The opaque user data passed on container creation.
|
---|
349 | * @param pIoCtx I/O context to copy the data from.
|
---|
350 | * @param ch The byte to set.
|
---|
351 | * @param cbSet Number of bytes to set.
|
---|
352 | */
|
---|
353 | DECLR3CALLBACKMEMBER(size_t, pfnIoCtxSet, (void *pvUser, PVDIOCTX pIoCtx,
|
---|
354 | int ch, size_t cbSet));
|
---|
355 |
|
---|
356 | /**
|
---|
357 | * Creates a segment array from the I/O context data buffer.
|
---|
358 | *
|
---|
359 | * @returns Number of bytes the array describes.
|
---|
360 | * @param pvUser The opaque user data passed on container creation.
|
---|
361 | * @param pIoCtx I/O context to copy the data from.
|
---|
362 | * @param paSeg The uninitialized segment array.
|
---|
363 | * If NULL pcSeg will contain the number of segments needed
|
---|
364 | * to describe the requested amount of data.
|
---|
365 | * @param pcSeg The number of segments the given array has.
|
---|
366 | * This will hold the actual number of entries needed upon return.
|
---|
367 | * @param cbData Number of bytes the new array should describe.
|
---|
368 | */
|
---|
369 | DECLR3CALLBACKMEMBER(size_t, pfnIoCtxSegArrayCreate, (void *pvUser, PVDIOCTX pIoCtx,
|
---|
370 | PRTSGSEG paSeg, unsigned *pcSeg,
|
---|
371 | size_t cbData));
|
---|
372 | /**
|
---|
373 | * Marks the given number of bytes as completed and continues the I/O context.
|
---|
374 | *
|
---|
375 | * @returns nothing.
|
---|
376 | * @param pvUser The opaque user data passed on container creation.
|
---|
377 | * @param pIoCtx The I/O context.
|
---|
378 | * @param rcReq Status code the request completed with.
|
---|
379 | * @param cbCompleted Number of bytes completed.
|
---|
380 | */
|
---|
381 | DECLR3CALLBACKMEMBER(void, pfnIoCtxCompleted, (void *pvUser, PVDIOCTX pIoCtx,
|
---|
382 | int rcReq, size_t cbCompleted));
|
---|
383 |
|
---|
384 | /**
|
---|
385 | * Returns whether the given I/O context must be treated synchronously.
|
---|
386 | *
|
---|
387 | * @returns true if the I/O context must be processed synchronously
|
---|
388 | * false otherwise.
|
---|
389 | * @param pvUser The opaque user data passed on container creation.
|
---|
390 | * @param pIoCtx The I/O context.
|
---|
391 | */
|
---|
392 | DECLR3CALLBACKMEMBER(bool, pfnIoCtxIsSynchronous, (void *pvUser, PVDIOCTX pIoCtx));
|
---|
393 |
|
---|
394 | /**
|
---|
395 | * Returns whether the user buffer of the I/O context is complete zero
|
---|
396 | * from to current position upto the given number of bytes.
|
---|
397 | *
|
---|
398 | * @returns true if the I/O context user buffer consists solely of zeros
|
---|
399 | * false otherwise.
|
---|
400 | * @param pvUser The opaque user data passed on container creation.
|
---|
401 | * @param pIoCtx The I/O context.
|
---|
402 | * @param cbCheck Number of bytes to check for zeros.
|
---|
403 | * @param fAdvance Flag whether to advance the buffer pointer if true
|
---|
404 | * is returned.
|
---|
405 | */
|
---|
406 | DECLR3CALLBACKMEMBER(bool, pfnIoCtxIsZero, (void *pvUser, PVDIOCTX pIoCtx,
|
---|
407 | size_t cbCheck, bool fAdvance));
|
---|
408 |
|
---|
409 | } VDINTERFACEIOINT, *PVDINTERFACEIOINT;
|
---|
410 |
|
---|
411 | /**
|
---|
412 | * Get internal I/O interface from interface list.
|
---|
413 | *
|
---|
414 | * @return Pointer to the first internal I/O interface in the list.
|
---|
415 | * @param pVDIfs Pointer to the interface list.
|
---|
416 | */
|
---|
417 | DECLINLINE(PVDINTERFACEIOINT) VDIfIoIntGet(PVDINTERFACE pVDIfs)
|
---|
418 | {
|
---|
419 | PVDINTERFACE pIf = VDInterfaceGet(pVDIfs, VDINTERFACETYPE_IOINT);
|
---|
420 |
|
---|
421 | /* Check that the interface descriptor is a progress interface. */
|
---|
422 | AssertMsgReturn( !pIf
|
---|
423 | || ( (pIf->enmInterface == VDINTERFACETYPE_IOINT)
|
---|
424 | && (pIf->cbSize == sizeof(VDINTERFACEIOINT))),
|
---|
425 | ("Not an internal I/O interface"), NULL);
|
---|
426 |
|
---|
427 | return (PVDINTERFACEIOINT)pIf;
|
---|
428 | }
|
---|
429 |
|
---|
430 | DECLINLINE(int) vdIfIoIntFileOpen(PVDINTERFACEIOINT pIfIoInt, const char *pszFilename,
|
---|
431 | uint32_t fOpen, PPVDIOSTORAGE ppStorage)
|
---|
432 | {
|
---|
433 | return pIfIoInt->pfnOpen(pIfIoInt->Core.pvUser, pszFilename, fOpen, ppStorage);
|
---|
434 | }
|
---|
435 |
|
---|
436 | DECLINLINE(int) vdIfIoIntFileClose(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage)
|
---|
437 | {
|
---|
438 | return pIfIoInt->pfnClose(pIfIoInt->Core.pvUser, pStorage);
|
---|
439 | }
|
---|
440 |
|
---|
441 | DECLINLINE(int) vdIfIoIntFileDelete(PVDINTERFACEIOINT pIfIoInt, const char *pszFilename)
|
---|
442 | {
|
---|
443 | return pIfIoInt->pfnDelete(pIfIoInt->Core.pvUser, pszFilename);
|
---|
444 | }
|
---|
445 |
|
---|
446 | DECLINLINE(int) vdIfIoIntFileMove(PVDINTERFACEIOINT pIfIoInt, const char *pszSrc,
|
---|
447 | const char *pszDst, unsigned fMove)
|
---|
448 | {
|
---|
449 | return pIfIoInt->pfnMove(pIfIoInt->Core.pvUser, pszSrc, pszDst, fMove);
|
---|
450 | }
|
---|
451 |
|
---|
452 | DECLINLINE(int) vdIfIoIntFileGetFreeSpace(PVDINTERFACEIOINT pIfIoInt, const char *pszFilename,
|
---|
453 | int64_t *pcbFree)
|
---|
454 | {
|
---|
455 | return pIfIoInt->pfnGetFreeSpace(pIfIoInt->Core.pvUser, pszFilename, pcbFree);
|
---|
456 | }
|
---|
457 |
|
---|
458 | DECLINLINE(int) vdIfIoIntFileGetModificationTime(PVDINTERFACEIOINT pIfIoInt, const char *pcszFilename,
|
---|
459 | PRTTIMESPEC pModificationTime)
|
---|
460 | {
|
---|
461 | return pIfIoInt->pfnGetModificationTime(pIfIoInt->Core.pvUser, pcszFilename,
|
---|
462 | pModificationTime);
|
---|
463 | }
|
---|
464 |
|
---|
465 | DECLINLINE(int) vdIfIoIntFileGetSize(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage,
|
---|
466 | uint64_t *pcbSize)
|
---|
467 | {
|
---|
468 | return pIfIoInt->pfnGetSize(pIfIoInt->Core.pvUser, pStorage, pcbSize);
|
---|
469 | }
|
---|
470 |
|
---|
471 | DECLINLINE(int) vdIfIoIntFileSetSize(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage,
|
---|
472 | uint64_t cbSize)
|
---|
473 | {
|
---|
474 | return pIfIoInt->pfnSetSize(pIfIoInt->Core.pvUser, pStorage, cbSize);
|
---|
475 | }
|
---|
476 |
|
---|
477 | DECLINLINE(int) vdIfIoIntFileWriteSync(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage,
|
---|
478 | uint64_t uOffset, const void *pvBuffer, size_t cbBuffer)
|
---|
479 | {
|
---|
480 | return pIfIoInt->pfnWriteMeta(pIfIoInt->Core.pvUser, pStorage,
|
---|
481 | uOffset, pvBuffer, cbBuffer, NULL,
|
---|
482 | NULL, NULL);
|
---|
483 | }
|
---|
484 |
|
---|
485 | DECLINLINE(int) vdIfIoIntFileReadSync(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage,
|
---|
486 | uint64_t uOffset, void *pvBuffer, size_t cbBuffer)
|
---|
487 | {
|
---|
488 | return pIfIoInt->pfnReadMeta(pIfIoInt->Core.pvUser, pStorage,
|
---|
489 | uOffset, pvBuffer, cbBuffer, NULL,
|
---|
490 | NULL, NULL, NULL);
|
---|
491 | }
|
---|
492 |
|
---|
493 | DECLINLINE(int) vdIfIoIntFileFlushSync(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage)
|
---|
494 | {
|
---|
495 | return pIfIoInt->pfnFlush(pIfIoInt->Core.pvUser, pStorage, NULL, NULL, NULL);
|
---|
496 | }
|
---|
497 |
|
---|
498 | DECLINLINE(int) vdIfIoIntFileReadUser(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage,
|
---|
499 | uint64_t uOffset, PVDIOCTX pIoCtx, size_t cbRead)
|
---|
500 | {
|
---|
501 | return pIfIoInt->pfnReadUser(pIfIoInt->Core.pvUser, pStorage,
|
---|
502 | uOffset, pIoCtx, cbRead);
|
---|
503 | }
|
---|
504 |
|
---|
505 | DECLINLINE(int) vdIfIoIntFileWriteUser(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage,
|
---|
506 | uint64_t uOffset, PVDIOCTX pIoCtx, size_t cbWrite,
|
---|
507 | PFNVDXFERCOMPLETED pfnComplete,
|
---|
508 | void *pvCompleteUser)
|
---|
509 | {
|
---|
510 | return pIfIoInt->pfnWriteUser(pIfIoInt->Core.pvUser, pStorage,
|
---|
511 | uOffset, pIoCtx, cbWrite, pfnComplete,
|
---|
512 | pvCompleteUser);
|
---|
513 | }
|
---|
514 |
|
---|
515 | DECLINLINE(int) vdIfIoIntFileReadMeta(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage,
|
---|
516 | uint64_t uOffset, void *pvBuffer,
|
---|
517 | size_t cbBuffer, PVDIOCTX pIoCtx,
|
---|
518 | PPVDMETAXFER ppMetaXfer,
|
---|
519 | PFNVDXFERCOMPLETED pfnComplete,
|
---|
520 | void *pvCompleteUser)
|
---|
521 | {
|
---|
522 | return pIfIoInt->pfnReadMeta(pIfIoInt->Core.pvUser, pStorage,
|
---|
523 | uOffset, pvBuffer, cbBuffer, pIoCtx,
|
---|
524 | ppMetaXfer, pfnComplete, pvCompleteUser);
|
---|
525 | }
|
---|
526 |
|
---|
527 | DECLINLINE(int) vdIfIoIntFileWriteMeta(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage,
|
---|
528 | uint64_t uOffset, void *pvBuffer,
|
---|
529 | size_t cbBuffer, PVDIOCTX pIoCtx,
|
---|
530 | PFNVDXFERCOMPLETED pfnComplete,
|
---|
531 | void *pvCompleteUser)
|
---|
532 | {
|
---|
533 | return pIfIoInt->pfnWriteMeta(pIfIoInt->Core.pvUser, pStorage,
|
---|
534 | uOffset, pvBuffer, cbBuffer, pIoCtx,
|
---|
535 | pfnComplete, pvCompleteUser);
|
---|
536 | }
|
---|
537 |
|
---|
538 | DECLINLINE(void) vdIfIoIntMetaXferRelease(PVDINTERFACEIOINT pIfIoInt, PVDMETAXFER pMetaXfer)
|
---|
539 | {
|
---|
540 | pIfIoInt->pfnMetaXferRelease(pIfIoInt->Core.pvUser, pMetaXfer);
|
---|
541 | }
|
---|
542 |
|
---|
543 | DECLINLINE(int) vdIfIoIntFileFlush(PVDINTERFACEIOINT pIfIoInt, PVDIOSTORAGE pStorage,
|
---|
544 | PVDIOCTX pIoCtx, PFNVDXFERCOMPLETED pfnComplete,
|
---|
545 | void *pvCompleteUser)
|
---|
546 | {
|
---|
547 | return pIfIoInt->pfnFlush(pIfIoInt->Core.pvUser, pStorage, pIoCtx, pfnComplete,
|
---|
548 | pvCompleteUser);
|
---|
549 | }
|
---|
550 |
|
---|
551 | DECLINLINE(size_t) vdIfIoIntIoCtxCopyTo(PVDINTERFACEIOINT pIfIoInt, PVDIOCTX pIoCtx,
|
---|
552 | const void *pvBuffer, size_t cbBuffer)
|
---|
553 | {
|
---|
554 | return pIfIoInt->pfnIoCtxCopyTo(pIfIoInt->Core.pvUser, pIoCtx, pvBuffer, cbBuffer);
|
---|
555 | }
|
---|
556 |
|
---|
557 | DECLINLINE(size_t) vdIfIoIntIoCtxCopyFrom(PVDINTERFACEIOINT pIfIoInt, PVDIOCTX pIoCtx,
|
---|
558 | void *pvBuffer, size_t cbBuffer)
|
---|
559 | {
|
---|
560 | return pIfIoInt->pfnIoCtxCopyTo(pIfIoInt->Core.pvUser, pIoCtx, pvBuffer, cbBuffer);
|
---|
561 | }
|
---|
562 |
|
---|
563 | DECLINLINE(size_t) vdIfIoIntIoCtxSet(PVDINTERFACEIOINT pIfIoInt, PVDIOCTX pIoCtx,
|
---|
564 | int ch, size_t cbSet)
|
---|
565 | {
|
---|
566 | return pIfIoInt->pfnIoCtxSet(pIfIoInt->Core.pvUser, pIoCtx, ch, cbSet);
|
---|
567 | }
|
---|
568 |
|
---|
569 | DECLINLINE(size_t) vdIfIoIntIoCtxSegArrayCreate(PVDINTERFACEIOINT pIfIoInt, PVDIOCTX pIoCtx,
|
---|
570 | PRTSGSEG paSeg, unsigned *pcSeg,
|
---|
571 | size_t cbData)
|
---|
572 | {
|
---|
573 | return pIfIoInt->pfnIoCtxSegArrayCreate(pIfIoInt->Core.pvUser, pIoCtx, paSeg, pcSeg, cbData);
|
---|
574 | }
|
---|
575 |
|
---|
576 | DECLINLINE(bool) vdIfIoIntIoCtxIsSynchronous(PVDINTERFACEIOINT pIfIoInt, PVDIOCTX pIoCtx)
|
---|
577 | {
|
---|
578 | return pIfIoInt->pfnIoCtxIsSynchronous(pIfIoInt->Core.pvUser, pIoCtx);
|
---|
579 | }
|
---|
580 |
|
---|
581 | DECLINLINE(bool) vdIfIoIntIoCtxIsZero(PVDINTERFACEIOINT pIfIoInt, PVDIOCTX pIoCtx,
|
---|
582 | size_t cbCheck, bool fAdvance)
|
---|
583 | {
|
---|
584 | return pIfIoInt->pfnIoCtxIsZero(pIfIoInt->Core.pvUser, pIoCtx, cbCheck, fAdvance);
|
---|
585 | }
|
---|
586 |
|
---|
587 |
|
---|
588 | RT_C_DECLS_END
|
---|
589 |
|
---|
590 | /** @} */
|
---|
591 |
|
---|
592 | #endif
|
---|