VirtualBox

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

Last change on this file since 2602 was 2591, checked in by vboxsync, 18 years ago

New open flag for disabling the optimizing out of unchanged block writes
for diff images.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 24.0 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 RT_BIT(0)
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 RT_BIT(1)
108/** Honor writes of the same data instead of ignoring whenever possible.
109 * This is handled generically, and is only meaningful for differential image
110 * formats. It is silently ignored otherwise. */
111#define VD_OPEN_FLAGS_HONOR_SAME RT_BIT(2)
112/** Mask of valid flags. */
113#define VD_OPEN_FLAGS_MASK (VD_OPEN_FLAGS_NORMAL | VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_HONOR_ZEROES | VD_OPEN_FLAGS_HONOR_SAME)
114/** @}*/
115
116/**
117 * Error message callback.
118 *
119 * @param pvUser The opaque data passed on container creation.
120 * @param rc The VBox error code.
121 * @param RT_SRC_POS_DECL Use RT_SRC_POS.
122 * @param pszFormat Error message format string.
123 * @param va Error message arguments.
124 */
125typedef DECLCALLBACK(void) FNVDERROR(void *pvUser, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va);
126/** Pointer to a FNVDERROR(). */
127typedef FNVDERROR *PFNVDERROR;
128
129
130/**
131 * VBox HDD Container main structure.
132 */
133/* Forward declaration, VBOXHDD structure is visible only inside VBox HDD module. */
134struct VBOXHDD;
135typedef struct VBOXHDD VBOXHDD;
136typedef VBOXHDD *PVBOXHDD;
137
138/**
139 * Allocates and initializes an empty VBox HDD container.
140 * No image files are opened.
141 *
142 * @returns VBox status code.
143 * @param pszBackend Name of the image file backend to use.
144 * @param pfnError Callback for setting extended error information.
145 * @param pvErrorUser Opaque parameter for pfnError.
146 * @param ppDisk Where to store the reference to the VBox HDD container.
147 */
148VBOXDDU_DECL(int) VDCreate(const char *pszBackend, PFNVDERROR pfnError, void *pvErrorUser, PVBOXHDD *ppDisk);
149
150/**
151 * Destroys the VBox HDD container.
152 * If container has opened image files they will be closed.
153 *
154 * @param pDisk Pointer to VBox HDD container.
155 */
156VBOXDDU_DECL(void) VDDestroy(PVBOXHDD pDisk);
157
158/**
159 * Opens an image file.
160 *
161 * The first opened image file in a HDD container must have a base image type,
162 * others (next opened images) must be differencing or undo images.
163 * Linkage is checked for differencing image to be consistent with the previously opened image.
164 * When another differencing image is opened and the last image was opened in read/write access
165 * mode, then the last image is reopened in read-only with deny write sharing mode. This allows
166 * other processes to use images in read-only mode too.
167 *
168 * Note that the image is opened in read-only mode if a read/write open is not possible.
169 * Use VDIsReadOnly to check open mode.
170 *
171 * @returns VBox status code.
172 * @param pDisk Pointer to VBox HDD container.
173 * @param pszFilename Name of the image file to open.
174 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants.
175 */
176VBOXDDU_DECL(int) VDOpen(PVBOXHDD pDisk, const char *pszFilename, unsigned uOpenFlags);
177
178/**
179 * Creates and opens a new base image file.
180 *
181 * @returns VBox status code.
182 * @param pDisk Pointer to VBox HDD container.
183 * @param pszFilename Name of the image file to create.
184 * @param enmType Image type, only base image types are acceptable.
185 * @param cbSize Image size in bytes.
186 * @param uImageFlags Flags specifying special image features.
187 * @param pszComment Pointer to image comment. NULL is ok.
188 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants.
189 * @param pfnProgress Progress callback. Optional. NULL if not to be used.
190 * @param pvUser User argument for the progress callback.
191 */
192VBOXDDU_DECL(int) VDCreateBase(PVBOXHDD pDisk, const char *pszFilename,
193 VDIMAGETYPE enmType, uint64_t cbSize,
194 unsigned uImageFlags, const char *pszComment,
195 unsigned uOpenFlags,
196 PFNVMPROGRESS pfnProgress, void *pvUser);
197
198/**
199 * Creates and opens a new differencing image file in HDD container.
200 * See comments for VDOpen function about differencing images.
201 *
202 * @returns VBox status code.
203 * @param pDisk Pointer to VBox HDD container.
204 * @param pszFilename Name of the differencing image file to create.
205 * @param uImageFlags Flags specifying special image features.
206 * @param pszComment Pointer to image comment. NULL is ok.
207 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants.
208 * @param pfnProgress Progress callback. Optional. NULL if not to be used.
209 * @param pvUser User argument for the progress callback.
210 */
211VBOXDDU_DECL(int) VDCreateDiff(PVBOXHDD pDisk, const char *pszFilename,
212 unsigned uImageFlags, const char *pszComment,
213 unsigned uOpenFlags,
214 PFNVMPROGRESS pfnProgress, void *pvUser);
215
216/**
217 * Merges two images having a parent/child relationship (both directions).
218 * As a side effect the source image is deleted from both the disk and
219 * the images in the VBox HDD container.
220 *
221 * @returns VBox status code.
222 * @param pDisk Pointer to VBox HDD container.
223 * @param nImageFrom Name of the image file to merge from.
224 * @param nImageTo Name of the image file to merge to.
225 * @param pfnProgress Progress callback. Optional. NULL if not to be used.
226 * @param pvUser User argument for the progress callback.
227 */
228VBOXDDU_DECL(int) VDMerge(PVBOXHDD pDisk, unsigned nImageFrom, unsigned nImageTo,
229 PFNVMPROGRESS pfnProgress, void *pvUser);
230
231/**
232 * Copies an image from one VBox HDD container to another.
233 * The copy is opened in the target VBox HDD container.
234 * It is possible to convert between different image formats, because the
235 * backend for the destination VBox HDD container may be different from the
236 * source container.
237 * If both the source and destination reference the same VBox HDD container,
238 * then the image is moved (by copying/deleting) to the new location.
239 * The source container is unchanged if the move operation fails, otherwise
240 * the image at the new location is opened in the same way as the old one was.
241 *
242 * @returns VBox status code.
243 * @param pDiskFrom Pointer to source VBox HDD container.
244 * @param nImage Image number, counts from 0. 0 is always base image of container.
245 * @param pDiskTo Pointer to destination VBox HDD container.
246 * @param pfnProgress Progress callback. Optional. NULL if not to be used.
247 * @param pvUser User argument for the progress callback.
248 */
249VBOXDDU_DECL(int) VDCopy(PVBOXHDD pDiskFrom, unsigned nImage, PVBOXHDD pDiskTo,
250 PFNVMPROGRESS pfnProgress, void *pvUser);
251
252/**
253 * Compacts a growing image file by removing zeroed data blocks.
254 * Optionally defragments data in the image so that ascending sector numbers
255 * are stored in ascending location in the image file.
256 *
257 * @todo maybe include this function in VDCopy.
258 *
259 * @returns VBox status code.
260 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
261 * @param pDisk Pointer to VBox HDD container.
262 * @param nImage Image number, counts from 0. 0 is always base image of container.
263 * @param fDefragment If true, reorder file data so that sectors are stored in ascending order.
264 * @param pfnProgress Progress callback. Optional. NULL if not to be used.
265 * @param pvUser User argument for the progress callback.
266 */
267VBOXDDU_DECL(int) VDCompact(PVBOXHDD pDisk, unsigned nImage,
268 bool fDefragment,
269 PFNVMPROGRESS pfnProgress, void *pvUser);
270
271/**
272 * Resizes an image. Allows setting the disk size to both larger and smaller
273 * values than the current disk size.
274 *
275 * @returns VBox status code.
276 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
277 * @param pDisk Pointer to VBox HDD container.
278 * @param nImage Image number, counts from 0. 0 is always base image of container.
279 * @param cbSize New image size in bytes.
280 * @param pfnProgress Progress callback. Optional. NULL if not to be used.
281 * @param pvUser User argument for the progress callback.
282 */
283VBOXDDU_DECL(int) VDResize(PVBOXHDD pDisk, unsigned nImage, uint64_t cbSize,
284 PFNVMPROGRESS pfnProgress, void *pvUser);
285
286/**
287 * Closes the last opened image file in the HDD container. Leaves all changes inside it.
288 * If previous image file was opened in read-only mode (that is normal) and closing image
289 * was opened in read-write mode (the whole disk was in read-write mode) - the previous image
290 * will be reopened in read/write mode.
291 *
292 * @param pDisk Pointer to VBox HDD container.
293 * @param fDelete If true, delete the image from the host disk.
294 */
295VBOXDDU_DECL(int) VDClose(PVBOXHDD pDisk, bool fDelete);
296
297/**
298 * Closes all opened image files in HDD container.
299 *
300 * @param pDisk Pointer to VBox HDD container.
301 */
302VBOXDDU_DECL(int) VDCloseAll(PVBOXHDD pDisk);
303
304/**
305 * Read data from virtual HDD.
306 *
307 * @returns VBox status code.
308 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
309 * @param pDisk Pointer to VBox HDD container.
310 * @param uOffset Offset of first reading byte from start of disk.
311 * @param pvBuf Pointer to buffer for reading data.
312 * @param cbRead Number of bytes to read.
313 */
314VBOXDDU_DECL(int) VDRead(PVBOXHDD pDisk, uint64_t uOffset, void *pvBuf, size_t cbRead);
315
316/**
317 * Write data to virtual HDD.
318 *
319 * @returns VBox status code.
320 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
321 * @param pDisk Pointer to VBox HDD container.
322 * @param uOffset Offset of first writing byte from start of disk.
323 * @param pvBuf Pointer to buffer for writing data.
324 * @param cbWrite Number of bytes to write.
325 */
326VBOXDDU_DECL(int) VDWrite(PVBOXHDD pDisk, uint64_t uOffset, const void *pvBuf, size_t cbWrite);
327
328/**
329 * Make sure the on disk representation of a virtual HDD is up to date.
330 *
331 * @returns VBox status code.
332 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
333 * @param pDisk Pointer to VBox HDD container.
334 */
335VBOXDDU_DECL(int) VDFlush(PVBOXHDD pDisk);
336
337/**
338 * Get number of opened images in HDD container.
339 *
340 * @returns Number of opened images for HDD container. 0 if no images have been opened.
341 * @param pDisk Pointer to VBox HDD container.
342 */
343VBOXDDU_DECL(unsigned) VDGetCount(PVBOXHDD pDisk);
344
345/**
346 * Get read/write mode of the VBox HDD container.
347 *
348 * @returns Virtual disk ReadOnly status.
349 * @returns true if no image is opened in HDD container.
350 * @param pDisk Pointer to VBox HDD container.
351 */
352VBOXDDU_DECL(bool) VDIsReadOnly(PVBOXHDD pDisk);
353
354/**
355 * Get total disk size of the VBox HDD container.
356 *
357 * @returns Virtual disk size in bytes.
358 * @returns 0 if no image is opened in HDD container.
359 * @param pDisk Pointer to VBox HDD container.
360 */
361VBOXDDU_DECL(uint64_t) VDGetSize(PVBOXHDD pDisk);
362
363/**
364 * Get virtual disk geometry stored in HDD container.
365 *
366 * @returns VBox status code.
367 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
368 * @returns VERR_VDI_GEOMETRY_NOT_SET if no geometry present in the HDD container.
369 * @param pDisk Pointer to VBox HDD container.
370 * @param pcCylinders Where to store the number of cylinders. NULL is ok.
371 * @param pcHeads Where to store the number of heads. NULL is ok.
372 * @param pcSectors Where to store the number of sectors. NULL is ok.
373 */
374VBOXDDU_DECL(int) VDGetGeometry(PVBOXHDD pDisk,
375 unsigned *pcCylinders, unsigned *pcHeads, unsigned *pcSectors);
376
377/**
378 * Store virtual disk geometry in HDD container.
379 *
380 * Note that in case of unrecoverable error all images in HDD container will be closed.
381 *
382 * @returns VBox status code.
383 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
384 * @param pDisk Pointer to VBox HDD container.
385 * @param cCylinders Number of cylinders.
386 * @param cHeads Number of heads.
387 * @param cSectors Number of sectors.
388 */
389VBOXDDU_DECL(int) VDSetGeometry(PVBOXHDD pDisk,
390 unsigned cCylinders, unsigned cHeads, unsigned cSectors);
391
392/**
393 * Get virtual disk translation mode stored in HDD container.
394 *
395 * @returns VBox status code.
396 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
397 * @returns VERR_VDI_GEOMETRY_NOT_SET if no geometry present in the HDD container.
398 * @param pDisk Pointer to VBox HDD container.
399 * @param penmTranslation Where to store the translation mode (see pdm.h).
400 */
401VBOXDDU_DECL(int) VDGetTranslation(PVBOXHDD pDisk, PPDMBIOSTRANSLATION penmTranslation);
402
403/**
404 * Store virtual disk translation mode in HDD container.
405 *
406 * Note that in case of unrecoverable error all images in HDD container will be closed.
407 *
408 * @returns VBox status code.
409 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
410 * @param pDisk Pointer to VBox HDD container.
411 * @param enmTranslation Translation mode (see pdm.h).
412 */
413VBOXDDU_DECL(int) VDSetTranslation(PVBOXHDD pDisk, PDMBIOSTRANSLATION enmTranslation);
414
415/**
416 * Get version of image in HDD container.
417 *
418 * @returns VBox status code.
419 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
420 * @param pDisk Pointer to VBox HDD container.
421 * @param nImage Image number, counts from 0. 0 is always base image of container.
422 * @param puVersion Where to store the image version.
423 */
424VBOXDDU_DECL(int) VDGetVersion(PVBOXHDD pDisk, unsigned nImage, unsigned *puVersion);
425
426/**
427 * Get type of image in HDD container.
428 *
429 * @returns VBox status code.
430 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
431 * @param pDisk Pointer to VBox HDD container.
432 * @param nImage Image number, counts from 0. 0 is always base image of container.
433 * @param penmType Where to store the image type.
434 */
435VBOXDDU_DECL(int) VDGetImageType(PVBOXHDD pDisk, unsigned nImage, PVDIMAGETYPE penmType);
436
437/**
438 * Get flags of image in HDD container.
439 *
440 * @returns VBox status code.
441 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
442 * @param pDisk Pointer to VBox HDD container.
443 * @param nImage Image number, counts from 0. 0 is always base image of container.
444 * @param puImageFlags Where to store the image flags.
445 */
446VBOXDDU_DECL(int) VDGetImageFlags(PVBOXHDD pDisk, unsigned nImage, unsigned *puImageFlags);
447
448/**
449 * Get open flags of last opened image in HDD container.
450 *
451 * @returns VBox status code.
452 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
453 * @param pDisk Pointer to VBox HDD container.
454 * @param puOpenFlags Where to store the image open flags.
455 */
456VBOXDDU_DECL(int) VDGetOpenFlags(PVBOXHDD pDisk, unsigned *puOpenFlags);
457
458/**
459 * Set open flags of last opened image in HDD container.
460 * This operation may cause file locking changes and/or files being reopened.
461 * Note that in case of unrecoverable error all images in HDD container will be closed.
462 *
463 * @returns VBox status code.
464 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
465 * @param pDisk Pointer to VBox HDD container.
466 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants.
467 */
468VBOXDDU_DECL(int) VDSetOpenFlags(PVBOXHDD pDisk, unsigned uOpenFlags);
469
470/**
471 * Get base filename of image in HDD container. Some image formats use
472 * other filenames as well, so don't use this for anything but for informational
473 * purposes.
474 *
475 * @returns VBox status code.
476 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
477 * @returns VERR_BUFFER_OVERFLOW if pszFilename buffer too small to hold filename.
478 * @param pDisk Pointer to VBox HDD container.
479 * @param nImage Image number, counts from 0. 0 is always base image of container.
480 * @param pszFilename Where to store the image file name.
481 * @param cbFilename Size of buffer pszFilename points to.
482 */
483VBOXDDU_DECL(int) VDGetFilename(PVBOXHDD pDisk, unsigned nImage, char *pszFilename, unsigned cbFilename);
484
485/**
486 * Get the comment line of image in HDD container.
487 *
488 * @returns VBox status code.
489 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
490 * @returns VERR_BUFFER_OVERFLOW if pszComment buffer too small to hold comment text.
491 * @param pDisk Pointer to VBox HDD container.
492 * @param nImage Image number, counts from 0. 0 is always base image of container.
493 * @param pszComment Where to store the comment string of image. NULL is ok.
494 * @param cbComment The size of pszComment buffer. 0 is ok.
495 */
496VBOXDDU_DECL(int) VDGetComment(PVBOXHDD pDisk, unsigned nImage, char *pszComment, unsigned cbComment);
497
498/**
499 * Changes the comment line of image in HDD container.
500 *
501 * @returns VBox status code.
502 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
503 * @param pDisk Pointer to VBox HDD container.
504 * @param nImage Image number, counts from 0. 0 is always base image of container.
505 * @param pszComment New comment string (UTF-8). NULL is allowed to reset the comment.
506 */
507VBOXDDU_DECL(int) VDSetComment(PVBOXHDD pDisk, unsigned nImage, const char *pszComment);
508
509/**
510 * Get UUID of image in HDD container.
511 *
512 * @returns VBox status code.
513 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
514 * @param pDisk Pointer to VBox HDD container.
515 * @param nImage Image number, counts from 0. 0 is always base image of container.
516 * @param pUuid Where to store the image UUID.
517 */
518VBOXDDU_DECL(int) VDGetUuid(PVBOXHDD pDisk, unsigned nImage, PRTUUID pUuid);
519
520/**
521 * Set the image's UUID. Should not be used by normal applications.
522 *
523 * @returns VBox status code.
524 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
525 * @param pDisk Pointer to VBox HDD container.
526 * @param nImage Image number, counts from 0. 0 is always base image of container.
527 * @param pUuid Optional parameter, new UUID of the image.
528 */
529VBOXDDU_DECL(int) VDSetUuid(PVBOXHDD pDisk, unsigned nImage, PCRTUUID pUuid);
530
531/**
532 * Get last modification UUID of image in HDD container.
533 *
534 * @returns VBox status code.
535 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
536 * @param pDisk Pointer to VBox HDD container.
537 * @param nImage Image number, counts from 0. 0 is always base image of container.
538 * @param pUuid Where to store the image modification UUID.
539 */
540VBOXDDU_DECL(int) VDGetModificationUuid(PVBOXHDD pDisk, unsigned nImage, PRTUUID pUuid);
541
542/**
543 * Set the image's last modification UUID. Should not be used by normal applications.
544 *
545 * @returns VBox status code.
546 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
547 * @param pDisk Pointer to VBox HDD container.
548 * @param nImage Image number, counts from 0. 0 is always base image of container.
549 * @param pUuid Optional parameter, new last modification UUID of the image.
550 */
551VBOXDDU_DECL(int) VDSetModificationUuid(PVBOXHDD pDisk, unsigned nImage, PCRTUUID pUuid);
552
553/**
554 * Get parent UUID of image in HDD container.
555 *
556 * @returns VBox status code.
557 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
558 * @param pDisk Pointer to VBox HDD container.
559 * @param nImage Image number, counts from 0. 0 is always base image of the container.
560 * @param pUuid Where to store the parent image UUID.
561 */
562VBOXDDU_DECL(int) VDGetParentUuid(PVBOXHDD pDisk, unsigned nImage, PRTUUID pUuid);
563
564/**
565 * Set the image's parent UUID. Should not be used by normal applications.
566 *
567 * @returns VBox status code.
568 * @param pDisk Pointer to VBox HDD container.
569 * @param nImage Image number, counts from 0. 0 is always base image of container.
570 * @param pUuid Optional parameter, new parent UUID of the image.
571 */
572VBOXDDU_DECL(int) VDSetParentUuid(PVBOXHDD pDisk, unsigned nImage, PCRTUUID pUuid);
573
574
575/**
576 * Debug helper - dumps all opened images in HDD container into the log file.
577 *
578 * @param pDisk Pointer to VBox HDD container.
579 */
580VBOXDDU_DECL(void) VDDumpImages(PVBOXHDD pDisk);
581
582__END_DECLS
583
584/** @} */
585
586#endif
Note: See TracBrowser for help on using the repository browser.

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