1 | /** @file
|
---|
2 | * VD: Image backend interface.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2019 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_INCLUDED_vd_image_backend_h
|
---|
27 | #define VBOX_INCLUDED_vd_image_backend_h
|
---|
28 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
29 | # pragma once
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #include <VBox/vd.h>
|
---|
33 | #include <VBox/vd-common.h>
|
---|
34 | #include <VBox/vd-ifs-internal.h>
|
---|
35 |
|
---|
36 |
|
---|
37 | /** @name VBox HDD backend write flags
|
---|
38 | * @{
|
---|
39 | */
|
---|
40 | /** Do not allocate a new block on this write. This is just an advisory
|
---|
41 | * flag. The backend may still decide in some circumstances that it wants
|
---|
42 | * to ignore this flag (which may cause extra dynamic image expansion). */
|
---|
43 | #define VD_WRITE_NO_ALLOC RT_BIT(1)
|
---|
44 | /** @}*/
|
---|
45 |
|
---|
46 | /** @name VBox HDD backend discard flags
|
---|
47 | * @{
|
---|
48 | */
|
---|
49 | /** Don't discard block but mark the given range as unused
|
---|
50 | * (usually by writing 0's to it).
|
---|
51 | * This doesn't require the range to be aligned on a block boundary but
|
---|
52 | * the image size might not be decreased. */
|
---|
53 | #define VD_DISCARD_MARK_UNUSED RT_BIT(0)
|
---|
54 | /** @}*/
|
---|
55 |
|
---|
56 | /** @name VBox HDD backend metadata traverse flags
|
---|
57 | * @{
|
---|
58 | */
|
---|
59 | /** Include per block metadata while traversing the metadata.
|
---|
60 | * This might take much longer instead of traversing just global metadata. */
|
---|
61 | #define VD_TRAVERSE_METADATA_INCLUDE_PER_BLOCK_METADATA RT_BIT(0)
|
---|
62 | /** @}*/
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * Image format backend interface used by VBox HDD Container implementation.
|
---|
66 | */
|
---|
67 | typedef struct VDIMAGEBACKEND
|
---|
68 | {
|
---|
69 | /** Structure version. VD_IMGBACKEND_VERSION defines the current version. */
|
---|
70 | uint32_t u32Version;
|
---|
71 | /** The name of the backend (constant string). */
|
---|
72 | const char *pszBackendName;
|
---|
73 | /** The capabilities of the backend. */
|
---|
74 | uint64_t uBackendCaps;
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * Pointer to a NULL-terminated array, containing the supported
|
---|
78 | * file extensions. Note that some backends do not work on files, so this
|
---|
79 | * pointer may just contain NULL.
|
---|
80 | */
|
---|
81 | PCVDFILEEXTENSION paFileExtensions;
|
---|
82 |
|
---|
83 | /**
|
---|
84 | * Pointer to an array of structs describing each supported config key.
|
---|
85 | * Terminated by a NULL config key. Note that some backends do not support
|
---|
86 | * the configuration interface, so this pointer may just contain NULL.
|
---|
87 | * Mandatory if the backend sets VD_CAP_CONFIG.
|
---|
88 | */
|
---|
89 | PCVDCONFIGINFO paConfigInfo;
|
---|
90 |
|
---|
91 | /**
|
---|
92 | * Check whether the file is supported by the backend.
|
---|
93 | *
|
---|
94 | * @returns VBox status code.
|
---|
95 | * @param pszFilename Name of the image file.
|
---|
96 | * @param pVDIfsDisk Pointer to the per-disk VD interface list.
|
---|
97 | * @param pVDIfsImage Pointer to the per-image VD interface list.
|
---|
98 | * @param penmType Returns the supported device type on success.
|
---|
99 | */
|
---|
100 | DECLR3CALLBACKMEMBER(int, pfnProbe, (const char *pszFilename, PVDINTERFACE pVDIfsDisk,
|
---|
101 | PVDINTERFACE pVDIfsImage, VDTYPE *penmType));
|
---|
102 |
|
---|
103 | /**
|
---|
104 | * Open a disk image.
|
---|
105 | *
|
---|
106 | * @returns VBox status code.
|
---|
107 | * @param pszFilename Name of the image file to open. Guaranteed to be available and
|
---|
108 | * unchanged during the lifetime of this image.
|
---|
109 | * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants.
|
---|
110 | * @param pVDIfsDisk Pointer to the per-disk VD interface list.
|
---|
111 | * @param pVDIfsImage Pointer to the per-image VD interface list.
|
---|
112 | * @param enmType Requested type of the image.
|
---|
113 | * @param ppBackendData Opaque state data for this image.
|
---|
114 | */
|
---|
115 | DECLR3CALLBACKMEMBER(int, pfnOpen, (const char *pszFilename, unsigned uOpenFlags,
|
---|
116 | PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
|
---|
117 | VDTYPE enmType, void **ppBackendData));
|
---|
118 |
|
---|
119 | /**
|
---|
120 | * Create a disk image.
|
---|
121 | *
|
---|
122 | * @returns VBox status code.
|
---|
123 | * @param pszFilename Name of the image file to create. Guaranteed to be available and
|
---|
124 | * unchanged during the lifetime of this image.
|
---|
125 | * @param cbSize Image size in bytes.
|
---|
126 | * @param uImageFlags Flags specifying special image features.
|
---|
127 | * @param pszComment Pointer to image comment. NULL is ok.
|
---|
128 | * @param pPCHSGeometry Physical drive geometry CHS <= (16383,16,255).
|
---|
129 | * @param pLCHSGeometry Logical drive geometry CHS <= (1024,255,63).
|
---|
130 | * @param pUuid New UUID of the image. Not NULL.
|
---|
131 | * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants.
|
---|
132 | * @param uPercentStart Starting value for progress percentage.
|
---|
133 | * @param uPercentSpan Span for varying progress percentage.
|
---|
134 | * @param pVDIfsDisk Pointer to the per-disk VD interface list.
|
---|
135 | * @param pVDIfsImage Pointer to the per-image VD interface list.
|
---|
136 | * @param pVDIfsOperation Pointer to the per-operation VD interface list.
|
---|
137 | * @param enmType Requested type of the image.
|
---|
138 | * @param ppBackendData Opaque state data for this image.
|
---|
139 | */
|
---|
140 | DECLR3CALLBACKMEMBER(int, pfnCreate, (const char *pszFilename, uint64_t cbSize,
|
---|
141 | unsigned uImageFlags, const char *pszComment,
|
---|
142 | PCVDGEOMETRY pPCHSGeometry,
|
---|
143 | PCVDGEOMETRY pLCHSGeometry,
|
---|
144 | PCRTUUID pUuid, unsigned uOpenFlags,
|
---|
145 | unsigned uPercentStart, unsigned uPercentSpan,
|
---|
146 | PVDINTERFACE pVDIfsDisk,
|
---|
147 | PVDINTERFACE pVDIfsImage,
|
---|
148 | PVDINTERFACE pVDIfsOperation,
|
---|
149 | VDTYPE enmType,
|
---|
150 | void **ppBackendData));
|
---|
151 |
|
---|
152 | /**
|
---|
153 | * Rename a disk image. Only needs to work as long as the operating
|
---|
154 | * system's rename file functionality is usable. If an attempt is made to
|
---|
155 | * rename an image to a location on another disk/filesystem, this function
|
---|
156 | * may just fail with an appropriate error code (not changing the opened
|
---|
157 | * image data at all). Also works only on images which actually refer to
|
---|
158 | * regular files. May be NULL.
|
---|
159 | *
|
---|
160 | * @returns VBox status code.
|
---|
161 | * @param pBackendData Opaque state data for this image.
|
---|
162 | * @param pszFilename New name of the image file. Guaranteed to be available and
|
---|
163 | * unchanged during the lifetime of this image.
|
---|
164 | */
|
---|
165 | DECLR3CALLBACKMEMBER(int, pfnRename, (void *pBackendData, const char *pszFilename));
|
---|
166 |
|
---|
167 | /**
|
---|
168 | * Close a disk image.
|
---|
169 | *
|
---|
170 | * @returns VBox status code.
|
---|
171 | * @param pBackendData Opaque state data for this image.
|
---|
172 | * @param fDelete If true, delete the image from the host disk.
|
---|
173 | */
|
---|
174 | DECLR3CALLBACKMEMBER(int, pfnClose, (void *pBackendData, bool fDelete));
|
---|
175 |
|
---|
176 | /**
|
---|
177 | * Start a read request.
|
---|
178 | *
|
---|
179 | * @returns VBox status code.
|
---|
180 | * @param pBackendData Opaque state data for this image.
|
---|
181 | * @param uOffset The offset of the virtual disk to read from.
|
---|
182 | * @param cbToRead How many bytes to read.
|
---|
183 | * @param pIoCtx I/O context associated with this request.
|
---|
184 | * @param pcbActuallyRead Pointer to returned number of bytes read.
|
---|
185 | */
|
---|
186 | DECLR3CALLBACKMEMBER(int, pfnRead, (void *pBackendData, uint64_t uOffset, size_t cbToRead,
|
---|
187 | PVDIOCTX pIoCtx, size_t *pcbActuallyRead));
|
---|
188 |
|
---|
189 | /**
|
---|
190 | * Start a write request.
|
---|
191 | *
|
---|
192 | * @returns VBox status code.
|
---|
193 | * @param pBackendData Opaque state data for this image.
|
---|
194 | * @param uOffset The offset of the virtual disk to write to.
|
---|
195 | * @param cbToWrite How many bytes to write.
|
---|
196 | * @param pIoCtx I/O context associated with this request.
|
---|
197 | * @param pcbWriteProcess Pointer to returned number of bytes that could
|
---|
198 | * be processed. In case the function returned
|
---|
199 | * VERR_VD_BLOCK_FREE this is the number of bytes
|
---|
200 | * that could be written in a full block write,
|
---|
201 | * when prefixed/postfixed by the appropriate
|
---|
202 | * amount of (previously read) padding data.
|
---|
203 | * @param pcbPreRead Pointer to the returned amount of data that must
|
---|
204 | * be prefixed to perform a full block write.
|
---|
205 | * @param pcbPostRead Pointer to the returned amount of data that must
|
---|
206 | * be postfixed to perform a full block write.
|
---|
207 | * @param fWrite Flags which affect write behavior. Combination
|
---|
208 | * of the VD_WRITE_* flags.
|
---|
209 | */
|
---|
210 | DECLR3CALLBACKMEMBER(int, pfnWrite, (void *pBackendData, uint64_t uOffset, size_t cbToWrite,
|
---|
211 | PVDIOCTX pIoCtx,
|
---|
212 | size_t *pcbWriteProcess, size_t *pcbPreRead,
|
---|
213 | size_t *pcbPostRead, unsigned fWrite));
|
---|
214 |
|
---|
215 | /**
|
---|
216 | * Flush data to disk.
|
---|
217 | *
|
---|
218 | * @returns VBox status code.
|
---|
219 | * @param pBackendData Opaque state data for this image.
|
---|
220 | * @param pIoCtx I/O context associated with this request.
|
---|
221 | */
|
---|
222 | DECLR3CALLBACKMEMBER(int, pfnFlush, (void *pBackendData, PVDIOCTX pIoCtx));
|
---|
223 |
|
---|
224 | /**
|
---|
225 | * Discards the given amount of bytes decreasing the size of the image if possible
|
---|
226 | *
|
---|
227 | * @returns VBox status code.
|
---|
228 | * @retval VERR_VD_DISCARD_ALIGNMENT_NOT_MET if the range doesn't meet the required alignment
|
---|
229 | * for the discard.
|
---|
230 | * @param pBackendData Opaque state data for this image.
|
---|
231 | * @param pIoCtx I/O context associated with this request.
|
---|
232 | * @param uOffset The offset of the first byte to discard.
|
---|
233 | * @param cbDiscard How many bytes to discard.
|
---|
234 | * @param pcbPreAllocated Pointer to the returned amount of bytes that must
|
---|
235 | * be discarded before the range to perform a full
|
---|
236 | * block discard.
|
---|
237 | * @param pcbPostAllocated Pointer to the returned amount of bytes that must
|
---|
238 | * be discarded after the range to perform a full
|
---|
239 | * block discard.
|
---|
240 | * @param pcbActuallyDiscarded Pointer to the returned amount of bytes which
|
---|
241 | * could be actually discarded.
|
---|
242 | * @param ppbmAllocationBitmap Where to store the pointer to the allocation bitmap
|
---|
243 | * if VERR_VD_DISCARD_ALIGNMENT_NOT_MET is returned or NULL
|
---|
244 | * if the allocation bitmap should be returned.
|
---|
245 | * @param fDiscard Flags which affect discard behavior. Combination
|
---|
246 | * of the VD_DISCARD_* flags.
|
---|
247 | */
|
---|
248 | DECLR3CALLBACKMEMBER(int, pfnDiscard, (void *pBackendData, PVDIOCTX pIoCtx,
|
---|
249 | uint64_t uOffset, size_t cbDiscard,
|
---|
250 | size_t *pcbPreAllocated,
|
---|
251 | size_t *pcbPostAllocated,
|
---|
252 | size_t *pcbActuallyDiscarded,
|
---|
253 | void **ppbmAllocationBitmap,
|
---|
254 | unsigned fDiscard));
|
---|
255 |
|
---|
256 | /**
|
---|
257 | * Get the version of a disk image.
|
---|
258 | *
|
---|
259 | * @returns version of disk image.
|
---|
260 | * @param pBackendData Opaque state data for this image.
|
---|
261 | */
|
---|
262 | DECLR3CALLBACKMEMBER(unsigned, pfnGetVersion, (void *pBackendData));
|
---|
263 |
|
---|
264 | /**
|
---|
265 | * Get the file size of a disk image.
|
---|
266 | *
|
---|
267 | * @returns size of disk image in bytes.
|
---|
268 | * @param pBackendData Opaque state data for this image.
|
---|
269 | */
|
---|
270 | DECLR3CALLBACKMEMBER(uint64_t, pfnGetFileSize, (void *pBackendData));
|
---|
271 |
|
---|
272 | /**
|
---|
273 | * Get virtual disk PCHS geometry stored in a disk image.
|
---|
274 | *
|
---|
275 | * @returns VBox status code.
|
---|
276 | * @returns VERR_VD_GEOMETRY_NOT_SET if no geometry present in the image.
|
---|
277 | * @param pBackendData Opaque state data for this image.
|
---|
278 | * @param pPCHSGeometry Where to store the geometry. Not NULL.
|
---|
279 | */
|
---|
280 | DECLR3CALLBACKMEMBER(int, pfnGetPCHSGeometry, (void *pBackendData, PVDGEOMETRY pPCHSGeometry));
|
---|
281 |
|
---|
282 | /**
|
---|
283 | * Set virtual disk PCHS geometry stored in a disk image.
|
---|
284 | * Only called if geometry is different than before.
|
---|
285 | *
|
---|
286 | * @returns VBox status code.
|
---|
287 | * @param pBackendData Opaque state data for this image.
|
---|
288 | * @param pPCHSGeometry Where to load the geometry from. Not NULL.
|
---|
289 | */
|
---|
290 | DECLR3CALLBACKMEMBER(int, pfnSetPCHSGeometry, (void *pBackendData, PCVDGEOMETRY pPCHSGeometry));
|
---|
291 |
|
---|
292 | /**
|
---|
293 | * Get virtual disk LCHS geometry stored in a disk image.
|
---|
294 | *
|
---|
295 | * @returns VBox status code.
|
---|
296 | * @returns VERR_VD_GEOMETRY_NOT_SET if no geometry present in the image.
|
---|
297 | * @param pBackendData Opaque state data for this image.
|
---|
298 | * @param pLCHSGeometry Where to store the geometry. Not NULL.
|
---|
299 | */
|
---|
300 | DECLR3CALLBACKMEMBER(int, pfnGetLCHSGeometry, (void *pBackendData, PVDGEOMETRY pLCHSGeometry));
|
---|
301 |
|
---|
302 | /**
|
---|
303 | * Set virtual disk LCHS geometry stored in a disk image.
|
---|
304 | * Only called if geometry is different than before.
|
---|
305 | *
|
---|
306 | * @returns VBox status code.
|
---|
307 | * @param pBackendData Opaque state data for this image.
|
---|
308 | * @param pLCHSGeometry Where to load the geometry from. Not NULL.
|
---|
309 | */
|
---|
310 | DECLR3CALLBACKMEMBER(int, pfnSetLCHSGeometry, (void *pBackendData, PCVDGEOMETRY pLCHSGeometry));
|
---|
311 |
|
---|
312 | /**
|
---|
313 | * Returns a region list for the disk image if supported, optional.
|
---|
314 | *
|
---|
315 | * @returns VBox status code.
|
---|
316 | * @retval VERR_NOT_SUPPORTED if region lists are not supported for this kind of image.
|
---|
317 | * @param pBackendData Opaque state data for this image.
|
---|
318 | * @param ppRegionList Where to store the pointer to the region list on success.
|
---|
319 | */
|
---|
320 | DECLR3CALLBACKMEMBER(int, pfnQueryRegions, (void *pBackendData, PCVDREGIONLIST *ppRegionList));
|
---|
321 |
|
---|
322 | /**
|
---|
323 | * Releases the region list acquired with VDIMAGEBACKEND::pfnQueryRegions() before.
|
---|
324 | *
|
---|
325 | * @returns nothing.
|
---|
326 | * @param pBackendData Opaque state data for this image.
|
---|
327 | * @param pRegionList The region list to release.
|
---|
328 | */
|
---|
329 | DECLR3CALLBACKMEMBER(void, pfnRegionListRelease, (void *pBackendData, PCVDREGIONLIST pRegionList));
|
---|
330 |
|
---|
331 | /**
|
---|
332 | * Get the image flags of a disk image.
|
---|
333 | *
|
---|
334 | * @returns image flags of disk image (VD_IMAGE_FLAGS_XXX).
|
---|
335 | * @param pBackendData Opaque state data for this image.
|
---|
336 | */
|
---|
337 | DECLR3CALLBACKMEMBER(unsigned, pfnGetImageFlags, (void *pBackendData));
|
---|
338 |
|
---|
339 | /**
|
---|
340 | * Get the open flags of a disk image.
|
---|
341 | *
|
---|
342 | * @returns open flags of disk image (VD_OPEN_FLAGS_XXX).
|
---|
343 | * @param pBackendData Opaque state data for this image.
|
---|
344 | */
|
---|
345 | DECLR3CALLBACKMEMBER(unsigned, pfnGetOpenFlags, (void *pBackendData));
|
---|
346 |
|
---|
347 | /**
|
---|
348 | * Set the open flags of a disk image.
|
---|
349 | *
|
---|
350 | * May cause the image to be locked in a different mode or be reopened (which
|
---|
351 | * can fail).
|
---|
352 | *
|
---|
353 | * @returns VBox status code.
|
---|
354 | * @param pBackendData Opaque state data for this image.
|
---|
355 | * @param uOpenFlags New open flags for this image (VD_OPEN_FLAGS_XXX).
|
---|
356 | */
|
---|
357 | DECLR3CALLBACKMEMBER(int, pfnSetOpenFlags, (void *pBackendData, unsigned uOpenFlags));
|
---|
358 |
|
---|
359 | /**
|
---|
360 | * Get comment of a disk image.
|
---|
361 | *
|
---|
362 | * @returns VBox status code.
|
---|
363 | * @param pBackendData Opaque state data for this image.
|
---|
364 | * @param pszComment Where to store the comment.
|
---|
365 | * @param cbComment Size of the comment buffer.
|
---|
366 | */
|
---|
367 | DECLR3CALLBACKMEMBER(int, pfnGetComment, (void *pBackendData, char *pszComment, size_t cbComment));
|
---|
368 |
|
---|
369 | /**
|
---|
370 | * Set comment of a disk image.
|
---|
371 | *
|
---|
372 | * @returns VBox status code.
|
---|
373 | * @param pBackendData Opaque state data for this image.
|
---|
374 | * @param pszComment Where to get the comment from. NULL resets comment.
|
---|
375 | * The comment is silently truncated if the image format
|
---|
376 | * limit is exceeded.
|
---|
377 | */
|
---|
378 | DECLR3CALLBACKMEMBER(int, pfnSetComment, (void *pBackendData, const char *pszComment));
|
---|
379 |
|
---|
380 | /**
|
---|
381 | * Get UUID of a disk image.
|
---|
382 | *
|
---|
383 | * @returns VBox status code.
|
---|
384 | * @param pBackendData Opaque state data for this image.
|
---|
385 | * @param pUuid Where to store the image UUID.
|
---|
386 | */
|
---|
387 | DECLR3CALLBACKMEMBER(int, pfnGetUuid, (void *pBackendData, PRTUUID pUuid));
|
---|
388 |
|
---|
389 | /**
|
---|
390 | * Set UUID of a disk image.
|
---|
391 | *
|
---|
392 | * @returns VBox status code.
|
---|
393 | * @param pBackendData Opaque state data for this image.
|
---|
394 | * @param pUuid Where to get the image UUID from.
|
---|
395 | */
|
---|
396 | DECLR3CALLBACKMEMBER(int, pfnSetUuid, (void *pBackendData, PCRTUUID pUuid));
|
---|
397 |
|
---|
398 | /**
|
---|
399 | * Get last modification UUID of a disk image.
|
---|
400 | *
|
---|
401 | * @returns VBox status code.
|
---|
402 | * @param pBackendData Opaque state data for this image.
|
---|
403 | * @param pUuid Where to store the image modification UUID.
|
---|
404 | */
|
---|
405 | DECLR3CALLBACKMEMBER(int, pfnGetModificationUuid, (void *pBackendData, PRTUUID pUuid));
|
---|
406 |
|
---|
407 | /**
|
---|
408 | * Set last modification UUID of a disk image.
|
---|
409 | *
|
---|
410 | * @returns VBox status code.
|
---|
411 | * @param pBackendData Opaque state data for this image.
|
---|
412 | * @param pUuid Where to get the image modification UUID from.
|
---|
413 | */
|
---|
414 | DECLR3CALLBACKMEMBER(int, pfnSetModificationUuid, (void *pBackendData, PCRTUUID pUuid));
|
---|
415 |
|
---|
416 | /**
|
---|
417 | * Get parent UUID of a disk image.
|
---|
418 | *
|
---|
419 | * @returns VBox status code.
|
---|
420 | * @param pBackendData Opaque state data for this image.
|
---|
421 | * @param pUuid Where to store the parent image UUID.
|
---|
422 | */
|
---|
423 | DECLR3CALLBACKMEMBER(int, pfnGetParentUuid, (void *pBackendData, PRTUUID pUuid));
|
---|
424 |
|
---|
425 | /**
|
---|
426 | * Set parent UUID of a disk image.
|
---|
427 | *
|
---|
428 | * @returns VBox status code.
|
---|
429 | * @param pBackendData Opaque state data for this image.
|
---|
430 | * @param pUuid Where to get the parent image UUID from.
|
---|
431 | */
|
---|
432 | DECLR3CALLBACKMEMBER(int, pfnSetParentUuid, (void *pBackendData, PCRTUUID pUuid));
|
---|
433 |
|
---|
434 | /**
|
---|
435 | * Get parent modification UUID of a disk image.
|
---|
436 | *
|
---|
437 | * @returns VBox status code.
|
---|
438 | * @param pBackendData Opaque state data for this image.
|
---|
439 | * @param pUuid Where to store the parent image modification UUID.
|
---|
440 | */
|
---|
441 | DECLR3CALLBACKMEMBER(int, pfnGetParentModificationUuid, (void *pBackendData, PRTUUID pUuid));
|
---|
442 |
|
---|
443 | /**
|
---|
444 | * Set parent modification UUID of a disk image.
|
---|
445 | *
|
---|
446 | * @returns VBox status code.
|
---|
447 | * @param pBackendData Opaque state data for this image.
|
---|
448 | * @param pUuid Where to get the parent image modification UUID from.
|
---|
449 | */
|
---|
450 | DECLR3CALLBACKMEMBER(int, pfnSetParentModificationUuid, (void *pBackendData, PCRTUUID pUuid));
|
---|
451 |
|
---|
452 | /**
|
---|
453 | * Dump information about a disk image.
|
---|
454 | *
|
---|
455 | * @param pBackendData Opaque state data for this image.
|
---|
456 | */
|
---|
457 | DECLR3CALLBACKMEMBER(void, pfnDump, (void *pBackendData));
|
---|
458 |
|
---|
459 | /**
|
---|
460 | * Get a time stamp of a disk image. May be NULL.
|
---|
461 | *
|
---|
462 | * @returns VBox status code.
|
---|
463 | * @param pBackendData Opaque state data for this image.
|
---|
464 | * @param pTimestamp Where to store the time stamp.
|
---|
465 | */
|
---|
466 | DECLR3CALLBACKMEMBER(int, pfnGetTimestamp, (void *pBackendData, PRTTIMESPEC pTimestamp));
|
---|
467 |
|
---|
468 | /**
|
---|
469 | * Get the parent time stamp of a disk image. May be NULL.
|
---|
470 | *
|
---|
471 | * @returns VBox status code.
|
---|
472 | * @param pBackendData Opaque state data for this image.
|
---|
473 | * @param pTimestamp Where to store the time stamp.
|
---|
474 | */
|
---|
475 | DECLR3CALLBACKMEMBER(int, pfnGetParentTimestamp, (void *pBackendData, PRTTIMESPEC pTimestamp));
|
---|
476 |
|
---|
477 | /**
|
---|
478 | * Set the parent time stamp of a disk image. May be NULL.
|
---|
479 | *
|
---|
480 | * @returns VBox status code.
|
---|
481 | * @param pBackendData Opaque state data for this image.
|
---|
482 | * @param pTimestamp Where to get the time stamp from.
|
---|
483 | */
|
---|
484 | DECLR3CALLBACKMEMBER(int, pfnSetParentTimestamp, (void *pBackendData, PCRTTIMESPEC pTimestamp));
|
---|
485 |
|
---|
486 | /**
|
---|
487 | * Get the relative path to parent image. May be NULL.
|
---|
488 | *
|
---|
489 | * @returns VBox status code.
|
---|
490 | * @param pBackendData Opaque state data for this image.
|
---|
491 | * @param ppszParentFilename Where to store the path.
|
---|
492 | */
|
---|
493 | DECLR3CALLBACKMEMBER(int, pfnGetParentFilename, (void *pBackendData, char **ppszParentFilename));
|
---|
494 |
|
---|
495 | /**
|
---|
496 | * Set the relative path to parent image. May be NULL.
|
---|
497 | *
|
---|
498 | * @returns VBox status code.
|
---|
499 | * @param pBackendData Opaque state data for this image.
|
---|
500 | * @param pszParentFilename Where to get the path from.
|
---|
501 | */
|
---|
502 | DECLR3CALLBACKMEMBER(int, pfnSetParentFilename, (void *pBackendData, const char *pszParentFilename));
|
---|
503 |
|
---|
504 | /** Returns a human readable hard disk location string given a
|
---|
505 | * set of hard disk configuration keys. The returned string is an
|
---|
506 | * equivalent of the full file path for image-based hard disks.
|
---|
507 | * Mandatory for backends with no VD_CAP_FILE and NULL otherwise. */
|
---|
508 | DECLR3CALLBACKMEMBER(int, pfnComposeLocation, (PVDINTERFACE pConfig, char **pszLocation));
|
---|
509 |
|
---|
510 | /** Returns a human readable hard disk name string given a
|
---|
511 | * set of hard disk configuration keys. The returned string is an
|
---|
512 | * equivalent of the file name part in the full file path for
|
---|
513 | * image-based hard disks. Mandatory for backends with no
|
---|
514 | * VD_CAP_FILE and NULL otherwise. */
|
---|
515 | DECLR3CALLBACKMEMBER(int, pfnComposeName, (PVDINTERFACE pConfig, char **pszName));
|
---|
516 |
|
---|
517 | /**
|
---|
518 | * Compact the image. The pointer may be NULL, indicating that this
|
---|
519 | * isn't supported yet (for file-based images) or not necessary.
|
---|
520 | *
|
---|
521 | * @returns VBox status code.
|
---|
522 | * @returns VERR_NOT_SUPPORTED if this image cannot be compacted yet.
|
---|
523 | * @param pBackendData Opaque state data for this image.
|
---|
524 | * @param uPercentStart Starting value for progress percentage.
|
---|
525 | * @param uPercentSpan Span for varying progress percentage.
|
---|
526 | * @param pVDIfsDisk Pointer to the per-disk VD interface list.
|
---|
527 | * @param pVDIfsImage Pointer to the per-image VD interface list.
|
---|
528 | * @param pVDIfsOperation Pointer to the per-operation VD interface list.
|
---|
529 | */
|
---|
530 | DECLR3CALLBACKMEMBER(int, pfnCompact, (void *pBackendData,
|
---|
531 | unsigned uPercentStart, unsigned uPercentSpan,
|
---|
532 | PVDINTERFACE pVDIfsDisk,
|
---|
533 | PVDINTERFACE pVDIfsImage,
|
---|
534 | PVDINTERFACE pVDIfsOperation));
|
---|
535 |
|
---|
536 | /**
|
---|
537 | * Resize the image. The pointer may be NULL, indicating that this
|
---|
538 | * isn't supported yet (for file-based images) or not necessary.
|
---|
539 | *
|
---|
540 | * @returns VBox status code.
|
---|
541 | * @returns VERR_NOT_SUPPORTED if this image cannot be resized yet.
|
---|
542 | * @param pBackendData Opaque state data for this image.
|
---|
543 | * @param cbSize New size of the image.
|
---|
544 | * @param pPCHSGeometry Pointer to the new physical disk geometry <= (16383,16,63). Not NULL.
|
---|
545 | * @param pLCHSGeometry Pointer to the new logical disk geometry <= (x,255,63). Not NULL.
|
---|
546 | * @param uPercentStart Starting value for progress percentage.
|
---|
547 | * @param uPercentSpan Span for varying progress percentage.
|
---|
548 | * @param pVDIfsDisk Pointer to the per-disk VD interface list.
|
---|
549 | * @param pVDIfsImage Pointer to the per-image VD interface list.
|
---|
550 | * @param pVDIfsOperation Pointer to the per-operation VD interface list.
|
---|
551 | */
|
---|
552 | DECLR3CALLBACKMEMBER(int, pfnResize, (void *pBackendData,
|
---|
553 | uint64_t cbSize,
|
---|
554 | PCVDGEOMETRY pPCHSGeometry,
|
---|
555 | PCVDGEOMETRY pLCHSGeometry,
|
---|
556 | unsigned uPercentStart, unsigned uPercentSpan,
|
---|
557 | PVDINTERFACE pVDIfsDisk,
|
---|
558 | PVDINTERFACE pVDIfsImage,
|
---|
559 | PVDINTERFACE pVDIfsOperation));
|
---|
560 |
|
---|
561 | /**
|
---|
562 | * Try to repair the given image.
|
---|
563 | *
|
---|
564 | * @returns VBox status code.
|
---|
565 | * @param pszFilename Name of the image file.
|
---|
566 | * @param pVDIfsDisk Pointer to the per-disk VD interface list.
|
---|
567 | * @param pVDIfsImage Pointer to the per-image VD interface list.
|
---|
568 | * @param fFlags Combination of the VD_REPAIR_* flags.
|
---|
569 | */
|
---|
570 | DECLR3CALLBACKMEMBER(int, pfnRepair, (const char *pszFilename, PVDINTERFACE pVDIfsDisk,
|
---|
571 | PVDINTERFACE pVDIfsImage, uint32_t fFlags));
|
---|
572 |
|
---|
573 | /**
|
---|
574 | * Traverse all metadata of the opened image.
|
---|
575 | *
|
---|
576 | * @returns VBox status code.
|
---|
577 | * @param pBackendData Opaque state data for this image.
|
---|
578 | * @param fFlags Traverse flags, combination of VD_TRAVERSE_METDATA_* defines.
|
---|
579 | * @param pVDIfsDisk Pointer to the per-disk VD interface list.
|
---|
580 | * @param pVDIfsImage Pointer to the per-image VD interface list.
|
---|
581 | * @param pVDIfsOperation Pointer to the per-operation VD interface list.
|
---|
582 | */
|
---|
583 | DECLR3CALLBACKMEMBER(int, pfnTraverseMetadata, (void *pBackendData, uint32_t fFlags,
|
---|
584 | PVDINTERFACE pVDIfsDisk,
|
---|
585 | PVDINTERFACE pVDIfsImage,
|
---|
586 | PVDINTERFACE pVDIfsOperation));
|
---|
587 |
|
---|
588 | /** Initialization safty marker. */
|
---|
589 | uint32_t u32VersionEnd;
|
---|
590 |
|
---|
591 | } VDIMAGEBACKEND;
|
---|
592 |
|
---|
593 | /** Pointer to VD backend. */
|
---|
594 | typedef VDIMAGEBACKEND *PVDIMAGEBACKEND;
|
---|
595 | /** Constant pointer to VD backend. */
|
---|
596 | typedef const VDIMAGEBACKEND *PCVDIMAGEBACKEND;
|
---|
597 |
|
---|
598 | /** The current version of the VDIMAGEBACKEND structure. */
|
---|
599 | #define VD_IMGBACKEND_VERSION VD_VERSION_MAKE(0xff01, 3, 0)
|
---|
600 |
|
---|
601 | /** @copydoc VDIMAGEBACKEND::pfnComposeLocation */
|
---|
602 | DECLCALLBACK(int) genericFileComposeLocation(PVDINTERFACE pConfig, char **pszLocation);
|
---|
603 | /** @copydoc VDIMAGEBACKEND::pfnComposeName */
|
---|
604 | DECLCALLBACK(int) genericFileComposeName(PVDINTERFACE pConfig, char **pszName);
|
---|
605 |
|
---|
606 | #endif /* !VBOX_INCLUDED_vd_image_backend_h */
|
---|