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