VirtualBox

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

Last change on this file since 4015 was 3632, checked in by vboxsync, 17 years ago

VBox_hdr_h -> _VBox_hdr_h

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