VirtualBox

source: vbox/trunk/include/VBox/VBoxHDD-new.h@ 2484

Last change on this file since 2484 was 2358, checked in by vboxsync, 18 years ago

New VMDK code.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 23.7 KB
Line 
1/** @file
2 * VBox HDD Container API.
3 * Will replace VBoxHDD.h.
4 */
5
6/*
7 * Copyright (C) 2006 InnoTek Systemberatung GmbH
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * If you received this file as part of a commercial VirtualBox
18 * distribution, then only the terms of your commercial VirtualBox
19 * license agreement apply instead of the previous paragraph.
20 */
21
22#ifndef __VBox_VD_h__
23#define __VBox_VD_h__
24
25#include <VBox/cdefs.h>
26#include <VBox/types.h>
27#include <VBox/pdm.h>
28
29__BEGIN_DECLS
30
31#ifdef IN_RING0
32# error "There are no VBox HDD Container APIs available in Ring-0 Host Context!"
33#endif
34
35/** @defgroup grp_vd VBox HDD Container
36 * @{
37 */
38
39/** Current VMDK image version. */
40#define VMDK_IMAGE_VERSION (0x0001)
41
42/** Current VDI image major version. */
43#define VDI_IMAGE_VERSION_MAJOR (0x0001)
44/** Current VDI image minor version. */
45#define VDI_IMAGE_VERSION_MINOR (0x0001)
46/** Current VDI image version. */
47#define VDI_IMAGE_VERSION ((VDI_IMAGE_VERSION_MAJOR << 16) | VDI_IMAGE_VERSION_MINOR)
48
49/** Get VDI major version from combined version. */
50#define VDI_GET_VERSION_MAJOR(uVer) ((uVer) >> 16)
51/** Get VDI minor version from combined version. */
52#define VDI_GET_VERSION_MINOR(uVer) ((uVer) & 0xffff)
53
54/** @name VBox HDD container image types
55 * @{ */
56typedef enum VDIMAGETYPE
57{
58 /** Normal dynamically growing base image file. */
59 VD_IMAGE_TYPE_NORMAL = 1,
60 /** Preallocated base image file of a fixed size. */
61 VD_IMAGE_TYPE_FIXED,
62 /** Dynamically growing image file for undo/commit changes support. */
63 VD_IMAGE_TYPE_UNDO,
64 /** Dynamically growing image file for differencing support. */
65 VD_IMAGE_TYPE_DIFF,
66
67 /** First valid image type value. */
68 VD_IMAGE_TYPE_FIRST = VD_IMAGE_TYPE_NORMAL,
69 /** Last valid image type value. */
70 VD_IMAGE_TYPE_LAST = VD_IMAGE_TYPE_DIFF
71} VDIMAGETYPE;
72/** Pointer to VBox HDD container image type. */
73typedef VDIMAGETYPE *PVDIMAGETYPE;
74/** @} */
75
76/** @name VBox HDD container image flags
77 * @{
78 */
79/** No flags. */
80#define VD_IMAGE_FLAGS_NONE (0)
81/** VMDK: Split image into 2GB extents. */
82#define VD_VMDK_IMAGE_FLAGS_SPLIT_2G (0x0001)
83/** VMDK: Split image into 2GB extents. */
84#define VD_VMDK_IMAGE_FLAGS_RAWDISK (0x0002)
85/** VDI: Fill new blocks with zeroes while expanding image file. */
86#define VD_VDI_IMAGE_FLAGS_ZERO_EXPAND (0x0100)
87
88/** Mask of valid image flags for VMDK. */
89#define VD_VMDK_IMAGE_FLAGS_MASK (VD_IMAGE_FLAGS_NONE | VD_VMDK_IMAGE_FLAGS_SPLIT_2G | VD_VMDK_IMAGE_FLAGS_RAWDISK)
90
91/** Mask of valid image flags for VDI. */
92#define VD_VDI_IMAGE_FLAGS_MASK (VD_IMAGE_FLAGS_NONE | VD_VDI_IMAGE_FLAGS_ZERO_EXPAND)
93
94/** Default image flags. */
95#define VD_IMAGE_FLAGS_DEFAULT (VD_IMAGE_FLAGS_NONE)
96/** @} */
97
98/** @name VBox HDD container image open mode flags
99 * @{
100 */
101/** Try to open image in read/write exclusive access mode if possible, or in read-only elsewhere. */
102#define VD_OPEN_FLAGS_NORMAL (0)
103/** Open image in read-only mode with sharing access with others. */
104#define VD_OPEN_FLAGS_READONLY (1)
105/** Honor zero block writes instead of ignoring them whenever possible.
106 * This is not supported by all formats. It is silently ignored in this case. */
107#define VD_OPEN_FLAGS_HONOR_ZEROES (2)
108/** Mask of valid flags. */
109#define VD_OPEN_FLAGS_MASK (VD_OPEN_FLAGS_NORMAL | VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_HONOR_ZEROES)
110/** @}*/
111
112/**
113 * Error message callback.
114 *
115 * @param pvUser The opaque data passed on container creation.
116 * @param rc The VBox error code.
117 * @param RT_SRC_POS_DECL Use RT_SRC_POS.
118 * @param pszFormat Error message format string.
119 * @param va Error message arguments.
120 */
121typedef DECLCALLBACK(void) FNVDERROR(void *pvUser, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va);
122/** Pointer to a FNVDERROR(). */
123typedef FNVDERROR *PFNVDERROR;
124
125
126/**
127 * VBox HDD Container main structure.
128 */
129/* Forward declaration, VBOXHDD structure is visible only inside VBox HDD module. */
130struct VBOXHDD;
131typedef struct VBOXHDD VBOXHDD;
132typedef VBOXHDD *PVBOXHDD;
133
134/**
135 * Allocates and initializes an empty VBox HDD container.
136 * No image files are opened.
137 *
138 * @returns VBox status code.
139 * @param pszBackend Name of the image file backend to use.
140 * @param pfnError Callback for setting extended error information.
141 * @param pvErrorUser Opaque parameter for pfnError.
142 * @param ppDisk Where to store the reference to the VBox HDD container.
143 */
144VBOXDDU_DECL(int) VDCreate(const char *pszBackend, PFNVDERROR pfnError, void *pvErrorUser, PVBOXHDD *ppDisk);
145
146/**
147 * Destroys the VBox HDD container.
148 * If container has opened image files they will be closed.
149 *
150 * @param pDisk Pointer to VBox HDD container.
151 */
152VBOXDDU_DECL(void) VDDestroy(PVBOXHDD pDisk);
153
154/**
155 * Opens an image file.
156 *
157 * The first opened image file in a HDD container must have a base image type,
158 * others (next opened images) must be differencing or undo images.
159 * Linkage is checked for differencing image to be consistent with the previously opened image.
160 * When another differencing image is opened and the last image was opened in read/write access
161 * mode, then the last image is reopened in read-only with deny write sharing mode. This allows
162 * other processes to use images in read-only mode too.
163 *
164 * Note that the image is opened in read-only mode if a read/write open is not possible.
165 * Use VDIsReadOnly to check open mode.
166 *
167 * @returns VBox status code.
168 * @param pDisk Pointer to VBox HDD container.
169 * @param pszFilename Name of the image file to open.
170 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants.
171 */
172VBOXDDU_DECL(int) VDOpen(PVBOXHDD pDisk, const char *pszFilename, unsigned uOpenFlags);
173
174/**
175 * Creates and opens a new base image file.
176 *
177 * @returns VBox status code.
178 * @param pDisk Pointer to VBox HDD container.
179 * @param pszFilename Name of the image file to create.
180 * @param enmType Image type, only base image types are acceptable.
181 * @param cbSize Image size in bytes.
182 * @param uImageFlags Flags specifying special image features.
183 * @param pszComment Pointer to image comment. NULL is ok.
184 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants.
185 * @param pfnProgress Progress callback. Optional. NULL if not to be used.
186 * @param pvUser User argument for the progress callback.
187 */
188VBOXDDU_DECL(int) VDCreateBase(PVBOXHDD pDisk, const char *pszFilename,
189 VDIMAGETYPE enmType, uint64_t cbSize,
190 unsigned uImageFlags, const char *pszComment,
191 unsigned uOpenFlags,
192 PFNVMPROGRESS pfnProgress, void *pvUser);
193
194/**
195 * Creates and opens a new differencing image file in HDD container.
196 * See comments for VDOpen function about differencing images.
197 *
198 * @returns VBox status code.
199 * @param pDisk Pointer to VBox HDD container.
200 * @param pszFilename Name of the differencing image file to create.
201 * @param uImageFlags Flags specifying special image features.
202 * @param pszComment Pointer to image comment. NULL is ok.
203 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants.
204 * @param pfnProgress Progress callback. Optional. NULL if not to be used.
205 * @param pvUser User argument for the progress callback.
206 */
207VBOXDDU_DECL(int) VDCreateDiff(PVBOXHDD pDisk, const char *pszFilename,
208 unsigned uImageFlags, const char *pszComment,
209 unsigned uOpenFlags,
210 PFNVMPROGRESS pfnProgress, void *pvUser);
211
212/**
213 * Merges two images having a parent/child relationship (both directions).
214 * As a side effect the source image is deleted from both the disk and
215 * the images in the VBox HDD container.
216 *
217 * @returns VBox status code.
218 * @param pDisk Pointer to VBox HDD container.
219 * @param nImageFrom Name of the image file to merge from.
220 * @param nImageTo Name of the image file to merge to.
221 * @param pfnProgress Progress callback. Optional. NULL if not to be used.
222 * @param pvUser User argument for the progress callback.
223 */
224VBOXDDU_DECL(int) VDMerge(PVBOXHDD pDisk, unsigned nImageFrom, unsigned nImageTo,
225 PFNVMPROGRESS pfnProgress, void *pvUser);
226
227/**
228 * Copies an image from one VBox HDD container to another.
229 * The copy is opened in the target VBox HDD container.
230 * It is possible to convert between different image formats, because the
231 * backend for the destination VBox HDD container may be different from the
232 * source container.
233 * If both the source and destination reference the same VBox HDD container,
234 * then the image is moved (by copying/deleting) to the new location.
235 * The source container is unchanged if the move operation fails, otherwise
236 * the image at the new location is opened in the same way as the old one was.
237 *
238 * @returns VBox status code.
239 * @param pDiskFrom Pointer to source VBox HDD container.
240 * @param nImage Image number, counts from 0. 0 is always base image of container.
241 * @param pDiskTo Pointer to destination VBox HDD container.
242 * @param pfnProgress Progress callback. Optional. NULL if not to be used.
243 * @param pvUser User argument for the progress callback.
244 */
245VBOXDDU_DECL(int) VDCopy(PVBOXHDD pDiskFrom, unsigned nImage, PVBOXHDD pDiskTo,
246 PFNVMPROGRESS pfnProgress, void *pvUser);
247
248/**
249 * Compacts a growing image file by removing zeroed data blocks.
250 * Optionally defragments data in the image so that ascending sector numbers
251 * are stored in ascending location in the image file.
252 *
253 * @todo maybe include this function in VDCopy.
254 *
255 * @returns VBox status code.
256 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
257 * @param pDisk Pointer to VBox HDD container.
258 * @param nImage Image number, counts from 0. 0 is always base image of container.
259 * @param fDefragment If true, reorder file data so that sectors are stored in ascending order.
260 * @param pfnProgress Progress callback. Optional. NULL if not to be used.
261 * @param pvUser User argument for the progress callback.
262 */
263VBOXDDU_DECL(int) VDCompact(PVBOXHDD pDisk, unsigned nImage,
264 bool fDefragment,
265 PFNVMPROGRESS pfnProgress, void *pvUser);
266
267/**
268 * Resizes an image. Allows setting the disk size to both larger and smaller
269 * values than the current disk size.
270 *
271 * @returns VBox status code.
272 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
273 * @param pDisk Pointer to VBox HDD container.
274 * @param nImage Image number, counts from 0. 0 is always base image of container.
275 * @param cbSize New image size in bytes.
276 * @param pfnProgress Progress callback. Optional. NULL if not to be used.
277 * @param pvUser User argument for the progress callback.
278 */
279VBOXDDU_DECL(int) VDResize(PVBOXHDD pDisk, unsigned nImage, uint64_t cbSize,
280 PFNVMPROGRESS pfnProgress, void *pvUser);
281
282/**
283 * Closes the last opened image file in the HDD container. Leaves all changes inside it.
284 * If previous image file was opened in read-only mode (that is normal) and closing image
285 * was opened in read-write mode (the whole disk was in read-write mode) - the previous image
286 * will be reopened in read/write mode.
287 *
288 * @param pDisk Pointer to VBox HDD container.
289 * @param fDelete If true, delete the image from the host disk.
290 */
291VBOXDDU_DECL(int) VDClose(PVBOXHDD pDisk, bool fDelete);
292
293/**
294 * Closes all opened image files in HDD container.
295 *
296 * @param pDisk Pointer to VBox HDD container.
297 */
298VBOXDDU_DECL(int) VDCloseAll(PVBOXHDD pDisk);
299
300/**
301 * Read data from virtual HDD.
302 *
303 * @returns VBox status code.
304 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
305 * @param pDisk Pointer to VBox HDD container.
306 * @param uOffset Offset of first reading byte from start of disk.
307 * @param pvBuf Pointer to buffer for reading data.
308 * @param cbRead Number of bytes to read.
309 */
310VBOXDDU_DECL(int) VDRead(PVBOXHDD pDisk, uint64_t uOffset, void *pvBuf, size_t cbRead);
311
312/**
313 * Write data to virtual HDD.
314 *
315 * @returns VBox status code.
316 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
317 * @param pDisk Pointer to VBox HDD container.
318 * @param uOffset Offset of first writing byte from start of disk.
319 * @param pvBuf Pointer to buffer for writing data.
320 * @param cbWrite Number of bytes to write.
321 */
322VBOXDDU_DECL(int) VDWrite(PVBOXHDD pDisk, uint64_t uOffset, const void *pvBuf, size_t cbWrite);
323
324/**
325 * Make sure the on disk representation of a virtual HDD is up to date.
326 *
327 * @returns VBox status code.
328 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
329 * @param pDisk Pointer to VBox HDD container.
330 */
331VBOXDDU_DECL(int) VDFlush(PVBOXHDD pDisk);
332
333/**
334 * Get number of opened images in HDD container.
335 *
336 * @returns Number of opened images for HDD container. 0 if no images have been opened.
337 * @param pDisk Pointer to VBox HDD container.
338 */
339VBOXDDU_DECL(unsigned) VDGetCount(PVBOXHDD pDisk);
340
341/**
342 * Get read/write mode of the VBox HDD container.
343 *
344 * @returns Virtual disk ReadOnly status.
345 * @returns true if no image is opened in HDD container.
346 * @param pDisk Pointer to VBox HDD container.
347 */
348VBOXDDU_DECL(bool) VDIsReadOnly(PVBOXHDD pDisk);
349
350/**
351 * Get total disk size of the VBox HDD container.
352 *
353 * @returns Virtual disk size in bytes.
354 * @returns 0 if no image is opened in HDD container.
355 * @param pDisk Pointer to VBox HDD container.
356 */
357VBOXDDU_DECL(uint64_t) VDGetSize(PVBOXHDD pDisk);
358
359/**
360 * Get virtual disk geometry stored in HDD container.
361 *
362 * @returns VBox status code.
363 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
364 * @returns VERR_VDI_GEOMETRY_NOT_SET if no geometry present in the HDD container.
365 * @param pDisk Pointer to VBox HDD container.
366 * @param pcCylinders Where to store the number of cylinders. NULL is ok.
367 * @param pcHeads Where to store the number of heads. NULL is ok.
368 * @param pcSectors Where to store the number of sectors. NULL is ok.
369 */
370VBOXDDU_DECL(int) VDGetGeometry(PVBOXHDD pDisk,
371 unsigned *pcCylinders, unsigned *pcHeads, unsigned *pcSectors);
372
373/**
374 * Store virtual disk geometry in HDD container.
375 *
376 * Note that in case of unrecoverable error all images in HDD container will be closed.
377 *
378 * @returns VBox status code.
379 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
380 * @param pDisk Pointer to VBox HDD container.
381 * @param cCylinders Number of cylinders.
382 * @param cHeads Number of heads.
383 * @param cSectors Number of sectors.
384 */
385VBOXDDU_DECL(int) VDSetGeometry(PVBOXHDD pDisk,
386 unsigned cCylinders, unsigned cHeads, unsigned cSectors);
387
388/**
389 * Get virtual disk translation mode stored in HDD container.
390 *
391 * @returns VBox status code.
392 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
393 * @returns VERR_VDI_GEOMETRY_NOT_SET if no geometry present in the HDD container.
394 * @param pDisk Pointer to VBox HDD container.
395 * @param penmTranslation Where to store the translation mode (see pdm.h).
396 */
397VBOXDDU_DECL(int) VDGetTranslation(PVBOXHDD pDisk, PPDMBIOSTRANSLATION penmTranslation);
398
399/**
400 * Store virtual disk translation mode in HDD container.
401 *
402 * Note that in case of unrecoverable error all images in HDD container will be closed.
403 *
404 * @returns VBox status code.
405 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
406 * @param pDisk Pointer to VBox HDD container.
407 * @param enmTranslation Translation mode (see pdm.h).
408 */
409VBOXDDU_DECL(int) VDSetTranslation(PVBOXHDD pDisk, PDMBIOSTRANSLATION enmTranslation);
410
411/**
412 * Get version of image in HDD container.
413 *
414 * @returns VBox status code.
415 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
416 * @param pDisk Pointer to VBox HDD container.
417 * @param nImage Image number, counts from 0. 0 is always base image of container.
418 * @param puVersion Where to store the image version.
419 */
420VBOXDDU_DECL(int) VDGetVersion(PVBOXHDD pDisk, unsigned nImage, unsigned *puVersion);
421
422/**
423 * Get type of image in HDD container.
424 *
425 * @returns VBox status code.
426 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
427 * @param pDisk Pointer to VBox HDD container.
428 * @param nImage Image number, counts from 0. 0 is always base image of container.
429 * @param penmType Where to store the image type.
430 */
431VBOXDDU_DECL(int) VDGetImageType(PVBOXHDD pDisk, unsigned nImage, PVDIMAGETYPE penmType);
432
433/**
434 * Get flags of image in HDD container.
435 *
436 * @returns VBox status code.
437 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
438 * @param pDisk Pointer to VBox HDD container.
439 * @param nImage Image number, counts from 0. 0 is always base image of container.
440 * @param puImageFlags Where to store the image flags.
441 */
442VBOXDDU_DECL(int) VDGetImageFlags(PVBOXHDD pDisk, unsigned nImage, unsigned *puImageFlags);
443
444/**
445 * Get open flags of last opened image in HDD container.
446 *
447 * @returns VBox status code.
448 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
449 * @param pDisk Pointer to VBox HDD container.
450 * @param puOpenFlags Where to store the image open flags.
451 */
452VBOXDDU_DECL(int) VDGetOpenFlags(PVBOXHDD pDisk, unsigned *puOpenFlags);
453
454/**
455 * Set open flags of last opened image in HDD container.
456 * This operation may cause file locking changes and/or files being reopened.
457 * Note that in case of unrecoverable error all images in HDD container will be closed.
458 *
459 * @returns VBox status code.
460 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
461 * @param pDisk Pointer to VBox HDD container.
462 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants.
463 */
464VBOXDDU_DECL(int) VDSetOpenFlags(PVBOXHDD pDisk, unsigned uOpenFlags);
465
466/**
467 * Get base filename of image in HDD container. Some image formats use
468 * other filenames as well, so don't use this for anything but for informational
469 * purposes.
470 *
471 * @returns VBox status code.
472 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
473 * @returns VERR_BUFFER_OVERFLOW if pszFilename buffer too small to hold filename.
474 * @param pDisk Pointer to VBox HDD container.
475 * @param nImage Image number, counts from 0. 0 is always base image of container.
476 * @param pszFilename Where to store the image file name.
477 * @param cbFilename Size of buffer pszFilename points to.
478 */
479VBOXDDU_DECL(int) VDGetFilename(PVBOXHDD pDisk, unsigned nImage, char *pszFilename, unsigned cbFilename);
480
481/**
482 * Get the comment line of image in HDD container.
483 *
484 * @returns VBox status code.
485 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
486 * @returns VERR_BUFFER_OVERFLOW if pszComment buffer too small to hold comment text.
487 * @param pDisk Pointer to VBox HDD container.
488 * @param nImage Image number, counts from 0. 0 is always base image of container.
489 * @param pszComment Where to store the comment string of image. NULL is ok.
490 * @param cbComment The size of pszComment buffer. 0 is ok.
491 */
492VBOXDDU_DECL(int) VDGetComment(PVBOXHDD pDisk, unsigned nImage, char *pszComment, unsigned cbComment);
493
494/**
495 * Changes the comment line of image in HDD container.
496 *
497 * @returns VBox status code.
498 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
499 * @param pDisk Pointer to VBox HDD container.
500 * @param nImage Image number, counts from 0. 0 is always base image of container.
501 * @param pszComment New comment string (UTF-8). NULL is allowed to reset the comment.
502 */
503VBOXDDU_DECL(int) VDSetComment(PVBOXHDD pDisk, unsigned nImage, const char *pszComment);
504
505/**
506 * Get UUID of image in HDD container.
507 *
508 * @returns VBox status code.
509 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
510 * @param pDisk Pointer to VBox HDD container.
511 * @param nImage Image number, counts from 0. 0 is always base image of container.
512 * @param pUuid Where to store the image UUID.
513 */
514VBOXDDU_DECL(int) VDGetUuid(PVBOXHDD pDisk, unsigned nImage, PRTUUID pUuid);
515
516/**
517 * Set the image's UUID. Should not be used by normal applications.
518 *
519 * @returns VBox status code.
520 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
521 * @param pDisk Pointer to VBox HDD container.
522 * @param nImage Image number, counts from 0. 0 is always base image of container.
523 * @param pUuid Optional parameter, new UUID of the image.
524 */
525VBOXDDU_DECL(int) VDSetUuid(PVBOXHDD pDisk, unsigned nImage, PCRTUUID pUuid);
526
527/**
528 * Get last modification UUID of image in HDD container.
529 *
530 * @returns VBox status code.
531 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
532 * @param pDisk Pointer to VBox HDD container.
533 * @param nImage Image number, counts from 0. 0 is always base image of container.
534 * @param pUuid Where to store the image modification UUID.
535 */
536VBOXDDU_DECL(int) VDGetModificationUuid(PVBOXHDD pDisk, unsigned nImage, PRTUUID pUuid);
537
538/**
539 * Set the image's last modification UUID. Should not be used by normal applications.
540 *
541 * @returns VBox status code.
542 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
543 * @param pDisk Pointer to VBox HDD container.
544 * @param nImage Image number, counts from 0. 0 is always base image of container.
545 * @param pUuid Optional parameter, new last modification UUID of the image.
546 */
547VBOXDDU_DECL(int) VDSetModificationUuid(PVBOXHDD pDisk, unsigned nImage, PCRTUUID pUuid);
548
549/**
550 * Get parent UUID of image in HDD container.
551 *
552 * @returns VBox status code.
553 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
554 * @param pDisk Pointer to VBox HDD container.
555 * @param nImage Image number, counts from 0. 0 is always base image of the container.
556 * @param pUuid Where to store the parent image UUID.
557 */
558VBOXDDU_DECL(int) VDGetParentUuid(PVBOXHDD pDisk, unsigned nImage, PRTUUID pUuid);
559
560/**
561 * Set the image's parent UUID. Should not be used by normal applications.
562 *
563 * @returns VBox status code.
564 * @param pDisk Pointer to VBox HDD container.
565 * @param nImage Image number, counts from 0. 0 is always base image of container.
566 * @param pUuid Optional parameter, new parent UUID of the image.
567 */
568VBOXDDU_DECL(int) VDSetParentUuid(PVBOXHDD pDisk, unsigned nImage, PCRTUUID pUuid);
569
570
571/**
572 * Debug helper - dumps all opened images in HDD container into the log file.
573 *
574 * @param pDisk Pointer to VBox HDD container.
575 */
576VBOXDDU_DECL(void) VDDumpImages(PVBOXHDD pDisk);
577
578__END_DECLS
579
580/** @} */
581
582#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette